2011-01-17 11 views
0

私は動作しているPHPサーバとmysqlデータベースを持っています。 Dreamweaverを使用してログインスクリプトを生成しましたが、動作しません。送信を押すと現在のページがリロードされます。いずれにしても、成功または失敗した場合、ページを変更する必要があります。何か案は?PHPログインスクリプトは何もしません(Dreamweaverが生成されました)

私はそれを解決しました。入力のIDとクラスが異なることを確認する必要がありました。いったん違っていた。

<?php require_once('Connections/Connection.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['emailField'])) { 
    $loginUsername=$_POST['emailField']; 
    $password=$_POST['passwordField']; 
    $MM_fldUserAuthorization = ""; 
    $MM_redirectLoginSuccess = "main.php"; 
    $MM_redirectLoginFailed = "login_failed.php"; 
    $MM_redirecttoReferrer = false; 
    mysql_select_db($database_Connection, $Connection); 

    $LoginRS__query=sprintf("SELECT email, password FROM customer WHERE email=%s AND password=%s", 
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 

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

    //declare two session variables and assign them 
    $_SESSION['MM_Username'] = $loginUsername; 
    $_SESSION['MM_UserGroup'] = $loginStrGroup;  

    if (isset($_SESSION['PrevUrl']) && false) { 
     $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; 
    } 
    header("Location: " . $MM_redirectLoginSuccess); 
    } 
    else { 
    header("Location: ". $MM_redirectLoginFailed); 
    } 
} 
?> 

<form ACTION="<?php echo $loginFormAction; ?>" METHOD="POST" name="login"> 
     <input type="text" id="emailField" class="emailField" /> 
    <input type="password" id="passwordField" class="passwordField" /> 
     <input type="submit" id="sendButton" value="Send" class="sendButton" /> 
     </form> 

CONNECTION.PHP 
<?php 
# FileName="Connection_php_mysql.htm" 
# Type="MYSQL" 
# HTTP="true" 
$hostname_Connection = "localhost"; 
$database_Connection = "db"; 
$username_Connection = "test"; 
$password_Connection = "password"; 
$Connection = mysql_pconnect($hostname_Connection, $username_Connection, $password_Connection) or trigger_error(mysql_error(),E_USER_ERROR); 
?> 
+0

がAccessCheckを、変数セットをGETですか? – ronaldosantana

+0

あなたのConnection.phpページを教えてください。 –

+0

そのように見えません。あなたは私がPHPに新しいんだと言うことができます。私はそれを探す必要がある特定の場所はありますか? さらにconnection.phpが追加されました – John

答えて

0

$ loginFormActionが設定されていないですか?

このページのHTMLコードを送信できますか?

+0

それ以外の普通のものは... $ loginFormAction = $ _SERVER ['PHP_SELF']; – John

+0

返されたHTMLコードですか? – Eray

+0

(私はソースコードを意味する - CTRL + U) – Eray

0

@ジョン:試してみてください -

<form ACTION="<?php echo $loginFormAction; ?>" METHOD="POST" name="login"> 
    <input type="text" name="emailField" id="emailField" class="emailField" /> 
    <input type="password" name="passwordField" id="passwordField" class="passwordField" /> 
    <input type="submit" id="sendButton" value="Send" class="sendButton" /> 
</form> 
関連する問題