Jump to content
MakeWebGames

Admin.php Modification - Why Isn't It Working???


-CrAzY-

Recommended Posts

I Modified Admin.php So I Could Kill ( Set A Users HP To 0 ) Someone In Admin Panel Instantly, This Is What I Did:

 

I Added This To Admin.php

case 'modkill': modkill(); break;
case 'modkillsub': modkillsub(); break;

 

Then Added This To Admin.php

[[url='admin.php?action=modkill']Modkill[/url]]

 

And Added This To Admin.php

function modkill()
{
print "Modkill

ID Of The User To Be Modkilled:



";
}
function modkillsub()
{
global $ir,$c,$userid;
{
mysql_query("UPDATE users WHERE userid={$_POST['id']} SET hp=0",$c);
print "Mod Killed!!
";
}
}

 

It Partly Works, I Can Get Onto The Modkill Screen, And I Can Put Someones User ID Into The Box And It Will Say Modkilled!!, But It Dosent Put There HP Down To 0, What Have I Done Wrong

 

Thanks!!

Link to comment
Share on other sites

Re: Admin.php Modification - Why Isn't It Working???

This is one of the things I dont like about the query system V1.1 uses. It does not give you proper error messages the way v2.0 does. Anyway, your problem is this

mysql_query("UPDATE users WHERE userid={$_POST['id']} SET hp=0",$c);

Should Be

mysql_query("UPDATE users SET hp=0 WHERE userid={$_POST['id']}",$c);

There may or may not be other issues but that is a major one I saw pretty easy

Link to comment
Share on other sites

Re: Admin.php Modification - Why Isn't It Working???

thanks very much +1, im not that good at Sql, i copyed query in admin.php and tryed to edit it, thanks!

could you help me with this problem:

 

i added this to header.php:

if($ir['hp'] == 0)

{

header("Location: dead.php");

exit;

}

because you could not 'Die' earlier, but when someone who is dead ( hp is 0) logs on it says:

Warning: Cannot modify header information - headers already sent by (output started at /home/imgame/public_html/header.php:1) in /home/imgame/public_html/header.php on line 80

 

please help

and again, thanks for the sql :-)

Link to comment
Share on other sites

Re: Admin.php Modification - Why Isn't It Working???

That is a tough one. You cannot just use the header function wherever you want. It would have to be the very first output in the code so it can be tricky, especially without getting rid of the Login.php redirect for logged off players. I haven't messed with this much but you might try something like this instead. Not sure if it will work for you, but I know Oxi was using it in his failed Minesweeper attempt

<meta http-equiv='refresh' content='0; url=dead.php'>

Link to comment
Share on other sites

  • 2 weeks later...

Re: Admin.php Modification - Why Isn't It Working???

 

I Modified Admin.php So I Could Kill ( Set A Users HP To 0 ) Someone In Admin Panel Instantly, This Is What I Did:

 

I Added This To Admin.php

case 'modkill': modkill(); break;
case 'modkillsub': modkillsub(); break;

 

Then Added This To Admin.php

[[url='admin.php?action=modkill']Modkill[/url]]

 

And Added This To Admin.php

function modkill()
{
print "<h3>Modkill</h3>

ID Of The User To Be Modkilled:<form action='admin.php?action=modkillsub' method='post'>
<input type='text' value='0' name='id'>

<input type='submit' value='Modkill'>
</form>";
}
function modkillsub()
{
global $ir,$c,$userid;
{
mysql_query("UPDATE users WHERE userid={$_POST['id']} SET hp=0",$c);
print "Mod Killed!!
";
}
}

 

It Partly Works, I Can Get Onto The Modkill Screen, And I Can Put Someones User ID Into The Box And It Will Say Modkilled!!, But It Dosent Put There HP Down To 0, What Have I Done Wrong

 

Thanks!!

And you have

 

function modkillsub()
{
global $ir,$c,$userid;
{
mysql_query("UPDATE users WHERE userid={$_POST['id']} SET hp=0",$c);
print "Mod Killed!!
";
}
}

 

dont even need that just put

 

function modkillsub()
{
global $ir,$c,$userid;
mysql_query("UPDATE users SET hp=0 WHERE userid={$_POST['id']}",$c);
print "Mod Killed!!
";
}
Link to comment
Share on other sites

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