Jump to content

Creating usernames and passwords based on filenames


richardmilne

Recommended Posts

Hello all, I hope someone can help me with my rather limited knowledge of SQL.

 

Lets say I have a folder on a server populated by JPGs. The file naming convention in this folder is "XXXXX_XXXX.jpg" (5 digit number followed by 4 digit number).

 

I need to create a list of usernames and passwords based on this file naming convention, where the username is the 5 digit number, and the password is the 4 digit number. Further to this; new users need to be added as more JPGs are added.

 

I really don't know where to start with this. As a general guide I'm using this tutorial:

 

http://www.phpeasystep.com/workshopview.php?id=6

 

I suppose the bit I'm interested in is the "INSERT INTO" line.

 

I hope someone can give me a little nudge in the right direction, I've never had to play around with SQL before, at least no more than setting up a database for wordpress installations.

 

Ultimately when a user logs in with said username and password they will be able to view the corresponding image.

 

TIA, hope someone can help me!

Are you only using these usernames/passwords for when people log in to view the one image?

 

There's no need for a database. Or more accurately, you already have one: the file system.

 

If someone logs in as 12345:9876 then look for "12345_9876.jpg". If it exists then great, and if it doesn't then the login isn't valid.

Be sure to make sure that the username is a five-digit string and the password is a four-digit string before doing anything else with them.

Awesome, thanks for the tips. I've come to the conclusion that a database is absolutely necessary, for the purpose of authentication via email (and will also come in handy for data capture for our clients). No information enters the database however until a user requests a photo.

 

My new overall flow for this is:

 

[*]User enters ID (5 digit number), PIN (4 digit number), email address, first and last name

[*]ID, PIN and reference to the file on the server (This is the bit I'm having difficulty with) go to the table "Photo" in their respective fields.

[*]Email, first and last name goes to the table "Customers" in their respective fields

[*]Now I believe a cross reference table is needed in case one user has multiple photos, which combines the records from "Photo" with each email address (Also having difficulty here!)

[*]Customer is emailed with a link to view their photo. The content of said link is updated as new photos are requested by the customer in step 1

 

My colleague is trying to help with this too, as he has some experience in databasing, just not with MySQL, and not for web.

 

So far I've created a super simple form that adds ID, PIN, email and names to the correct tables, but just can't figure out how to make the jump to use this data to find a file in the filesystem.

 

Forgive my noobish cry for help, I'm just trying to learn!

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.