code says im not logged in
Posted: Thu Feb 10, 2005 6:20 am
The following code is where I add blog entries into a database. I have been working on this for about a week now.
What happens is, I always get the "You have to sign in first", however, I am signed in when I try to add.
As I say, if I am logged in, and the basic validation works, I should get the message "Thankyou, your post has been added"
If anyone solves this for me I would be very grateful.
Thanks
What happens is, I always get the "You have to sign in first", however, I am signed in when I try to add.
Code: Select all
<html>
<head>
<?php include ("constants.inc"); ?>
<?php echo"<title>$SiteTitle</title>"?>
<?php echo"<link rel="stylesheet" href="$cssfile" type="text/css">"?>
</head>
<body>
<?php
include ("connect.php");
if ( !$username || !$title || !$comment ) {
echo "Please make sure all fields are filled in";
}
else {
if (isset($_SESSIONї'name'])) // 20
{
else {
$date = date("d/m/Y");
$name = preg_replace("/>/",">",$name);
$name = preg_replace("/</","<",$name);
$comment = preg_replace("/>/",">",$comment);
$comment = preg_replace("/</","<",$comment);
$comment = ereg_replace("<","",$comment);
$comment = ereg_replace(">","",$comment);
$wrap = intval(45)+1;
$comment = wordwrap($comment, $wrap, ' ', 1);
$comment = stripslashes($comment);
$yname = stripslashes($name);
$ytitle = stripslashes($title);
$ycomm = stripslashes($comment);
$insert = "INSERT INTO content (username,title,date,comment)
VALUES ('$yname','$ytitle','$date','$ycomm')";
mysql_query($insert) or die ("Could not add data to the table");
$query = "SELECT * FROM content";
$result = mysql_query($query);
$numrows = mysql_num_rows($result);
echo "Thankyou, your post has been added<br><br>";
}
}
else {
echo 'You have to sign in first ';
echo '<a href="login.php" title="Login">Login</a>';
}
}
?>If anyone solves this for me I would be very grateful.
Thanks