Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
General Tutorial [PHP] Account manager script.
Author Message
TeraByTe Offline
PHP Coder
Premium Users

Posts: 64
Joined: Mar 2011
Reputation: 4
Post: #1
[PHP] Account manager script.
Hello,

This is a neat little script I coded for my forum that gets the information of the user and displays it on a styled page. To use it create a new page in your forum root called XXX.php in this case mine is named manage.php

Fill it in with this code be user to fill out the settings inside the file.

PHP Code:
<?php
#MyBB Account Manager Script integration [byTeraByTe]
# Description : Fetches user information based on their last post IP, displays Avatar, UserGroup, Posts Number, Rep, Email.
# Author : TeraByTe
# Created : 5/21/2011
# Updated : N/A
# Thread : http://mybbsource.com/
#MyBB Account Manager Script integration [byTeraByTe]

/*************************************************\
\*************************************************/
/*************************************************\
\*************************************************/
/*************************************************\
\*************************************************/

#Start Settings
$board_title "Hallway Insider"// Board Title
$db_host "localhost"// Database Host
$db_user "terabyte_root";  // Database UserName
$db_pass "pass123"// Database Password
$db_name="terabyte_forum"// Database name
$db_prefix ="mybb_"// Table prefix
#End Settings

/*************************************************\
\*************************************************/
/*************************************************\
\*************************************************/
/*************************************************\
\*************************************************/




$input $_SERVER['REMOTE_ADDR'];
$request $_GET['request'];
if(
$input){
$conn mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db($db_name$conn); 
$query "SELECT * FROM ".$db_prefix."users WHERE lastip = '$input'";
$result mysql_query($query) or die(mysql_error());
$row mysql_fetch_array($result);
$user $row['username'];
$posts $row['postnum'];
$group $row['usergroup'];
$ptz $row['newpoints'];
$rep $row['reputation'];
$ava $row['avatar'];
$email $row['email'];
# Start Ranks
if($group == '4'){$gname 'Administrator';}if($group == '2'){$gname 'Member';}if($group == '8'){$gname 'Subscriber';}if($group == '3'){$gname 'Super Moderator';}if($group == '6'){$gname 'Moderator';}if($group == '7'){$gname 'Banned';}if($group == '9'){$gname 'Community Contributor';} 
# Stop Ranks

#Start Rep Title
if ($rep >= '1')
{
    
$tit "Neutral";
}
if (
$rep >= '2')
{
    
$tit "Good";
}
if (
$rep <= '0')
{
    
$tit "Bad";
}

if(
mysql_num_rows($result)){

?>
<!-- API : 
User :  <?=$user?>  @
Posts : <?=$posts?> @
Group :  <?=$gname?> @
Rep : <?=$rep?> @
Ava : <?=$ava?> @
-->
<html><head>
<title><?=$board_title?></title>
<style> 
.body{
background-color: #C5D0DC;
}
 
.mods_box{
    background: #dce7f2;
    border-top: 1px solid #ebf2f8;
border-bottom: 1px solid #ebf2f8;
padding:0px;
text-align:left;
margin:0;
}
 
.mods_box item{
text-align:right;
}
 
a:link {
    text-decoration: none;
    color: #000;
}
a:visited {
    text-decoration: none;
    color: #000;
}
a:hover {
    text-decoration: none;
    color: #0F0;
}
a:active {
    text-decoration: none;
    color: #000;
}
@font-face {
 
    font-family: ink;
 
    src: url('http://media.hallwayinsider.com/fonts/i.ttf');
 
    }
 
@font-face {
 
    font-family: f25;
 
        src: url('http://media.hallwayinsider.com/fonts/f25.ttf');
 
}
#welcome-block {

    width: 100%;

    overflow: none;

}



.welcome-picture {

    float: left;

    padding: 18px;

    margin: 0px;

}



.welcome-info {

    float: left;

    width: 40%;

    border-left: 1px solid #e4ebf2;

    padding-left: 20px;

}



#welcome-block dt {

    float: left;

    clear: left;

    width: 40%;

}



#welcome-block dd {

    float: left;

}
.title {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    border: 1px solid #bbb;
    background: #333333;
    width: 291px;
    margin-bottom: 0;
    padding: 4px;
    margin-right: 20px;
    border-bottom: 0;
}

</style> 
</head>

<body class="body">

<div class="mods_box"><font size="90" face="ink"><center><?=$board_title?> Account Manager [BETA]</center></font></div>
<div class="mods_box"><div id='welcome-block'>

            <div class='welcome-picture'>

                <img src='<?=$ava?>' alt="<?=$user?>'s Photo" width='96' height='100' class='photo' />

            </div>

            <div class='welcome-info'>


                <dl>

                    <dt><strong>Name</strong></dt>

                    <dd><?=$user?></dd>

                    <dt><strong>Group</strong></dt>

                    <dd><span style='color: green'><b><?=$gname?></b></span></dd>

                    <dt><strong>Email</strong></dt>

                    <dd><?=$email?></dd>

                    <dt><strong>Total Posts</strong></dt>

                    <dd><?=$posts?></dd>

        
                    <dt><strong>Reputation</strong></dt>

                        <dd>

                        

                            <div class='reputation positive'>

                        

                        

                        

                            <span class='number'><?=$rep?></span>

                            

                                <span class='title'><?=$tit?></span>

                            

                            

                        </div>

                        </dd>


                </dl>

            </div>
            </div></div>

</body>
</html>
<?
}
elseif(!isset($modify) && !isset($_GET['browse'])) {
die("Please make a post on $board_title, and try again.");
}
} else {
echo 'Please enter a username';
}
?>

Picture : [Image: ipenfs.png]

Live Demo : http://hallwayinsider.com/manage.php

[Ohmy]Hallway Insider Forums - Join Now. [/Ohmy]
Goals :
✔ = Complete X = Incomplete
[✔] 1 Rep
[X] 5 Rep
[✔] 50 posts
[X] 100 Posts
(This post was last modified: 05-23-2011, 03:53 AM by TeraByTe)
05-22-2011, 05:15 AM
Visit this user's website Find all posts by this user Quote this message in a reply
euantor Offline
Posting Freak
*******
Support

Posts: 870
Joined: Jun 2009
Reputation: 7
Post: #2
RE: [PHP] Account manager script.
Why not just include the MyBB global.php? That way, you'd have access to the database class and all the settings already globalled in the $mybb variable.
05-22-2011, 04:46 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Chandy Offline
Junior Member
**

Posts: 10
Joined: Apr 2009
Reputation: 0
Post: #3
RE: [PHP] Account manager script.
Nice idea dude,but i agree with euantor.
05-22-2011, 10:35 PM
Find all posts by this user Quote this message in a reply
TeraByTe Offline
PHP Coder
Premium Users

Posts: 64
Joined: Mar 2011
Reputation: 4
Post: #4
RE: [PHP] Account manager script.
Well this way you can put it anywhere ... I will probably add in the global class tonight e.e

Thanks for your feedback.

[Ohmy]Hallway Insider Forums - Join Now. [/Ohmy]
Goals :
✔ = Complete X = Incomplete
[✔] 1 Rep
[X] 5 Rep
[✔] 50 posts
[X] 100 Posts
05-23-2011, 03:53 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Corrupt Offline
Junior Member
**

Posts: 7
Joined: Jun 2011
Reputation: 0
Post: #5
RE: [PHP] Account manager script.
Nice work. I'm already using it , it works fine. All you have to do is just secure the page and edit the MYSQL fields in the php file.
06-30-2011, 12:35 AM
Find all posts by this user Quote this message in a reply
fma965 Offline
Member
***

Posts: 78
Joined: Jul 2011
Reputation: 0
Post: #6
RE: [PHP] Account manager script.
+1 eunator
08-01-2011, 12:49 AM
Find all posts by this user Quote this message in a reply
Taz Offline
Junior Member
**

Posts: 11
Joined: Aug 2009
Reputation: 0
Post: #7
RE: [PHP] Account manager script.
Can you make it so that it integrates with your forums theme?
08-03-2011, 07:11 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)