Sorting Hat

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    how to Sorting Hat

    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...

    PHP Code:
    ////////////////////////////////////////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&amp;sid=$sid">Place Head Inside Hat</a><br/></div>";
    echo 
    "<br/>";

    echo 
    "<div class="list22" align="center">";
            
            
            echo 
    "<a href="index.php?action=main&amp;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&amp;a=5&amp;sid=$sid">Give It To Charity</a><br/>";
       echo 
    "<a href="hat.php?action=q2&amp;a=2&amp;sid=$sid">Keep It</a><br/>";
       echo 
    "<a href="hat.php?action=q2&amp;a=3&amp;sid=$sid">Give It To The Police</a><br/>";
       echo 
    "<a href="hat.php?action=q2&amp;a=4&amp;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&amp;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&amp;a=2&amp;sc=$sc&amp;sid=$sid">Snake</a><br/>";
       echo 
    "<a href="hat.php?action=q3&amp;a=5&amp;sc=$sc&amp;sid=$sid">Owl</a><br/>";
       echo 
    "<a href="hat.php?action=q3&amp;a=3&amp;sc=$sc&amp;sid=$sid">Rat</a><br/>";
       echo 
    "<a href="hat.php?action=q3&amp;a=4&amp;sc=$sc&amp;sid=$sid">Cat</a><br/></div>";
     echo 
    "<br/>";
    echo 
    "<div class="list22" align="center">";
            
            echo 
    "<a href="index.php?action=main&amp;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&amp;a=5&amp;sc=$sc&amp;sid=$sid">Lime</a><br/>";
       echo 
    "<a href="hat.php?action=q4&amp;a=3&amp;sc=$sc&amp;sid=$sid">Brussel Sprout</a><br/>";
       echo 
    "<a href="hat.php?action=q4&amp;a=4&amp;sc=$sc&amp;sid=$sid">Chocolate</a><br/>";
       echo 
    "<a href="hat.php?action=q4&amp;a=2&amp;sc=$sc&amp;sid=$sid">Boggie</a><br/></div>";
      echo 
    "<br/>";
     
    echo 
    "<div class="list22" align="center">";
            
            echo 
    "<a href="index.php?action=main&amp;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&amp;a=2&amp;sc=$sc&amp;sid=$sid">Read Peoples Minds</a><br/>";
       echo 
    "<a href="hat.php?action=end&amp;a=4&amp;sc=$sc&amp;sid=$sid">Move Things With Your Mind</a><br/>";
       echo 
    "<a href="hat.php?action=end&amp;a=5&amp;sc=$sc&amp;sid=$sid">Invisability</a><br/>";
       echo 
    "<a href="hat.php?action=end&amp;a=3&amp;sc=$sc&amp;sid=$sid">Fly</a><br/></div>";
      echo 
    "<br/>";
      
    echo 
    "<div class="list22" align="center">";
            
            echo 
    "<a href="index.php?action=main&amp;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($message1);
      echo 
    "<br/>";
    echo 
    "<div class="list22" align="center">";
            
           
            echo 
    "<a href="index.php?action=main&amp;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&amp;sid=$sid"><img src="images/chat.gif" alt="*"/>Chatrooms</a><br/>";
            echo 
    "<a href="index.php?action=main&amp;sid=$sid"><img src="images/home.gif" alt="*"/>Home</a></div>";
    exit();
    }

    ?> 
    Thanks

    #2
    SQL:
    Code:
    ALTER TABLE `ibwf_users` ADD `house` VARCHAR( 25 ) NOT NULL DEFAULT 'Muggle';
    php:
    PHP Code:
    mysql_query("UPDATE ibwf_users SET house='".$house."'"); 

    Profile:
    PHP Code:
    $house mysql_fetch_array(mysql_query("SELECT house FROM ibwf_users WHERE id='".$who."'"));
    echo 
    $house[0].'<br/>'
    Last edited by something else; 02.10.15, 21:42.

    Comment


      #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

      Comment


        #4
        PHP Code:
        $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

        Comment


          #5
          Originally posted by something else View Post
          PHP Code:
          $house mysql_fetch_array(mysql_query(&quot;SELECT house FROM ibwf_users WHERE id='&quot;.$uid.&quot;'&quot;));
          if(
          $house[0]!='Muggle')
          {
          echo 
          'You Are A ' $house[0].' Member'<br/>';  
          }
          else
          {
          //Do normal stuff here

          Thanks bro,will try this out

          Comment


            #6
            Originally posted by sky2kv View Post

            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...

            Comment


              #7
              oops sorry - i messed up in my first post..... it should be:
              PHP Code:
              mysql_query("UPDATE ibwf_users SET house='".$house."' WHERE id='".$uid."'"); 

              Comment


                #8
                Originally posted by something else View Post
                oops sorry - i messed up in my first post..... it should be:
                PHP Code:
                mysql_query("UPDATE ibwf_users SET house='".$house."' WHERE id='".$uid."'"); 
                Awsome Bro,now it works

                Comment

                Working...
                X