School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store | FORUMS
Class / Forums / php101 ![]() |
Week #8 Basic To-Do Assignment, post here |
(#14 2003-08-07 16:49:17) Post Reply |
|
TDavid
|
Week #8 Basic 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.
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!
|
(#82 2003-08-22 15:48:49) Post Reply |
|
Sk8rRIMuk
|
The working URL to my script is:
http://www.katikai.com/ee/assi...0Assignment.php As always all my scripts can be found at: http://www.katikai.com/ee/assignment/ Heres my code: |
(#186 2003-09-11 05:14:09) Post Reply |
|
Quicksaver
|
me again :)
tsc tsc tsc... TDavid TDavid... i would never imagine... :D |
(#187 2003-09-11 05:16:25) Post Reply |
|
Quicksaver
|
ah cmon why cant i add text between codes??? you really gotta correct that, gonna split tat then
my code:
working url |
(#188 2003-09-11 05:18:08) Post Reply |
|
Quicksaver
|
then i said i found this error under "Simple JavaScript Mouseover with PHP" on the course:
you put that example in and that example is bugged, you got 2 seconds to find the bug for yourself untill you read the next post :) |
(#189 2003-09-11 05:19:44) Post Reply |
|
Quicksaver
|
the bug is that arrays start at 0 and the count() funtion starts counting at 1 so you gotta put the -1 after it like so:
then i said "tsc tsc tsc blahblahblah", that part is stilll visible on the first post |
(#242 2003-09-18 05:25:03) Post Reply |
|
Shrek
|
My Week #8 Assignment
http://members.lycos.co.uk/jef...wan/class08.php |
(#445 2003-12-31 16:02:05) Post Reply |
|
PureGrain
|
Here is week 8 :)
http://members.lycos.co.uk/xko...on8/lesson8.php |
(#446 2003-12-31 16:45:20) Post Reply |
|
TDavid
|
Bug here on this line PureGrain:
[CODE] $result = count(0,$count); [/CODE] mt_rand() I think is what you are looking for as the function here. |
(#448 2003-12-31 18:34:22) Post Reply |
|
PureGrain
|
Thanks TDavid. I got ahead of myself. I actually had the code right the first time, then i saved over the file by accident and re-wrote it too fast i guess. :D
BTW, I was wondering why the url kept popping up MSN everytime. :) here is the fixed code and url.
Thanks again TD http://members.lycos.co.uk/xko...on8/lesson8.php |
(#474 2004-01-16 05:28:04) Post Reply |
|
fpu112
|
hey SK8
there is an error there (well at least there was for me, when i tried it the same away at first. on this line $count=count($urls); i made mine $count=(count($urls)-1) becasue my rand link would always throw in my directory wich i had all my php files in, and i didnt want that, just thought i would point that out...nerd, and get better grades :P |
(#629 2004-06-09 09:26:21) Post Reply |
|
Ahkorahil
|
<?php
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]; } header("Location: $to"); } ?> 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> |
(#736 2004-11-12 15:02:49) Post Reply |
|
lestat
|
Working URL - http://www.timslan.com/scripts...k8/wk8basic.php
Suggestions? Coments? <? /* 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 */ // Process code to redirect if($in != ""){ // Assigning urls to variable to link if ($in == "rnd"){ $randomurls = array("http://www.google.com/", "http://www.scriptschool.com/", "http://www.xerorip.com/", "http://www.tigerdirect.com/"); mt_srand(time()); // Setting Random Seed $count = count($randomurls); // Count the urls $number = mt_rand(0,$count); // Getting the random number $in = $randomurls[$number]; // Picking URL from the random number } header("Location: $in"); // If no redirect variable is set (1st page open) } ?> <html> <head> <title>Week #8 BASIC ~ Lestat</title> <link rel="stylesheet" type="text/css" href="/css/scriptskewl.css"> </head> <body> Click <a href="http://timslan.com/scriptskewl/week8/wk8basic.php?in=rnd" onMouseOver="window.status='link'; return true;" onMouseOut="window.status='';">here</a> for a random page Link </body> </html> |
(#737 2004-11-12 15:06:32) Post Reply |
|
lestat
|
Forgot to add the code tags ... sorry :) |
(#785 2005-03-06 11:04:22) Post Reply |
|
zman
|
My basic assignment #8:
|
(#836 2005-06-15 07:37:29) Post Reply |
|
vegyta2004
|
MY assignment(i don't know what's happening,it gives me the error"expected ';'" )
<script language="javascript" <a href="http://www.vegyta.3x.ro\dropdown.php?in=http://www.manga-anime.ro onMouseOver="window.status='Yes, you really do need to click this'; return true;" onMouseOut="window.status='';">You really need to click here</a> </script> <? if($in != "") { if ($in == "rnd") { $url=array("htttp://www.vegyta.3x.ro","http://www.manga-anime.ro","http://www.programare-me.as.ro","http://www.vegyta.ropage.com","http://www.animes.3xforum.ro"); mt_srand(time()); $count = count($urls); $result = rand(0,$count); $in = $urls[$result]; } header("Location: $in"); } Help Please!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
(#837 2005-06-15 15:09:44) Post Reply |
|
vegyta2004
|
hello,is me again,i've solved my understanding problem.
My basic assignment: <? $url=array("http://www.manga-anime.ro","http://www.programare-me.as.ro","http://www.vegyta.ropage.com","http://www.animes.3xforum.ro"); $counts = count($url); mt_srand(time()); $result =mt_rand(0,$counts-1); $var=$url[$result]; print("<a href=\"$var\" onMouseOver=\"window.status='click it now,go go';return true;\" onMouseOut=\"window.status='';\">link</a>"); ?> |
(#918 2005-12-31 14:23:44) Post Reply |
|
Dylan
|
Okay, got it, with the exception that the javascript code doesn't seem to work (on mine or anyone else's). I don't know if it's my browsers or a change in some standard... but since I'm focused on PHP at the moment, I'm ignoring it. I had to add this code to the beginning:
|
(#974 2006-03-21 00:34:49) Post Reply |
|
Russell
|
i actually had some trouble with this one. i finally figured out that i really didnt understand what exactly i was trying to do :P i think i got it figured out...
|
|
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