Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Feb 2005
    Location
    Florida, USA
    Posts
    527
    Tokens
    0

    Default Tutorial :: Making a DJ Says

    This is actually very simple to do. All you have to know is a bit of MySQL and PHP and thats all. Anyways, lets start. First, make a Database then add this table to it

    PHP Code:
    CREATE TABLE `djsays` (
    `
    messagevarchar(250NOT NULL default 'No Message',
    PRIMARY KEY (`id`)
    TYPE=MyISAM
    Next we will need to connect to that database and that user. Use this.

    PHP Code:
    <? 
       ob_start
    (); // allows you to use cookies 
       
    $conn mysql_connect("localhost","DATABASE USERNAME","DATABASE PASSWORD"); 
       
    mysql_select_db(DATABASE NAME) or die(mysql_error()); 
       
    //fill in the above lines where there are capital letters. 
       
    $logged MYSQL_QUERY("SELECT * from users WHERE id='$_COOKIE[id]' AND password = '$_COOKIE[pass]'"); 
       
    $logged mysql_fetch_array($logged); 
       
    //the above lines get the user's information from the database. 
    ?>
    Save that as config.php

    Next we will need the page for the DJ to send the message. This part is simple. Here we go.

    PHP Code:
    <? 
    ob_start
    (); 
    include(
    "config.php"); 
    <
    form method=\"POST\">  
    <tr> 
    <td align=\"right\" width=\"25%\"> 
    Location 
    </td> 
    <td align=\"left\"> 
    <input type=\"text\" size=\"25\" maxlength=\"25\" name=\"djsays\" value=\"
    $djsays[djsays]\"></td> 
    </tr> 
    <td align=\"left\"> 
    <input type=\"submit\" name=\"update\" value=\"Update\"></td> 
    </tr> 
    </table> 
    </form> 
    </center>"
    ); 

    else 

    $djsays htmlspecialchars($_POST[djsays]); 
    // the above lines get rid of all html. 
    echo ("Your profile has been updated!"); 
    $update mysql_query("Update users set djsays = '$djsays'
    // updates the information in the database. 
    ?>
    Okay, save that as djsaysform.php

    Easy yes?

    Next we need to make a page that will say the message, thats very simple aswell, trust me.

    Just make a page called djmessage.php and in it put

    PHP Code:
    <?php
    ob_start
    ();
    include(
    "config.php");
    echo (
    "DJ Says: $djsays[djsays]<br />
    "
    );
    ?>
    Now if you want this to appear somewhere withouth having to have it as an iframe just put
    PHP Code:
    <? 
       
    include("djmessage.php"); 
    ?>
    where ever you want it be.

    By the way this is my first tutorial ever. Hopefully you all like it and it works.

    Oh, by the way I really dont know if this works I just wrote it from the top of my head. Just test it to see.
    Even Though We May Be From Different Places, Speak In Different Tounges, Our Hearts
    Still Beats As One.



  2. #2
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    3,285
    Tokens
    0

    Latest Awards:

    Default

    The users table appears by magic? :S



    i used to be NintendoNews. visit my blog or add me on twitter.
    need help with vista? i am a microsoft certified technology specialist in configuring windows vista and connected home integrator.. pm me for help!


    "I am the way, the truth, and the life. No one comes to the Father except through me"
    John 14:6 (NIV)


  3. #3
    Join Date
    Feb 2005
    Posts
    1,411
    Tokens
    0

    Latest Awards:

    Default

    Mmm, ill have to try that later.
    I owe rep to:

    NintendoNews & Luckyrare

  4. #4
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    This looks familiar to the techtuts one. The techtuts one has alot of errors in it.
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  5. #5
    Join Date
    Dec 2005
    Location
    England | Brighton
    Posts
    1,378
    Tokens
    0

    Latest Awards:

    Default

    i swear i have seen this one before :S

  6. #6
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Lol it dont even work

  7. #7
    Join Date
    Dec 2005
    Posts
    993
    Tokens
    0

    Default

    Quote Originally Posted by Organised
    Lol it dont even work
    I agree, It Dont Work :S
    SWANSEA CITY FAN 4 LIFE + LIVERPOOL FAN + ITALY FAN


    Avatar and Signature removed by Agesilaus (Forum Super Moderator): Images were exceeding the size limit for your usergroup.

  8. #8
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    I'll run it on my test server to see if I can get it working.

    Edit: The SQL isn't correct, so I haven't even tested the rest.
    Last edited by nets; 20-03-2006 at 04:48 PM.
    kinda quit.

  9. #9
    Join Date
    Jul 2005
    Posts
    1,653
    Tokens
    50

    Latest Awards:

    Default

    Well where the **** does the dj login? You dont need a users table.

  10. #10
    Join Date
    Nov 2004
    Posts
    268
    Tokens
    0

    Default

    This tutorial has been stolen from TechTuts.com
    Status:

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •