School Map:  Home / Enroll $ Student Records; Class  
$ News @ LIVE Tech Radio * Support/FAQ | Store | FORUMS

Class / Forums / php101 Refresh the current page Week #3 Basic To-Do Assignment: Post here!
 

 (#4 2003-08-07 15:59:16) Post Reply
Page 0 1 2

TDavid
php mySQL Perl C/C++
Principal


Enrolled: Mar 2000
Posts: 193
AP: 1

Week #3 Basic TO-DO ASSIGNMENT: Write a script to print to the browser a different url every day of the month using an array and no conditional statement (no switch/case or if/else).

Post this assignment here so that we can offer comment/critique for you.

 

 (#56 2003-08-17 18:09:49) Post Reply
Page 0 1 2

Sk8rRIMuk
Need To Set


Enrolled: Aug 2003
Posts: 39
AP: 1


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Sk8rRIMuk's Picture-A-Day Script</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>
<body>
<?php
//Set the URL's into an array
$url=array(
'<a href="http://www.n00bstories.com" target="_blank">http://www.n00bstories.com</a>',
'<a href="http://www.renmaps.com" target="_blank">http://www.renmaps.com</a>',
'<a href="http://www.google.com" target="_blank">http://www.google.com</a>',
'<a href="http://www.google.co.uk" target="_blank">http://www.google.co.uk</a>',
'<a href="http://www.westwood.com" target="_blank">http://www.westwood.com</a>',
'<a href="http://www.renforums.com" target="_blank">http://www.renforums.com</a>',
'<a href="http://www.laeubi.de" target="_blank">http://www.laeubi.de</a>',
'<a href="http://www.katikai.com" target="_blank">http://www.katikai.com</a>',
'<a href="http://www.geocities.com" target="_blank">http://www.geocities.com</a>',
'<a href="http://www.teamspeak.org" target="_blank">http://www.teamspeak.org</a>',
'<a href="http://www.php.net" target="_blank">http://www.php.net</a>',
'<a href="http://www.runescape.com" target="_blank">http://www.runescape.com</a>',
'<a href="http://www.microsoft.com" target="_blank">http://www.microsoft.com</a>',
'<a href="http://www.lycos.com" target="_blank">http://www.lycos.com</a>',
'<a href="http://www.altavista.com" target="_blank">http://www.altavista.com</a>',
'<a href="http://www.ebay.com" target="_blank">http://www.ebay.com</a>',
'<a href="http://www.ebay.co.uk" target="_blank">http://www.ebay.co.uk</a>',
'<a href="http://www.totalrock.com" target="_blank">http://www.totalrock.com</a>',
'<a href="http://www.winamp.com" target="_blank">http://www.winamp.com</a>',
'<a href="http://www.msn.com" target="_blank">http://www.msn.com</a>',
'<a href="http://www.reallifecomics.com" target="_blank">http://www.reallifecomics.com</a>',
'<a href="http://www.animeacademy.com" target="_blank">http://www.animeacademy.com</a>',
'<a href="http://www.mirc.com" target="_blank">http://www.mirc.com</a>',
'<a href="http://www.icq.com" target="_blank">http://www.icq.com</a>',
'<a href="http://www.hotmail.com" target="_blank">http://www.hotmail.com</a>',
'<a href="http://www.mtv.com" target="_blank">http://www.mtv.com</a>',
'<a href="http://www.pcworld.co.uk" target="_blank">http://www.pcworld.co.uk</a>',
'<a href="http://www.pcworld.com" target="_blank">http://www.pcworld.com</a>',
'<a href="http://codewalkers.com" target="_blank">http://codewalkers.com</a>',
'<a href="http://www.aol.com" target="_blank">http://www.aol.com</a>',
'<a href="http://www.blueyonder.co.uk" target="_blank">http://www.blueyonder.co.uk</a>',
);
//Set the day of the month and subtract 1 to account for servers month starting at 00
$day_of_month=(date("j")-1);
//Print the centered URL
print("<center>Today'sURLis:$url[$day_of_month]</center>");
?>
</body>
</html>



I think you shoud get phpbb2 or something for the forums, anyways I am not sure about the advanced assignmentcould you help me with that :S.

 

 (#64 2003-08-19 08:22:56) Post Reply
Page 0 1 2

Donnie
Need To Set


Enrolled: Aug 2003
Posts: 41
AP: 1

Finished the Basic Assignment 3.



<HTML>
<HEAD>
<TITLE>SCRIPTSCHOOL BASIC ASSIGNMENT 3</TITLE>
</HEAD>
<BODY>
<?php
//Set up array with 31 URLs.
$urls=array('http://www.dandrenterprises.com','http://www.eoepa.org','http://www.ebay.com','http://www.php-scripts.com','http://www.tdscripts.com','http://www.yahoo.com','http://www.dogpile.com','http://www.hotsheet.com','http://www.rock103.com','http://www.delta.com','www.kait8.com','http://www.jonesborosun.com','http://www.moveon.org','http://www.cadkey.com','http://www.maclean-fogg.com','http://www.almanet.org','http://www.abc.com','http://www.disneychannel.com','http://www.cnn.com','http://www.hotbot.com','http://www.webcrawler.com','http://www.mlb.com','http://www.stlcardinals.com','http://www.budget.com','http://www.monsterjobs.com','http://www.candystand.com','http://www.jokeaday.com','http://www.gamesville.com','http://www.coffeebreak.com','http://www.espn.com','http://www.cnnsi.com');
//Determine the day of the month.
$day=(date("j")-1);
//Print the link.
print("<A HREF = "$urls[$day]">$urls[$day]</A>");
?>
</BODY>
</HTML>



 

 (#145 2003-09-01 19:14:07) Post Reply
Page 0 1 2

galacey
Need To Set


Enrolled: Aug 2003
Posts: 7
AP: 1



<?php

//assign 31 URLs to an array
$url=array('www.yahoo.com','www.google.com','www.money-maker.co.uk',
'www.helping-you-make-money.com/html',
'www.helping-you-make-money.com/newsletter.html',
'www.helping-you-make-money.com/template1',
'www.helping-you-make-money.com/template2','www.microsoft.com',
'www.hotmail.com','www.mail.com','www.altavista.com',
'www.bananalotto.co.uk','www.dmoz.org','www.fastfreeway.com',
'www.bannersgomlm.com','www.madasafish.com','www.grc.com',
'www.webbizinsider.com','www.hits-central.com','www.money-maker.zzn.com',
'www.referraltraffic.com','www.126hits.com','www.autohits.info',
'www.subscriptionrocket.com','www.subscriberdrive.com',
'www.hitpulse.com','www.viralvisitors.com','www.rapidreply.net',
'www.web-meld.com','autohits.dk','www.1-search-engines.co.uk');

//get day of the month (minus one because arrays start at zero)
$day_of_month=(date("j")-1);

//print featured site to browser
print("Today's featured site is:
<A HREF=
\"http://$url[$day_of_month]\">$url[$day_of_month]");

?>



 

 (#146 2003-09-01 19:21:06) Post Reply
Page 0 1 2

galacey
Need To Set


Enrolled: Aug 2003
Posts: 7
AP: 1

Sorry to repost, left off the closing /A tag at the end but it still worked.



<?php

//assign 31 URLs to an array
$url=array('www.yahoo.com','www.google.com','www.money-maker.co.uk',
'www.helping-you-make-money.com/html',
'www.helping-you-make-money.com/newsletter.html',
'www.helping-you-make-money.com/template1',
'www.helping-you-make-money.com/template2','www.microsoft.com',
'www.hotmail.com','www.mail.com','www.altavista.com',
'www.bananalotto.co.uk','www.dmoz.org','www.fastfreeway.com',
'www.bannersgomlm.com','www.madasafish.com','www.grc.com',
'www.webbizinsider.com','www.hits-central.com','www.money-maker.zzn.com',
'www.referraltraffic.com','www.126hits.com','www.autohits.info',
'www.subscriptionrocket.com','www.subscriberdrive.com',
'www.hitpulse.com','www.viralvisitors.com','www.rapidreply.net',
'www.web-meld.com','autohits.dk','www.1-search-engines.co.uk');

//get day of the month (minus one because arrays start at zero)
$day_of_month=(date("j")-1);

//print featured site to browser
print("Today's featured site is:
<A HREF=
\"http://$url[$day_of_month]\">$url[$day_of_month]</A>");

?>



 

 (#169 2003-09-09 09:21:09) Post Reply
Page 0 1 2

Quicksaver
Need To Set


Enrolled: Sep 2003
Posts: 90
AP: 1

it has a couple of extras, i was kinda bored :P



<?
$uday
= date("j")-1;
$urls =

array(
"www.site1.com","www.site2.com","www.site3.com","www.site4.com","www.site5.com","www.site6.com","www.site7.com","www.site8.com","www.site9.com","www.s

ite10.com"
,"www.site11.com","www.site12.com","www.site13.com","www.site14.com","www.site15.com","www.site16.com","www.site17.com","www.site18.com","www.site

19.com"
,"www.site20.com","www.site21.com","www.site22.com","www.site23.com","www.site24.com","www.site25.com","www.site26.com","www.site27.com","www.site28

.com"
,"www.site29.com","www.site30.com","www.site31.com");
$today = date("j");
$month = date("F");
$suffix = date("S");

print(
"Today is $month $today with the <a href=\"http://$urls[$uday]/\">$today$suffix url of the month</a>.");
?>




working url

 

 (#194 2003-09-11 11:26:20) Post Reply
Page 0 1 2

TDavid
php mySQL Perl C/C++
Principal


Enrolled: Mar 2000
Posts: 193
AP: 1

galacey - don't be sorry about reposting ;) Correcting your own bugs -- or helping other students -- is encouraged ;)

 

 (#195 2003-09-13 00:22:32) Post Reply
Page 0 1 2

Nazz
Need To Set


Enrolled: Aug 2003
Posts: 8
AP: 1



<? //assign urls
$url=array('www.packers.com/',
'www.denverbroncos.com/',
'www.dallascowboys.com/',
'www.raiders.com/',
'www.free-webhosts.com/reviews/Araspus.php',
'www.free-webhosts.com/reviews/WebCities.php',
'www.free-webhosts.com/reviews/WebCities.php',
'www.free-webhosts.com/reviews/0v.ca.php',
'www.google.com/',
'www.dogpile.com/',
'www.yahoo.com/',
'www.altavista.com/',
'www.mpogd.com/games/game.asp?ID=370',
'www.mpogd.com/games/game.asp?ID=809',
'www.mpogd.com/games/game.asp?ID=1377',
'www.mpogd.com/games/game.asp?ID=233',
'www.mail.yahoo.com/',
'www.email.indiatimes.com/',
'www.myownemail.com/moe4/login/default.cfm',
'www.email.com/',
'www.hondamotorcycle.com/index.asp?bhcp=1',
'www.yamaha-motor.com/',
'www.harley-davidson.com/selector.asp',
'www.harley-davidson.com/selector.asp',
'www.recipesource.com/',
'www-2.cs.cmu.edu/~mjw/recipes/',
'www.ivillage.com/food/recipefinder',
'www.gumbopages.com/recipe-page.html');
//assign date
$day_of_month=(date("j")-1);

//print featured site to browser
print("Our featured site of the day:
<a href=
\"http://$url[$day_of_month]\">$url[$day_of_month]</a>");
?>



 

 (#196 2003-09-13 16:38:08) Post Reply
Page 0 1 2

operations
Need To Set


Enrolled: Sep 2003
Posts: 8
AP: 1

http://members.lycos.co.uk/operations/



<?php

/* TO-DO ASSIGNMENT: Write a script to print to the
* browser a different url each day of the MONTH using
* an array and using no conditional statement.
*
* The arrays
*/



$url = array("<a href=\"http://adslguide.org.uk\">ADSLGuide</a>",
"<a href=\"http://mozilla.org/\">Mozilla.org</a>",
"<a href=\"http://www.php.net/\">PHP</a>",
"<a href=\"http://mozilla.org/products/firebird/\">Mozilla Firebird</a>",
"<a href=\"http://www.fairadsl.co.uk\">Fairbroadband</a>",
"<a href=\"http://mozilla.org/projects/thunderbird/\">Mozilla Thunderbird</a>",
"<a href=\"http://www.google.com\">Google</a>",
"<a href=\"http://www.neowin.net\">Neowin</a>",
"<a href=\"http://www.devshed.com/\">Devshed</a>",
"<a href=\"http://www.tomshardware.com/\">Tomshardware</a>",
"<a href=\"http://www.alltheweb.com/\">Alltheweb</a>",
"<a href=\"http://altavista.com/\">Altavista</a>",
"<a href=\"http://www.ask.co.uk/\">Ask Jeeves</a>",
"<a href=\"http://www.hotbot.com/\">Hotbot</a>",
"<a href=\"http://www.lycos.co.uk/\">Lycos/a>",
"<a href=\"http://home.myway.com/\">Myway</a>",
"<a href=\"http://www.search.com/\">Search</a>",
"<a href=\"http://www.teoma.com/\">Teoma</a>",
"<a href=\"http://turbo10.com/\">Turbo10</a>",
"<a href=\"http://www.webcrawler.com/\">Webcrawler</a>",
"<a href=\"http://www.wisenut.com/\">Wisenut</a>",
"<a href=\"http://www.yahoo.com/\">Yahoo</a>",
"<a href=\"http://science.ksc.nasa.gov/shuttle/countdown/video/\">NASA - KSC Video Feeds</a>",
"<a href=\"http://www.spacedaily.com/\">Spacedaily</a>",
"<a href=\"http://americasarmy.com/\">AmericasArmy</a>",
"<a href=\"http://www.myrealbox.com/\">MyRealbox</a>",
"<a href=\"http://www.samurize.com/news.php\">Samurize</a>",
"<a href=\"http://download.com.com/\">Download.com</a>",
"<a href=\"http://www.themexp.org/\">Themexp</a>",
"<a href=\"http://www.mod-x.co.uk/main.php\">Mod-X</a>",
"<a href=\"http://www.spywareinfo.com/\">Spywareinfo</a>");

//What you see goes here
?>

<title>Script School Assignment 3 Basic</title>
<center>

<?php
$day_of_month
= (date("j")-1);

Print(
$url[$day_of_month]);
?>



 

 (#206 2003-09-15 08:38:45) Post Reply
Page 0 1 2

Shrek
Need To Set


Enrolled: Aug 2003
Posts: 33
AP: 1

Hello, Every One, Here is my Assignment Today...



<Title>Assignment 03 Script School - URL of the Month</title>

<?

$chooseday
=array('www.cnn.com','www.abc.com','www.yahoo.com','www.google.com','www.hongkong.com','www.geocities.com',
'class.scriptschool.com','group.yahoo.com','finance.yahoo.com','www.881903.com','www.rthk.org.hk','www.hkd2.com',
'www.info.gov.hk','www.hangsengbank.com','www.microsoft.com','www.windows.com','www.tvb.com','d2hkt.idle.org.hk',
'www.tom.com','iyellowbus.com','www.net-yan.com','www.pccw.com','www.ppshk.com','games.cnool.net/diabo2/diaboindex.htm',
'www.geocities.com/dinosaur130/main.htm');
$day_of_month=date("j");
?>

<p><strong><small><font face="Arial">Output to HTML</font></small></strong></p>

<p><small><font face="Arial">Try to mix it html with php.<br>
Today Day of the month is <? print($day_of_month); ?><br>

Today URL link is <? print($chooseday[$day_of_month]) ?>. Click <a href=http://<? print($chooseday[$day_of_month]) ?>>Here</a> to Go <p>

</font></small></p>


 

 (#207 2003-09-15 08:47:49) Post Reply
Page 0 1 2

Shrek
Need To Set


Enrolled: Aug 2003
Posts: 33
AP: 1

I think i need to amend some code

The code to print the URL should be


<? print($chooseday[$day_of_month-1]) ?>



.

Thx a lot.

 

 (#251 2003-09-19 12:03:17) Post Reply
Page 0 1 2

amiller
Need To Set


Enrolled: Sep 2003
Posts: 2
AP: 1



<?
$url
=array('http://google.com','http://miller.nl.tt','http://google.com',
'http://google.com','http://google.com','http://google.com','http://google.com',
'http://google.com','http://google.com','http://google.com','http://google.com',
'http://google.com','http://google.com','http://google.com','http://google.com',
'http://google.com','http://google.com','http://google.com','http://google.com',
'http://google.com','http://google.com','http://google.com','http://google.com',
'http://google.com','http://google.com','http://google.com','http://google.com',
'http://google.com','http://google.com','http://google.com','http://google.com',);
$date=(date("j")-1);
Print(
"todays url is :
<hr>
$url
[$date]");
?>



 

 (#255 2003-09-19 23:07:08) Post Reply
Page 0 1 2

merlin69
Need To Set


Enrolled: Sep 2003
Posts: 4
AP: 1


<html>
<head>
<title>Week 3 assignment </title>
</head>
<body>
<?php
// Assignment is to creat a script that shows
// a different link every day of the month
// start by setting values in the array (links)
$date = (date("j")-1);
$links = array("<a href=\"http://www.knick-nacks.com\">knick-nacks</a>",
"<a href=\"http://www.realm-of-merlin.com\">realm-of-merlin</a>",
"<a href=\"http://www.ebay.com\">ebay</a>",
"<a href=\"http://www.yahoo.com\">yahoo</a>",
"<a href=\"http://www.google.com\">google</a>",
"<a href=\"http://www.nascar.com\">nascar</a>",
"<a href=\"http://www.aol.com\">aol</a>",
"<a href=\"http://www.pogo.com\">pogo</a>",
"<a href=\"http://www.espn.com\">espn</a>",
"<a href=\"http://www.hotmail.com\">hotmail</a>",
"<a href=\"http://www.monster.com\">monster</a>",
"<a href=\"http://www.starwars.com\">starwars</a>",
"<a href=\"http://www.cnn.com\">cnn</a>",
"<a href=\"http://www.msn.com\">msn</a>",
"<a href=\"http://www.askjeeves.com\">Ask Jeeves</a>",
"<a href=\"http://mail.yahoo.com\">Yahoo Mail</a>",
"<a href=\"http://mail.aol.com\">Aol Mail</a>",
"<a href=\"http://www.scriptstore.com\">script store</a>",
"<a href=\"http://www.php.com\">php</a>",
"<a href=\"http://www.hot.rr.com\">H.O.T Road Runner</a>",
"<a href=\"http://www.nfl.com\">NFL</a>",
"<a href=\"http://www.knick-nacks.com/view_product.php?product=32420\">Look at me</a>",
"<a href=\"http://www.cubecart.com\">Cube Cart</a>",
"<a href=\"http://www.mysql.com\">mysql</a>",
"<a href=\"http://www.123webmaster.com\">123webmaster</a>",
"<a href=\"http://www.alabama.com\">Alabama</a>",
"<a href=\"http://www.garthbrooks.com\">Garth Brooks</a>",
"<a href=\"http://www.coopertool.com\">Cooper Tools</a>",
"<a href=\"http://www.magnavox.com\">Magnavox</a>",
"<a href=\"http://www.dell.com\">Dell</a>",
"<a href=\"http://www.gateway.com\">Gateway</a>");
//End of variables
// Start the call to function
echo("Hello, the current date is: ".date("D F d, Y"));
echo(
"<br> the current time is: ".date("h:i:s A"));
echo(
"<br>we would like you to visit&nbsp;");
echo(
$links[$date]);
// end of script
?>
</body>
</html>


I added a date and time function just so I can keep up with earlier lessons and NOT forget how to do them.
you can see a working version at http://www.realm-of-merlin.com...chool/week3.php


 

 (#275 2003-09-26 05:25:02) Post Reply
Page 0 1 2

maddy
Need To Set


Enrolled: Sep 2003
Posts: 14
AP: 1


<?
//what is today's date?
$date = date("l j M Y");

//one link per day for the entire month, 31 in all
$link = array("<a href=\"http://link.com/1.html\">link 1</a>", "<a href=\"http://link.com/2.html\">link 2</a>", "<a href=\"http://link.com/3.html\">link 3</a>", "<a href=\"http://link.com/4.html\">link 4</a>", "<a href=\"http://link.com/5.html\">link 5</a>", "<a href=\"http://link.com/6.html\">link 6</a>", "<a href=\"http://link.com/7.html\">link 7</a>", "<a href=\"http://link.com/8.html\">link 8</a>", "<a href=\"http://link.com/9.html\">link 9</a>", "<a href=\"http://link.com/10.html\">link 10</a>", "<a href=\"http://link.com/11.html\">link 11</a>", "<a href=\"http://link.com/12.html\">link 12</a>", "<a href=\"http://link.com/13.html\">link 13</a>", "<a href=\"http://link.com/14.html\">link 14</a>", "<a href=\"http://link.com/15.html\">link 15</a>", "<a href=\"http://link.com/16.html\">link 16</a>", "<a href=\"http://link.com/17.html\">link 17</a>", "<a href=\"http://link.com/18.html\">link 18</a>", "<a href=\"http://link.com/19.html\">link 19</a>", "<a href=\"http://link.com/20.html\">link 20</a>", "<a href=\"http://link.com/21.html\">link 21</a>", "<a href=\"http://link.com/22.html\">link 22</a>", "<a href=\"http://link.com/23.html\">link 23</a>", "<a href=\"http://link.com/24.html\">link 24</a>", "<a href=\"http://link.com/25.html\">link 25</a>", "<a href=\"http://link.com/26.html\">link 26</a>", "<a href=\"http://link.com/27.html\">link 27</a>", "<a href=\"http://link.com/28.html\">link 28</a>", "<a href=\"http://link.com/29.html\">link 29</a>", "<a href=\"http://link.com/30.html\">link 30</a>", "<a href=\"http://link.com/31.html\">link 31</a>", );

//what is today numerically as day of month, need to subtract one, because while array number starts at 0,
//day of month starts at 1

$day_of_month = (date("j") - 1);

//print out link for the day. use the day of month string to get the right img from the array
print("Today is $date and the site of the day is $link[$day_of_month]");
?>



 

 (#315 2003-10-12 15:30:06) Post Reply
Page 0 1 2

zxrod
Need To Set


Enrolled: Oct 2003
Posts: 7
AP: 1

I think I've got this one down. Tell me if otherwise..
<html>
<title>Week 3 Basic To-Do Assignment</title>
<body>


<?php
// This script is to print a different url every day of the month
// Define my urls in an array
$url = array('http://www.zxrod.com',
'http://www.google.com',
'http://www.hotmail.com',
'http://www.stonersfromspace.com',
'http://www.toolarmy.com',
'http://toolshed.down.net',
'http://maddox.xmission.com',
'http://www.aim.com',
'http://www.kazaa.com',
'http://www.albinoblacksheep.com',
'http://www.askjeeves.com',
'http://www.scriptschool.com',
'http://www.deftones.com',
'http://www.nin.com',
'http://www.mindlessselfindulgence.com',
'http://www.bored.com',
'http://www.monster.com',
'http://www.hotjobs.com',
'http://www.expedia.com',
'http://www.mapquest.com',
'http://www.webmonkey.com',
'http://www.mountaindew.com',
'http://www.gateway.com',
'http://www.dell.com',
'http://www.hightimes.com',
'http://www.zxrod.com/phpclass/week3basic.php',
'http://www.aperfectcircle.com',
'http://www.primus.com',
'http://www.ticketmaster.com',
'http://www.logitech.com',
'http://www.pizzahut.com');
$dayofmonth = (date("j")-1);
$date = date("n/j/y");
$link = '<a href =$url[$dayofmonth]>';
$linktxt = $url[$dayofmonth];
print(
"The link for : " .$date. " is " .$link .$linktxt ."</a>");
?>



</body>

 

 (#331 2003-10-24 21:51:39) Post Reply
Page 0 1 2

willie565
Need To Set


Enrolled: Oct 2003
Posts: 5
AP: 1

Code Works but I didn't Put A Url For Every Day all The weeks are the same
<a href="http://megatech.tk/~will/datem.php"> The Code</a>
and I do now realize there's a date function for the weeks ha oh well


<html>
<?php
$datem
=date("j");
$datew=date("w");
$tweek=0;
$dayweek1=array("A Great html Help Site <a href='http://www.draac.com'>Draac</a>",
"Great Search Engine <a href='http://www.google.com'>Google</a>",
"Great Comp Store <a href='http://www.megatech.tk'>MegaTech</a>",
"Great I dunno Blog Site <a href='http://www.kinkythoughts.org'>Kinkthoughts</a>(non-sexual)",
"Great Search Engine <a href='http://www.yahoo.com'>Yahoo</a>",
"Great Script tuts <a href='http://www.scriptschool.com'>Script School</a>");

$dayweek2=array("A Great html Help Site <a href='http://www.draac.com'>Draac</a>",
"Great Search Engine <a href='http://www.google.com'>Google</a>",
"Great Comp Store <a href='http://www.megatech.tk'>MegaTech</a>",
"Great I dunno Blog Site <a href='http://www.kinkythoughts.org'>Kinkthoughts</a>(non-sexual)",
"Great Search Engine <a href='http://www.yahoo.com'>Yahoo</a>",
"Great Script tuts <a href='http://www.scriptschool.com'>Script School</a>");

$dayweek3=array('A Great html Help Site <a href="http://www.draac.com">Draac</a>',
'Great Search Engine <a href="http://www.google.com">Google</a>',
'Great Comp Store <a href="http://www.megatech.tk">MegaTech</a>',
'Great I dunno Blog Site <a href="http://www.kinkythoughts.org">Kinkthoughts</a>(non-sexual)',
'Great Search Engine <a href="http://www.yahoo.com">Yahoo</a>',
'Great Script tuts <a href="http://www.scriptschool.com">Script School</a>');

$dayweek4=array('A Great html Help Site <a href="http://www.draac.com">Draac</a>',
'Great Search Engine <a href="http://www.google.com">Google</a>',
'Great Comp Store <a href="http://www.megatech.tk">MegaTech</a>',
'Great I dunno Blog Site <a href="http://www.kinkythoughts.org">Kinkthoughts</a>(non-sexual)',
'Great Search Engine <a href="http://www.yahoo.com">Yahoo</a>',
'Great Script tuts <a href="http://www.scriptschool.com">Script School</a>');

$dayweek5=array('A Great html Help Site <a href="http://www.draac.com">Draac</a>',
'Great Search Engine <a href="http://www.google.com">Google</a>',
'Great Comp Store <a href="http://www.megatech.tk">MegaTech</a>',
'Great I dunno Blog Site <a href="http://www.kinkythoughts.org">Kinkthoughts</a>(non-sexual)');

if(
$datem >= 7){
$tweek=0;
}
if((
$datem > 7)&&($datem <= 14)){
$tweek=1;
}
if((
$datem > 14)&&($datem <= 21)){
$tweek=2;
}
if((
$datem > 21)&&($datem <= 28)){
$tweek=3;
}
if((
$datem > 28)&&($datem <= 31)){
$tweek=4;
}
$daymonth=array($dayweek1,$dayweek2,$dayweek3,$dayweek4,$dayweek5);
echo(
"<u>OMFG New Url Every Day Of The Fricking Month</u><br>");
echo(
$daymonth[$tweek][$datew]);
?>
</html>


 

 (#337 2003-10-27 16:41:18) Post Reply
Page 0 1 2

Tala
Need To Set


Enrolled: Oct 2003
Posts: 3
AP: 1

It's not working. WTF am I doing wrong?


<?
//set up the array first
$url=array('http://www.freakmanor.com','http://www.free-porn-spot.com','http://www.msnarcissa.com','http://www.chainleather.com','http://www.php.net','http://www.infidelguy.com','http://www.blowmeuptom.com', 'http://www.rotten.com', 'http://www.google.com', 'http://www.typeonegative.net', 'http://www.queensryche.com', 'http://www.big-tits.com', 'http://www.kinkinc.net', 'http://www.sex.com', 'http://www.boysrus.com', 'http://www.gofuckyourself.com', 'http://www.hardcoredesigns.net', 'http://www.whoopsie.com', 'http://www.nurple.com', 'http://www.leathercellar.com', 'http://www.bmezine.com', 'http://www.yahoo.com', 'http://www.silkandsteel.com', 'http://www.porncity.net', 'http://www.gor.com', 'http://www.halloween.com', 'http://www.gfy.com', 'http://www.talawolf.com', 'http://www.naughtyfables.com', 'http://www.dogfarts.com', 'http://www.homestarrunner.com');
//What day is it?
$day_of_month = (date("j")-1);
//Output
print("< a href=\"$url[$day]$url[$day]</A>");
?>


 

 (#338 2003-10-27 17:56:51) Post Reply
Page 0 1 2

Quicksaver
Need To Set


Enrolled: Sep 2003
Posts: 90
AP: 1

you have this:

print("< a href=\"$url[$day]$url[$day]</A>");

where it should be like this:

print("<a href=\"$url[$day]\">$url[$day]</A>");

if forgot to close the "a href" part with the ">" and you added a space before the "a". It should work now :)

 

 (#380 2003-11-16 20:54:54) Post Reply
Page 0 1 2

coinweb
Need To Set


Enrolled: Nov 2003
Posts: 4
AP: 1

<html>
<head>
<TITLE>Homework For Week #2</TITLE>
</head>
<body bgcolor="blue">

<center><table width="75%" border="1" bgcolor="white">
<tr>
<td>

<?php

/*Write a script to print to the browser a different url every day of the month
using an array and no conditional statement (no switch/case or if/else).
*/

//group of urls to be cycled through daily

$url = array('http://www.coinwebstore.com/0','http://www.coinwebstore.com/1',
'http://www.coinwebstore.com/2','http://www.coinwebstore.com/3',
'http://www.coinwebstore.com/4','http://www.coinwebstore.com/5',
'http://www.coinwebstore.com/6','http://www.coinwebstore.com/7',
'http://www.coinwebstore.com/8','http://www.coinwebstore.com/9',
'http://www.coinwebstore.com/10','http://www.coinwebstore.com/11',
'http://www.coinwebstore.com/12','http://www.coinwebstore.com/13',
'http://www.coinwebstore.com/14','http://www.coinwebstore.com/15',
'http://www.coinwebstore.com/16','http://www.coinwebstore.com/17',
'http://www.coinwebstore.com/18','http://www.coinwebstore.com/19',
'http://www.coinwebstore.com/20','http://www.coinwebstore.com/21',
'http://www.coinwebstore.com/22','http://www.coinwebstore.com/23',
'http://www.coinwebstore.com/24','http://www.coinwebstore.com/25',
'http://www.coinwebstore.com/26','http://www.coinwebstore.com/27',
'http://www.coinwebstore.com/28','http://www.coinwebstore.com/29',
'http://www.coinwebstore.com/30');


//This prints the daily featured website to the browser.
$day_of_month = (date("j")-1);
print("Please visit today's featured website:
<a href=\"$url[$day_of_month]\">$url[$day_of_month]</a>");

?>

</td>
</tr>
</table></center>


</body>
</html>

 

 (#386 2003-11-17 13:37:49) Post Reply
Page 0 1 2

RamblnRick
Need To Set


Enrolled: Nov 2003
Posts: 6
AP: 1

Lots of hours were spent figuring this one out!

<html>
<head>
<title>Week Number 3 Advanced - Site Of The Day for the entire month</title>
<body>


<?
// Build multi-dimensional array with URL's for each day of the month
// using a different category for each day of the week

// Assign numeric values to index keys
$category=array(0=>'football',1=>'baseball',2=>'soccer',3=>'basketball',4=>'golf',5=>'rugby',6=>'sailing');

// Initialize Variables
$today=date("l");
$link=rand(01,03);

// Assign weblink values to Multi-Dimensional Array
$urls = array("football"=>array('http://www.clevelandbrowns.com',
'http://www.nfl.com',
'http://www.ncaafootball.net',
'http://www.profootballhof.com',
'http://www.arenafootball.com'
),
'baseball'=>array('http://www.baseballhalloffame.org',
'http://www.worldseries.com',
'http://www.baseball-reference.com',
'http://www.baseball-almanac.com',
'http://www.sportingnews.com/baseball'
),
'soccer'=>array('http://www.soccernet.com',
'http://www.us-soccer.com',
'http://www.soccer.com',
'http://www.socceramerica.com',
'http://www.soccertv.com'
),
'basketball'=>array('http://www.nba.com',
'http://www.basketball.com',
'http://www.usabasketball.com',
'http://www.hoophall.com',
'http://www.basketballnews.com'
),
'golf'=>array('http://www.golfweb.com',
'http://www.golfonline.com',
'http://www.pga.com',
'http://www.golfdigest.com',
'http://www.golfcourse.com'
),
'rugby'=>array('http://www.irfb.com',
'http://www.planet-rugby.com',
'http://www.rleague.com',
'http://lamar.colostate.edu/~greg/guide.htm',
'http://www.americanrugby.com'
),
'sailing'=>array('http://www.sailing.org',
'http://www.sailingsource.com',
'http://www.sailingworld.com',
'http://www.sailingnow.com',
'http://www.madforsailing.com'

),
);

// Assign variable to randomized link variable
$todayslink=($urls[$category[date(w)]][$link]);

// Print the link
print("The link for today $today is: "."<a href=\"$todayslink\">$todayslink</a>");


?>



</body>
</html>

Working Script at: http://www.ricksramblings.com/..._assignment.php

 

 (#388 2003-11-17 18:42:03) Post Reply
Page 0 1 2

RamblnRick
Need To Set


Enrolled: Nov 2003
Posts: 6
AP: 1

ooops! Sorry, that should have been posted in the advanced forum.

 

 (#401 2003-11-23 05:39:57) Post Reply
Page 0 1 2

Ahkorahil
Need To Set


Enrolled: Oct 2003
Posts: 20
AP: 1

<HTML>
<HEAD>
<TITLE> 3th Assignment </TITLE>
</HEAD>
<BODY>
<?php
$websites= array("www.google.com",
"www.neti.ee",
"www.hot.ee",
"www.php.com",
"www.nut.ee",
"www.zone.ee",
"www.zone.com",
"www.thelandofshadow.com",
"www.mail.ee",
"www.msn.com",
"www.hotmail.com",
"www.delfi.ee",
"www.delfi.ee",
"www.zone.ee/kincclan",
"www.zone.ru",
"www.2advanced.com",
"www.astalavista.com",
"www.yahoo.com",
"www.scriptschool",
"www.delfi.lv",
"www.reality.com",
"www.counter-strike.net",
"www.lammas.ee",
"www.flashkit.com",
"www.cia.com",
"www.civilizarion3.com",
"www.google.ee",
"www.nice1.com",
"www.address.com",
"www.helloworld.com",
"www.zoo.com");
$day = (date("j")-1);
printf("$websites[$day]");
?>
</BODY>
</HTML>
//Script works! =)

 

 (#415 2003-12-11 04:42:59) Post Reply
Page 0 1 2

fudded
Need To Set


Enrolled: Dec 2003
Posts: 5
AP: 1



<html>
<head>
<title>Lesson three</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<center>
<?php
// array for the websites
$daily_www_site = array("www.web0.com","www.web1.com","www.web2.com",
"www.web3.com","www.web4.com","www.web5.com",
"www.web6.com","www.web7.com","www.web8.com",
"www.web9.com","www.web10.com","www.web11.com",
"www.web12.com","www.web13.com","www.web14.com",
"www.web15.com","www.web16.com","www.web17.com",
"www.web18.com","www.web19.com","www.web20.com",
"www.web21.com","www.web22.com","www.web23.com",
"www.web24.com","www.web25.com","www.web26.com",
"www.web27.com","www.web28.com","www.web29.com",
"www.web30.com");
//numeric day of the month, remember to --
$day_of_month = (date("j")-1);
//a little date to make the page look nicer
$day = date("j");
$month =date("M");
$year =date("Y");

//output to browser
print("Today is $day-$month-$year: todays link is ---> <a href = $daily_www_site[$day_of_month]> $daily_www_site[$day_of_month] </a>");
?>
</center>

</body>
</html>


 

 (#431 2003-12-27 02:44:35) Post Reply
Page 0 1 2

n2o2k
Need To Set


Enrolled: Dec 2003
Posts: 6
AP: 1



<?
/****************************
* To do Assignement #3 *
* by n2o_2k *
* n2o_2k@hotmail.com *
*****************************/

?>
<html>
<HEAD>
<TITLE>SchoolScript.com Assignment 3 - URL of the Day</TITLE>
</HEAD>
<BODY>
<?
/*Basic
Write a script to print to the browser a different url every day of the month using an array and no conditional statement (no switch/case or if/else).*/


//store the favorite url in a array
$url_array = array( 'www.hotmail.com', 'www.automotiveforums.com', 'www.nba.com',
'www.yahoo.com','www.azlyrics.com','www.wnba.com',
'www.altavista.com','www.ohhla.com','www.naza.gov',
'www.google.com','www.launch.com','www.howstaffworks.com',
'www.justlinux.com','www.phpfreak.com','www.honda.com',
'www.microsoft.com', 'www.adobe.com','www.ask.com',
'www.crxsi.com', 'www.radioshack.com', 'www.walmart.com',
'www.foodsubs.com', 'www.cookinclub.com','www.foodstop.com',
'www.the12volt.com', 'www.artonline.com', 'www.weather.com',
'www.download.com', 'www.telecharger.com', 'www.phpedit.com'
);

//get the day of the week
$day_of_week= (date("j")-1);

print(
'<u><b>Basic part of the assignement</u></b><br>');
print(
'Url of the day: <a href="http://'.$url_array[$day_of_week].'" target=_blank>'.$url_array[$day_of_week].'</a>');


?>


<?
/*Advance
Write a script to print to the browser
a different url every day of the month
with a different category of url for each
day of the week using a multi-dimensional
array and no conditional statement.

*/

//create the multidimensionl array
$url_array= array('0'=>array('www.hotmail.com','mail.yahoo.com','www.caramail.com'),
'1'=>array('www.hotmail.com','mail.yahoo.com','www.caramail.com'),
'2'=>array('www.altavista.com','www.yahoo.com','www.google.com'),
'3'=>array('www.espn.com', 'www.nba.com', 'www.wnba.com'),
'4'=>array('www.honda.com','www.automotiveforums.com', 'www.hondaswap.com'),
'5'=>array('www.microsoft.com', 'www.adobe.com', 'www.pagemaker.com'),
'6'=>array('www.download.com', 'www.telecharger.com','www.foodsubs.com'),
'7'=>array('www.phpfreak.com', 'www.justlinux.com', 'www.cprogramming.com'),
'8'=>array('www.hotmail.com','mail.yahoo.com','www.caramail.com'),
'9'=>array('www.altavista.com','www.yahoo.com','www.google.com'),
'10'=>array('www.espn.com', 'www.nba.com', 'www.wnba.com'),
'11'=>array('www.honda.com','www.automotiveforums.com', 'www.hondaswap.com'),
'12'=>array('www.microsoft.com', 'www.adobe.com', 'www.pagemaker.com'),
'13'=>array('www.download.com', 'www.telecharger.com','www.foodsubs.com'),
'14'=>array('www.phpfreak.com', 'www.justlinux.com', 'www.cprogramming.com'),
'15'=>array('www.hotmail.com','mail.yahoo.com','www.caramail.com'),
'16'=>array('www.hotmail.com','mail.yahoo.com','www.caramail.com'),
'17'=>array('www.hotmail.com','mail.yahoo.com','www.caramail.com'),
'18'=>array('www.altavista.com','www.yahoo.com','www.google.com'),
'19'=>array('www.espn.com', 'www.nba.com', 'www.wnba.com'),
'20'=>array('www.honda.com','www.automotiveforums.com', 'www.hondaswap.com'),
'21'=>array('www.microsoft.com', 'www.adobe.com', 'www.pagemaker.com'),
'22'=>array('www.download.com', 'www.telecharger.com','www.foodsubs.com'),
'23'=>array('www.phpfreak.com', 'www.justlinux.com', 'www.cprogramming.com'),
'24'=>array('www.hotmail.com','mail.yahoo.com','www.caramail.com'),
'25'=>array('www.altavista.com','www.yahoo.com','www.google.com'),
'26'=>array('www.espn.com', 'www.nba.com', 'www.wnba.com'),
'27'=>array('www.honda.com','www.automotiveforums.com', 'www.hondaswap.com'),
'28'=>array('www.microsoft.com', 'www.adobe.com', 'www.pagemaker.com'),
'29'=>array('www.download.com', 'www.telecharger.com','www.foodsubs.com'),
'30'=>array('www.phpfreak.com', 'www.justlinux.com', 'www.cprogramming.com')
);
//get the day of the week
$day_of_week= date("j")-1;

/* for each day of the week select a different url according to
* the pattern bellow
0-1, first url (sunday and monday)
2-4, second url (tuesday, wednesday and thursday)
5-6, third url (friday, saturday )
*/
switch(date("w")){
case
0:
case
1:
$sub_day_of_week = 0;
break;
case
2:
case