Current location: Hot Scripts Forums » Programming Languages » PHP » custom admin login script... phpbb3 database

custom admin login script... phpbb3 database

Reply
  #1 (permalink)  
Old 10-11-08, 06:21 PM
gaogier gaogier is offline
New Member
 
Join Date: Oct 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
custom admin login script... phpbb3 database

the login page would use the data from the old phpbb2 forums.

Then, it would allow you to login.

What i have done, is change the login info, delete the part that checks if a user is active or not (not in phpbb3), then i attempted to login.

I cant login, no errors, or anything comes up.

I have done some research on this, and it appears that phpbb has changed its password encryption. some people have said they use their own encryption now. I have a few login scripts. They all use this line of code.

if(phpbb_check_hash($password, $user->user_password))

They also use a hash.php file. Which i have, and added this to an includes file.

This is now my code.

Code:
<?php
include ('diffhead.inc');
?><img src="images/homepage13.jpg" alt="" width="727" height="48"></td>
                                                    </tr>
                                                    <tr>
                                                        <td><table width="100%" border="0" cellspacing="0" cellpadding="0" id="box4" class="box">
                                                                <tr>
                                                                    <td class="content">
<center>
<?php
 
include('includes/hash.php');
 
if(isset($_POST['submit'])){
if(empty($_POST['username'])){
        $username = FALSE;
        $message = '<table width=98% bgcolor=#faf5f4 class=logfail align=center><tr>
                            <td width=40><img src=images/exclamation.gif></td>
                            <td align=left>
                            <b>Login Failed!</b> <br />
                            No username entered.
                            <br />Please Try again<br />
                            </table><br /><br />';
    }else{
        $username = $_POST['username'];
    }
    if(empty($_POST['password'])){
        $password = FALSE;
        $message1 = '<br /><table width=98% bgcolor=#faf5f4 class=logfail align=center><tr>
                            <td width=40><img src=images/exclamation.gif></td>
                            <td align=left>
                            <b>Login Failed!</b> <br />
                            No password entered.
                            <br />Please Try again<br />
                            </table><br /><br />';
    }else{
        $password = $_POST['password'];
        //$password = md5($password1);      
    }
    //echo $password1 .' ' .$password. ' ' .$username;
    if($username && $password){
 
 
        require_once ('../mysql_connect1.php');
        $query = "SELECT user_id, username, user_email, user_password, user_sitemod FROM phpbb_users WHERE username='$username' AND user_password='$password' AND user_sitemod = '1'";
        $result = mysql_query ($query) or DIE ("Error in query $query" . mysql_error());
        $row = mysql_fetch_array ($result);
        if(mysql_num_rows($result) > 0)
                {
                    $_SESSION['user_sitemod'] = $row['user_sitemod'];
                    $_SESSION['user_avatar'] = $row['user_avatar'];
                    $_SESSION['user_email'] = $row['user_email'];
                    $_SESSION['username'] = $row['username'];
                    $_SESSION['user_id'] = $row['user_id'];
                    //ob_end_clean();
 
                //  include('diffhead.inc');
                    include ('admin.inc');
                    echo '<p align="center">You\'ve logged in successfully.</p>';
                    include('difffooter.inc');
                }else{
                    $message = '<table width=98% bgcolor=#342d25 class=logfail align=center><tr>
                            <td width=40><img src=images/exclamation.gif></td>
                            <td align=left>
                            <B>Login Failed!</B> <BR>
                            The login combination you entered was not found. 
                            <BR>Please Try again<br />
                            </table><br /><br />';      
                    }
    
    
    }
}
 
echo '<font face=verdana size=2> <b>Login</b></font><br /><br />'.$message.$message1.'
Your browser must allow cookies in order to login.<br />';
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
                            <table width=98% bgcolor=#342d25 class=blueborder align=center>
                              <tr>
                            <td width=40><img src=images/keylogin.gif></td>
                            <td align=right>                            
                            <B>Username:</B> <br /><br />
                            <B>Password:</B> <br /></td>
                            <td align=left>
                            <input type="text" name="username" size="10" maxlength="20" class="login" value ="<?php if (isset($_POST['username'])) echo $_POST['username']; ?>" />&nbsp;&nbsp;<small><i>Please enter your username</i></small><br /><br />                          
                            <input type="password" name="password" size="20" maxlength="20" class="login"/>&nbsp;&nbsp;<small><i>Please enter your password</i></small></td></tr>
                            <tr><td width=40></td><td align="center"><input type="submit" name="submit" class="login" value="Login" /></td></tr>
            </table><br /><br />
</form></center>
<?php
include ('difffooter.inc');
?>

The code that I know works, but for something different.

Code:
<html>
<body>
<?php
 
include('generate_sig.php');
include('includes/hash.php');
include('mysql_connect_sig.php');
 
if(isset($_POST['submit'])){
if(empty($_POST['username'])){
        $username = FALSE;
        $message = '<table width=98% bgcolor=#faf5f4 class=logfail align=center><tr>
                            <td width=40><img src=images/exclamation.gif></td>
                            <td align=left>
                            <b>Login Failed!</b> <br />
                            No username entered.
                            <br />Please Try again<br />
                            </table><br /><br />';
    }else{
        $username = $_POST['username'];
    }
    if(empty($_POST['password'])){
        $password = FALSE;
        $message1 = '<br /><table width=98% bgcolor=#faf5f4 class=logfail align=center><tr>
                            <td width=40><img src=images/exclamation.gif></td>
                            <td align=left>
                            <b>Login Failed!</b> <br />
                            No password entered.
                            <br />Please Try again<br />
                            </table><br /><br />';
    }else{
        $password = $_POST['password'];
        //$password = md5($password1);      
    }
    //echo $password1 .' ' .$password. ' ' .$username;
    if($username && $password){
        
        /* Connect to the database and prepare the signature */
        //require_once ('../mysql1_connect1.php');
        
        //echo 'username: ' . USERNAME;
        $db_connection = mysql_connect(HOST, USERNAME, PASSWORD) or die("Could not connect to DB");
        
        /* Select the database we need */
        mysql_select_db(DBNAME, $db_connection) or die("Could not find DB");
            
        $query = "SELECT u.user_id, u.username, u.user_posts, u.user_password, u.user_form_salt, p.pf_runescape_user FROM phpbb_users u, phpbb_profile_fields_data p WHERE u.username='$username' AND u.user_id=p.user_id";
        $result = mysql_query($query, $db_connection);
        
        if (!$result) {
            die(mysql_error());
        }
        
        $user = mysql_fetch_object($result);
 
        if($user != NULL)
        {
            
            if(phpbb_check_hash($password, $user->user_password))
            {
                if($user->user_posts < 10) { // User MUST have 10 or more posts in order to get the signature
                    
                   $message = '<table width=98% bgcolor=#faf5f4 class=logfail align=center><tr>
                        <td width=40><img src=images/exclamation.gif></td>
                        <td align=left>
                        <B>Signature Retrieval Failed!</B> <BR>
                        You need to have made at least 10 posts before you can retrieve your signature.
                        </table><br /><br />';
                } else {
                    if($user->pf_runescape_user != '') {
                        ?>
                        <form name="myform" action="/dynsig/image.php" method="post">
                            <input type="hidden" name="username" value="<?php if ($user->pf_runescape_user) echo $user->pf_runescape_user; ?>">
                            <input type="hidden" name="userid" value="<?php if ($user->user_id) echo $user->user_id; ?>">
                        </form>
                        
                        <script language="javascript">
                            document.myform.submit();
                        </script>
                        <?php
                    } else {
                        $message = '<table width=98% bgcolor=#faf5f4 class=logfail align=center><tr>
                                <td width=40><img src=images/exclamation.gif></td>
                                <td align=left>
                                <b>No Registered Runescape User!</b> <br /><br />
                                <form name="myform" action="/dynsig/image.php" method="post">
                                    Please enter your Runescape username:<input type="text" name="rsuser" size="10" maxlength="20" class="login" value ="'.$_POST["pf_runescape_user"].'" />&nbsp;&nbsp;<br /><br />
                                    <input type="hidden" name="userid" value="'.$user->user_id.'">
                                    <input type="submit" name="rs_submit" value="Submit" />
                                </form>
                                </table><br /><br />';
                    }
                }
            } else {
                $message = '<table width=98% bgcolor=#faf5f4 class=logfail align=center><tr>
                        <td width=40><img src=images/exclamation.gif></td>
                        <td align=left>
                        <B>Login Failed!</B> <BR>
                        The login combination you entered was not found.
                        <BR>Please Try again<br />
                        </table><br /><br />';  
            }
        } else {
            $message = '<table width=98% bgcolor=#faf5f4 class=logfail align=center><tr>
                    <td width=40><img src=images/exclamation.gif></td>
                    <td align=left>
                    <B>Login Failed!</B> <BR>
                    The login combination you entered was not found. 
                    <BR>Please Try again<br />
                    </table><br /><br />';      
        }
    }
}
if(!isset($_POST['submit'])){
echo '<font face=verdana size=2 color=#3FC7C9> <b>Login</b></font><br /><br />'.$message.$message1.'
Login using your forum account.<br />
You must have a forum account and have set the "Username" field in order to use our dynamic sigs.<br />';
 
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
                            <table width=98% bgcolor=#f5f8ff class=blueborder align=center><tr>
                            <td align=right>
                            <B>Username:</B> <br /><br />
                            <B>Password:</B> <br /></td>
                            <td align=left>
                            <input type="text" name="username" size="10" maxlength="20" class="login" value ="<?php if (isset($_POST['username'])) echo $_POST['username']; ?>" />&nbsp;&nbsp;<small><i>Please enter your forum username</small></i><br /><br />
                            <input type="password" name="password" size="10" maxlength="20" class="login" value ="<?php if (isset($_POST['password'])) echo $_POST['password']; ?>" />&nbsp;&nbsp;<small><i>Please enter your forum password</small></i><br /><br />
                            <tr><td width=40></td><td align="center"><input type="submit" name="submit" class="login" value="Login" /></td></tr>
                            </table><br /><br />
</form>
<?php
} else {
    echo($message);
}
 
?>
</body>
</html>
I just need that code somehow merged with my login script. Then it should work, but I dont know what I am doing, and im asking for help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 10-13-08, 03:18 PM
smithygotlost smithygotlost is offline
Coding Addict
 
Join Date: Jul 2006
Location: United Kingdom
Posts: 347
Thanks: 7
Thanked 0 Times in 0 Posts
ok well from what your asking and what your giving doesnt really help you hence the lack of replie's so why are you looking at using your own login script ? whats wrong with the one used by phpbb3 ? could you not just mod that login script to make it do what you want ?

once i get a bit more info ill try my best to help you

thanks
mike
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
phpbb3 integration using existing login acctman PHP 1 07-08-08 10:40 AM
Login Script v1.9 Problem SuavyDoodle JavaScript 8 09-28-06 09:13 PM
Simple Login Script Help dflowers PHP 2 05-10-06 06:52 PM
Login script not working in frame... varial PHP 6 03-04-05 09:26 AM
login script required lochie Script Requests 2 03-06-04 07:44 PM


All times are GMT -5. The time now is 10:05 AM.
vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.