plik index2.php:
<?php // If there is no cookie presesnt // Variables that data come from the form $username = $_POST["user"]; $password = $_POST["pass"]; // Check if username and password where submitted if (!$username) { } if (!$password) { } // Use Connect Script include("connect.php"); // MD5 Username and Password // Check if username exists. If not then say no such username. // If username exists if ($usernamelogin == 1) { $issuchpassword = mysql_query("SELECT * FROM userdata WHERE userid = '$username' AND userpass = '$password'"); // If password is correct if ($passwordlogin == 1) { $cookie_data = $username.'-'.$password; } else { echo "You computer does not support cookies. <BR> To view other pages after logged in you need to have cookies enabled.<BR>"; } } else { exit; } } else { exit; } } // End if no cookie present ?> <?php // Use Connect Script include("connect.php"); // Use cookie and Extract the cookie data (Username and Password) $namecookie = $cookie_info[0]; $passcookie = $cookie_info[1]; $namecookie = $_POST["user"]; $passcookie = $_POST["pass"]; // MD5 Username and Password } // Check if username exists. If not then say no such username. // If username exists if ($usernamelogin == 1) { $issuchpassword = mysql_query("SELECT * FROM userdata WHERE userid = '$namecookie' AND userpass = '$passcookie'"); // If password is correct if ($passwordlogin == 1) { // User is now logged in, display details of user // Get details of user from Database and put them in variables ?>
i teraz jak zrobiæ aby po zamkniêciu okna przegladarki i nie wciepaniu "wyloguj" po ponownym wejsciu na index.php czyli z formularzem logowania zrobic tak aby wykryto iz jest juz siê zalogowanym i nast±pi³o bezpo¶rednie przekierowanie juz na zaloowane wcze¶niej konto