Jump to content

Recommended Posts

Hey, i am new to php and after following some great tutorials i have managed to create a login system ;D 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!

Link to comment
https://forums.phpfreaks.com/topic/115016-php-members-area-need-help/
Share on other sites

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 ;D)

 

 

<?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";

}

?>

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>

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.