Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP+How to redirect user if they are naughty?
Old 03-21-2005, 11:25 AM PHP+How to redirect user if they are naughty?
csj
Junior Talker

Posts: 2
Trades: 0
Hi

I was wondering how to set up an auto redirect if person refreshes page.

I have a page "view.php" which is in a pop-up window. on this page is a link to "dosomething.php". when the user goes to both these pages it has an image on it (which is being read from a mysql table). When the user clicks on the link for "dosomething.php" the info (image,image title,ect..) is deleted from the mysql table.

but if (and it happens) the user tries to refresh "dosomething.php" or click to go back to "view.php" the image won't show up cause by then it has been deleted from the mysql table. It looks untidy and horrible cause not all the info is there and its showing a broken image.

What I need to know is how can I create a script so that if the user refreshes the page it automatically takes them to a page called "Notthere.php" that says "Error, that item is no longer valid for viewing"

I tried using cookies, but it didn't work out for me cause everytime i went back to "view.php" at a later time it would immediately redirect to "Notthere.php".

I am desperate!! Please somebody just help me a little. I will be so grateful!
csj is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-21-2005, 12:48 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
Well presumably you are telling view.php what you want to view, so can you run a check into your database to see if it exists and redirect only if not?
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 03-29-2005, 04:40 PM
Average Talker

Posts: 15
Trades: 0
well to redirect someone you can use header("Location: youwerebad.php"); but it has to be called before any print() or echo() statements

I think you should have the page with the image on it test to see if the image exists. If it does, load the image and get ready for the delete query. If it doesn't, on the other hand, use header(); to send him/her to another location
kmkz is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP+How to redirect user if they are naughty?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11676 seconds with 12 queries