All pastes #73163 Raw Edit

Something

public php v1 · immutable
#73163 ·published 2006-06-27 14:56 UTC
rendered paste body
<?phprequire("config.php");?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>The University Of Newcastle - Advergames Study</title> <style type="text/css"><!--.style1 {	font-size: 24px;	font-family: Arial, Helvetica, sans-serif;}.style2 {	font-size: 16px;	font-family: Arial, Helvetica, sans-serif;}.style3 {	font-size: 18px;	font-family: Arial, Helvetica, sans-serif;	font-style: italic;	color: #000066;}.style4 {font-size: 18px}.style5 {font-size: 18px; font-family: Arial, Helvetica, sans-serif; }--> </style><SCRIPT LANGUAGE="JavaScript">var interval = 2.5;var random_display = 1;interval *= 1000;var image_index = 0;image_list = new Array();image_list[image_index++] = new imageItem("http://javascript.internet.com/img/image-cycler/01.jpg");image_list[image_index++] = new imageItem("http://javascript.internet.com/img/image-cycler/02.jpg");image_list[image_index++] = new imageItem("http://javascript.internet.com/img/image-cycler/03.jpg");image_list[image_index++] = new imageItem("http://javascript.internet.com/img/image-cycler/04.jpg");var number_of_image = image_list.length;function imageItem(image_location) {this.image_item = new Image();this.image_item.src = image_location;}function get_ImageItemLocation(imageObj) {return(imageObj.image_item.src)}function generate(x, y) {var range = y - x + 1;return Math.floor(Math.random() * range) + x;}function getNextImage() {if (random_display) {image_index = generate(0, number_of_image-1);}else {image_index = (image_index+1) % number_of_image;}var new_image = get_ImageItemLocation(image_list[image_index]);return(new_image);}function rotateImage(place) {var new_image = getNextImage();document[place].src = new_image;var recur_call = "rotateImage('"+place+"')";setTimeout(recur_call, interval);}</script></head><BODY OnLoad="rotateImage('rImage')"><table width="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#000000" bgcolor="#000000" id="top">  <tr>    <th width="428" scope="col"><div align="left"></div></th>    <th width="450" scope="col"><div align="right"><a href="http://www.newcastle.edu.au"><img src="images/banner.png" alt="Newcastle Uni" width="430" height="75" border="0" longdesc="http://www.newcastle.edu.au/index.html" /></a></div></th>  </tr></table><table width="75%" border="0" align="center" cellpadding="1" cellspacing="1">  <tr>    <th scope="col"><h1 align="center" class="style1 style4">Survey Results</h1>         <p align="center" class="style3">By the Numbers</p></th>  </tr>  <tr>    <td><p align="left" class="style2"><?php$sql="SELECT * FROM survey";$query=mysql_query($sql) or die(mysql_error());//let's get some numbers, shall we?$sagree=0;$agree=0;$neutral=0;$disagree=0;$sdisagree=0;$males=0;$females=0;$age13=0;$age18=0;$age30=0;$age50=0;$lt3=0;$3to6=0;$6to12=0;$gt1=0;$avgtime=0;$wouldrec=0;$wouldagain=0;$before=0;$totalplayers=0;while ($survey=mysql_fetch_array($query)) {extract($survey);//was it a good game?if ($goodgame == "Strongly Disagree") $sdisagree=$sdisagree+1;else if ($goodgame == "Disagree") $disagree=$disagree+1;else if ($goodgame == "Neutral") $neutral=$neutral+1;else if ($goodgame == "Agree") $agree=$agree+1;else if ($goodgame == "Strongly Agree") $sagree=$sagree+1;//age ratioif ($age == "13-17") $age13=$age13+1;else if ($age == "18-29") $age18=$age18+1;else if ($age == "30-49") $age30=$age30+1;else if ($age == "50+") $age50=$age50+1;//sex ratioif ($sex == "male") $males=$males+1;else $females=$females+1;//they've been playing...if ($playinggames == "less that 3 months") $lt3=$lt3+1;else if ($playinggames == "1-3 hours") $1to3=$1to3+1;else if ($playinggames == "6-12 months") $6to12=$6to12+1;else if ($playinggames == "more than 1 year") $gt1=$gt1+1;if ($recommend == "yes") $wouldrec=$wouldrec+1;if ($playagain == "yes") $wouldagain=$wouldagain+1;if ($playedbefore == "yes") $before=$before+1;$avgtime=$avgtime+$timeplayed;$totalplayers=$totalplayers+1;}$avgtime=round(($avgtime/$totalplayers),2);$wouldnotrec=$totalplayers-$wouldrec;$wouldnotagain=$totalplayers-$wouldagain;$notbefore=$totalplayers-$before;echo "$totalplayers people have taken the survey. All numbers rounded to two decimal places.</p><b>Average time played:</b> $avgtime seconds<br/><b>$before</b> people had played the game before, <b>$notbefore</b> had not.<br/><b>$wouldagain</b> people would play the game again, <b>$wouldnotagain</b> would not.<br/><b>$wouldrec</b> people would recommend the game to a friend, <b>$wouldnotrec</b> would not.<br/><br/>$totalage=$age13+$age18+$age30+$age50;$age13=round(($age13/$totalage),4)*100;$age18=round(($age18/$totalage),4)*100;$age30=round(($age30/$totalage),4)*100;$age50=round(($age50/$totalage),4)*100;echo "Age ratio: <table border=1 width=40%><tr><td><b>Age 13-17</b></td><td>{$age13}%</td></tr><tr><td><b>Age 18-29</b></td><td>{$age18}%</td></tr><tr><td><b>Age 30-49</b></td><td>{$age30}%</td></tr><tr><td><b>Age 50+</b></td><td>{$age50}%</td></tr></table><br/>";$totalsex=$males+$females;$males=round(($males/$totalsex),4)*100;$females=round(($females/$totalsex),4)*100;echo "Sex ratio: <table border=1 width=40%><tr><td><b>Males</b></td><td>{$males}%</td></tr><tr><td><b>Females</b></td><td>{$females}%</td></tr></table><br/>";$totalgame=$sagree+$agree+$neutral+$disagree+$sdisagree;$sagree=round(($sagree/$totalgame),4)*100;$agree=round(($agree/$totalgame),4)*100;$neutral=round(($neutral/$totalgame),4)*100;$disagree=round(($disagree/$totalgame),4)*100;$sdisagree=round(($sdisagree/$totalgame),4)*100;echo "Statement: \"This was a good game.\": <table border=1 width=40%><tr><td><b>Strongly Disagree</b></td><td>{$sdisagree}%</td></tr><tr><td><b>Disagree</b></td><td>{$disagree}%</td></tr><tr><td><b>Neutral</b></td><td>{$neutral}%</td></tr><tr><td><b>Agree</b></td><td>{$agree}%</td></tr><tr><td><b>Strongly Agree</b></td><td>{$sagree}%</td></tr></table><br/>";$totalplaying=$lt3+$3to6+$6to12+$gt1;$lt3=round(($lt3/$totalplaying),4)*100;$3to6=round(($3to6/$totalplaying),4)*100;$6to12=round(($6to12/$totalplaying),4)*100;$gt1=round(($gt1/$totalplaying),4)*100;echo "How long they've been playing games: <table border=1 width=40%><tr><td><b>&lt; 3 months</b></td><td>{$lt3}%</td></tr><tr><td><b>3-6 months</b></td><td>{$3to6}%</td></tr><tr><td><b>6-12 months</b></td><td>{$6to12}%</td></tr><tr><td><b>&gt; 1 year</b></td><td>{$gt1}%</td></tr></table><br/>";?></p>    </td>  </tr></table><h1 align="center" class="style1 style1">&nbsp;</h1><p class="style2">&nbsp;</p><p align="center" class="style2">&nbsp;</p><p class="style2">&nbsp; </p></body></html>