Im trying to redirect an user of my page when I ban him from my chat box using this (php):
header("location: index.php");
exit;
The problem is the index.php page is opening inside the connected users section, in this case inside a div
. How can i redirect the user's main page ?
Thanks for your time.
Im trying to redirect an user of my page when I ban him from my chat box using this (php):
header("location: index.php");
exit;
The problem is the index.php page is opening inside the connected users section, in this case inside a div
. How can i redirect the user's main page ?
Thanks for your time.
Share Improve this question edited Feb 21, 2013 at 3:36 Mollo asked Feb 20, 2013 at 16:34 MolloMollo 7233 gold badges7 silver badges25 bronze badges 6-
rather than redirecting in the frame, you could use
die("You have been banned");
instead ofheader()
. The other option is to have a ajax/java call to check on if a redirect is needed – UnholyRanger Commented Feb 20, 2013 at 16:49 -
I just tried
die("banned");
everything inside the connected users div got erased so its actually the same problem, somehow i need to do that in the parent document. I dont know about ajax hehehe – Mollo Commented Feb 20, 2013 at 16:58 - Do you have the parent page check if the user is banned? – UnholyRanger Commented Feb 20, 2013 at 17:40
- Ummm, good idea, i can put a check in the parent page and refresh it when i ban someone but the next question is: How to tell an specific page to refresh in php or javascript – Mollo Commented Feb 20, 2013 at 18:25
-
This may depend on what the page is used for, if a refresh occurs often, then the check will happen but if the user never refreshes you need to intervene. One way is to use java to make a check so often against the server or make the page refresh with (HTML header)
<meta http-equiv="refresh" content="($seconds)">
. This could get annoying to some. – UnholyRanger Commented Feb 20, 2013 at 18:32
2 Answers
Reset to default 8Try this in the javascript code:
window.top.location.href = "http://www.site.";
This is the answer using javascript:
window.parent.location = "http://www.example./index.php";