runnerjp Posted March 8, 2007 Share Posted March 8, 2007 hey guys $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";} how could i change that code so that when a user is loged in it shows 1 page beeing the index.inc.php and when they are logged in it will show anouther like main index page??? and what would i call that index page cheers Quote Link to comment Share on other sites More sharing options...
rofl90 Posted March 8, 2007 Share Posted March 8, 2007 Research If & else they will help you decide so.. If (whatever) { echo "Content with logged in"} else { echo"Your not logged in"} Dos that help? Quote Link to comment Share on other sites More sharing options...
rofl90 Posted March 8, 2007 Share Posted March 8, 2007 also if you're trying to get the stuff to show i dont think yo've echoed $content variable Quote Link to comment Share on other sites More sharing options...
runnerjp Posted March 8, 2007 Author Share Posted March 8, 2007 yes that helps i will have a read up on it thanks... just needed pointing in right directly.... the content bit works means any thing i wanna add does show up there Quote Link to comment Share on other sites More sharing options...
rofl90 Posted March 8, 2007 Share Posted March 8, 2007 click your topic solved tool so helpers know which posts to answer to Quote Link to comment Share on other sites More sharing options...
runnerjp Posted March 8, 2007 Author Share Posted March 8, 2007 does this sound right if($auth[error]) { include("include/index_index.inc.php"); } else { include("include/index.log.php"); } ?> so if($auth[error]) should see if they are logged in and if not send them to index.inc and if the are (else) sends them to right page??? Quote Link to comment Share on other sites More sharing options...
rofl90 Posted March 8, 2007 Share Posted March 8, 2007 Lol thats fine, looks quite funny cuz its usualy otherway round but i wont confuse you looks fine to me test it out on wamp or whathavu Quote Link to comment Share on other sites More sharing options...
runnerjp Posted March 8, 2007 Author Share Posted March 8, 2007 lol ok what do you mean the other way round.. better get it right lol Quote Link to comment Share on other sites More sharing options...
runnerjp Posted March 8, 2007 Author Share Posted March 8, 2007 ok i get an error Parse error: syntax error, unexpected T_IF in /home/runnerse/public_html/index.php on line 10 think iv left something out sum where <? // 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=if($auth[error]) { include("include/index.inc.php"); } else { include("include/index.log.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"); ?> Quote Link to comment Share on other sites More sharing options...
rofl90 Posted March 8, 2007 Share Posted March 8, 2007 Hmm could you post ay heavily coded ncluded / required files Quote Link to comment Share on other sites More sharing options...
runnerjp Posted March 8, 2007 Author Share Posted March 8, 2007 ok this is index.inc <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> </p> <p> </p> <p> </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> auth member <? function authenticate ($login, $password) { global $db_name, $tbl_members, $incpath; include("$incpath/error.inc.php"); $valid = mysql_fetch_array(mysql_db_query($db_name, "SELECT * FROM $tbl_members WHERE login='$login'")); if ($login) { if ($password == crypt($valid[password], $login)) { if ($valid[enabled] == "yes") { $result=$valid; } else { $result[error]=$strError700;} } else { $result[error]=$strError800;} } else { $result[error]=$strError200;} return $result; } ?> thats large bits oh and body <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> is it something to do with this tho $content=if($auth[error]) { include("include/index.inc.php"); } else { include("include/index.log.php"); } if ($auth[error]) {$menu="include/menu_u.inc.php";} else {$menu="include/menu_v.inc.php";} is content=if orrect Quote Link to comment Share on other sites More sharing options...
runnerjp Posted March 8, 2007 Author Share Posted March 8, 2007 any help n e 1? Quote Link to comment Share on other sites More sharing options...
runnerjp Posted March 8, 2007 Author Share Posted March 8, 2007 ok after messing around with it i have fixed it <? // 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"); if($auth[error]) { include("include/index.inc.php"); } else { include("include/index.log.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"); ?> but this means that the index.inc and index.log does not appear in the body where the content is supposed to appear how comes... do i have to set it as content? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.