Witam. Najpierw kody:

w mod_rewrite mam:

  1. RewriteRule ^([a-zA-Z0-9]*)$ show.php?id=$1 [L]


i plik show w 2 wersjach:
  1. $ref = $_SERVER['HTTP_REFERER'];
  2. $id = addslashes($_GET['id']);
  3.  
  4. echo '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
  5. <script type="text/javascript">
  6. $(document).ready(function() {
  7. setTimeout ( "doSomething3()", 1000 );
  8. });
  9.  
  10. function doSomething3 ( )
  11. {
  12. $.ajax({
  13. type: "GET",
  14. url: "showadd.php",
  15. data: "id='.$id.'&ref='.$ref.'",
  16. });
  17. }
  18. </script>';
  19.  
  20. if($_GET['id']){
  21.  
  22. $getUrl = mysql_fetch_array(mysql_query("SELECT url FROM url WHERE id='$id'"));
  23. $url = $getUrl[0];
  24. if(!empty($url)){
  25. echo "
  26. <frameset rows='*,1' border='0' frameborder='no' framespacing='0'>
  27. <frame src='".$url."' marginheight='0' marginwidth='0' topmargin='0' leftmargin='0'>
  28. <frame src='add.php' marginheight='0' marginwidth='0' border='0' topmargin='0' scroling='no' leftmargin='0'>
  29. </frameset>
  30. ";
  31.  
  32.  
  33. } else {
  34. echo "<center>Error : invalid url</center>";
  35. }
  36. } else {
  37. header("Location: index.php");
  38. }

Przy takiej opcji gdy wpiszę adres strony jako http://adresstrony.pl mimo że powinno mnie przekierować poprzez header("Location: index.php"); nie robi tego.
Pokombinowałem i zmieniłem kod na taki.
  1.  
  2. if($_GET['id']){
  3. $id = addslashes($_GET['id']);
  4. $getUrl = mysql_fetch_array(mysql_query("SELECT url FROM url WHERE id='$id'"));
  5. $url = $getUrl[0];
  6. if(!empty($url)){
  7. echo "
  8. <frameset rows='*,1' border='0' frameborder='no' framespacing='0'>
  9. <frame src='".$url."' marginheight='0' marginwidth='0' topmargin='0' leftmargin='0'>
  10. <frame src='add.php' marginheight='0' marginwidth='0' border='0' topmargin='0' scroling='no' leftmargin='0'>
  11. </frameset>
  12. ";
  13.  
  14. $ref = $_SERVER['HTTP_REFERER'];
  15.  
  16. echo '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
  17. <script type="text/javascript">
  18. $(document).ready(function() {
  19. setTimeout ( "doSomething3()", 1000 );
  20. });
  21.  
  22. function doSomething3 ( )
  23. {
  24. $.ajax({
  25. type: "GET",
  26. url: "showadd.php",
  27. data: "id='.$id.'&ref='.$ref.'",
  28. });
  29. }
  30. </script>';
  31.  
  32. } else {
  33. echo "<center>Error : invalid url</center>";
  34. }
  35. } else {
  36. header("Location: index.php");
  37. }


Przy takim kodzie owszem przekierowanie na index.php przy wpisaniu adresu jako http://adresstrony.pl działa ale za to nie działa tutaj teraz nie działa przesłanie GET z funkcji doSomething3 ...

Zapewne rozwiązanie jest banalne ale już nie mam pomysłu co jest nie tak.

hmm morze dziś się znajdzie ktoś kto pomorze wink.gif ?