Heyas,
I'm kinda new to this session concept btw--
after I login the script forwards me to the members' area
So, I have
validation.php:
<?php
/* get the incoming ID and password hash */
$user = $_POST["userid"];
$pass = sha1($_POST["password"]);
/* establish a connection with the database */
$server = mysql_connect("localhost", "sirius",
"--");
if (!$server) die(mysql_error());
mysql_select_db(" sirius_ictpassword");
/* SQL statement to query the database */
$query = "SELECT * FROM users WHERE User = '$user'
AND Password = '$pass'";
/* query the database */
$result = mysql_query($query);
/* Allow access if a matching record was found, else deny access. */
if (mysql_fetch_row($result))
echo "Access Granted: Welcome, $user!";
else
echo "<font color = /"red/"><h1>Access Denied: Invalid Credentials.</h1>";
mysql_close($server);
?>
And the code that it forwards to if login successful:
<?php
session_start();
header("Cache-control: private");
if ($_SESSION["access"] == "granted")
header("Location: ./secure/index.php");
else
header("Location: ./index.html");
?>
<HTML>
<HEAD>
<TITLE>Alper's Bookstore - <?php $_SESSION["userid"] ?>Logged In</TITLE>
<style type="text/css">
.....
But when I put in the correct login information I get:
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/sirius/public_html/ict/secure/index.php:2) in /home/sirius/public_html/ict/secure/index.php on line 3
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/sirius/public_html/ict/secure/index.php:2) in /home/sirius/public_html/ict/secure/index.php on line 3
Warning: Cannot modify header information - headers already sent by (output started at /home/sirius/public_html/ict/secure/index.php:2) in /home/sirius/public_html/ict/secure/index.php on line 4
Warning: Cannot modify header information - headers already sent by (output started at /home/sirius/public_html/ict/secure/index.php:2) in /home/sirius/public_html/ict/secure/index.php on line 8
If you want to see the dir's you can login 😉
http://www.sirius-surf.be/ict/
login: alper
pass: ilhan
(Yea, it's my ICT project--)