Jump to content

My registrer code dont work.


Kristian_C

Recommended Posts

Here's the code.

<?session_start();include_once"includes/kontakt.php";if(isset($_POST['regg'])){$brukernavn=$_POST['brukernavn'];$kjonn=$_POST['######'];$ref=$_POST['ref'];$land=$_POST['land'];$email=$_POST['email'];$email2=$_POST['email2'];$sjekkbrukernavn=mysql_query("SELECT brukernavn FROM brukere WHERE brukernavn='$brukernavn'");$sjekkemail=mysql_query("SELECT email FROM brukere WHERE email='$email'");$brukernavnsjekk=mysql_num_rows($sjekkbrukernavn);$emailsjekk=mysql_num_rows($sjekkemail);if($brukernavnsjekk > 0){echo"That username is allready in use";exit();if($emailsjekk > 0){echo"That email is allready beeing used";exit();}if (ereg('[^A-Za-z^0-9]', $brukernavn)) { echo "Username can only contain letters!";}if (strlen($brukernavn) <= 5 || strlen($brukernavn) >= 18){echo "The username is to big or to small!";}else{$passord=rand(111111,999999);$ip = $_SERVER['REMOTE_ADDR'];mysql_query("INSERT INTO `brukere` (`id` , `passord` , `brukernavn` , `email` , `aktivert` , `oppdrag` , `liv` , `ip` , `l_ip` , `online` , `brukerlevel` , `rank` , `penger` , `kuler` , `tos` , `######` , `profiltekst` , `profilbilde` , `profilmusikk` , `sistkrim` , `sistgta` , `antallkrim` , `antallgta` , `land` , `sistfly` , `fly` , `antalldrap` , `antallfly` , `antallmeld` , `amtallforum` , `antalloc` , `antallforum` , `hus` , `antallprofil` , `huspenger` , `krimsjanse` , `gtasjanse` , `hjelper` , `lukket` , `avisskriver` , `aviseier` , `avis` , `avisavis` , `status` ) VALUES ('', '$passord', '$brukernavn', '$email', 'ja', '1', '100', '$ip', '', '$nå', 'bruker', 'Slave', '500', '0', 'Accepted', '$kjonn', '', '', '', '0', '0', '0', '0', '$land', '0', 'None', '0', '0', '0', '0', '0', '0', '1', '200', '0', '0-0-0-0', '0-0-0', 'nei', '0', 'nei', 'nei', 'None', 'nei', 'lever')");$subject="UnderWorld Mafia";$message="Hello $brukernavn <br>		  Welcome to UnderWorld Mafia. You can login with the following information : <br>		  Username : $brukernavn		  Password : $passord		  		  This information is sent from a server that humans dont watch so pleace do not reply.		  UnderWorld Mafia Crew.";mail($email,$subject,$message,"From: UW Mafia<admin@UnderWorld-Mafia.com>");echo"Your account has been created. Pleace check your spam folder to if you dont get your account iformation within 10Minutes."; }}}?>

It dont show any errors. echo's or nothing :s.Anyone that can help me out? ->Kristian_C

Link to comment
Share on other sites

I don't know if this is the right answer, but I saw a whitespace on the third line and you missed these ( )You've written: include_once"includes/kontakt.php";And you should have written: include_once ("includes/kontakt.php");And have you named the form itself? I mean, the submit button must have name="regg" because you've used if(isset($_POST['regg'])) {You also need to name the inputs with what you've used in the PHP code.

Link to comment
Share on other sites

the syntax of the mail function should go like this:

mail("url@url.com", "Web mail", $email, $subject, $message);

and i don't think that you can put 2 variables in this function, you should make on variable named 'headers' which contains those 2 variables. ($email, $subject).

Link to comment
Share on other sites

I don't know if this is the right answer, but I saw a whitespace on the third line and you missed these ( )You've written: include_once"includes/kontakt.php";And you should have written: include_once ("includes/kontakt.php");And have you named the form itself? I mean, the submit button must have name="regg" because you've used if(isset($_POST['regg'])) {You also need to name the inputs with what you've used in the PHP code.
Hehe, ive allways used include_once"include.include.php"; so that is not the problem.every form button/textfiled ++ have the right names. And to the mail answer : i used allmost the same mail code at my first game so that aint the problem, anyway it whould insert the user to the db before it sends the mail. so the mail aint the prob.->Kristian_C
Link to comment
Share on other sites

Found the problem :)

<?session_start();include_once"includes/kontakt.php";[b]From here :[/b]if(isset($_POST['regg'])){ $brukernavn=$_POST['brukernavn'];$kjonn=$_POST['######'];$ref=$_POST['ref'];$land=$_POST['land'];$email=$_POST['email'];$email2=$_POST['email2'];$sjekkbrukernavn=mysql_query("SELECT brukernavn FROM brukere WHERE brukernavn='$brukernavn'");$sjekkemail=mysql_query("SELECT email FROM brukere WHERE email='$email'");$brukernavnsjekk=mysql_num_rows($sjekkbrukernavn);$emailsjekk=mysql_num_rows($sjekkemail);if($brukernavnsjekk > 0){echo"That username is allready in use";exit(); [b]To here it is fine.  [/b] Here i added [b] } [/b] And now it works :p i hate that error :p if($emailsjekk > 0){echo"That email is allready beeing used";exit();}if (ereg('[^A-Za-z^0-9]', $brukernavn)) { echo "Username can only contain letters!";}if (strlen($brukernavn) <= 5 || strlen($brukernavn) >= 18){echo "The username is to big or to small!";}else{

Edited by Kristian_C
Link to comment
Share on other sites

Just to clarify....

You've written: include_once"includes/kontakt.php";And you should have written: include_once ("includes/kontakt.php");
The include and require statements are special language constructs, and you can use them with/without parens. It really only matters if you are getting the return value. For example, if your include file has a return value this will not save the value:$retval = include ("file.php");But this will:$retval = (include "file.php");
the syntax of the mail function should go like this:mail("url@url.com", "Web mail", $email, $subject, $message);
That's not right, the mail function has 3 required parameters and two optional parameters. This is the definition for mail:bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]] )mail ($to, $subject, $message, $headers, $params);
Link to comment
Share on other sites

My include files is the files i have on every page, those are the ones that keeps my game goin, like the connection to the db and and most of the time functions that must go on again after they've stopped, "game missions" that i have made for users who plays more then others is include files and stuff like that, in that case i only use include_once"file.php";or include "file.php"; and ive never had a problem with that.. but what do you meen with the save thing?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...