Jump to content

Protection for a one time use PHP page


ridgey28

Recommended Posts

Hi I am wondering how to tackle a problem and would like some advice.

 

Basically I have a one time use registration script that sets up 3 tables in my database.  Once the tables have been setup, I then want to protect the page from being executed again.  I thought about deleting it from the server which is fine for me but is not user friendly to others when released.

 

My thoughts were to write a function to check the database.  If the database has already been setup then redirect the user, otherwise show the form.

 

My only question is that how do you check to see if the table has not been setup  without getting those horrible mysql error messages when the table does not exist.

 

Currently using MYSQL 5

 

What way would you do it?

 

Thanks in advance

 

Tracy

Link to comment
Share on other sites

My only question is that how do you check to see if the table has not been setup  without getting those horrible mysql error messages when the table does not exist.

 

You could use error suppression to hide said errors. eg Place @ before any call that might trigger an error. But deleting the file is likely your best option, you can have the script itself do this.

Link to comment
Share on other sites

Thanks guys.  Deleting the file is probably the safest of options as the script is only used the once.  It's a bonus that you can delete it with a little bit of PHP instead of doing it manually though.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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