SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast demontemplates's Avatar
    Join Date
    Feb 2007
    Location
    United Kingdom
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A little bit of coding help needed

    Hi All

    I are working on a project and I need this script changed so that at the end it will redirect to a url after 5 seconds.

    my ($submitResult, $tempTime);

    # pass the CGI object parameters to the submit object
    $objSubmit->AddCgiParameters($objFormData);

    # open the tab file
    $objTabFile->OpenFile;

    # see what engines to use and ready the submit object
    &ProcessEngines;

    # print out what time we started

    $tempTime = $objUtility->GetDate . " " . $objUtility->GetTime;
    $objPage->WriteLine ($objPage->Bold ("Started: " . $tempTime));
    $submitResult = "Started: " . $objUtility->GetDate . " " . $objUtility->GetTime . "\n";

    # print out all the paramenters just for fun
    my ($param);
    foreach $param ($objFormData->param) {
    unless ($param eq $FORMNAME_URL || $param eq $FORMNAME_ENGINES) {
    $objPage->WriteLine("" . $objPage->Bold($param . ": ") . $objFormData->param($param));
    $submitResult .= $param . ": " . $objFormData->param($param) . "\n";
    }
    }
    $objPage->WriteLine();

    # check to see if multiple urls were specified. if so, then split them into an
    # array so we can loop through them.
    my ($url, @urls);
    if ($objUtility->InStr($objFormData->param($FORMNAME_URL),"\n")) {
    @urls = $objSubmit->StringToArray("\n",$objFormData->param($FORMNAME_URL));
    } elsif ($objUtility->InStr($objFormData->param($FORMNAME_URL),",")) {
    @urls = $objSubmit->StringToArray(",",$objFormData->param($FORMNAME_URL));
    } else {
    $urls[0] = $objFormData->param($FORMNAME_URL);
    }

    # submit each url one at a time to the specified engines
    foreach $url (@urls) {
    # get rid of possible line break character.
    chop $url if ($objUtility->RightChars($url,1) eq "\n" || $objUtility->RightChars($url,1) eq "\r");

    if ($objUtility->IsAuthorizedDomain($url)) {
    $objSubmit->AddParameters(url => $url);
    $objPage->WriteHeader("Submitting: " . $url);
    $submitResult .= "\n" . "Submitting: " . $url . "\n";;
    # tell the submit object to do it
    $objSubmit->Submit;
    $submitResult .= $objSubmit->Results;
    $tempTime = $objUtility->GetDate . " " . $objUtility->GetTime;
    $objPage->WriteLine($objPage->Bold("Finished: " . $tempTime));
    $objPage->WriteLine();
    $submitResult .= "Finished: " . $objUtility->GetDate . " " . $objUtility->GetTime . "\n";
    } else {
    $objPage->WriteHeader("The URL '" . $url . "' is not authorized.");
    $submitResult .= "\n" . "The URL '" . $url . "' is not authorized.\n";;
    }
    }
    return $submitResult;
    }



    I have tried adding this bit of code to the bottom, though it works and redirects it distord the page somewhat.

    This is the code I added but now removered.

    # forward user to some page...
    print "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 3.2//EN'>";
    print "<html><head><title>$page_title</title>";
    print "<META HTTP-EQUIV='Refresh' CONTENT='0; URL=http://www.somedomain.com'>";
    print "</HEAD><BODY></BODY></HTML>";

  2. #2
    SitePoint Addict
    Join Date
    Apr 2006
    Posts
    249
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think the code you removed was corrrect, it was just redirecting immediately - change it to content='5; url=http://... - the 5 tells it to redirect after 5 seconds.

  3. #3
    SitePoint Member
    Join Date
    Mar 2008
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <meta http-equiv="refresh" content="0;URL=http://www.somedomain.com" />
    Should be the correct code...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •