473,324 Members | 2,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Redirection Help Emergency

RX
I try to use PHP to redirect to other page and failed. Please give me a
help. Thanks.

The script is:

if($rows_num>0)
{
session_start();
session_register("userid");
session_register("username");
session_register("userpriv");
$userid=$data[0]['user_id'];
$username=$data[0]['username'];
$userpriv=$data[0]['priv_id'];
echo "<script
language=javascript>self.location='admin_cpanel.ph p';</script>";
exit;
}
else
{
echo "<script
language=javascript>self.location='admin_login.php ';</script>";
exit;
}

The result is a blank page. No redirection as expected.

Jul 17 '05 #1
2 1622
RX <li******@telus.net> wrote:
I try to use PHP to redirect to other page and failed. Please give me a
help. Thanks.
No you are not, you are using javascript instead.
echo "<script language=javascript>self.location='admin_cpanel.ph p';</script>";

Read up on your javascript skills (eg:
http://www.comptechdoc.org/independe...alocation.html)

Better yet: use PHP:
header("Location: $abs_url");

See http://php.net/header

--

Daniel Tryba

Jul 17 '05 #2
RX wrote:
I try to use PHP to redirect to other page and failed. Please give me a
help. Thanks.

The script is:

if($rows_num>0)
{
session_start();
session_register("userid");
session_register("username");
session_register("userpriv");
$userid=$data[0]['user_id'];
$username=$data[0]['username'];
$userpriv=$data[0]['priv_id'];
echo "<script
language=javascript>self.location='admin_cpanel.ph p';</script>";
exit;
}
else
{
echo "<script
language=javascript>self.location='admin_login.php ';</script>";
exit;
}

The result is a blank page. No redirection as expected.


try window.location='http://www.mysite.com/admin_login.php'

It looks like, from a quick search on google, that you have to include the
full url when you try to do it this way. I've used the .href approach
before and gotten away with not including the full url.


Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues...
0
by: cristiano valli via .NET 247 | last post by:
(Type your message here) Hi to all, I'm using RSA Passage products to protect my workstation. It usessmart card to pick up user's credentials and installs its ownGINA. My problem is the following...
52
by: Gerard M Foley | last post by:
Can one write a webpage which is not displayed but which simply redirects the user to another page without any action by the user? Sorry if this is simple, but I am sometimes simple myself. ...
15
by: Taki Jeden | last post by:
Hello everybody Does anybody know why w3c validator can not get pages that use 404 htaccess redirection? I set up two web sites so that clients request non-existent urls, but htaccess redirects...
27
by: Josh | last post by:
I work for a small hotel. They don't want to invest in a good front desk program and the paper system that is being used is not working. It is complete chaos at the moment. I want to make a...
8
by: Luciano A. Ferrer | last post by:
Hi! I was following the http://www.seomoz.org/articles/301-redirects.php article, trying to do that with one of my test sites I added this to the .htaccess file: RewriteEngine On RewriteCond...
13
by: souissipro | last post by:
Hi, I have written a C program that does some of the functionalities mentionned in my previous topic posted some days ago. This shell should: 1- execute input commands from standard input,...
1
by: comp.lang.php | last post by:
require_once("/users/ppowell/web/php_global_vars.php"); if ($_GET) { // INITIALIZE VARS $fileID = @fopen("$userPath/xml/redirect.xml", 'r'); $stuff = @fread($fileID,...
13
by: Massimo Fabbri | last post by:
Maybe it's a little OT, but I'll give it try anyway.... I was asked to maintain and further develop an already existing small company's web site. I know the golden rule of "eternal" URIs, but...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.