Jump to content
MakeWebGames

Recommended Posts

Posted

i had 2 problem with gangs names and one was with creategang.php and the other with gan_staff_name function in yourgang.php and i managed to fix the problem with creategang.php but cant figure out what i am doing wrong here so the problem is that before i messed around with the script it allowed the user to have same name gangs by leaving spaces before the gang here is the function.

 

function gang_staff_name()
{
global $db, $ir, $userid, $gangdata, $h, $leaders;
if(in_array($userid, $leaders))
{
if(isset($_POST['subm']))
{
$_POST['subm'] = trim($_POST['subm']);
$check=$db->query(sprintf("SELECT `gangNAME` FROM `gangs` WHERE `gangNAME` = '%s'", clean($_POST['name'])));
if($db->num_rows($check))
{
print "ERROR.

[url='yourgang.php?action=staff']> Back[/url]";
$h->endpage();
exit;
}
$sql = sprintf("UPDATE gangs SET gangNAME = '%s' WHERE (gangID = %u)", clean($_POST['vp']), $gangdata['gangID']);
$db->query($sql);
echo "Gang name changed!

[url='yourgang.php?action=staff']> Back[/url]";
}
else
{
echo "Current Name: 
";
echo sprintf("%s
", format($gangdata['gangNAME']));
echo "
<form action='yourgang.php?action=staff&act2=name' method='post'>";
echo "<input type='hidden' name='subm' value='submit' />";
echo "<table class='table' width='75%'>";
echo "<tr>";
echo "<th>New name</th>";
echo sprintf("<td style='text-align:center;'><input type='text' name='vp' value='%s' size='40%%' /></td>", format($gangdata['gangNAME']));
echo "</tr>";
echo "<tr>";
echo "<td colspan='2' style='text-align:center;'><input type='submit' value='Change' /></td>";
echo "</tr>";
echo "</table>";
echo "</form>";
}
}
} 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...