View previous topic :: View next topic |
Author |
Message |
hellie -
Joined: 30 May 2005 Posts: 4
|
Posted: Mon May 30, 2005 8:29 pm Post subject: Session error:S |
|
|
hey guys check this out: http://www.ruissaard.trap17.com/inloggen.php
and this: http://62.234.17.158:8001/website/inloggen.php
thes two are the SAME scripts and the the webserver(the ip one) has an error called undefined index. plz help me with all of these errors.
script:
Code: | <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h2 align="center">Inloggen</h2>
<?
session_start();
ob_start();
include("config.php");
if($_SESSION['naam'] AND $_SESSION['status']) {
if($_COOKIE['naam'] AND $_COOKIE['wachtwoord'] AND $_COOKIE['email'] == "") {
if(isset($_GET['login'])) {
if($_POST['naam'] != "" AND $_POST['wachtwoord'] != "") {
$sql = "SELECT * FROM gebruikers WHERE naam='".$_POST['naam']."'";
$resultaat = mysql_query($sql) OR die ("Kon geen verbinding maken met MySQL");
$rij = mysql_fetch_object($resultaat);
$dbpass = htmlspecialchars($rij->wachtwoord);
$status = htmlspecialchars($rij->status);
$email = htmlspecialchars($rij->email);
$actief = htmlspecialchars($rij->actief);
$pass = md5($_POST['wachtwoord']);
if($dbpass == $pass) {
if($actief == 1) {
$_SESSION['naam'] = $_POST['naam'];
$_SESSION['status'] = $status;
if($_POST['blijven'] == "1") {
setcookie("naam", $_POST['naam'], time() + 365 * 86400);
setcookie("wachtwoord", $pass, time() + 365 * 86400);
}
header("Location: $inlogp");
}else{
echo "<font color='red'><b>Je account is nog niet geactiveerd!</b><font>";
}
}else{
echo "<font color='red'><b>Je wachtwoord en/of naam is incorrect!</b></font>";
}
}else{
echo "<font color='red'><b>Je bent een veld vergeten in te vullen!</b></font>";
}
}else{ }
?>
<form method="post" action="<? echo $_SERVER['PHPSELF']; ?>?login">
<table>
<tr>
<td>Naam:</td><td><input type="text" name="naam"></td>
</tr>
<tr>
<td>Wachtwoord:</td><td><input type="password" name="wachtwoord"></td>
</tr>
<tr>
<td></td><td><input type="checkbox" name="blijven" value="1"> Ingelogd blijven</td>
</tr>
<tr>
<td></td><td><input type="submit" value="Inloggen"></td>
</tr>
</table>
<a href="wachtwoord_vergeten.php"><small>Wachtwoord vergeten?</small></a>
</form>
<?
}else{
$sql = "SELECT * FROM gebruikers WHERE naam='".$_COOKIE['naam']."'";
$resultaat = mysql_query($sql) OR die ("Kon geen verbinding maken met MySQL");
$rij = mysql_fetch_object($resultaat);
$dbnaam = htmlspecialchars($rij->naam);
$dbstatus = htmlspecialchars($rij->status);
$dbpass = htmlspecialchars($rij->wachtwoord);
$pass = $_COOKIE['wachtwoord'];
$naam = $_COOKIE['naam'];
if($dbpass == $pass AND $dbnaam == $naam) {
$_SESSION['naam'] = $dbnaam;
header("Location: $inlogp");
}else{
echo "<font color='red'><b>Eén van je cookies klopt niet met wat in de db staat!</b></font>";
}
}
}else{
?>
Je bent al ingelogd..
<?
}
?>
</body>
</html>
[/list] | [/code] |
|
Back to top |
|
 |
k1ll3rdr4g0n -
Joined: 04 Jul 2004 Posts: 609
|
Posted: Mon May 30, 2005 11:08 pm Post subject: |
|
|
Which line is causing the error? _________________
 |
|
Back to top |
|
 |
hellie -
Joined: 30 May 2005 Posts: 4
|
Posted: Tue May 31, 2005 6:26 am Post subject: |
|
|
$_SESSION['naam'] = $_POST['naam'];
THIS line and i saw on another topic this:These are Notices , since we get so many of the same posts every day
I might as well explain how to turn these Notices off , open your php.ini
file in C:\Windows or C:\Winnt depending on your OS and do this.
Find: error_reporting = E_ALL;
change this line to
error_reporting = E_ALL & ~E_NOTICE;
Find: register_globals = Off
change this line to
register_globals = On
Note: If you feel like not displaying any errors , use this directive , find
display_errors = On and change it to display_errors = Off , Enjoy PHP!
Now their you have it , a perfect configuration of the php.ini file , its not that
hard to configure but I was once confused by these so who am I kidding. LateR!
on the last error(display_errors = On) if i turn that off the errors are gone but that means that the errors are still there and i just want get rid of them!
Plz help me:)[/code] |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Tue May 31, 2005 6:34 am Post subject: |
|
|
No , Notices are not errors , they just tell you stuff about the script you are
using like whether a variable already carries a value , the php.net website
recommends that you leave display_errors = On to Off. LateR!
Also about the register_globals , its recommended to keep this on in my
opinion because some scripts require such a function to be turned on. :-)
Sincerely , TRUSTpunk |
|
Back to top |
|
 |
|