Hi I created an image generator where a user enters a name and it spits/creates an image for them. I then have those images saved using the name entered on the server. Question is how can I prevent someone else coming along and creating the same name? I want it to display a message stating that name was already created. Would I create an IF statement?
yes you would need an if statement if you are recording these image names on any table on database, then its pretty simple just run a query on that table which would check if that name already exists or not if it returns with records in database then it should write a error message! simple
They are not saved in a DB, just saved to a directory on the server. This is what I'm using: $upload = $_FILES['image']['tmp_name']; $name = $_POST[name]; $text = str_replace (" ", "-", $_POST[name]);
No just the images it generates saved to a directory... They are all named accordingy to what they enter. So if they enter jen2swt, it saves the image as jen2swt.png in the directory.
so what use would that image do when it cant relate to anything? =/ then I would make a record of it in a table that would be the easiest way. or right a script which would search for the file or whatever script you are using for uploading the image to the directory, ask it to check if the file already exists or not if so abort the uploading process and write the error message
I guess that's what I need help with. Writing something that will check the directory for duplicate names and write an error message that it already exsists if someone is uploading the same name...I'll search some more. Thanks for all the help