Well this is what i got:
login.html > checkuser.php > post.html > post.php
What happens is that a user logins in and it will give them a session (it writes the username, firstname and lastname of the user).
Then they gets to post.html. they fill in the fields and submit. the information is sent to post.php. If they havn’t logged in it will give them a message, if they have the message is recorded into a mysql database. I’m only having problems with the post.php file. I think i am callin the session in wrong.
hope you can help.
<?
session_start();
header("Cache-control: private");
if($_SESSION['user_name'] || $_SESSION['first_name'] || $_SESSION['last_name']){
echo "You must login to post! If you do not have an account you may register it for free!";
include 'login.html';
include 'register.html';
exit();
}
include 'db.php';
$title = $_POST['title'];
$url = $_POST['url'];
$message = $_POST['message'];
$username = $_SESSION['user_name']
$firstname = $_SESSION['first_name']
$lastname = $_SESSION['last_name']
$title = stripslashes($title);
$url = stripslashes($url);
$message = stripslashes($message);
if((!$title) || (!$url) || (!$message) || (!$username) || (!$firstname) || (!$lastname)){
echo 'You did not submit the following required information! <br />';
if(!$title){
echo "Message Title is a required field. Please enter it below.<br />";
}
if(!$url){
echo "Url is a required field. Please enter it below.<br />";
}
if(!$message){
echo "Message is a required field. Please enter it below.<br />";
}
if(!$username){
echo "There was an error in recording your username. Please Login!<br />";
}
if(!$firstname){
echo "There was an error in recording your first name. Please Login!<br />";
}
if(!$lastname){
echo "There was an error in recording your last name. Please Login!<br />";
}
include 'post.html';
exit();
}
$sql = mysql_query("INSERT INTO public (title, url, message, username, firstname, lastname, postdate)
VALUES('$title', '$url', '$message', '$username', '$first_name', '$last_name', now())")
?>
Thanks for your help.