Sorting Hat

Started on the old forum in October 2015 · view the original in the archive · old links redirect here

#lavalair

7 replies · 195 views · started 11 years ago · 3 min read

2 participants
sky2kv Junior · 30 posts #1

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:)

something else Fellow · 2,296 posts #2

SQL:

ALTER TABLE `ibwf_users` ADD `house` VARCHAR( 25 ) NOT NULL DEFAULT 'Muggle';

php:

mysql_query("UPDATE ibwf_users SET house='".$house."'");

Profile:

$house = mysql_fetch_array(mysql_query("SELECT house FROM ibwf_users WHERE id='".$who."'"));
echo $house[0].'<br/>';
sky2kv Junior · 30 posts #3

Thanks Bro,it works well:) How do i make it so that when a member uses the magic hat and is selected as Hufflepuff ,now when he enters magic hat to play again,he must be told,"You Are A Hufflepuff Member"....and he mustnt be able to play a second time and anytime after he is selected the first time... Many Thanks For You Help:)

something else Fellow · 2,296 posts #4
$house = mysql_fetch_array(mysql_query("SELECT house FROM ibwf_users WHERE id='".$uid."'"));
if($house[0]!='Muggle')
{
echo 'You Are A ' $house[0].' Member'<br/>';  
}
else
{
//Do normal stuff here
}
sky2kv Junior · 30 posts #5

something else wrote:

$house = mysql_fetch_array(mysql_query("SELECT house FROM ibwf_users WHERE id='".$uid."'"));
if($house[0]!='Muggle')
{
echo 'You Are A ' $house[0].' Member'<br/>';  
}
else
{
//Do normal stuff here
}

Thanks bro,will try this out:)

sky2kv Junior · 30 posts #6

sky2kv wrote: Thanks bro,will try this out:)

The problem im facing now,is that whenever any member plays the hat and whatever they are Named,shows in all other members profiles...like if im a Hufflepuff already and a member plays and he turns out to be a Raven,then automatically im also changed to Raven...

something else Fellow · 2,296 posts #7

oops sorry - i messed up in my first post..... it should be:

mysql_query("UPDATE ibwf_users SET house='".$house."' WHERE id='".$uid."'"); 
sky2kv Junior · 30 posts #8

something else wrote: oops sorry - i messed up in my first post..... it should be:

mysql_query("UPDATE ibwf_users SET house='".$house."' WHERE id='".$uid."'"); 

Awsome Bro,now it works:)

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close