Jump to content
MakeWebGames

[mccode] Advanced Warning System


Silver

Recommended Posts

My second free mod!

Advanced Warning System

Allows staff to give a user a warning with a reason. It also allows edit warnings and remove warnings (owner only; so other staff cant piss around). Once the user has 6 warnings the system will automatically place them in the Federal Jail.

Create File: warnings.php

 

Insert:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

SQL: Run this query on the sql tab in phpmyadmin

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Go into viewuser.php

 

Find:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Replace With:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Any problems contact me on msn: [email protected]

Enjoy!

Link to comment
Share on other sites

  • Replies 87
  • Created
  • Last Reply

Top Posters In This Topic

Re: [Free v1] Advanced Warning System

for the:

--

-- Table structure for table `warnings`

--

CREATE TABLE `warnings` (

`id` int(11) NOT NULL auto_increment,

`user` int(11) NOT NULL default '0',

`warnedfor` text NOT NULL,

`warner` int(11) NOT NULL default '0',

`time` int(11) NOT NULL default '0',

PRIMARY KEY (`id`)

) ENGINE=MyISAM AUTO_INCREMENT=18 DEFAULT CHARSET=latin1;

--

-- Dumping data for table `warnings`

--

Does it have to have the:

--

-- Table structure for table `warnings`

--

but there?

just wondering :) please dont call me a n00b

Link to comment
Share on other sites

Re: [Free v1] Advanced Warning System

 

for the:

--

-- Table structure for table `warnings`

--

CREATE TABLE `warnings` (

`id` int(11) NOT NULL auto_increment,

`user` int(11) NOT NULL default '0',

`warnedfor` text NOT NULL,

`warner` int(11) NOT NULL default '0',

`time` int(11) NOT NULL default '0',

PRIMARY KEY (`id`)

) ENGINE=MyISAM AUTO_INCREMENT=18 DEFAULT CHARSET=latin1;

--

-- Dumping data for table `warnings`

--

Does it have to have the:

--

-- Table structure for table `warnings`

--

but there?

just wondering :) please dont call me a n00b

What do you mean mate?

Link to comment
Share on other sites

Re: [Free v1] Advanced Warning System

what i mean is, when i put that sql in, do i need to have the:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

part and the

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

part in it?

or can i just put the sql in as

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Link to comment
Share on other sites

Re: [Free v1] Advanced Warning System

Add this to index where you want it:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Make sure before the $w=

you have a ";

and the part underneath starts with print example:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Link to comment
Share on other sites

Re: [Free v1] Advanced Warning System

and if you want the table that will show why they were warned and such use this also both of these will work good good one silver too fast for me...lol

Just put this in your loggedin.php page

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Link to comment
Share on other sites

Re: [Free v1] Advanced Warning System

 

kraig

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Anything with '--' before it in an sql query is just a comment, you can run it fine and it wont affect anything

Oh thanks, cheers, thanks :) +1 for each

Link to comment
Share on other sites

Re: [mccode] Advanced Warning System

Create File: warnings.php

Insert:

Code:

<?php

/*-----------------------------------------------------

-- Mono Country v1.0 BETA

-- A product of DBS-entertainment

-- Copyright held 2005 by Dabomstew

-- INDEX.php

-----------------------------------------------------*/

include "globals.php";

if($ir['user_level'] < 2)

{

die("Staff Only!");

}

switch($_GET['action'])

{

case 'add': addwarning(); break;

case 'addsub': addwarning2(); break;

case 'del': deletewarning(); break;

case 'edit': editwarning(); break;

case 'edit2': editwarning2(); break;

default: index(); break;

}

function index()

{

global $ir,$c,$userid;

print "<h3>Viewing Warnings For ID: <a href=viewuser.php?u={$_GET['user']}>{$_GET['user']}</a></h3>

";

$q=mysql_query("SELECT w.*,u.* FROM warnings w LEFT JOIN users u ON w.warner=u.userid WHERE w.user={$_GET['user']} ORDER BY w.time DESC",$c);

print "<center><font color=red><h4>Total Warnings: ".mysql_num_rows($q)."

</h4>

[<a href=warnings.php?action=add&userid={$_GET['user']}>Add Warning</a>]

<table width=90% border=1 align=center><tr><tr style='background: gray'><td>Warned By:</td><td width=40%>Reason</td><td>Date</td><td>Links</td></tr>";

while($r=mysql_fetch_array($q))

{

$warned=date('F j, Y, g:i:s a',$r['time']);

print "<tr><td><a href=viewuser.php?u={$r['userid']}>{$r['username']}</a></td><td>{$r['warnedfor']}</td><td>$warned</td><td>";

if($ir['userid'] == 1)

{

print "[<a href=warnings.php?action=del&ID={$r['id']}>Remove</a>] ";

}

if($ir['warner'] == $userid || $userid == 1)

{

print "[<a href=warnings.php?action=edit&ID={$r['id']}>Edit</a>]";

}

print "</td></tr>";

}}

function addwarning()

{

global $ir,$c,$userid;

print "<form action=warnings.php?action=addsub method=post>

<input style='visibility: hidden' name=user value={$_GET['userid']}>

Reason:

<textarea rows=7 cols=30 name=reason></textarea>

 

<input type=submit value='Add warning'></form>";

}

function addwarning2()

{

global $ir,$c,$userid;

$_POST['user']=($_POST['user']);

$_POST['reason']=($_POST['reason']);

mysql_query("INSERT INTO warnings VALUES ('','{$_POST['user']}','{$_POST['reason']}','$userid',unix_timestamp())",$c);

$checkfed=mysql_query("SELECT * FROM warnings WHERE user='{$_POST['user']}'",$c);

if(mysql_num_rows($checkfed) > 5)

{

mysql_query("UPDATE users SET fedjail=1 WHERE userid='{$_POST['user']}'",$c);

mysql_query("INSERT INTO fedjail VALUES('','{$_POST['user']}','300','$userid','Reached 6 warnings in game. Account jailed.')",$c);

}

print "Warning Added!

 

[*]<a href=viewuser.php?u={$_POST['user']}>Back to users profile</a>";

}

function deletewarning()

{

global $ir,$c,$userid;

if($ir['userid'] != 1)

{

die("Owner Only");}

mysql_query("DELETE FROM warnings WHERE id={$_GET['ID']}",$c);

print "Warning Deleted";

}

function editwarning()

{

global $ir,$c,$userid;

$target=$_GET['ID'];

$edit=mysql_query("SELECT * FROM warnings WHERE id='$target'",$c);

while($r=mysql_fetch_array($edit))

{

if($r['warner'] != $userid || $userid != 1)

{

die("You never set this warning, therefore cannot edit it");

}

print "<h3>Edit Warning</h3>

 

<form action=warnings.php?action=edit2 method=post>

<input style='visibility: hidden;' name=id value=$target>

<textarea rows=7 cols=30 name=reason>{$r['warnedfor']}</textarea>

 

<input type=submit value='Edit Warning'></form>";

}

}

function editwarning2()

{

global $ir,$c,$userid;

mysql_query("UPDATE warnings SET warnedfor={$_POST['reason']} WHERE id={$_POST['id']}",$c);

print "Warning Updated.

[*]<a href=index.php>Home</a>";

}

?>

there it is for V2, everything else is the same as far as the query goes, and the view user entry

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