Hi friends,i taken this code from the wapirate script,its a very good code indeed,but i want some help to modify it a bit...see what i want is when a member uses the hat once,whatever is selected for him/her must be recorded into the ibwf_users table and must outputed in his/hers profile...when he/her goes back into the sorting hat page,it must say that you are already a...Slytherin ect... Hope you guys understand what im trying to say...
////////////////////////////////////////MAIN PAGE
if($action=="main")
{
addonline(getuid_sid($sid),"Sorting Hat","");
echo "<head><title>$site_name</title>";
if($theme){echo "<link rel="StyleSheet" type="text/css" href="style/$theme[0]" />";
}
else{echo "<link rel="StyleSheet" type="text/css" href="style/style.css" />";
}
echo "<div class="phdr"><center><b>Harry Potter And The Magic Hat</b></center></div><br/>";
echo "<div class="gmenuu"><p align="center">";
$name = mysql_fetch_array(mysql_query("SELECT name ibwf_users WHERE id='".$uid."'"));
echo "<img src="/images/hat.png" alt="*"/><br/>";
echo "<b>Welcome To The Sorting Hat!</b><br/>";
echo "<br/>";
$hat = rand(1,4);
if($hat==1){
echo "$name[0] I See Good Things To Come From You In the Future!<br/><br/>";
}else if($hat==2){
echo "$name[0] Put All Your Thought Into This!<br/><br/>";
}else if($hat==3){
echo "$name[0] Theres Ssssomething Sssstrange About You!<br/><br/>";
}else if($hat==4){
echo "$name[0] Make Sure You Answer As Truthfully As Possible!<br/><br/>";
}
echo "Place Your Head Inside The Hat And Answer The Hats Questions!<br/>";
echo "<br/>";
echo "<a href="hat.php?action=q1&sid=$sid">Place Head Inside Hat</a><br/></div>";
echo "<br/>";
echo "<div class="list22" align="center">";
echo "<a href="index.php?action=main&sid=$sid"><img src="images/home.gif" alt="*"/>Home</a></div><br/>";
echo "<div class="phdra"><center><b>$copy</b></center></a></div>";
echo "</p>";
echo "</body></html>";
exit();
}
//////////////////////////////////////////////question 1
else if($action=="q1")
{
addonline(getuid_sid($sid),"Sorting Hat","");
echo "<head><title>$site_name</title>";
if($theme){echo "<link rel="StyleSheet" type="text/css" href="style/$theme[0]" />";
}
else{echo "<link rel="StyleSheet" type="text/css" href="style/style.css" />";
}
echo "<div class="phdr"><center><b>Sorting Hat</b></center></div><br/>";
echo "<div class="gmenuu"><p align="center">";
echo "<img src="/images/hat.jpg" alt="*"/><br/><br/>";
echo "<b>If You Found £10000 On A bus Would You... </b><br/><br/>";
echo "<a href="hat.php?action=q2&a=5&sid=$sid">Give It To Charity</a><br/>";
echo "<a href="hat.php?action=q2&a=2&sid=$sid">Keep It</a><br/>";
echo "<a href="hat.php?action=q2&a=3&sid=$sid">Give It To The Police</a><br/>";
echo "<a href="hat.php?action=q2&a=4&sid=$sid">Keep Half And Give Half To Charity</a><br/></div>";
echo "<br/>";
echo "<div class="list22" align="center">";
echo "<a href="index.php?action=main&sid=$sid"><img src="images/home.gif" alt="*"/>Home</a></div><br/>";
echo "<div class="phdr"><center><b>$copy</b></center></a></div>";
echo "</p>";
echo "</body></html>";
exit();
}
//////////////////////////////////////////////question 2
else if($action=="q2")
{
addonline(getuid_sid($sid),"Sorting Hat","");
echo "<head><title>$site_name</title>";
if($theme){echo "<link rel="StyleSheet" type="text/css" href="style/$theme[0]" />";
}
else{echo "<link rel="StyleSheet" type="text/css" href="style/style.css" />";
}
echo "<div class="phdr"><center><b>Sorting Hat</b></center></div><br/>";
echo "<div class="gmenuu"><p align="center">";
$a=$_GET["a"];
$sc = $a;
echo "<img src="/images/hat.jpg" alt="*"/><br/><br/>";
echo "<b>What Animal Would You Choose... </b><br/><br/>";
echo "<a href="hat.php?action=q3&a=2&sc=$sc&sid=$sid">Snake</a><br/>";
echo "<a href="hat.php?action=q3&a=5&sc=$sc&sid=$sid">Owl</a><br/>";
echo "<a href="hat.php?action=q3&a=3&sc=$sc&sid=$sid">Rat</a><br/>";
echo "<a href="hat.php?action=q3&a=4&sc=$sc&sid=$sid">Cat</a><br/></div>";
echo "<br/>";
echo "<div class="list22" align="center">";
echo "<a href="index.php?action=main&sid=$sid"><img src="images/home.gif" alt="*"/>Home</a></div><br/>";
echo "<div class="phdra"><center><b>$copy</b></center></a></div>";
echo "</p>";
echo "</body></html>";
exit();
}
//////////////////////////////////////////////question 3
else if($action=="q3")
{
addonline(getuid_sid($sid),"Sorting Hat","");
echo "<head><title>$site_name</title>";
if($theme){echo "<link rel="StyleSheet" type="text/css" href="style/$theme[0]" />";
}
else{echo "<link rel="StyleSheet" type="text/css" href="style/style.css" />";
}
echo "<div class="phdr"><center><b>Sorting Hat</b></center></div><br/>";
echo "<div class="gmenuu"><p align="center">";
$a=$_GET["a"];
$sc=$_GET["sc"];
$sc = $a + $sc;
echo "<img src="/images/hat.jpg" alt="*"/><br/><br/>";
echo "<b>What Flavour Jelly Bean Do You Like... </b><br/><br/>";
echo "<a href="hat.php?action=q4&a=5&sc=$sc&sid=$sid">Lime</a><br/>";
echo "<a href="hat.php?action=q4&a=3&sc=$sc&sid=$sid">Brussel Sprout</a><br/>";
echo "<a href="hat.php?action=q4&a=4&sc=$sc&sid=$sid">Chocolate</a><br/>";
echo "<a href="hat.php?action=q4&a=2&sc=$sc&sid=$sid">Boggie</a><br/></div>";
echo "<br/>";
echo "<div class="list22" align="center">";
echo "<a href="index.php?action=main&sid=$sid"><img src="images/home.gif" alt="*"/>Home</a></div><br/>";
echo "<div class="phdra"><center><b>$copy</b></center></a></div>";
echo "</p>";
echo "</body></html>";
exit();
}
//////////////////////////////////////////////question 4
else if($action=="q4")
{
addonline(getuid_sid($sid),"Sorting Hat","");
echo "<head><title>$site_name</title>";
if($theme){echo "<link rel="StyleSheet" type="text/css" href="style/$theme[0]" />";
}
else{echo "<link rel="StyleSheet" type="text/css" href="style/style.css" />";
}
echo "<div class="phdr"><center><b>Sorting Hat</b></center></div><br/>";
echo "<div class="gmenuu"><p align="center">";
$a=$_GET["a"];
$sc=$_GET["sc"];
$sc = $a + $sc;
echo "<img src="/images/hat.jpg" alt="*"/><br/><br/>";
echo "<b>Which Magical Power Would You Choose... </b><br/><br/>";
echo "<a href="hat.php?action=end&a=2&sc=$sc&sid=$sid">Read Peoples Minds</a><br/>";
echo "<a href="hat.php?action=end&a=4&sc=$sc&sid=$sid">Move Things With Your Mind</a><br/>";
echo "<a href="hat.php?action=end&a=5&sc=$sc&sid=$sid">Invisability</a><br/>";
echo "<a href="hat.php?action=end&a=3&sc=$sc&sid=$sid">Fly</a><br/></div>";
echo "<br/>";
echo "<div class="list22" align="center">";
echo "<a href="index.php?action=main&sid=$sid"><img src="images/home.gif" alt="*"/>Home</a></div><br/>";
echo "<div class="phdra"><center><b>$copy</b></center></a></div>";
echo "</p>";
echo "</body></html>";
exit();
}
//////////////////////////////////////////////end
else if($action=="end")
{
addonline(getuid_sid($sid),"Sorting Hat","");
echo "<head><title>$site_name</title>";
if($theme){echo "<link rel="StyleSheet" type="text/css" href="style/$theme[0]" />";
}
else{echo "<link rel="StyleSheet" type="text/css" href="style/style.css" />";
}
echo "<div class="phdr"><center><b>Sorting Hat</b></center></div><br/>";
echo "<div class="gmenuu"><p align="center">";
$a=$_GET["a"];
$sc=$_GET["sc"];
$sc = $a + $sc;
echo "<img src="/images/hat.jpg" alt="*"/><br/><br/>";
if($sc<11){
echo "Your Best Suited For Slytherin!<br/>";
echo "<img src="/images/sly.jpeg" alt="Slytherin"/><br/>";
$house = "Slytherin";
echo "</div>";
}else if($sc>10&&$sc<14){
echo "Your Best Suited For Hufflepuff<br/>";
echo "<img src="/images/huff.jpg" alt="Hufflepuff"/><br/>";
$house = "Hufflepuff";
echo "</div>";
}else if($sc>13&&$sc<17){
echo "Your Best Suited For Ravenclaw!<br/>";
echo "<img src="/images/rav.jpeg" alt="Ravenclaw"/><br/>";
$house = "Ravenclaw";
echo "</div>";
}else if($sc>16){
echo "Your Best Suited For Gryffindor<br/>";
echo "<img src="/images/gry.jpg" alt="Gryffindor"/><br/>";
$house = "Gryffindor";
echo "</div>";
}
$name = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_users WHERE id='".$uid."'"));
$who = $name[0];
$message = "[pro5=$uid]$who [/pro5] Has Visited The Sorting Hat. [br/] The Sorting Hat Has Placed Them In [b] $house [/b] -wizard- ";
autopm($message, 1);
echo "<br/>";
echo "<div class="list22" align="center">";
echo "<a href="index.php?action=main&sid=$sid"><img src="images/home.gif" alt="*"/>Home</a></div><br/>";
echo "<div class="phdra"><center><b>$copy</b></center></a></div>";
echo "</p>";
echo "</body></html>";
exit();
}
else{
addonline(getuid_sid($sid),"Lost in sorting hat lol","");
echo "<div><br/>Doh!<br/></div>";
echo "<p align="center">";
echo "I don't know how did you get into here, but there's nothing to show<br/><br/>";
echo "<div class="box_cen" align="center">";
echo "<a href="index.php?action=chat&sid=$sid"><img src="images/chat.gif" alt="*"/>Chatrooms</a><br/>";
echo "<a href="index.php?action=main&sid=$sid"><img src="images/home.gif" alt="*"/>Home</a></div>";
exit();
}
?>
Thanks:)