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 Link to comment https://forums.phpfreaks.com/topic/41761-any-help-changing-this-code/ 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? Link to comment https://forums.phpfreaks.com/topic/41761-any-help-changing-this-code/#findComment-202461 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 Link to comment https://forums.phpfreaks.com/topic/41761-any-help-changing-this-code/#findComment-202463 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 Link to comment https://forums.phpfreaks.com/topic/41761-any-help-changing-this-code/#findComment-202465 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 Link to comment https://forums.phpfreaks.com/topic/41761-any-help-changing-this-code/#findComment-202466 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??? Link to comment https://forums.phpfreaks.com/topic/41761-any-help-changing-this-code/#findComment-202469 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 Link to comment https://forums.phpfreaks.com/topic/41761-any-help-changing-this-code/#findComment-202479 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 Link to comment https://forums.phpfreaks.com/topic/41761-any-help-changing-this-code/#findComment-202481 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"); ?> Link to comment https://forums.phpfreaks.com/topic/41761-any-help-changing-this-code/#findComment-202491 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 Link to comment https://forums.phpfreaks.com/topic/41761-any-help-changing-this-code/#findComment-202493 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 Link to comment https://forums.phpfreaks.com/topic/41761-any-help-changing-this-code/#findComment-202503 Share on other sites More sharing options...
runnerjp Posted March 8, 2007 Author Share Posted March 8, 2007 any help n e 1? Link to comment https://forums.phpfreaks.com/topic/41761-any-help-changing-this-code/#findComment-202512 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? Link to comment https://forums.phpfreaks.com/topic/41761-any-help-changing-this-code/#findComment-202516 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.