# login.php?? -----Original Message----- From: Erik Gjertsen [mailto:[EMAIL PROTECTED] Sent: Thursday, May 06, 2004 12:43 PM To: [EMAIL PROTECTED] Subject: [PHP] Login page
I have made a login page but I got an error on line 1..... Can some one please help me to solve the problem <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>LoggInn</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <?php # login.php if (isset($_POST['submit'])) { // Handel the form. require_once('../../../Connections/innlogging.php'); mysql_select_db($database_innlogging, $innlogging); $query_logginn = "SELECT usrid, username, password1 FROM users"; $logginn = mysql_query($query_logginn, $innlogging) or die(mysql_error()); $row_logginn = mysql_fetch_assoc($logginn); $totalRows_logginn = mysql_num_rows($logginn); // Crating a function for escaping the data. function escape_data ($data) { global $dbc; //meed the connection if (ini_get('magic_quotes_gpc')) { $data = stripslashes($data); } 1........ return mysql_real_escape_string($data, $dbc); } // end of function $message = NULL; // Create an enpty new variable // Check for a username if (empty($_POST['username'])) { $username = FALSE; $message .= '<p>You forgot to enter your username!</p>'; } else { $username = escape_data($_POST['username']); } // Check for a Password if (empty($_POST['password1'])) { $password1 = FALSE; $message .= '<p>You forgot to enter your password!</p>'; } else { $password1 = escape_data($_POST['password1']); } if ($username && $password1) { //if everything's ok. //Retrieve the user_id an name for that username and password combination. $query = "SELECT usrid name FROM users WHERE username='$username' AND password1=PASSWORD('$password1')"; $result = @mysql_query ($query); //Run the query $row = mysql_fetch_array ($result, MYSQL_NUM); //Return a record, if applicable. if ($row) { //A record was pulled from the database. //Set the cookies & redirect. setcookie ('name', $row[1]); setcookie ('usrid', $row[1]); header ("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/Loggedin.php"); exit(); //Quit the script } else { // No record matched the query. $message = '<p>The username and password entered do not match on file.</p>'; } mysql_close(); // Close the databaseconection. } else { $message = '<p>Please try again.</p>'; } } // End of themail submitconditional. //Print the error message if ther is one if (isset($message)) { echo '<font color="red">', $message, '</font>'; } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <fieldset><legend>Enter your information in the form below:</legend> <p><b>User Name:</b> <input type="text" name="username" size="10" maxlength="20" value="<?php if (isset($_POST['username'])) echo $_POST['username']; ?>" /></p> <p><b>Password:</b> <input type="password1" name="password1" size="20" maxlength="20" /></p> <div align="center"><input type="submit" name="submit" value="Login" /></div> </fieldset> </form> </body> </html> Thanks Erik Gjertsen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -------------------------------------------------------------------- Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Technikon or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php