dr.maju Posted July 16, 2008 Share Posted July 16, 2008 Hey, i am new to php and after following some great tutorials i have managed to create a login system but now im stuck. Basically, i have a client.php page that is protected via the login system etc...on this page i have an iFrame and in the iFrame i want to load different content based on what user is logged in. (can i do this by using their user id that is created in the database?) Thanks, any help will be greatly appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/115016-php-members-area-need-help/ Share on other sites More sharing options...
DeanWhitehouse Posted July 16, 2008 Share Posted July 16, 2008 yes, have an if statement in the iframe, where u set the url, and change the url based on the id number e.g. if($idnumber == 1) { echo "link to page"; } Quote Link to comment https://forums.phpfreaks.com/topic/115016-php-members-area-need-help/#findComment-591457 Share on other sites More sharing options...
dr.maju Posted July 16, 2008 Author Share Posted July 16, 2008 yes, have an if statement in the iframe, where u set the url, and change the url based on the id number e.g. if($idnumber == 1) { echo "link to page"; } thanks for the quick reply! would i have to repeat that for all the different id's? Quote Link to comment https://forums.phpfreaks.com/topic/115016-php-members-area-need-help/#findComment-591458 Share on other sites More sharing options...
dr.maju Posted July 16, 2008 Author Share Posted July 16, 2008 Here is the code that is now in the inline frame. It dosn't seem to load the new pages when a different member id logs in. It always goes to the first1. (btw in the sql connect bit all the details are filled in correctly ) <?php $dbh=mysql_connect ("hostname", "username", "password") or die('Cannot connect to the database because: ' . mysql_error()); mysql_select_db ("databasename"); $id = $_GET['member_id']; if($id == 1) { echo "clients/client1.php"; } if($id == 2) { echo "clients/client2.php"; } if($id == 3) { echo "clients/client3.php"; } if($id == 4) { echo "clients/client4.php"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/115016-php-members-area-need-help/#findComment-591463 Share on other sites More sharing options...
dr.maju Posted July 16, 2008 Author Share Posted July 16, 2008 *made a mistake in last post* it dosn't go to the pages at all. Quote Link to comment https://forums.phpfreaks.com/topic/115016-php-members-area-need-help/#findComment-591465 Share on other sites More sharing options...
DeanWhitehouse Posted July 16, 2008 Share Posted July 16, 2008 where is the iframe code? Quote Link to comment https://forums.phpfreaks.com/topic/115016-php-members-area-need-help/#findComment-591470 Share on other sites More sharing options...
dr.maju Posted July 16, 2008 Author Share Posted July 16, 2008 on a different page, the one that has the iframe embedded in it. Quote Link to comment https://forums.phpfreaks.com/topic/115016-php-members-area-need-help/#findComment-591471 Share on other sites More sharing options...
dr.maju Posted July 16, 2008 Author Share Posted July 16, 2008 OH do i put the php code on the iframe code? i thought u meant in the iframe page Quote Link to comment https://forums.phpfreaks.com/topic/115016-php-members-area-need-help/#findComment-591474 Share on other sites More sharing options...
DeanWhitehouse Posted July 16, 2008 Share Posted July 16, 2008 ahh ok, soz, yer you would have <iframe all the code src= " <?php $dbh=mysql_connect ("hostname", "username", "password") or die('Cannot connect to the database because: ' . mysql_error()); mysql_select_db ("databasename"); $id = $_GET['member_id']; if($id == 1) { echo "clients/client1.php"; } if($id == 2) { echo "clients/client2.php"; } if($id == 3) { echo "clients/client3.php"; } if($id == 4) { echo "clients/client4.php"; } ?> "></iframe> Quote Link to comment https://forums.phpfreaks.com/topic/115016-php-members-area-need-help/#findComment-591477 Share on other sites More sharing options...
samshel Posted July 16, 2008 Share Posted July 16, 2008 do you plan to have differente pages for different clients?? so if you have 100 users you will have 100 pages? or am i getting this terribly wrong.. i think you should have only one page and put the logic to display something or not in the if or switch conditions. PS: OR having different pages depending on type of users ( like admin, user etc) makes more sense to me. Quote Link to comment https://forums.phpfreaks.com/topic/115016-php-members-area-need-help/#findComment-591482 Share on other sites More sharing options...
dr.maju Posted July 16, 2008 Author Share Posted July 16, 2008 ha, sounds stupid when u put it that way. But yeah...each user needs their own page. so having different pages for just admin and user wouldn't help much. And as i am a complete rookie at php i dont really know any other way of doing it. Thanks for ure comment though. If anyone knows of a simpler way please let me know. Quote Link to comment https://forums.phpfreaks.com/topic/115016-php-members-area-need-help/#findComment-591751 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.