View Single Post
  #3  
Old 03-29-2008, 09:14 AM
Vedran is offline Vedran
Registered User

Join Date: Mar 2008
Posts: 2

Yes, i'm actually accessing pbpBB db here is the code:

PHP Code:
<? mysql_connect('localhost', 'omeragic_phpb1', 'g7zCV9VJmuNJ'); ?>
            <?php
            
if($_POST['login']) {
                if(
auth_user($_POST['username'],$_POST['user_password'])) {
                    echo(
"You are now logged in. Click here to go to your page");
                } else {
                    echo(
"Login Failed! Please try again. <br /><br />");
                }
            }
            
            
login_form(); 
            
?>

            
            <?
            function auth_user($username,$user_password) {            
                $query=mysql_query("SELECT username,user_password FROM phpbb_users WHERE username='".addslashes($username)."' AND user_password='".addslashes($user_password)."' LIMIT 1");
                if(mysql_num_rows($query) > 0) {
                    setcookie("loggedin",true,time()+170000);
                    $_SESSION['loggedin']=true;
            
                    return true;
            
                } else {
                    return false;
            
                }
                return false;
            }
            
            function is_logged_in() {
            
                if(($_COOKIE['loggedin']==true) or ($_SESSION['loggedin']==true)) {
                    return true;
                } else {
                    return false;
                }
            }
            
            
            function login_form() {
            ?> 
            <form method="post" action="<?echo($_SERVER['PHP_SELF']);?>">
            Username: <input type="text" name="username" value="" /><br />
            Password: <input type="password" name="user_password" value="" /><br />
            <input type="hidden" name="login" value="true" />
            <input type="submit" name="submit" value="login" />
            </form>
            <?
            }
            ?>
EDIT: btw, sorry for wraping the forum with my post
Reply With Quote