jd2007 Posted July 24, 2007 Share Posted July 24, 2007 i used isset ... never worked...i did this : if ($_POST["email"]&&$_POST["username"]&&$_POST["password"]&&$_POST["cpass"]) ...never worked what do i do...pls help ? Quote Link to comment Share on other sites More sharing options...
DeadEvil Posted July 24, 2007 Share Posted July 24, 2007 if (!empty($_POST["email"])&&!empty($_POST["username"])&&!empty($_POST["password"])&&!empty($_POST["cpass"])) Quote Link to comment Share on other sites More sharing options...
jd2007 Posted July 24, 2007 Author Share Posted July 24, 2007 <?php session_start(); header("Cache-control: private"); $theIP=$_SERVER['REMOTE_ADDR']; if (!empty($_POST["email"])&&!empty($_POST["username"])&&!empty($_POST["password"])&&!empty($_POST["cpass"])) { similar_text($_POST["password"],$_POST["cpass"],$percent); if ($percent!=100) { echo "Passwords don't match."; } else { if (ereg("^[a-zA-Z0-9\_\-\.]+@[a-zA-Z]+\.[a-zA-Z\.\-]+$",$_POST["email"])) { include("connect.php"); $query="SELECT username FROM users WHERE username='$_POST[username]'"; $result=mysql_query($query) or die(mysql_error()); if (mysql_num_rows($result)==0) { $query2="INSERT INTO users (username, password, email, confirm, credits, admin) VALUES ('$_POST[username]', '$_POST[password]', '$_POST[email]', '0', '5', '0')"; $result2=mysql_query($query2) or die(mysql_error()); if ($result2) { $x=rand(1, 10); $y=md5(rand(1, 10)); $c=$x.$y; echo $c; $to=$_POST[email]; $subject="Registration Confirmation Mail"; $message="Type this code:$c into the text box on the confirmation page."; $headers = "From: NDS ROM\n"; $mailed=mail($to, $subject, $message, $headers); if ($mailed) { echo "A confirmation mail was sent to your e-mail address. Please type the code provided in the mail into the confirmation box below."; echo "<form method='post' action='confirm.php?var2=$c&var3=$_POST[username]'> Confirmation Code: <input type='text' name='ccode'><br><br> <input type='submit' value='Confirm'> </form>"; $queryx="DELETE FROM dip WHERE userip= '$theIP'"; $resultx=mysql_query($queryx); } else { $mailfail="Sending mail failed. Please try again later."; header("Location:register.php?mf=$mailfail"); } } else { $userex="Username exists. Try another username"; header("Location:register.php?ue=$userex"); } } else { $notvalid="E-mail is not valid. Please enter a valid e-mail."; header("Location:register.php?nv=$notvalid"); } } } } else { $notfilled="Please make sure all fields are filled."; header("Location:register.php?nf=$notfilled"); } ?> not working... the code is above Quote Link to comment Share on other sites More sharing options...
Guest Tim_Christopher Posted July 24, 2007 Share Posted July 24, 2007 Note that amongst other things "0" is considered empty. Quote Link to comment Share on other sites More sharing options...
DeadEvil Posted July 24, 2007 Share Posted July 24, 2007 try to print the post value first.. i.e print_r($_POST); Quote Link to comment Share on other sites More sharing options...
Guest Tim_Christopher Posted July 24, 2007 Share Posted July 24, 2007 Try: if ( empty($_POST["email"]) || empty($_POST["username"]) || empty($_POST["password"]) || empty($_POST["cpass"])) { echo 'One or more empty fields'; } else { echo 'All fields are not empty'; } Quote Link to comment Share on other sites More sharing options...
shivani.shm Posted July 24, 2007 Share Posted July 24, 2007 strlen($_POST[filedname] == 0) thn its empty otherwise not Quote Link to comment Share on other sites More sharing options...
jd2007 Posted July 24, 2007 Author Share Posted July 24, 2007 thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.