2012-01-24 21 views
0

嘿傢伙我試圖用默認的Dreamweaver登錄模塊登錄時出現此錯誤,請幫助我 - 這是一個雖然一個,我只是一個HTML設計師嘗試爲我正在工作的一個小網站製作一個簡單的登錄腳本。它是偉大的,如果你能幫助致命錯誤:調用未定義的函數getsqlvaluestring()

<?php require_once('../Connections/dsfsdfsdfd.php'); ?> 
    <?php 
    // *** Validate request to login to this site. 
    if (!isset($_SESSION)) { 
    session_start(); 
    } 
    $loginFormAction = $_SERVER['PHP_SELF']; 
    if (isset($_GET['accesscheck'])) { 
    $_SESSION['PrevUrl'] = $_GET['accesscheck']; 
    } 

    if (isset($_POST['username'])) { 
    $loginUsername=$_POST['username']; 
    $password=$_POST['password']; 
    $MM_fldUserAuthorization = "access_level"; 
    $MM_redirectLoginSuccess = "index.php"; 
    $MM_redirecttoReferrer = true; 
    mysql_select_db($database_promocenter, $promocenter); 

    $LoginRS__query=sprintf("SELECT username, password, destination_page FROM 
    users WHERE username=%s AND password=%s", 
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "int")); 


    $LoginRS = mysql_query($LoginRS__query, $promocenter) or die(mysql_error()); 
    $loginFoundUser = mysql_num_rows($LoginRS); 
    if ($loginFoundUser) { 

    $loginStrGroup = mysql_result($LoginRS,0,'access_level'); 

    if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} 
    else {session_regenerate_id();} 
    //declare two session variables and assign them 
    $_SESSION['MM_Username'] = $loginUsername; 
    $_SESSION['MM_UserGroup'] = $loginStrGroup;  

    if (isset($_SESSION['PrevUrl']) && true) { 
    $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];  
    } 
    header("Location: " . $MM_redirectLoginSuccess); 
    } 
    else { 
    header("Location: ". $MM_redirectLoginFailed); 
    } 
    } 
    ?> 
    <?php 
    if (!function_exists("GetSQLValueString")) { 
    function GetSQLValueString($theValue, $theType, 
    $theDefinedValue = "", $theNotDefinedValue = "") 
    { 
    if (PHP_VERSION < 6) { 
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; 
    } 

    $theValue = function_exists("mysql_real_escape_string") ? 
    mysql_real_escape_string($theValue) : mysql_escape_string($theValue); 

    switch ($theType) { 
    case "text": 
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; 
    break;  
    case "long": 
    case "int": 
    $theValue = ($theValue != "") ? intval($theValue) : "NULL"; 
    break; 
    case "double": 
    $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; 
    break; 
    case "date": 
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; 
    break; 
    case "defined": 
    $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; 
    break; 
    } 
    return $theValue; 
    } 
    } 

    mysql_select_db($database_promocenter, $promocenter); 
    $query_rs_users_login = "SELECT * FROM users"; 
    $rs_users_login = mysql_query($query_rs_users_login, $promocenter) 
    or die(mysql_error()); 
    $row_rs_users_login = mysql_fetch_assoc($rs_users_login); 
    $totalRows_rs_users_login = mysql_num_rows($rs_users_login); 
    ?> 

對不起球員,錯誤是致命的錯誤:調用在/ U1 /家庭/ XXXXXX /的public_html /通訊/資源/ promocenter /管理/登入未定義功能getsqlvaluestring()。第22行的php這是標準的Dreamweaver CS5代碼。

連接到數據庫等。我確定我的代碼中包含了該文件,請在那裏查看。我也可以說,這段代碼在一年中工作得很好,突然之間,我每次嘗試登錄時都會出現這個錯誤。正常的前端仍然顯示來自數據庫的字段。這只是/管理員/登錄方面給出的問題

+2

如果您可以發佈**完整**錯誤消息,這將有所幫助。它會告訴人們在哪一行發生錯誤。在一個無關的說明中,術語*「Dreamweaver登錄模塊」*讓我不寒而慄:) – rdlowrey

+0

你可以通過並縮進你的代碼嗎?它會讓每個人都變得更加可讀。 – jprofitt

+0

更好,如果你告訴哪一行你得到的錯誤...像'不工作如果(PHP_VERSION> = 5.1){session_regenerate_id(true);} –

回答

3
Fatal error: Call to undefined function getsqlvaluestring() 

這意味着沒有這樣的功能。 我想這個功能是另一個文件,你忘了包含它。

+0

大家都知道 - 我通過移動這個塊正確的<?php require_once('../ Connections/dsfsdfsdfd.php'); ?> 該塊 如果(!function_exists( 「GetSQLValueString」)){ 函數GetSQLValueString($ theValue,$ theType, $ theDefinedValue = 「」,$ theNotDefinedValue = 「」) { 如果(PHP_VERSION <6) {.......等等等 – Anton

-1

我和你有同樣的問題。只是想讓你知道你並不孤單。我試過你的伎倆,它的工作。 ITs ODD,但是第一次運行LogInUser腳本時,它沒有插入帶有檢查的塊,以查看是否存在GetSQLValueString。我得到了你得到的錯誤。 然後,我撕開了代碼並再次運行它,並且DID插入了執行該檢查的代碼塊,另一個PHP版本進行檢查,然後進行全部檢查。我不得不改變它,把session_start命令放在頂部(從我聽說的,它不會啓動會話,除非它是命中服務器的第一件事)。 但是,現在我在Dreamweaver中發現錯誤,說我有2個LogInUser處理程序,我需要刪除一個。但它不會讓我刪除任何一個。然而,它運行在服務器上,所以我想我會繼續......

一些(未經請求的)建議:Dreamweaver數據訪問處理程序只是一大袋垃圾,就我而言關心。
我一直在Dreamweaver上訪問大約3個月的數據,並得出結論說它還沒有準備好黃金時段。他們對他們產品的這一部分的支持是沒有的。你不能從Adobe獲得它。我試過了。花了大約3天時間與他們一起,最後告訴他們,他們不賣技術支持,只是軟件。

你應該可以從獨立的Adobe合作伙伴那裏獲得它,但是如果你能找到能夠幫助你像「技術支持顧問」那樣的人,那麼他們的專業知識會花你100美元/小時以上的專業知識。 (讓我知道你是否找到某人!)

因此,如果您剛剛開始使用數據驅動的Web應用程序(需要數據庫連接),請自己幫忙:找到除Dreamweaver以外的其他解決方案用它來開發它。因爲你會浪費很多時間,除非你有嚴格的PHP技能來調試Adobe的腳本,否則你永遠不會完成你的項目。我已經看過Zend框架,我也聽說Yii.com是一個優秀的框架(和免費)但都是非常複雜的設置,使用php作爲一個真正的面向對象的編程環境。所以學習曲線比兩者都高於Dreamweaver。

但是,在你像我一樣深入研究它之前,請先幫個忙,然後紓困。 Dreamweaver非常適用於html,但不幸的是,當您開始使用php和數據庫時,它只是不適合使用。

+1

;-)感謝您的建議 – Anton

相關問題