chrissie18 Posted November 24, 2008 Share Posted November 24, 2008 Hello everybody i have a problem with my register script i have added a new option in my register.php but when i register myself i see nothing in mysql what i changed the rest is there here are my codes and sorry for my bad English <?php session_start(); //allows session include('config.php'); //checks if there trying to veriy there account if(isset($_GET['verify'])) { //gets the code and makes it safe $code = addslashes($_GET['code']); //gets the code from the database $getcode=mysql_query("SELECT * FROM `verification` WHERE `code` = '$code'"); //counts the number of rows $getcode = mysql_num_rows($getcode); //if the ammount of rows is 0 the code does not exist if($getcode == 0) { echo "Verkeerd activatie code!"; } //or if the code does exist we will activiate there account else{ //get the data from the database $getcode=mysql_query("SELECT * FROM `verification` WHERE `code` = '$code'"); //fetchs the data from the db $dat = mysql_fetch_array($getcode); //sets the users user level to 2 which means they can now use there account $update = mysql_query("UPDATE `members` SET `userlevel` = '2' WHERE `username` = '".$dat['username']."'") or die(mysql_error()); //deletes the code as there is no use of it now $delete = mysql_query("DELETE FROM `verification` WHERE code = '$code'"); //says thanks and your account is ready for use echo "Bedankt, Je account is geactiveerd je kunt nu inloggen."; echo "<meta http-equiv='Refresh' content='2; URL=login.php'/>"; } }else //if we have posted the register for we will register this user if(isset($_GET['register'])) { //check to see if any fields were left blank if((!$_POST[username]) || (!$_POST[password]) || (!$_POST[cpassword]) || (!$_POST[email]) || (!$_POST[dname])) { echo "Je moet alles wel invullen."; echo "<meta http-equiv='Refresh' content='2; URL=register.php'/>"; }else{ //posts all the data from the register form $username = $_POST[username]; $dname = $_POST[dname]; $password = $_POST[password]; $cpassword = $_POST[cpassword]; $email = $_POST[email]; //check see if the 2 passwords are the same if($password == $cpassword) { //encrypts the password 8 times $password = sha1(md5(md5(sha1(md5(sha1(sha1(md5($password)))))))); $dname = mysql_query("SELECT `dname` FROM `members` WHERE `dname` = '$dname'"); $dname= mysql_num_rows($dname); $cname = mysql_query("SELECT `username` FROM `members` WHERE `username` = '$username'"); $cname= mysql_num_rows($cname); //checks to see if the username or email allready exist if($cname>=1) { echo "Gebruikersnaam bestaat al"; echo "<meta http-equiv='Refresh' content='2; URL=register.php'/>"; } if($dname>=1) { echo "dname bestaat al"; echo "<meta http-equiv='Refresh' content='2; URL=register.php'/>"; }else{ //gets rid of bad stuff from there username, dealername, email $username = addslashes(htmlspecialchars($username)); $dname = addslashes(htmlspecialchars($dname)); $email = addslashes(htmlspecialchars($email)); if($semail == "1") { // $email set as 1 means email activation is active //adds them to the db $adduser = mysql_query("INSERT INTO `members` (`username`, `password`, `email`, `dname`) VALUES('$username','$password','$email','$dname')"); //posible letters for the verification code $alphanum = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; //shuffles the letters around to create a 16 long code $code = substr(str_shuffle($alphanum), 0, 16); //adds there code along with there user name to the db $addcode = mysql_query("INSERT INTO `verification` (`username`, `code`) VALUES('$username','$code')"); //don't edit this, this is the link for there activication $link = "http://$host$self?verify&code=$code"; //sends the email to the person mail("$email", "Lidmaatschap validatie", "Bedankt voor het registreren op $sitename. Je gebruikersnaam is: $username en je wachtwoord is: $password Enigste wat je nu nog hoeft te doen is je account activeren dat kan om naar deze link te gaan: $link", "From: admin@exxelent.nl"); //message sent now lets tell them to check there email echo "Je bent nu geregistreert,<br><br>Kijk in je email voor de activatie link."; }else{ //no need for email activation $adduser = mysql_query("INSERT INTO `members` (`username`, `password`, `email`, `userlevel`, `dname`) VALUES('$username','$password','$email','2','$dname')"); echo "Je bent nu geregistreert,<br><br>Je kunt nu inloggen op je account"; echo "<meta http-equiv='Refresh' content='2; URL=login.php'/>"; } } }else{ echo "De twee wachtwoorden kwam niet overeen probeer het opnieuw!"; echo "<meta http-equiv='Refresh' content='2; URL=register.php'/>"; } } }else{ //none of the above so lets show the register form echo "<form action='register.php?register' method='post'> <table width='350'> <tr> <td width='150'>Gebruikersnaam:</td> <td width='200'><input type='text' name='username' size='30' maxlength='25'></td> </tr> <tr> <td>Dname:</td> <td width='200'><input type='text' name='dname' size='30' maxlength='25'></td> </tr> <tr> <td>Wachtwoord:</td> <td><input type='password' name='password' size='30' maxlength='25'></td> </tr> <tr> <td>bevestig wachtwoord:</td> <td><input type='password' name='cpassword' size='30' maxlength='25'></td> </tr> <tr> <td>Email:</td> <td><input type='text' name='email' size='30' maxlength='55'></td> </tr> <tr> <td colspan='2'><center><input type='submit' value='Aanmelden'></center></td> </tr> </table> </form>"; } ?> And i changed the dname all is there in mysql except for (dname) please help me out. thanks allot Chris Link to comment https://forums.phpfreaks.com/topic/133979-error-in-registerphp-need-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.