GetInfo/Clan Managment

Results 1 to 9 of 9
  1. #1
    igunz.net Dawson is offline
    LegendRank
    Feb 2010 Join Date
    ::1 (Canada BC)Location
    2,581Posts

    GetInfo/Clan Managment

    Another Snippet from Trinity Entertainment this time from Koreans custom management panel

    This allows users to manage their clans you can combine this with your existing player management panel very easily with a few tweaks it allows users to control many aspects of their clan or even create a clan

    GetInfo.php(It's an include)

    PHP Code:
    <?php

        $getcharnames 
    odbc_exec($connection"
            SELECT Name
            FROM Character
            WHERE AID = '
    $_SESSION[AID]' AND Deleteflag = '0'
        "
    );
        
    $CN1 odbc_result($getcharnames1);
        
    $getcharnames odbc_exec($connection"
            SELECT Name
            FROM Character
            WHERE AID = '
    $_SESSION[AID]' AND Deleteflag = '0' AND Name != '$CN1'
        "
    );
        
    $CN2 odbc_result($getcharnames1);
        
    $getcharnames odbc_exec($connection"
            SELECT Name
            FROM Character
            WHERE AID = '
    $_SESSION[AID]' AND Deleteflag = '0' AND Name != '$CN1' AND Name != '$CN2'
        "
    );
        
    $CN3 odbc_result($getcharnames1);
        
    $getcharnames odbc_exec($connection"
            SELECT Name
            FROM Character
            WHERE AID = '
    $_SESSION[AID]' AND Deleteflag = '0' AND Name != '$CN1' AND Name != '$CN2' AND Name != '$CN3'
        "
    );
        
    $CN4 odbc_result($getcharnames1);
        
    $getcid odbc_exec($connection"
            SELECT CID
            FROM Character
            WHERE AID = '
    $_SESSION[AID]' AND Deleteflag = '0'
        "
    );
        
    $CID1 odbc_result($getcid1);
        
    $getcid odbc_exec($connection"
            SELECT CID
            FROM Character
            WHERE AID = '
    $_SESSION[AID]' AND Deleteflag = '0' AND CID != '$CID1'
        "
    );
        
    $CID2 odbc_result($getcid1);
        
    $getcid odbc_exec($connection"
            SELECT CID
            FROM Character
            WHERE AID = '
    $_SESSION[AID]' AND Deleteflag = '0' AND CID != '$CID1' AND CID != '$CID2'
        "
    );
        
    $CID3 odbc_result($getcid1);
        
    $getcid odbc_exec($connection"
            SELECT CID
            FROM Character
            WHERE AID = '
    $_SESSION[AID]' AND Deleteflag = '0' AND CID != '$CID1' AND CID != '$CID2' AND CID != '$CID3'
        "
    );
        
    $CID4 odbc_result($getcid1);
        
    $getclan odbc_exec($connection"
            SELECT Name
            FROM Clan
            WHERE MasterCID = '
    $CID1' AND Deleteflag = '0'
        "
    );
        
    $CLAN1 odbc_result($getclan1);
        
    $getclan odbc_exec($connection"
            SELECT Name
            FROM Clan
            WHERE MasterCID = '
    $CID2' AND Deleteflag = '0'
        "
    );
        
    $CLAN2 odbc_result($getclan1);
        
    $getclan odbc_exec($connection"
            SELECT Name
            FROM Clan
            WHERE MasterCID = '
    $CID3' AND Deleteflag = '0'
        "
    );
        
    $CLAN3 odbc_result($getclan1);
        
    $getclan odbc_exec($connection"
            SELECT Name
            FROM Clan
            WHERE MasterCID = '
    $CID4' AND Deleteflag = '0'
        "
    );
        
    $CLAN4 odbc_result($getclan1);
        
    $getclan odbc_exec($connection"
            SELECT CLID
            FROM Clan
            WHERE MasterCID = '
    $CID1' AND Deleteflag = '0'
        "
    );
        
    $CLID1 odbc_result($getclan1);
        
    $getclan odbc_exec($connection"
            SELECT CLID
            FROM Clan
            WHERE MasterCID = '
    $CID2' AND Deleteflag = '0'
        "
    );
        
    $CLID2 odbc_result($getclan1);
        
    $getclan odbc_exec($connection"
            SELECT CLID
            FROM Clan
            WHERE MasterCID = '
    $CID3' AND Deleteflag = '0'
        "
    );
        
    $CLID3 odbc_result($getclan1);
        
    $getclan odbc_exec($connection"
            SELECT CLID
            FROM Clan
            WHERE MasterCID = '
    $CID4' AND Deleteflag = '0'
        "
    );
        
    $CLID4 odbc_result($getclan1);

    ?>
    Andd clan.php

    PHP Code:
    <div align="center">
    <script type="text/javascript">
    function confirmunassign(){
    msg = "Confirm this action?";
    return confirm(msg);
    }
    </script>
    <?php
    include "getinfo.php";

    if( 
    $CN1 == '' )
    {
                
    $_SESSION[MSG] = 'You do not have any characters.';
                
    redirect("index.php");
                die();
    }


    ?>

    <table>
    <?php
    if( $CLAN1 == '' && $CLAN2 == '' && $CLAN3 == '' && $CLAN4 == '' )
    ?>


    <tr><td colspan=2><center><b>Clan Management Tools</center></b></td></tr>
    <tr><td colspan=2><center>Create Clan</center></td></tr>
    <form method="post" action="index.php?account=clan">
    <tr>
        <td colspan=2><center>
        <select name="character">

    <?php
    if( $CN1 == '' )
    {
    }
    else
    {
    ?>
        <option value="1"><?php echo $CN1?></option>
    <?php ?>
    <?php
    if( $CN2 == '' )
    {
    }
    else
    {
    ?>
            <option value="2"><?php echo $CN2?></option>
    <?php ?>
    <?php
    if( $CN3 == '' )
    {
    }
    else
    {
    ?>
            <option value="3"><?php echo $CN3?></option>
    <?php ?>
    <?php
    if( $CN4 == '' )
    {
    }
    else
    {
    ?>
            <option value="4"><?php echo $CN4?></option>
    <?php ?>

        </select> 
        <input type="text" name="newclan" MAXLENGTH=14/>&nbsp;<input type="submit" name="createclan" value="Create" />
    </center>
    </td>
    </tr>
    </form>


    <?php
    }
    else{
    ?>
    <tr><td colspan=2><center><b>Clan Management Tools</center></b></td></tr>
    <tr><td colspan=2><center>Create Clan</center></td></tr>
    <form method="post" action="index.php?account=clan">
    <tr>
        <td colspan=2><center>
        <select name="character">

    <?php
    if( $CN1 == '' )
    {
    }
    else
    {
    ?>
        <option value="1"><?php echo $CN1?></option>
    <?php ?>
    <?php
    if( $CN2 == '' )
    {
    }
    else
    {
    ?>
            <option value="2"><?php echo $CN2?></option>
    <?php ?>
    <?php
    if( $CN3 == '' )
    {
    }
    else
    {
    ?>
            <option value="3"><?php echo $CN3?></option>
    <?php ?>
    <?php
    if( $CN4 == '' )
    {
    }
    else
    {
    ?>
            <option value="4"><?php echo $CN4?></option>
    <?php ?>

        </select> 
        <input type="text" name="newclan" MAXLENGTH=14/>&nbsp;<input type="submit" name="createclan" value="Create" />
    </center>
    </td>
    </tr>
    <tr><td>&nbsp;</td></tr>
    <tr><td>&nbsp;</td></tr>
    </form>
    <tr><td colspan=2><center>Clan Selection</center></td></tr>
    <form enctype="multipart/form-data" onsubmit="return confirmunassign();" action="index.php?account=clan" method="post">
    <tr>
        <td colspan=2><center>
        <select name="clanselect">
    <?php
    if( $CLAN1 == '' )
    {
    }
    else
    {
    ?>
        <option value="1"><?php echo $CLAN1; echo ' // '; echo $CN1?></option>
    <?php ?>
    <?php
    if( $CLAN2 == '' )
    {
    }
    else
    {
    ?>
            <option value="2"><?php echo $CLAN2; echo ' // '; echo $CN2?></option>
    <?php ?>
    <?php
    if( $CLAN3 == '' )
    {
    }
    else
    {
    ?>
            <option value="3"><?php echo $CLAN3; echo ' // '; echo $CN3?></option>
    <?php ?>
    <?php
    if( $CLAN4 == '' )
    {
    }
    else
    {
    ?>
            <option value="4"><?php echo $CLAN4; echo ' // '; echo $CN4?></option>
    <?php ?>

    </select>
    </center>
    </td>
    </tr>
    <tr><td>&nbsp;</td></tr>
    <tr><td colspan=2><center>Reset Clan Score</center></td></tr>
    <tr><td colspan=2><center><input type="submit" name="resetclan" value="Reset"></center></td></tr>
    <tr><td>&nbsp;</td></tr>
    <tr><td colspan=2><center>Delete Clan</center></td></tr>
    <tr><td colspan=2><center><input type="submit" name="deleteclan" value="Delete"></center></td></tr>
    <tr><td>&nbsp;</td></tr>
    <tr><td colspan=2><center>Upload Emblem</center></td></tr>
    <tr><td colspan=2><center><input name="uploaded" type="file" /> <input type="submit" name="emblemupload" value="Upload" /></td></tr>
    </form>
    <?php ?>
    </table>
    <br><br>


    </div>

    <?php

        $character 
    CorrectString($_POST['character']);
        if ( 
    $character == )
        {
        
    $usecid $CID1;
        }
        if ( 
    $character == )
        {
        
    $usecid $CID2;
        }
        if ( 
    $character == )
        {
        
    $usecid $CID3;
        }
        if ( 
    $character == )
        {
        
    $usecid $CID4;
        }
        
        
    $clanselect CorrectString($_POST['clanselect']);
        if ( 
    $clanselect == )
        {
        
    $useclan $CLAN1;
        
    $useclid $CLID1;
        }
        if ( 
    $clanselect == )
        {
        
    $useclan $CLAN2;
        
    $useclid $CLID2;
        }
        if ( 
    $clanselect == )
        {
        
    $useclan $CLAN3;
        
    $useclid $CLID3;
        }
        if ( 
    $clanselect == )
        {
        
    $useclan $CLAN4;
        
    $useclid $CLID4;
        }
        

        if( isset(
    $_POST['createclan']) )
        {
            
    $checkexist odbc_exec($connection"SELECT CLID FROM ClanMember WHERE CID = '$usecid'");
            
    $clanname CorrectString($_POST['newclan']);
            if (
    preg_match("/^[a-zA-Z0-9| ]{3,}+$/"$clanname))
            {

            
    $query01 odbc_exec($connection"SELECT CLID FROM Clan WHERE Name = '$clanname'");
            if( 
    num_rows($checkexist) != )
            {
                {
                    
    $_SESSION[MSG] = 'That character is a member of another clan.';
                    
    redirect("index.php?account=clan");
                    die();
                }
            }
            elseif( 
    num_rows($query01) != )
            {
                
    $_SESSION[MSG] = 'That clan name is taken.';
                
    redirect("index.php?account=clan");
                die();
            }
            else
            {

                
    odbc_exec($connection"
                                INSERT INTO Clan (Name, MasterCID, RegDate)
                                VALUES ('
    $clanname', '$usecid', GETDATE())");

                
    $getclid odbc_exec($connection"SELECT CLID FROM Clan WHERE Name = '$clanname' AND MasterCID = '$usecid'");
                
    odbc_fetch_row($getclid);
                
    $clid odbc_result($getclid1);

                
    odbc_exec($connection"
                                INSERT INTO ClanMember (CLID, CID, Grade, RegDate)
                                VALUES ('
    $clid', '$usecid', 1, GETDATE())");
                                
                
    logclancreate$clanname$usecid );
                
    $_SESSION[MSG] = 'Clan creation successful.';
                
    redirect("index.php?account=clan");
                die();
            }
            }
            else
            {
                
    $_SESSION[MSG] = 'Invalid name format.  Please try again.';
                
    redirect("index.php?account=clan");
                die();
            }

        }
        elseif( isset(
    $_POST['deleteclan']) )
        {

            if( 
    $useclan "" )
            {
                
    $_SESSION[MSG] = 'Please fill in all of the fields.';
                
    redirect("index.php?account=clan");
                die();
            }
            else
            {
            
    $query01 odbc_exec($connection"SELECT CLID, Name FROM Clan WHERE CLID = '$useclid'");
            }
            if( 
    num_rows($query01) != )
            {
                
    $_SESSION[MSG] = 'That clan does not exist.';
                
    redirect("index.php?account=clan");
                die();
            }
            else
            {
                
    odbc_fetch_row($query01);
                
    $clid odbc_result($query011);
                
    $name odbc_result($query012);
                
    odbc_exec($connection"DELETE FROM ClanMember WHERE CLID = '$clid'");
                
    odbc_exec($connection"UPDATE Clan SET Name = NULL, DeleteFlag = 1, Point = 0, DeleteName = '$name' WHERE CLID = '$clid'");
                
                
    logclandelete$name );
                
    $_SESSION[MSG] = 'Clan deletion successful.';
                
    redirect("index.php?account=clan");
                die();
            }
        }
        elseif( isset(
    $_POST['resetclan']) )
        {
            
    $query01 odbc_exec($connection"SELECT CLID, Name FROM Clan WHERE CLID = '$useclid'");
            if( 
    $useclan == "" )
            {
                
    $_SESSION[MSG] = 'Please fill in all of the fields.';
                
    redirect("index.php?account=clan");
                die();
            }
            if( 
    num_rows($query01) != )
            {
                
    $_SESSION[MSG] = 'That clan does not exist.';
                
    redirect("index.php?account=clan");
                die();
            }
            else
            {
                
    odbc_fetch_row($query01);
                
    $clid odbc_result($query011);
                
    $name odbc_result($query012);

                
    odbc_exec($connection"
                                UPDATE Clan SET Ranking = 0, Wins=0, Losses=0, Point=1000,
                                RankIncrease=0, LastDayRanking=0 WHERE CLID = '
    $clid'");

                
    logclanreset$name );
                
    $_SESSION[MSG] = 'The clan score has been successfully reset.';
                
    redirect("index.php?account=clan");
                die();
            }
        }
        elseif( isset(
    $_POST['emblemupload'] ) ) {                   
            
    $emblem CorrectString($_POST['uploaded']) ;
            
    $target "../emblems/upload/upload/";
            
    $target $target basename$_FILES['uploaded']['name']);
            
    $ok=1;
            if (
    $_FILES['uploaded']['size']  > '15000')
                {
                    
    $_SESSION[MSG] = 'The file size is too large.';
                    
    redirect("index.php?account=clan");
                    die();
                if((
    $_FILES['uploaded']['type'] != "image/jpeg"))
                { 
                    
    $ok=0;
                }
                if((
    $_FILES['uploaded']['type'] != "image/GIF"))
                { 
                    
    $ok=0;
                }
                if((
    $_FILES['uploaded']['type'] != "image/PNG"))
                { 
                    
    $ok=0;
                }
            }
            else {
    $ok=1;}
            if (
    $ok==0)
            {
                
    $_SESSION[MSG] = 'Please recheck your image size or format.';
                
    redirect("index.php?account=clan");
                die();
            }
            else
            {

                if(
    move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
                {

                    
    $target 'upload/' basename$_FILES['uploaded']['name']);
                    
    odbc_exec($connection"UPDATE Clan SET EmblemChecksum = EmblemChecksum + 1 WHERE CLID = '$useclid'");
                    
    odbc_exec($connection"UPDATE Clan SET EmblemUrl = 'upload/".$target."' WHERE CLID = '$useclid'");
                    
    $_SESSION[MSG] = 'Your emblem has been uploaded.  Please allow 12-48 hours for your emblem to appear in-game.';
                    
    redirect("index.php?account=clan");
                    die();
                }
                else
                {
                    
    $_SESSION[MSG] = 'There was an unexpected error.';
                    
    redirect("index.php?account=clan");
                    die();
                }
            }
        }

    ?>


    Again, sorry this isn't just a drag and drop work, but it will save some PHP devs plenty of time if they plan on making their own clan management from scrap they can just take a looksi loo here and do some "shortcuts"


  2. #2
    Reality, What is? Rain is offline
    MemberRank
    Jan 2009 Join Date
    PhotoshopLocation
    804Posts

    Re: GetInfo/Clan Managment

    this is AWESOME! i love you <3
    Thanks and nice releas

  3. #3
    igunz.net Dawson is offline
    LegendRank
    Feb 2010 Join Date
    ::1 (Canada BC)Location
    2,581Posts

    Re: GetInfo/Clan Managment

    Quote Originally Posted by azureamv View Post
    this is AWESOME! i love you <3
    Thanks and nice releas
    No problem, if you know anything about PHP this should save you plenty of time rather than making your own ^_^;

    When you're done with it you should drop me a PM with what you used it in I'd like to see how it was implemented!

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

    Re: GetInfo/Clan Managment

    Thanks. This looks pretty useful. I'll test it later.

  5. #5
    Account Upgraded | Title Enabled! wesley1189 is offline
    MemberRank
    Dec 2009 Join Date
    On a potatoLocation
    407Posts

    Re: GetInfo/Clan Managment

    Thanks, this is kinda usefull!

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

    Re: GetInfo/Clan Managment

    I tried it but it's just blank on the website. Nothing shows up.

  7. #7
    igunz.net Dawson is offline
    LegendRank
    Feb 2010 Join Date
    ::1 (Canada BC)Location
    2,581Posts

    Re: GetInfo/Clan Managment

    Quote Originally Posted by Phoenix View Post
    I tried it but it's just blank on the website. Nothing shows up.
    It's not just a drag to your webserver and use kinda deal, you need to integrate it into what you currently have working.

    It's really just small changes. and a lot of copy pasting to make it work.

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

    Re: GetInfo/Clan Managment

    Quote Originally Posted by DawsonByrd View Post
    It's not just a drag to your webserver and use kinda deal, you need to integrate it into what you currently have working.

    It's really just small changes. and a lot of copy pasting to make it work.
    I'm using the MPOG web but I don't know what changes are to be made in this clan panel script to make it work with my web.

  9. #9
    I am THE DON Joe9099 is offline
    MemberRank
    Jan 2007 Join Date
    England, UkLocation
    3,655Posts

    Re: GetInfo/Clan Managment

    Excellent! now i don't got to do it all on my own, srsly i was just about to do something like this for my server, but heh, why do it when its provided :D

    Good job once again dawson!



Advertisement