jd2007 Posted July 15, 2007 Share Posted July 15, 2007 <?php /*Use of Sessions*/ if(!session_id()) session_start(); header("Cache-control: private"); //avoid an IE6 bug (keep this line on top of the page) echo "<style> span.a { background-color:Linen; color:Maroon; } </style>"; //if all fields filled, execute 2 if ( isset($_POST["name"]) && isset($_POST["location"]) && isset($_POST["age"]) && isset($_POST["username"])&& isset($_POST["password"]) && isset($_POST["cpass"]) && isset($_POST["email"])) { //this is 2..if passwords match, execute 3 if ($_POST["password"] == $_POST["cpass"]) { //this is 3 //encrypt password and store in a variable if (ereg("^[a-zA-Z0-9\_\-\.]+@[a-zA-Z]+\.[a-zA-Z\.\-]+$",($_POST["email"]))) { /*Connection to database logindb using your login name and password*/ mysql_connect('localhost','root') or die(mysql_error()); mysql_select_db('UserProfile'); /*additional data checking and striping*/ // $_POST['username']=mysql_real_escape_string(strip_tags(trim($_POST['username']))); // $_POST['cpass']=mysql_real_escape_string(strip_tags(trim($_POST['cpass']))); mysql_query("INSERT INTO Users SET username='$_POST[username]',password='$_POST[password]', name='$_POST[name]'"); if(mysql_affected_rows() > 0) { //$_SESSION['username'] = $_POST['username']; $a=md5(rand(0, 3)); $a=substr($a, 1, 10); $b=rand(0, 3); $b=substr($b, 1, 10); $c=$a.$b; //$to = $_POST['email']; //$subject = 'Voting User Confirmation'; //$message="You are one step away to cast your vote. echo "Enter this code to confirm your registration: $c"; echo "<br>"; // $mail_sent=mail($to, $subject, $message); /*echo $mail_sent ? "A confirmation mail has been sent to your e-mail address. Please enter the code provided in your confirmation mail in the box below.<br>*/echo "<form method='post' action='confirmation.php'> <input type='text' name='confirm' /><br> <input type='submit' value='Confirm' /> </form>";/*: "We're sorry, sending confirmation mail failed. ";*/ } else { echo "<span class='a'>Please choose another nickname.</span>"; exit; } } else { echo "<span class='a'>Please enter a valid e-mail.</span>"; } } else { echo "<span class='a'>Passwords do not match.</span>"; } } //else if (!isset($_POST["name"]) || !isset($_POST["location"]) || !isset($_POST["age"]) ||!isset($_POST["username"]) || !isset($_POST["password"]) || !isset($_POST["cpass"]) || !isset($_POST["email"])) //{ //echo "<span class='a'>Please fill in all fields.</span>"; //echo "<span class='a'>You must accept our <a href=\"\">terms and conditions</a> to register.</span>"; //} else if (!isset($_POST["name"]) || !isset($_POST["location"]) || !isset($_POST["age"]) || !isset($_POST["username"]) || !isset($_POST["password"]) || !isset($_POST["cpass"]) || !isset($_POST["email"])) { echo "<span class='a'>Please fill in all fields.</span>"; } else {}//if (isset($_POST["name"]) && isset($_POST["location"]) && isset($_POST["age"]) && isset($_POST["username"])&& isset($_POST["password"]) && isset($_POST["cpass"]) && isset($_POST["email"])) //{ //echo "<span class='a'>You must accept our <a href=\"\">terms and conditions</a> to register.</span>"; //} ?> Link to comment Share on other sites More sharing options...
wildteen88 Posted July 15, 2007 Share Posted July 15, 2007 Can you stop posting new threads for every single problem you have with your scripts. If its the same script post in the original thread. Don't open new ones. Also please use more descriptive thread titles and provide information about the script too, such as what it does, what its supposed to do, what's happening etc. Don't just dump the code on us and expect us to read to your mind. Thread closed. Link to comment Share on other sites More sharing options...
Recommended Posts