Bij een login script heb ik deze foutmeldingen:
Warning: session_start() [function.session-start]: open(/public/tmp/sess_ad68ae9b6b5681523c811cf3220fdc6b, O_RDWR) failed: No such file or directory (2) in /public/sites/www.carsalesnl.nl/admin/login_3.php on line 1
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /public/sites/www.carsalesnl.nl/admin/login_3.php:1) in /public/sites/www.carsalesnl.nl/admin/login_3.php on line 1
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /public/sites/www.carsalesnl.nl/admin/login_3.php:1) in /public/sites/www.carsalesnl.nl/admin/login_3.php on line 1
Dit is het loginscrit:
<?php
require('../../includes/connection.php');
//3. If the form is submitted or not.
//3.1 If the form is submitted
if (isset($_POST['username']) and isset($_POST['password'])){
//3.1.1 Assigning posted values to variables.
$username = $_POST['username'];
$password = $_POST['password'];
//3.1.2 Checking the values are existing in the database or not
$query = "SELECT * FROM `users` WHERE username='$username' and password='$password'";
$result = mysql_query($query) or die(mysql_error());
$count = mysql_num_rows($result);
//3.1.2 If the posted values are equal to the database values, then session will be created for the user.
if ($count == 1){
$_SESSION['username'] = $username;
}else{
//3.1.3 If the login credentials doesn't match, he will be shown with an error message.
echo "Account niet gevonden";
}
}
//3.1.4 if the user is logged in Greets the user with message
if (isset($_SESSION['username'])){
$username = $_SESSION['username'];
header("location:../index.php");
}else{
echo "Something went wrong";
}
?>
En in login_3.php begin ik met.
<?php session_start(); ?>
Toch zegt hij dat dat al gebeurd in het script op lijn 1, maar daar staat niks anders dan de php open tags. Weet iemand hoe dat komt?
2.307 views