[thelist] PHP help needed

Flavia Tarzwell (FayeC) ftarzwell at fayec.com
Mon Nov 28 18:13:02 CST 2005

I am sorry to bug you but I am lost. I am still learning PHP and I think 
I got myself into things I am not able to do yet....
I have a simple login (no need for secure login - as instructed by the 
site's owner - she *requested* that the login uses only a username, no 
password), the login is not validated against a db or anything....it's 
basically only a way to sort through image files and display only the 
associated files.
So, the login sends the user to a page called gallery.php where 4 images 
are displayed. The images are named user1_1.jpg, user1_2.jpg, 
user1_3.jpg and user1_4.jpg.
The images are displayed and arranged in the page and I have the src 
pointing to $username_1.jpg, $username_2.jpg, $username_3.jpg and 
The problem is selecting the images from the images folder.
I have been struggling to write the right code to grab the username from 
the form and then use that in the path to the images (I thought it would 
be a good idea to have folders named after the username inside the 
images folder like images/user1, images/user2 and the whenever the user 
logs in with the username the username is then added to the path to the 
images and all images in that specific folder are loaded...
But since I *know* only 4 images are to be displayed then the images can 
be put in the images folder together but the name of the images need to 
be user#_1.jpg, etc....
Maybe I am complicating things more than they need to be.
Could I just get the username using:
$username = $_POST['username'];
And then use $username in the image source name?
Is that the solution?
Has anybody done something similar?

*And yes, I did explain to the client about the security issues of not 
having a password and not validating the password/username but she 
explained it was not a matter of safety as the images were for public 
display anyways. The images are screenshots taken during ultrasound 
exams and they are posted online for the extended family to view so the 
only concern is really selecting the right images for the right 

Thank you in advance for any tips,


More information about the thelist mailing list