Jump to content

[SOLVED] include problem


sharal

Recommended Posts

Heya, i'm writing an application where the users profile information is stored in a php file - i want to include that specific file now. I'm doing this by getting the users profile file via his / her session.

It can be discussed how safe that is, but it's nothing thats going live anyway :)

I've checked if there's any errors in the "username.php" file ofcourse, which there isn't - i don't get any parse errors either, it just doesn't work.

 

This current line doesn't work as it's not quoted ofcourse, but it's just an example of what i want to do and have been trying

 

<?php include ($_SESSION['username'] .".php");?>

 

Hope you can help me :)

Link to comment
https://forums.phpfreaks.com/topic/176148-solved-include-problem/
Share on other sites

what i'm trying to do is, to include a file that has the name of the user.

 

For instance, lets say that your username is Redarrow.

Your profile file would then be named Redarrow.php, if your name was Sharal. It would be named Sharal.php.  Now i want to include the correct file depending on which user logged in.

So if it's you who logged in it would include your profile file "Redarrow.php", if it was me. Then it would include "Sharal.php", which i want to do by getting the session username, where your username is stored in eg: $_SESSION['username'] = Redarrow.

 

$cuser = $_SESSION['username'];
include($cuser . ".php");

just an example

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.