smartfaq
SmartFAQ is developed by The SmartFactory (http://www.smartfactory.ca), a division of InBox Solutions (http://www.inboxsolutions.net)

How do I safely remove the page within Xoops that says :"If the page does not automatically reload, please click here" ? I feel like it's buggy.
Requested by Carnuke and Answered by Hervet on 2004/12/15 17:07:42 (10012 reads)
The line you want to replace should look something like:

redirect_header("index.php", 3, _NOPERM);


Replace that with:
header("Location: index.php");


The comments are owned by the author. We aren't responsible for their content.
  • Just popping in

 Remove If the page does not automatically reload, please click here" ?

Hack this

function redirect_header($url$time 3$message ''$addredirect true)
{
    global 
$xoopsConfig$xoopsRequestUri;
    if (!
defined('XOOPS_CPFUNC_LOADED')) {
        
header("Location: $url");
        exit();
    } else {
        
$url preg_replace("/&/i"'&'htmlspecialchars($urlENT_QUOTES));
        echo 
'
        <html>
        <head>
        <title>'
.$xoopsConfig['sitename'].'</title>
        <meta http-equiv="Content-Type" content="text/html; charset='
._CHARSET.'" />
        <meta http-equiv="Refresh" content="'
.$time.'; url='.$url.'" />
        <style type="text/css">
                body {background-color : #fcfcfc; font-size: 12px; font-family: Trebuchet MS,Verdana, Arial, Helvetica, sans-serif; margin: 0px;}
                .redirect {width: 70%; margin: 110px; text-align: center; padding: 15px; border: #e0e0e0 1px solid; color: #666666; background-color: #f6f6f6;}
                .redirect a:link {color: #666666; text-decoration: none; font-weight: bold;}
                .redirect a:visited {color: #666666; text-decoration: none; font-weight: bold;}
                .redirect a:hover {color: #999999; text-decoration: underline; font-weight: bold;}
        </style>
        </head>
        <body>
        <div align="center">
        <div class="redirect">
          <span style="font-size: 16px; font-weight: bold;">'
.$message.'</span>
          <hr style="height: 3px; border: 3px #E18A00 solid; width: 95%;" />
          <p>'
.sprintf(_IFNOTRELOAD$url).'</p>
        </div>
        </div>
        </body>
        </html>'
;
    }
    exit();
}

 
  • Just popping in

 Re: Remove If the page does not automatically reload, ple...

mauriciolima, thanx for the tip.
for those who were also wondering where this piece of code comes from: /include/functions.php

personally, i was interested in setting the variable
"$time = 3" in the first line in the quote above to "$time = 1"

this saves two seconds of irritating waiting time...

 
  • XOOPS is my life!

 Re: Remove If the page does not automatically reload, ple...

Changing

function redirect_header($url$time 3$message ''$addredirect true)
to
function redirect_header($url, [color=ff0000]$time 1[/color], $message ''$addredirect true)
only changes the default value for $time, and will only have an effect if redirect_header() is called without that parameter specified.

If you want to force the time delay to a particular value, do it in the body of the function:

function redirect_header($url$time 3$message ''$addredirect true)
{
   [
color=ff0000]$time 1;[/color]
   global 
$xoopsConfig$xoopsRequestUri;
   if (!
defined('XOOPS_CPFUNC_LOADED')) {


Note that a one-second delay will make it difficult to read an error message. In fact, when I'm debugging, I may set the value to something like 600 (10 minutes) to allow plenty of time to read or save error messages.

Another useful thing to do when debugging is to save the redirect messages in a log file:

function redirect_header($url$time 3$message ''$addredirect true)
{
   [
color=ff0000]error_log(date('[Y-m-d H:i:s] ') . $message "n"3XOOPS_ROOT_PATH '/cache/34948430.log');#*#REDIRECT_LOG#[/color]
   
global $xoopsConfig$xoopsRequestUri;
   if (!
defined('XOOPS_CPFUNC_LOADED')) {


(On a production site, be careful where you place that log file, since it may contain infomation that you don't want other people to see. In the above example, I used the /cache directory, but that directory is publicly readable unless you take measures to protect it.)

 
  • Just popping in

 Re: Remove If the page does not automatically reload, ple...

i've got line

redirect_header("index.php?op=members_type", 2, _MD_MEMBERS_TYPE_EDITED);

in my admin/index.php and the log message shows not in whole page but only in content area - admin navigation stays.. how to change that?