Hi back again sorted login trouble with register now
this script from same tutorial but when put new user it it dont crate it on the data base just goes back to the reg page
<? session_start() ?>
<HTML>
<HEAD>
<TITLE>Register</TITLE>
</HEAD>
<BODY>
<H2>Register</H2>
<?
// check to see if these two variables have been passed from
// the HTML form at the foot of this script (which calls this page again)
if ($user && $pass) {
// connect to database and select the 'userlist' database
$db = mysql_connect("localhost");
mysql_select_db("userlist", $db);
// check to see if username is already on the database
$result = mysql_query ("SELECT * FROM users WHERE name = '".$user."'");
if (mysql_num_rows($result) == 0) {
// if it's not, add the new details to the database
$result = mysql_query ("INSERT INTO users (name, password) VALUES
('".$user."', PASSWORD('".$pass."'))");
if ($result) {
// if successful, log in the user and show a welcome message
// then exit the script
$logged_in_user = $user;
session_register("logged_in_user");
echo "Your details have been added to the database, ".$user."<BR><BR>";
echo "<A HREF='main.php'>Click here to proceed to the main page.</A><BR><BR>";
echo "<A HREF='logout.php'>Click here to log out.</A>";
exit;
} else {
// if the details could not be added for some reason,
// show an error message
echo "Sorry, there has been a technical hitch. We cannot enter your details.";
exit;
}
} else {
// if the details were already on the database, let the user try again
echo "Sorry, that username has been taken. Please try another.<BR>";
}
} else if ($user || $pass) {
// if the user has filled in one field but not the other,
// throw up this error
echo "Please fill in both fields.";
}
// show HTML form as follows
?>
<FORM METHOD=POST ACTION="register.php">
Please enter a username:
<INPUT NAME="user" TYPE=TEXT MAXLENGTH=20 SIZE=20>
<BR>
Please enter a password:
<INPUT NAME="pass" TYPE=PASSWORD MAXLENGTH=10 SIZE=10>
<BR>
<INPUT TYPE=SUBMIT VALUE="Register">
</FORM>
</BODY>
</HTML>
any help b appreciated thanks trev