I suppose it was mysql_close that was a problem but I am not secure. I am new in this. I have tryed to made registration page. I wish to that you can use one nic name ony one time.
I hav use the following code: <body> <?php include("header.inc"); if (isset($_POST['submit'])) { // Handle the form require_once ("mysql_connect.php"); // Create a funtion for escaping the data. function escape_data ($data) { global $dbc; // Ned the conection if (ini_get('magic_quotes_gpc')) { $data = stripslashes($data); } return mysql_real_escape_string($data, $dbc); } // End of function $message = NULL; //Create an empty new variable if (empty($_POST['name'])) { $name = FALSE; $message = '<p> You forgot to enter your name</p>'; } else { $name = escape_data($_POST['name']); if (empty($_POST['email'])) { $email = FALSE; $message = '<p> You forgot to enter your email</p>'; } else { $email = escape_data($_POST['email']); if (empty($_POST['username'])) { $username = FALSE; $message = '<p> You forgot to enter your username</p>'; } else { $username = escape_data($_POST['username']); if (empty($_POST['password1'])) { $password1 = FALSE; $message = '<p> You forgot to enter your password</p>'; } else { if ($_POST['password1'] == $_POST['password2']) { $password1 = escape_data($_POST['password1']); } else { $password = FALSE; $message = '<p> your password did not math</p>'; } } if ($name && $email && $username && $password) // If everything's ok. $query = "SELECT usrid FROM users WHERE username='$username'"; $result = @mysql_query ($query); //Run the query if (mysql_num_rows($result) == 0) { // Make the query $query = "INSERT INTO users (username, name, email, password, registration_date) VALUES ('$username', '$name', '$email', '$password', NOW() )"; $result = @mysql_query ($query); if ($result) { // IF it ran OK // Send an email, if desired echo '<p><b>You have been registered!</b></P>'; include("./footer.inc"); exit(); } else { // If it did not ron OK. $message = '<p>You cout not be registered due to a system error. We apologize for any inconvenience</p>'; } } else { $message = '<p>That username is alredy taken.</p>'; } mysql_close(); } else { $message = '<p>Please try again.</p>'; } } // End of the main submit conditional. // 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>Name</b> <input type="text" name="name" size="15" maxlength="15" value="<?php if (isset($_POST['name'])) echo $_POST['name']; ?>" /></p> <p><b>Email Adress</b> <input type="text" name="email" size="40" maxlength="40" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" /></p> <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="password" name="password1" size="20" maxlength="20" /></p> <p><b>Confirm Password</b> <input type="password" name="password2" size="20" maxlength="20" /></p> <div align="center"><input type="submit" name="Submit" value="Register" /></div> </fieldset> </form> <?php include("./footer.inc"); ?> </body> </html> but it dont work. If I take away al after mysql close to form_action it com the folloving error:Parse error: parse error on line 114 (it is on the end of the script). But when I set it back aganst the error massages coms on the line of mysql_close. Are ther someone that understand what I means?? Thanks for any proposal Erik Gjertsen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php