Dentafrice1
27-12-2006, 05:03 PM
Ok I hardly ever ask for help anymore.
<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
<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