Jump to content
Sign in to follow this  
StylishXx

Trenger hjelp til PHP script

Recommended Posts

Hei prøver og lage en side for venner osv...

men får denne feilmelingen:

Notice: Undefined index: $name in /www/zzl.org/m/a/f/mafialegend/htdocs/_check_user.php on line 10 Notice: Undefined index: cookieusername in /www/zzl.org/m/a/f/mafialegend/htdocs/_connect.php on line 18.

 

_check_user.php:

<?php

#################################################

# #

# Auteur: J. Klompen #

# Site : http://www.maffia.net.tc #

# Date : 15 apr 2005 #

# Email: Jeroen@tweakomatic.nl #

# #

#################################################

if($_POST['name']) {

$name = $_POST['name'];

$password = $_POST['password'];

include "_connect.php";

$datem = date( "j.M.Y - G:i:s" );

$opdracht = "insert INTO ip_logs values('0','$name','$password','$datem','$REMOTE_ADDR')";

$resultaat = mysql_query($opdracht);

$lijstGebruikers = "SELECT * FROM users WHERE username='$name' AND password='$password'";

$resultLijstGebruikers = mysql_query($lijstGebruikers);

if (mysql_num_rows($resultLijstGebruikers) == 1) {

$name = $_POST['name'];

$password = $_POST['password'];

setcookie("cookieusername", $name,time()+86400);

setcookie("cookiepassword", $password,time()+86400);

$lijstGebruikers = "SELECT `id` FROM users WHERE `username`='$name' AND `password`='$password'";

$resultLijstGebruikers = mysql_query($lijstGebruikers);

while ($row = mysql_fetch_array($resultLijstGebruikers)) {

setcookie("userid", $row[id],time()+86400);

}

$melding = "Login succes, <br /> You will be redirected in 2 seconds";

 

echo "<META http-equiv=refresh content=\"0;url=login_true.php\">";

} else {

$melding = "Login wrong";

}

}

?>

 

_connect.php:

<?PHP

#################################################

# #

# Auteur: J. Klompen #

# Site : http://www.maffia.net.tc #

# Date : 15 apr 2005 #

# Email: Jeroen@tweakomatic.nl #

# #

#################################################

$Host = "#";

$User = "#";

$Pass = "#";

$DBName = "#";

 

$Link = mysql_connect ($Host, $User, $Pass);

mysql_select_db($DBName);

 

$cookieusername = $_COOKIE['cookieusername'];

 

$datem = date( "j.M.Y - G:i:s" );

?>

 

 

Beklager, viste ikke hvordan jeg fikk det i en script box.

 

Håper noen kan hjelpe meg.

Edited by StylishXx

Share this post


Link to post

Du sier lite om hva koden din skal gjøre, sett at du faktisk forstår det selv. Er du sikker på at et mafiaspill er det beste å lage for en på ditt kunnskapsnivå?

 

Hvis jeg ikke tar feil har du et skjema som sender data videre til _check_user.php. Dette skjemaet må ha et felt med navn "name" for at koden din skal kunne sjekke om brukernavnet eksisterer. Kan vi få se koden fra den filen også? Vær snill å bruk

 eller [php] rundt, så gjør du det letter å lese.

Share this post


Link to post

Kan ikke en mod sette en sticky ang spørsmål om mafiaspill?

Hva mener du det skulle være godt for? Det er jo ikke imot forumes retningslinjer å stille spørsmål relatert til mafiaspill.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...