Gå til innhold

Kan noen hjelpe meg med feilen i scriptet mitt?


Anbefalte innlegg

Emm kan noen hjelpe meg her...

 

<?php

ob_start();

// allows you to use cookies

include("config.php");

//gets the config page

if ($_POST[register]) {

// the above line checks to see if the html form has been submitted

$username = $_POST[username];

$password = $_POST[pass];

$cpassword = $_POST[cpass];

$email = $_POST[emai1];

//the above lines set variables with the user submitted information

if($username==NULL|$password==NULL|$cpassword==NULL|$email==NULL) {

//checks to make sure no fields were left blank

echo "A field was left blank.";

}else{

//none were left blank! We continue...

if($password != $cpassword) {

// the passwords are not the same!

echo "Passwords do not match";

}else{

// the passwords are the same! we continue...

$password = md5($password);

// encrypts the password

$checkname = mysql_query("SELECT username FROM users WHERE username='$username'");

$checkname= mysql_num_rows($checkname);

$checkemail = mysql_query("SELECT email FROM users WHERE email='$email'");

$checkemail = mysql_num_rows($checkemail);

if ($checkemail>0|$checkname>0) {

// oops...someone has already registered with that username or email!

echo "The username or email is already in use";

}else{

// noone is using that email or username! We continue...

$username = htmlspecialchars($username);

$password = htmlspecialchars($password);

$email = htmlspecialchars($email);

// the above lines make it so that there is no html in the user submitted information.

//Everything seems good, lets insert.

$query = mysql_query("INSERT INTO users (username, password, email) VALUES('$username','$password','$email')");

// inserts the information into the database.

echo "You have successfully registered!";

}

}

}

}

else

{

// the form has not been submitted...so now we display it.

echo ("

<center>

<form method=\"POST\">

Username: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"username\"><br />

Password: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"pass\"><br />

Confirm Password: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"cpass\"><br />

Email: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"emai1\"><br />

<input name=\"register\" type=\"submit\" value=\"Register\">

</form>

</center>

");

}

?>

Se link--->

http://legend113.phpnet.us/MafiaSpill/Login.php

 

Hvis noen har kunnet rettet opp feilen har det vært greit :D

Lenke til kommentar
Videoannonse
Annonse

Det første jeg ser er at

 

if ($_POST[register]) {

// the above line checks to see if the html form has been submitted

$username = $_POST[username];

$password = $_POST[pass];

$cpassword = $_POST[cpass];

$email = $_POST[emai1];

 

burde være

 

PHP
<?php

if ($_POST['register']) {

// the above line checks to see if the html form has been submitted

$username = $_POST['username'];

$password = $_POST['pass'];

$cpassword = $_POST['cpass'];

$email = $_POST['emai1'];

?>

Endret av crowly
Lenke til kommentar

Det forste jeg ser er at du ikke har riktig passord til root for a koble til MySQL databasen din.

 

og Crowly; burde, ikke skal :p *pirke*

 

 

skal ikek denne linjen

 

if($username==NULL|$password==NULL|$cpassword==NULL|$email==NULL) {

 

vaere

 

if($username==NULL||$password==NULL||$cpassword==NULL||$email==NULL) {

Endret av Ståle
Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
×
×
  • Opprett ny...