IPBanning script

Results 1 to 13 of 13
  1. #1
    Account Upgraded | Title Enabled! fuxpro321 is offline
    MemberRank
    Jun 2010 Join Date
    266Posts

    IPBanning script

    a script that the admins can add the USER ID OR Character name and it just look for the IP in the DB and add it to the Ipbans.dbo
    Last edited by fuxpro321; 21-12-10 at 11:50 AM.


  2. #2
    Ā  Phoenix is offline
    ModeratorRank
    Mar 2009 Join Date
    6,890Posts

    Re: IPBanning script

    No lifex's MPOG web has that function.

  3. #3
    Account Upgraded | Title Enabled! fuxpro321 is offline
    MemberRank
    Jun 2010 Join Date
    266Posts

    Re: IPBanning script

    EDIT:i need one that dosent need the to Enter the Users IP Adress

    just the Charname or the User ID
    Last edited by fuxpro321; 21-12-10 at 12:27 PM.

  4. #4
    Account Upgraded | Title Enabled! alfredao is offline
    MemberRank
    Jan 2008 Join Date
    Coronel FabriciLocation
    705Posts

    Re: IPBanning script

    DECLARE @IP VARCHAR(40)
    DECLARE @UserID VARCHAR(20)

    SET @UserID = 'xxxxx'

    SELECT @IP = LastIP FROM Login WHERE UserID = @UserID

    INSERT INTO [IPBans] (UserID, IP) VALUES (@UserID, @IP)


    Execute in SQL Server management
    Last edited by alfredao; 21-12-10 at 02:06 PM.

  5. #5
    Account Upgraded | Title Enabled! fuxpro321 is offline
    MemberRank
    Jun 2010 Join Date
    266Posts

    Re: IPBanning script

    and?

    what dose it do?

    and could be provide the script?

  6. #6
    Account Upgraded | Title Enabled! alfredao is offline
    MemberRank
    Jan 2008 Join Date
    Coronel FabriciLocation
    705Posts

    Re: IPBanning script

    PHP Code:
    <?php

    if(isset($_POST['submit']))
    {
        
        
    $userid $_POST['userid'];
        
        
    $a mssql_query("SELECT LastIP FROM Login WHERE UserID = " $userid);
        
        if(
    mssql_num_rows($a) == 0)
        {
            echo 
    "Invalid userid";
            die();
        }
        
        
    $b mssql_fetch_array($a);
        
        if(
    $b['LastIP'] == "")
        {
            echo 
    "User ip not exists";
            die();
        }
        else
        {
            
    mssql_query("INSERT INTO [IPBans] (UserID, IP) VALUES ('$userid', '{$b['LastIP']}')");
            echo 
    "UserID " $userid " ip banned";
        }
    }
    ?>

    <form method="POST" action="">
      UserID: 
      <input type="text" name="userid" id="userid" />
      <input name="submit" type="submit" id="submit" value="Ban">
    </form>
    Last edited by alfredao; 21-12-10 at 06:23 PM.

  7. #7
    Account Upgraded | Title Enabled! fuxpro321 is offline
    MemberRank
    Jun 2010 Join Date
    266Posts

    Re: IPBanning script

    Code:
    Warning: mssql_query() [function.mssql-query]: message: Invalid column name 'lol'. (severity 16) in C:\AppServ\www\web\BANIP.PHP on line 8
    
    Warning: mssql_query() [function.mssql-query]: Query failed in C:\AppServ\www\web\BANIP.PHP on line 8
    
    Warning: mssql_num_rows(): supplied argument is not a valid MS SQL-result resource in C:\AppServ\www\web\BANIP.PHP on line 10
    Invalid userid
    Here is the script i added to my DB..

    I Edited abit cause it dosent Execute to the DB


    Code:
    Use [GunzDB]
    GO
    
    DECLARE @IP VARCHAR(40)
    DECLARE @UserID VARCHAR(20)
    
    SET @UserID = 'xxxxx'
    
    SELECT @IP = LastIP FROM Login WHERE UserID = @UserID
    
    INSERT INTO [IPBans] (UserID, IP) VALUES (@UserID, @IP)
    so any idea?

    screenie before

    Last edited by fuxpro321; 22-12-10 at 08:44 AM.

  8. #8
    Account Upgraded | Title Enabled! alfredao is offline
    MemberRank
    Jan 2008 Join Date
    Coronel FabriciLocation
    705Posts

    Re: IPBanning script

    Edit this
    PHP Code:
    $a mssql_query("SELECT LastIP FROM Login WHERE UserID = " $userid); 
    to
    PHP Code:
    $a mssql_query("SELECT LastIP FROM Login WHERE UserID = '" $userid "'"); 

  9. #9
    Account Upgraded | Title Enabled! fuxpro321 is offline
    MemberRank
    Jun 2010 Join Date
    266Posts

    Re: IPBanning script

    now it says Invalid userid

    yes i am sure i entered the correct info

  10. #10
    Account Upgraded | Title Enabled! alfredao is offline
    MemberRank
    Jan 2008 Join Date
    Coronel FabriciLocation
    705Posts

    Re: IPBanning script

    Are you sure the userid exists?

  11. #11
    Account Upgraded | Title Enabled! fuxpro321 is offline
    MemberRank
    Jun 2010 Join Date
    266Posts

    Re: IPBanning script

    Yeah1

  12. #12
    Enthusiast notbanned is offline
    MemberRank
    Dec 2010 Join Date
    29Posts

    Re: IPBanning script

    BUMP! i am fuxpro321

  13. #13
    Enthusiast notbanned is offline
    MemberRank
    Dec 2010 Join Date
    29Posts

    Re: IPBanning script

    bump!



Advertisement