2011-01-17 6 views
0

Ich habe einen funktionierenden PHP-Server und MySQL-Datenbank. Benutzte Dreamweaver, um ein Anmeldeskript zu generieren, aber es funktioniert nicht. Nach dem Abschicken wird die aktuelle Seite neu geladen. Wie auch immer, bei Erfolg oder Misserfolg sollte es Seiten wechseln. Irgendwelche Ideen?PHP-Login-Skript tut nichts (Dreamweaver generiert)

Ich löste es, musste sicherstellen, dass die ID und die Klasse der Eingabe unterschiedlich waren. Einmal anders hat es funktioniert.

<?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

Ist der Access variable Satz GET? – ronaldosantana

+0

Zeigen Sie uns Ihre Connection.php Seite. –

+0

Sieht nicht so aus. Wie du sehen kannst, bin ich neu bei PHP. Gibt es einen bestimmten Ort, an dem ich suchen sollte? Auch hinzugefügt die connection.php – John

Antwort

0

Ist $ Loginformaction nicht gesetzt?

Können Sie uns HTML-Codes dieser Seite senden?

+0

Anders als die normalen Sachen, die es ist ... $ loginFormAction = $ _SERVER ['PHP_SELF']; – John

+0

Also, zurückgegebene HTML-Codes? – Eray

+0

(ich meine Quellcodes - STRG + U) – Eray

0

@John: Versuchen -

<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>