olivierarbez
asked on
Script not working with Firefox but working ok with IE
Hi, the following work well with IE but not for Firefox.
When you select a link the following code get called and log the hit from the url then redirect to the url selected.
With firefox a black page with Redirecting show up with the url but you have to click on it to go there.
I would like go directly to the url with having to click on the link.
Thank You.
<html><body text=#ffffff bgcolor=000000 onLoad="javascript:documen t.links[0] .click();" >
<?
# pointer.php
# passed vars: g
# this page will redirect a user to the specified url
#
# NOTE: $g can only be accessed if register globals is turned on (not suggested)
$destination = base64_decode(urldecode($_ GET['g'])) ; // $_GET['g']);
// find the link in the video table so we can log the hit...
// j require_once 'init/nom_var.php';
// j require_once 'init/init.php';
require_once ($DOCUMENT_ROOT . "/init/nom_var.php");
require_once ($DOCUMENT_ROOT . "/init/init.php");
$sql = 'SELECT
VI_ID,
VI_category
FROM
video
WHERE
VI_url = \'' . addslashes($destination) . '\'';
$query = mysql_query($sql);
$rowID = @mysql_result($query, 0, 0);
$category = @mysql_result($query, 0, 1);
if (preg_match('/^\d+$/', $rowID)) {
// A valid record was found. Now log the hit
$sql = 'INSERT INTO video_access_log (
VAL_VI_ID,
VAL_category,
VAL_lang,
VAL_accessdate)
VALUES(
' . $rowID . ',
\'' . addslashes($category) . '\',
\'eng\',
NOW())';
$query = mysql_query($sql);
}
?>
<a name=redirect href="<? echo $destination; ?>"> Redirecting...</a>
</body></html>
When you select a link the following code get called and log the hit from the url then redirect to the url selected.
With firefox a black page with Redirecting show up with the url but you have to click on it to go there.
I would like go directly to the url with having to click on the link.
Thank You.
<html><body text=#ffffff bgcolor=000000 onLoad="javascript:documen
<?
# pointer.php
# passed vars: g
# this page will redirect a user to the specified url
#
# NOTE: $g can only be accessed if register globals is turned on (not suggested)
$destination = base64_decode(urldecode($_
// find the link in the video table so we can log the hit...
// j require_once 'init/nom_var.php';
// j require_once 'init/init.php';
require_once ($DOCUMENT_ROOT . "/init/nom_var.php");
require_once ($DOCUMENT_ROOT . "/init/init.php");
$sql = 'SELECT
VI_ID,
VI_category
FROM
video
WHERE
VI_url = \'' . addslashes($destination) . '\'';
$query = mysql_query($sql);
$rowID = @mysql_result($query, 0, 0);
$category = @mysql_result($query, 0, 1);
if (preg_match('/^\d+$/', $rowID)) {
// A valid record was found. Now log the hit
$sql = 'INSERT INTO video_access_log (
VAL_VI_ID,
VAL_category,
VAL_lang,
VAL_accessdate)
VALUES(
' . $rowID . ',
\'' . addslashes($category) . '\',
\'eng\',
NOW())';
$query = mysql_query($sql);
}
?>
<a name=redirect href="<? echo $destination; ?>"> Redirecting...</a>
</body></html>
ASKER
The script is working but could you please remove the time function so it redirect right away (I am aware that 0 will redirect immediately).
Thank you
Thank you
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Both of the solution works. I will have to Split points.
Is it possible to add a referrer variable to a header? like $referrer that would be sent with the URL $destination.
Thank you.
-O-
Is it possible to add a referrer variable to a header? like $referrer that would be sent with the URL $destination.
Thank you.
-O-
$ref = urlencode($_SERVER['HTTP_R EFERRER']) ;
header("Location: $destination?ref=$ref");
Then just use this to get the referrer back in the next script: $ref = urldecode($_GET['ref']);
header("Location: $destination?ref=$ref");
Then just use this to get the referrer back in the next script: $ref = urldecode($_GET['ref']);
ASKER
Thank you for your great help.
-O-
-O-
<html><body text="#ffffff" bgcolor="000000">
<?php
# pointer.php
# passed vars: g
# this page will redirect a user to the specified url
#
# NOTE: $g can only be accessed if register globals is turned on (not suggested)
$destination = base64_decode(urldecode($_
// find the link in the video table so we can log the hit...
// j require_once 'init/nom_var.php';
// j require_once 'init/init.php';
require_once ($DOCUMENT_ROOT . "/init/nom_var.php");
require_once ($DOCUMENT_ROOT . "/init/init.php");
$sql = 'SELECT
VI_ID,
VI_category
FROM
video
WHERE
VI_url = \'' . addslashes($destination) . '\'';
$query = mysql_query($sql);
$rowID = @mysql_result($query, 0, 0);
$category = @mysql_result($query, 0, 1);
if (preg_match('/^\d+$/', $rowID)) {
// A valid record was found. Now log the hit
$sql = 'INSERT INTO video_access_log (
VAL_VI_ID,
VAL_category,
VAL_lang,
VAL_accessdate)
VALUES(
' . $rowID . ',
\'' . addslashes($category) . '\',
\'eng\',
NOW())';
$query = mysql_query($sql);
}
javascriptRedir($destinati
function javascriptRedir($page, $seconds){
$time = $seconds * 1000;
echo "<br><br>You will be redirected to <a href='$page'>$page</a> in $seconds seconds...";
echo '<script language="javascript">'."\
}
?>
</body></html>