SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot Tiger_Tom's Avatar
    Join Date
    Jan 2000
    Location
    U.K.
    Posts
    194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    eregi - error in this code?

    This code works:

    $form_input = eregi_replace("disco|hip-hop|soul","BARRY WHITE",$form_input);

    This code doesn't do anything:

    if (eregi("hip-hop|disco",$form_input)){
    echo "<HTML><HEAD><META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=http://www.tigertom.com/cgi-bin/Captain_Picard.cgi?bounce1=1\"></HEAD></HTML>\n";
    }

    nor does this:

    if (eregi("soul",$form_input)){
    echo "<HTML><HEAD><META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=http://www.tigertom.com/cgi-bin/Captain_Picard.cgi?bounce2=1\"></HEAD></HTML>\n";
    }

    Have I made a mistake in the code? What I'm trying to do
    is filter input, and redirect to an external cgi-script.
    When I type in the words 'soul', 'hip-hop', nothing happens. They are printed to the php page.

    I'm a PHP newbie, I should say!

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How about this:

    PHP Code:
    if (eregi("soul",$form_input)){ 
    header("Location: http://www.tigertom.com/cgi-bin/Captain_Picard.cgi?bounce1=1");

    Make sure there is no html or whitespace above the opening <? tag and you are not using echo or print before it either
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Zealot Tiger_Tom's Avatar
    Join Date
    Jan 2000
    Location
    U.K.
    Posts
    194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you Freddy.

    I had tried this early on in my travails, but the header was already
    set in the script. Php is a curious beast; I'm trying to find where in the
    code I can 'catch' the form input *before* the header is set.

    I'd post the entire script, but it's someone else's work; I'm trying to
    customise it.

    Your idea was a good one; I'll try using it instead, and stick it earlier
    on in the script.


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
  •