Hallo iedereen,
IK heb een script gemaakt maar nou loop ik vast
alles werkt goed allen als ik op register klikt stuurt die wel een bevestigings email, maar als je op register klikt moet die hem al in de database registeren en dat doet die niet, en als je de bevestiging email activeerd dan gaat een cijfertje van 0 naar 1 en als die dan op 1 staat is die geactiveert dat doet die wel, maar hij zet hem dus niet in de database als je op register klikt hier de script:
alvast bedankt!
snabbo
IK heb een script gemaakt maar nou loop ik vast
alles werkt goed allen als ik op register klikt stuurt die wel een bevestigings email, maar als je op register klikt moet die hem al in de database registeren en dat doet die niet, en als je de bevestiging email activeerd dan gaat een cijfertje van 0 naar 1 en als die dan op 1 staat is die geactiveert dat doet die wel, maar hij zet hem dus niet in de database als je op register klikt hier de script:[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]connect.php[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]register[/COLOR][COLOR= #007700]])
{[/COLOR]
[COLOR= #FF8000]//get form data[/COLOR]
[COLOR= #0000BB]$username[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]));[/COLOR]
[COLOR= #0000BB]$password[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]]));[/COLOR]
[COLOR= #0000BB]$email[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]));[/COLOR]
[COLOR= #0000BB]$habbo[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strip_tags"]strip_tags[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]habbo[/COLOR][COLOR= #007700]]));[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](![/COLOR][COLOR= #0000BB]$username[/COLOR][COLOR= #007700]||![/COLOR][COLOR= #0000BB]$password[/COLOR][COLOR= #007700]||![/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700]||![/COLOR][COLOR= #0000BB]$habbo[/COLOR][COLOR= #007700])[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Please, enter all fields correctly"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[COLOR= #FF8000]//check if username and already taken[/COLOR]
[COLOR= #0000BB]$check[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM users WHERE username=$username"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$check[/COLOR][COLOR= #007700])>=[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700])[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Username already in use!"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[COLOR= #FF8000]//generate random code[/COLOR]
[COLOR= #0000BB]$code[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]11111111[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]99999999[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #FF8000]//send activation email[/COLOR]
[COLOR= #0000BB]$to[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$subject[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"Activate your account at snabbo.nl"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$headers[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"From: admin@snabbo.nl"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$body[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"Hello $username!
Youve registered at http://snabbo.nl/ you need to activate your account!
Click on the link below or copy/paste in the URl content of your webbrowser!
http://www.snabbo.nl/v2/activate.php?code=$code
Thanks!
"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](![/COLOR][URL="http://www.php.net/mail"]mail[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$to[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$subject[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$body[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$headers[/COLOR][COLOR= #007700]))[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"We cant register you at the moment. Please try again later!"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[COLOR= #FF8000]//register into database[/COLOR]
[COLOR= #0000BB]$register[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO users VALUE (,$username,$password,$email,$code,0,Lid,Geen,$habbo,0)"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Your registration is almost completed! Check your inbox to activate your account!!<br><br>E-mail: $email<br>Username: $username"[/COLOR][COLOR= #007700];
}
}
}
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
?>
<table><tr valign="top"><td width="50%">
<form action=register.php method=POST>
Choose username:<br />
<input type=text name=username><br />
Choose password:<br />
<input type=password name=password><br />
Email:<br />
<input type=text name=email><br />
</td>
<td width="50%">
Habbo naam:<br />
<input type=text name=habbo><br />
<br /><input type=submit name=register value=Register><br /><br />
</form>
</td></tr></table>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
?> alvast bedankt!
snabbo
?
Ik had er nog wat bijgemaakt