...

View Full Version : only want my image to appear when guests are viewing site



runnerjp
03-07-2007, 10:36 AM
hey guys... got my page with an image and login box... i only whant these to appear if the user is logged in as a "guest" is there sum "what if" statement i can use to get rid of boxes when user is logged in?

maghiel
03-07-2007, 11:13 AM
this is really too little info.
how does your user log in?
where do you store the info(cookie? session?)
when someone logs in you probably write done some info somewhere,
check if that info if set, if not, show the pictures.

runnerjp
03-07-2007, 11:33 AM
well what happens is when a user loogs in the are sent to the same index page
i have used

<?
include("include/adminerr.inc.php");
if($auth[error]) { include("include/messages/index_unverified.inc.php"); }
else { include("include/messages/index_verified.inc.php"); } ?>
so that when a user loggs in it shows a different message

and here is my login script if it helps


<?

// File ID: login.php (user log in routine)

include("require/config.php");
require("require/membership.php");

$content="include/loginbox.inc.php";
$menu="include/menu_u.inc.php";
$page_title="Login Form";

if ($HTTP_POST_VARS) {
if ($login && $password) {
$password=crypt($password, $login);
$data=authenticate($login, $password);
if ($data[error]) {$error=$data[error];}
else {
setcookie("ProfilePHP","$login&&$password", 0, "/");
if (!$ref) {$ref="index.php";}
Header("Location: redirect.php?ref=$ref");
}
} else {$error="901";}
}

error_message($error);

include("include/header.inc.php");
include("include/body.inc.php");
include("include/footer.inc.php");
?>

mlseim
03-07-2007, 01:38 PM
I think we need the code for the actual page where the box appears.
That's where your PHP "if" statement will be.

runnerjp
03-07-2007, 01:42 PM
ok heres all i got on it


<table width="100%" summary="body">
<tr>
<td width="15%" height="96" align="left" valign="top"><center>
<?include("include/info.inc.php"); ?>
</center>
<?include("$menu");?></td>
<td width="1%" align="left" valign="top" bgcolor="#FFFFFF"><div id="linedown"> <img src="http://www.runnerselite.com/images/linedown.jpg" alt="linedown" />
</div></td>
<td width="84%" align="left" valign="top"><?
if (file_exists($content)) {
include($content);
} else {?>
<?echo $content;?>
</p>
<?} ?>
</td>
</tr>
</table>



body used where content and things will apear


here is the page where its the index.inc.php, so this is where all info for both logged in users and guests appear


<table width="100%" summary="maincontent">
<tr>
<td align="left" valign="top" bgcolor="#FFFFFF"><h1 align="left"><img src="../images/runner.jpg" alt="runner" width="127" height="155" align="left"/></h1>
<h1 align="center"><u> Welcome Back To RunnersElite!</u></h1>
<center>
<?
include("include/adminerr.inc.php");
if($auth[error]) { include("include/messages/index_unverified.inc.php"); }
else { include("include/messages/index_verified.inc.php"); } ?>

<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp; </p>
</center>

<center>
<a href="../register.php"><img align="middle" src="../images/bemem.gif" alt="signup" width="280" height="250" border="0" /></a>
</center> </td>
<td align="left" valign="top"><?include("include/loginbox.inc.php"); ?></td>
</tr>
</table>


and here is the index that hold it all together


<?
// File ID: index.php (main page for profile site)


include("require/config.php");
require("require/authmember.php");

$auth=authenticate($login, $password);
include("include/get_config.inc.php");
$content="include/index.inc.php";
if ($auth[error]) {$menu="include/menu_u.inc.php";} else {$menu="include/menu_v.inc.php";}

include("include/header.inc.php");
include("include/body.inc.php");
//include("include/footer.inc.php");
?>

mlseim
03-08-2007, 01:53 PM
I think you should look at this line:

if ($auth[error]) {$menu="include/menu_u.inc.php";} else {$menu="include/menu_v.inc.php";}

They check for authorization.
If the user is logged-in, they include the file: menu_v.inc.php
Otherwise, they include: menu_u.inc.php

Compare those two files and see what is difference is between them.

==========================

Another thing you might want to try ... but make sure you save a copy
of your original "index.inc.php" before you overwrite it.



<table width="100%" summary="maincontent">
<tr>
<td align="left" valign="top" bgcolor="#FFFFFF"><h1 align="left"><img src="../images/runner.jpg" alt="runner" width="127" height="155" align="left"/></h1>
<h1 align="center"><u> Welcome Back To RunnersElite!</u></h1>
<center>
<?
include("include/adminerr.inc.php");
if($auth[error]) { include("include/messages/index_unverified.inc.php"); }
else { include("include/messages/index_verified.inc.php"); } ?>

<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp; </p>
</center>

<?
if($auth[error]) {
echo"
<center>
<a href='../register.php'><img align='middle' src='../images/bemem.gif' alt='signup' width='280' height='250' border='0' /></a>
</center> </td>
<td align='left' valign='top'>";
include("include/loginbox.inc.php");
echo"</td>";
}
else{
echo "<br>\n";
}
?>
</tr>
</table>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum