School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store | FORUMS
Class / Forums / php101 ![]() |
Week #8 ADVANCED To-Do Assignment, post here |
(#15 2003-08-07 16:51:03) Post Reply |
|
TDavid
|
Week #8 ADVANCED TO-DO ASSIGNMENT: Write a script to randomly choose a URL and redirect the surfer when clicked. Make the URL a javascript mouseover so that it is a blind link so the person clicking will not see the result in the browser status window. Include security measures to ensure the script call is only coming from Adult Netsurprise or your server and make sure that the URL looks like a valid URL before redirecting the surfer if it does not look valid than redirect to a different URL.
Post this assignment here so that we can offer comment/critique for you, but also post a URL to the working copy of the script and the complete source code of the script in your post. scriptname.php <-- script name Good luck to you!
|
(#85 2003-08-23 12:48:08) Post Reply |
|
Sk8rRIMuk
|
I have a question regarding the advanced tutorial for week 8 PHP, if I were to put security on to make sure whatever came after ?url= was in the typical URL format wouldn't it defeat the random link purpose. The secutiry would not allow ?url=ran.
Would it be possible to define rules such as, it must be http://www.<whatever>.<whatever> or ran? if so how would I do this? |
(#86 2003-08-23 17:55:56) Post Reply |
|
TDavid
|
I don't really understand the question, perhaps you can supply an example of what you mean. Sorry :( |
(#87 2003-08-23 20:10:34) Post Reply |
|
Sk8rRIMuk
|
Heres my code:
Basically I want the ereg of $url to accept things in the format of 'http://www.anything.anything' and also in the format of 'ran'. I just can't get the security to make sure the url is in the right format to work, it just keeps making the page appear as </center></body></html> (with no other code) :( |
(#190 2003-09-11 07:06:18) Post Reply |
|
Quicksaver
|
when i added proctetion to make sure a valid url is entered i also added a bad url to test that part of the script, in theory what i done is "while an invalid url is entered, keep doing the choose the url routine till a valid comes up" and now, it does a timeout of 3 seconds on the lines of the while() loop, what could be causing this timeout? evryhing looks fine to me :S
working url |
(#191 2003-09-11 07:21:02) Post Reply |
|
Quicksaver
|
to sk8r: could you upload your code, cuz i really dont understand what your problem is, all i (think i)got is that you want this:
even tho i dont understand why you want it, i think i need to see whatever error you say you're having, or you can wait for the more experient TDavid :) |
(#192 2003-09-11 10:07:51) Post Reply |
|
Quicksaver
|
oh, and in the last part of the code, when you do the link, you forgot to put the backslashes before the double quotes i think |
(#243 2003-09-18 05:48:17) Post Reply |
|
Shrek
|
My Week #8 Advanced Assignment
HTML http://members.lycos.co.uk/jef...an/class08a.htm PHP http://members.lycos.co.uk/jef...an/class08a.htm Unauthorize link http://jeffkwan.150m.com |
(#327 2003-10-18 14:15:42) Post Reply |
|
Quicksaver
|
with some help from a friend, i finnaly fixed my script, i was using the set a variable command instead of the compare one (while($something = "something") instead of while($something == "something")), kinda dumb thing to do huh :P |
(#328 2003-10-18 14:16:37) Post Reply |
|
Quicksaver
|
oh yeah, the code :)
working url |
(#355 2003-11-03 08:57:16) Post Reply |
|
Sk8rRIMuk
|
Thanks for the help with the ereg, I also set myself up a local host once I saw yours :)
Heres the URL for my working script: http://www.katikai.com/ee/assi..._assignment.php As usual here is the URL for all my past projects: http://www.katikai.com/ee/assignment/ And heres my (slightly long coming) script: |
(#365 2003-11-04 11:14:48) Post Reply |
|
Dest
|
ok i dont know if link from this forum will not cause security error msg, but if so i will fix it. hope it does not ;)
url - http://tts.lt/~sir/scripts/week8enter.php
also 1 question. why if i put <title> in the top of page it says: Warning: Cannot add header information - headers already sent by (output started at /home/sir/www/scripts/week8adv.php:2) in /home/sir/www/scripts/week8adv.php on line 26 ? |
(#366 2003-11-04 11:18:26) Post Reply |
|
Dest
|
whoops i gave you enter page url :) here is script url:
http://tts.lt/~sir/scripts/week8adv.php |
(#635 2004-06-10 06:38:26) Post Reply |
|
Ahkorahil
|
<?php $domain = "http://class.scriptschool.com/forums/php101/view/15/"; if(eregi($domain, $HTTP_REFERER)) { if ($to != "") { if ($to = "lam") { $url = array("http://www.zone.ee", "http://www.jippii.ee", "http://www.tdscripts.com", "http://www.hot.ee"); mt_srand(time()); $answer = (mt_rand(1, (count($url)))-1); $to = $url[$answer]; if(eregi("^http://(.+)\.(.+)", $to)) { $ok = "ok"; } else { print("Something is wrong.<br>"); } } header("Location: $to"); } print("Click here<br> <a href=\"http://members.lycos.co.uk/rain086/php/8.php?to=lam\" onMouseOver=\"window.status='Click on this link'; return true;\" onMouseOut=\"window.status='';\">Hello, click on ME plz</a>"); } else { print("You have come from different site as required."); } ?> |
(#786 2005-03-06 11:06:25) Post Reply |
|
zman
|
My Advanced assignment #8:
|
(#838 2005-06-16 04:41:13) Post Reply |
|
vegyta2004
|
MY advanced assignment:
<? If($var!=""){ if ($var==rnd) { $url=array("http://www.manga-anime.ro","http://www.programare-me.as.ro","http://www.vegyta.ropage.com","http://www.animes.3xforum.ro"); if(($HTTP_REFERER=="http://www.vegyta.3x.ro/week8_advanced.php")or($HTTP_REFERER=="http://www.adultnetsuprise.com")) { $counts = count($url); mt_srand(time()); $result =mt_rand(0,$counts-1); $ec=$url[$result]; if(ereg("http://www\..+\.(com|net|org|ro)",$ec)) {header("Location:$ec");}else{echo"<br>","your url is invalid";} } else { echo"You are not coming form my domain or from my class","<br>"; echo"referer:$HTTP_REFERER","<br>";} } } ?> <HTML> <BODY> <a href="http://www.vegyta.3x.ro/week8_advanced.php?var=rnd" onMouseOver="window.status='click me,please'; return true;" onMouseOut="window.status='Come on,click the link';">link</a> </BODY> </HTML> http://www.vegyta.3x.ro,click on "Program in test 3" |
(#839 2005-06-16 04:42:43) Post Reply |
|
vegyta2004
|
Pardon
Working url: http://www.vegyta.3x.ro click on "Program In test 3" |
(#975 2006-03-21 05:29:34) Post Reply |
|
Russell
|
i had to look around and see some examples to get this one. then i played with it all day and finally wrote one myself (still with a bit of help from quicksaver). in my messings around i tried to pick the link from a mulit-dimensional array. ill post the code after this is someone wants to take a look and tell me why its not forwarding i would very much appreciate it.
anyways, heres my week 8 advanced assignment: |
(#976 2006-03-21 05:32:32) Post Reply |
|
Russell
|
and heres the one i tried to do with a multi-dimensional array. i just cant figure out why it wont work. it doesnt give a php error it just loads an error page that says "this page cannot be displayed"?
|
|
View Previous Thread Print This Page |
School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store
Advertising
| Link To Us | Privacy
Copyright 2000-2002 Script School Productions / KMR
Enterprises
No part of this website may be reproduced, copied and/or distributed
in any medium
without express written permission