Password compare, why isn't it working?

Evolve

New Member
I am using this to compare the password entered and the confirm password. No matter what, it creates the user. Why so?here's the database code -\[code\]$connect = @mysql_connect ($host, $username, $password) or die ('error');$select = @mysql_select_db($db_name, $connect) or die('check');$username=stripslashes(trim($_POST['username']));$select_record="select * from users where username=' ".$username."' ";$select_query=mysql_query($select_record) or die (mysql_error());if(mysql_num_rows($select_query)==0){ $fullname = stripslashes(trim($_POST['fullname'])); $email = stripslashes(trim($_POST['email'])); $website = stripslashes(trim($_POST['website'])); $username = stripslashes(trim($_POST['username'])); $password = stripslashes(trim($_POST['password'])); $add_new="insert into users (fullname,email,website,username,password) values ('$fullname','$email','$website','$username','$password')"; $add_query=mysql_query($add_new) or die(mysql_error()); if($add_query) { echo "Awesome! You are now a member"; }}elseecho "Please try again";?>\[/code\]Above connect, i have my database username and password.Just to revise, here's my current code -\[code\]<div id="form"><form action="registersuccess.php" method="post">Full Name<br /><input type="text" name="fullname"/><br /><br />Website<br /><input type="text" name="site"/><br /><br />Email<br /><input type="text" name="email"/><br /><br />Username<br /><input type="text" maxlength="255" name="username"/><br /><br />Password<br /><input type="password" name="password"/><br /><br />Confirm Password<br /><input type="password" name="confirmpass"/><br /><br /><p class="submit"><input type="submit" value="http://stackoverflow.com/questions/3926934/Create my Account"/></p></form><?php$pass = $_POST['password']; $cpass = $_POST['confirmpass'];$cmp = strcmp($pass, $cpass);if ($cmp != 0){ echo "check password";}else{ return true;}?>\[/code\]
 
Back
Top