Results 1 to 21 of 21

Thread: Redirecting to an other URL....

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Redirecting to an other URL....

    I am not 100 % sure if this is a PHP or HTML question. But I am posting it here.

    I am still working on my searching engine. And I have it working, but I want to modify it a bit. When you are searching this forum, you will first have a page up saying something like searching. And after it is finished then it is showing the results. How can I do that??? How can I redirect the page from the "Searching" page to the page with the results, and at the same time sending the results in variables????

  2. #2
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    header("location: blah.htm");

    might work..

    you could also write to the html document, when it's finished loading

    <script>
    window.location = "http://www.newlocation.com/";
    </script>

    Something like that might work..

  3. #3

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    So I guessed right. It wasn't PHP...but it seems to be working. I have to do some test later tonight. But thanks.

  4. #4
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    No worries

  5. #5
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    You could also use a meta refresh (like vbforums):

    Code:
    <meta http-equiv="Refresh" content="2; URL=http://www.blah.com/blah.html">
    My evil laugh has a squeak in it.

    kristopherwilson.com

  6. #6

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Yeah I was thinking of that. One of my friends made a script with meta refresh that autoamtically voted on a web page once...That was fun...the other band got 5000votes...my friends band got 1 000 000 votes...and that was on Norways biggest TV channels web page...


    BTW nice avatar Hobo....

  7. #7
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    surely the poll should've required unique ip votes :|

  8. #8

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Yes, but they didn't. I think they wanted people to spend time voting on their page. But I don't think that they thought of the possibility of being "hacked"...

  9. #9
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    it's more like exploiting it, not hacking it

    it'd be hacking if you deleted all votes for the other band..

  10. #10

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    That is why I did put up the " " on the word. I know it's not hacking, but I'm not so good in English so hacking was the closest word I found...

  11. #11

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by da_silvy
    header("location: blah.htm");

    might work..

    you could also write to the html document, when it's finished loading

    <script>
    window.location = "http://www.newlocation.com/";
    </script>

    Something like that might work..
    OK...now I have tested it...and I have an other question. On the first page a person writes in a text tin a text box. He clicks submit, and it moves to the next page. With the variable. THen when he is finished searching, he moves to the next page. But then without the variable....is it possible for me to move the variable over to the 3. page???

  12. #12
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    You could either save to a database as you go and then delete the entry when you're done.

    Or you can keep printing the values to each page, such as:

    Code:
    <?php
        echo '<input type="hidden" name="age" value="' . $_POST['age'] . '">';
    ?>
    Something like that.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  13. #13

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Sorry but I am a kind of dumb here....but from the first page to the second one. It ads my variable name and variable value to the "address". If I use your line like this:

    Code:
    	<?PHP
    		echo '<input type="hidden" name="author" value="massive">';
    	?>
    	<script>
    		window.location = "http://www.klubbscenen.com/searchpage2.php"; 
    	</script>
    it doesn't do that. Is that becuase of the type is hidden? What should it be I want to see it in the address bar?

  14. #14
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    yoyu can't submit a form element just by doing a window.location.

    if you want it in the address bar then you have to append it to the url.

    not sure why you are using this but ok

    <script>
    window.location = "http://www.klubbscenen.com/searchpage2.php?val1=1&val2=2&val3=3...etc";
    </script>

  15. #15

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    OK...here my problem is....I want a "waiting screen" to appear when my searching engine is searching my webpage. So my first though was that I had to send the search word to the waiting screen (this works fine). Then my PHP code would seach the site for that word (this works fine), but then I have to open up a new PHP site to show the results. So then I have to send the results to that page too...and I don't get how...Can anyone help me, or have an other idea on how to do this???


    <script>
    window.location = "http://www.klubbscenen.com/searchpage2.php?val1=1&val2=2&val3=3...etc";
    </script>

    I thought of that too...but I can't have the script in the PHP code, and my variables are losing scope ater the PHP tag is finished doesn't it??? Or can I use my PHP variables like you did in the Script???

  16. #16
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    You missed my suggestion completely.

    The hidden field has to be within a form.

    And the form needs to be submitted.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  17. #17

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    I actually saw that in my PHP book right now. So I gusess that I am not any closer to any solution yet...Becuase I can't use a submit button on the searching(the page where the user is sitting back and waiting for the result) page..

    So how do this forum or any forum do this??? Anybody know?

  18. #18
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Why do you want a waiting screen in the first place?

    All it does is delay the user from getting to the results. There isn't anything going on in the background, the search is already complete.

    It's just a waste of time.

    Google, Altavista, Yahoo, MSN...they don't have waiting pages. They realize it's a waste of time.

    Why do you want one? Because it's different or looks cool?

    When you print your waiting page, use the meta refresh like I said:

    Code:
    <?php
    
    $url = "http://www.blah.com/blah.php?search=" . $_REQUEST['query'];
    
    echo '<html>
    <head>
        <meta http-equiv="Refresh" content="2; URL=' . $url . '">
    </head>
    <body>
        Your search is in progress, please wait, blah blah...
    </body>
    </html>';
    
    ?>
    So when it goes to the next page, it has the query.

    If you can't figure out what I'm talking about or how to do it, you need to go learn some basic programming concepts.

    It's not that hard to figure out.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  19. #19

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    I understand that code. Thanks you are great. I actually havn't though about pages like yahoo, altavista and other pages. I just though of other PHP forums like this one. So now I am not sure if I want that waithing page at all....but I will do some test and see what I will end up with.

    Thanks

  20. #20
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    this forum doesn't have a waiting page. it has a page that delays you and tells you the search is started. then when it refreshes the search actually begins. like Hobo said, the waiting page is nothing, nothing is happening. then all they use is a meta tag refresh with the url of the search page. most of the time the waiting page is setting a cookie or something.

  21. #21

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Thanks guys, you have been really helpfull. So I think I will drop the whole waiting screen....thanks again.

Posting Permissions

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



Click Here to Expand Forum to Full Width