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!


Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default [URGENT] PHP HELP [URGENT] - Paying

    Ok I hardly ever ask for help anymore.

    PHP Code:
    <html>
    <head>
    <title>Home</title>
    <style type="text/css">
    a {
    font-size: 10px;
    color: #000000;
    }
    a:link {
    text-decoration: none;
    color: #000000;
    }
    a:visited {
    text-decoration: none;
    color: #000000;
    }
    a:hover {
    text-decoration: underline;
    color: #000000;
    }
    a:active {
    text-decoration: none;
    color: #000000;
    }
    body,td,th,p {
    font-family: Verdana;
    font-size: 10px;
    color: #000000;
    }
    </style>
    </head>
    <body bgcolor="#ffffff">
    <p><u><b>Mass Badge</b></u></p>
    <p>This page allows you to give a badge to every one in the selected usergroup. Only Admin may use this.<br>
    Click <a href="index.php" target="usersystem">here</a> to go back</p>
    </body>
    </html>
    <?php  
    ob_start
    (); 
    include(
    "config.php"); 
    if(
    $logged[username] && $logged[level] == 12
    // Checks to see they are logged in, and their level is admin 
    if(!$_POST[send]){  
    // If submit button hasn't been clicked, it shows the form 
    echo "<b>Mass Badge.</b><br /><form method='post'><br>
    <select name=\"level\" id=\"level\" tabindex=\"2\" size=\"1\" style=\"width: 200; height: 23\">
    <option value=\"0\">Banned</option>              
    <option value=\"1\">User</option>
                  <option value=\"2\">Webdesigner</option>
                  <option value=\"3\">Graphics Designer</option>
                  <option value=\"4\">News Reporter</option>
                  <option value=\"5\">Radio DJ</option>
      <option value=\"6\">Forum Trainee Hobba</option>
                  <option value=\"7\">Forum Moderator</option>
                  <option value=\"9\">(Asst) Manager</option>
                  <option value=\"10\">Player Support</option>
                  <option value=\"11\">Super Moderator</option>
      <option value=\"12\">Administrator</option>
                </select> 
                <br><br>
    <select name='bname'>"

    $getbadges mysql_query("SELECT * FROM badges ORDER BY 'name' ASC");  
    while (
    $badges MySQL_Fetch_Array($getbadges)) {  
    echo (
    "<option value='$badges[name]'>$badges[name]</option>");  

    echo(

    </select> <br>  <br>
    <input type='submit' name='send' value='Submit'>  
    </form>"
    );  
    // Thats a form, you know what that does 
    }else{  
    // If submit button has been pressed, send the pm 
    $bname=$_POST['bname']; 
    $geturl =mysql_query("SELECT * FROM badges WHERE name = '$bname'");  
    $rows=mysql_fetch_array($geturl); 
    $burl=$rows['url']; 
    $query mysql_query("SELECT * FROM users WHERE `level`='$_POST[level]'");
    while(
    $row mysql_fetch_array($query)) {
    $query2 mysql_query("SELECT * FROM ubadges WHERE `bname`='$bname' AND `uname`='$row[id]'");
    $num mysql_num_rows($query2);
    if(
    $num "1" || $num "1") {
    }else{
    $sql="INSERT INTO ubadges(uname, bname, burl)VALUES('$row[id]', '$bname', '$burl')"
    $result=mysql_query($sql);
    }}
    }    
    ?>
    That just gives the selected usergroup that badge. But it gives duplicates to people who already have it

    How can I prevent duplicates?

    +rep to anyone who fixes it
    2 HC sofas on Habbo
    3 Super rares on Habbo-Record
    1000 Credits on Habbo-Record
    VIP Badge on Habbo-Record

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

    Latest Awards:

    Default

    Im not sure but cant you use the 'if' thing in PHP.

    Im a newbie at php so i dont know what its called.
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  3. #3
    Join Date
    Feb 2006
    Location
    /usr/local
    Posts
    2,809
    Tokens
    688

    Latest Awards:

    Default

    er yes u can in msot codes

  4. #4
    Join Date
    Dec 2006
    Location
    Swindon
    Posts
    3,299
    Tokens
    215
    Habbo
    dunko

    Latest Awards:

    Default

    Quote Originally Posted by MacBook View Post
    Im not sure but cant you use the 'if' thing in PHP.

    Im a newbie at php so i dont know what its called.
    You can really actually use if($WHATEVER){ anywhere.

    Ok.

    Use this:

    PHP Code:
    <html>
    <head>
    <title>Home</title>
    <style type="text/css">
    a {
    font-size: 10px;
    color: #000000;
    }
    a:link {
    text-decoration: none;
    color: #000000;
    }
    a:visited {
    text-decoration: none;
    color: #000000;
    }
    a:hover {
    text-decoration: underline;
    color: #000000;
    }
    a:active {
    text-decoration: none;
    color: #000000;
    }
    body,td,th,p {
    font-family: Verdana;
    font-size: 10px;
    color: #000000;
    }
    </style>
    </head>
    <body bgcolor="#ffffff">
    <p><u><b>Mass Badge</b></u></p>
    <p>This page allows you to give a badge to every one in the selected usergroup. Only Admin may use this.<br>
    Click <a href="index.php" target="usersystem">here</a> to go back</p>
    </body>
    </html>
    <?php  
    ob_start
    (); 
    include(
    "config.php"); 
    if(
    $logged[username] && $logged[level] == 12
    // Checks to see they are logged in, and their level is admin 
    if(!$_POST[send]){  
    // If submit button hasn't been clicked, it shows the form 
    echo "<b>Mass Badge.</b><br /><form method='post'><br>
    <select name=\"level\" id=\"level\" tabindex=\"2\" size=\"1\" style=\"width: 200; height: 23\">
    <option value=\"0\">Banned</option>              
    <option value=\"1\">User</option>
                  <option value=\"2\">Webdesigner</option>
                  <option value=\"3\">Graphics Designer</option>
                  <option value=\"4\">News Reporter</option>
                  <option value=\"5\">Radio DJ</option>
      <option value=\"6\">Forum Trainee Hobba</option>
                  <option value=\"7\">Forum Moderator</option>
                  <option value=\"9\">(Asst) Manager</option>
                  <option value=\"10\">Player Support</option>
                  <option value=\"11\">Super Moderator</option>
      <option value=\"12\">Administrator</option>
                </select> 
                <br><br>
    <select name='bname'>"

    $getbadges mysql_query("SELECT * FROM badges ORDER BY 'name' ASC");  
    while (
    $badges MySQL_Fetch_Array($getbadges)) {  
    echo (
    "<option value='$badges[name]'>$badges[name]</option>");  

    echo(

    </select> <br>  <br>
    <input type='submit' name='send' value='Submit'>  
    </form>"
    );  
    // Thats a form, you know what that does 
    }else{  
    // If submit button has been pressed, send the pm 
    $bname=$_POST['bname']; 
    $geturl =mysql_query("SELECT * FROM badges WHERE name = '$bname'");  
    $rows=mysql_fetch_array($geturl); 
    $burl=$rows['url']; 
    $query mysql_query("SELECT * FROM users WHERE `level`='$_POST[level]'");
    while(
    $row mysql_fetch_array($query)) {
    $query2 mysql_query("SELECT * FROM ubadges WHERE `bname`='$bname' AND `uname`='$row[id]'");
    $num mysql_num_rows($query2);
    if(
    $num "1" || $num "1") {
    }else{
    $delete mysql_query("DELETE FROM `ubadges` WHERE(`bname`) = '$bname'");
    $sql="INSERT INTO ubadges(uname, bname, burl)VALUES('$row[id]', '$bname', '$burl')"
    $result=mysql_query($sql);
    }}
    }    
    ?>
    I think this will delete from the table ubadges the badge posted, then insert it again.
    Last edited by Blob; 30-12-2006 at 04:00 PM.

Posting Permissions

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