saintdevi Posted March 17, 2009 Report Share Posted March 17, 2009 (edited) Sveiki, man ir skriptiņš, kurš pārmet uz lapu <script LANGUAGE='JavaScript'> window.location='$targetpage'; </script> $targetpage būtu vieta kurā ieliktu linu, kurš ir pievienots lapai Piemēram: Http://www.lapa.lv/?targetpage=http://www....amp;UYUIUH96668 Kā noparsēt linku, lai otro daļu iemet $targetpage? Un būtu labi ja to JS parādītu lapā tikai tad, ja ir norādīts ?targetpage, ja nava, tad tas nemaz nerādās ... rezultātā, ja lietotājs nāk uz lapu un norāda ?targetpage tiek automātiki pārmests ar js uz ?targetpage! Lielas man problēmas to ielikt ira ... nesanāk nekādi, vai lūdzu kāds varētu palīdzēt? :) Edited March 17, 2009 by Aleksejs Quote Link to comment Share on other sites More sharing options...
Delfins Posted March 17, 2009 Report Share Posted March 17, 2009 if (!empty($xxx)) header("Location: $xxx"); Quote Link to comment Share on other sites More sharing options...
saintdevi Posted March 17, 2009 Author Report Share Posted March 17, 2009 (edited) if (!empty($xxx)) header("Location: $xxx"); Atvaino, bet vai varētu mazliet detalizētāku examplīti iemes? Kad piesiets JS un citas lietas ... Edited March 17, 2009 by saintdevi Quote Link to comment Share on other sites More sharing options...
saintdevi Posted March 17, 2009 Author Report Share Posted March 17, 2009 Vai lūdzu kāds nevarētu palīdzēt? Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted March 17, 2009 Report Share Posted March 17, 2009 Nezinu, vai līdz galam izpratu, ko vēlies, bet te mans minējums: <?php if(array_key_exists('targetpage',$_GET){ $trg = validate_input_so_that_this_input_is_ok($_GET['targetpage']); echo "<html> <head> <title>Pārsūtīšana uz $trg</title> </head> <body> <script>window.location='$trg';</script> </body> </html>"; } else { //Kas jādara, ja nav padots targetpage? } Quote Link to comment Share on other sites More sharing options...
zinatnieks Posted March 17, 2009 Report Share Posted March 17, 2009 (edited) <script type="text/javascript"> if('<?=$_GET['targetpage']?>' != ''){ window.location='<?=$_GET['targetpage'];?>'; } </script> Edited March 17, 2009 by zinatnieks Quote Link to comment Share on other sites More sharing options...
saintdevi Posted March 17, 2009 Author Report Share Posted March 17, 2009 Lapa jāielādē kā parasti ... Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted March 17, 2009 Report Share Posted March 17, 2009 Nu, tad: <?php if(array_key_exists('targetpage',$_GET){ $trg = validate_input_so_that_this_input_is_ok($_GET['targetpage']); echo "<html> <head> <title>Pārsūtīšana uz $trg</title> </head> <body> <script>window.location='$trg';</script> </body> </html>"; die(); } Quote Link to comment Share on other sites More sharing options...
saintdevi Posted March 17, 2009 Author Report Share Posted March 17, 2009 un beigās ?> Vnk man te nava nekādu iespēju pārbaudīt, tapēc parprasu, vai tas tiešām beigās izrādās tik vienkārši ... ?! Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted March 17, 2009 Report Share Posted March 17, 2009 Jā, un beigās: ?> Quote Link to comment Share on other sites More sharing options...
v3rb0 Posted March 17, 2009 Report Share Posted March 17, 2009 pēc jaunās modes, failos kuros ir tikai php (kā šinī gadījumā), vairs nevajag beigās ?> Quote Link to comment Share on other sites More sharing options...
Delfins Posted March 18, 2009 Report Share Posted March 18, 2009 a kāpēc JS? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.