|
|||||||
| PHP Discussion and technical support for using and deploying PHP based websites. |
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Good day to you all,
stupid as it sound, all the thing that I have tried to match a variable into a text file and execute according to it result. PHP Code:
__________________
That's why we are not alone on earth, to help each other ! Let's build ! |
|
#2
|
||||
|
||||
|
If I understand you correctly, you have a text file on the server named user_list.txt and wish to see if the session user name is in that file and then display the desired image based on the comparison.
Your code as posted uses the value you set for $active which is "user_list.txt", not the file. You have no code to import the file into that variable. ![]() If my assumptions are correct, try this revised code: PHP Code:
$active=$_SERVER['DOCUMENT_ROOT']."/path_to/user_list.txt"; And adjust the path as necessary, so if the script is ever moved to a different server with a different document root path it won't break. The rest that follows are "btw, I noticed..." comments: Also, I'm sure you have your reasons for enclosing each image in a bold tag, but without text it seems odd. If you don't need the <b> tag remove it and move the ID to the img tags. Also, it's perfectly legal to use single quotes instead of double quotes in simple HTML like this. Each byte counts! Cheers. -jim |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|