Hello I was wondering if someone could help me with a little bug in my shoutbox that I intergrated into 4images. The first is actually quite simple but I can't seem to figure out the code to use.
On my gallery I have a shoutbox where the user cannot post unless he/she is logged in. I used the {if user_loggedin} to show the form if the user is logged in, if the user is a guest I used the {if user_loggedout} to show an image stating that u must be logged into post.
The problem is that sometimes a user logs out of the gallery and their browser has cached the page and the form is visible which lets the visitor post even though he/she is logged out. I want to add a bit code to the script below that will be along the lines of:
if user_level=guest or user_awaiting // popup a javascript message stating that you must be logged into post then when the user clicks ok he/she is redirected back to the page they came from. and if user_level=registered or admin //continue with the post as normal.
If anyone could help with this I would be very greatful. I wrote this little script myself and am trying to get rid of a few bugs but when I do I will post this as a mod unless someone else wants to, your free to do so. My code is below so you can see what I'm getting at.
<?php
if ($shout){
define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
if ($message == !""){
$ip = $REMOTE_ADDR;
$info = $HTTP_USER_AGENT;
$goto = $HTTP_REFERER;
$add_date=time (void);
$message = stripslashes($message);
$message = htmlspecialchars($message);
$user_name = $user_info['user_name'];
$result=MYSQL_QUERY("INSERT INTO shoutbox (id,name,message,timestamp,ip,browser,block)".
"VALUES ('NULL', '$user_name', '$message', '$add_date', '$ip', '$info', '$block')");
echo "<META http-equiv='refresh' content='0;URL=$goto'>";
}
else {
echo "<META http-equiv='refresh' content='0;URL=http://www.myleeneklass.com'>";
}
}
?>