girish_327
Posts: 108
|
| Posted: 03/23/2010, 1:13 AM |
|
Hello All,
I would like use PHPBB3 Forum User Name Password as Codecharge Login and Password.
I got one PHP Program Using which I can Authonticate php_users database table.
but using same username password How come I Login in CCS Program.
Below is Login Program for Checking User Name and Password of PHPBB3
<?php
//ob
ob_start();
//session
session_start();
/*if (isset($_SESSION['username']))
{
header("Location: ./forum/");
exit();
}*/
//connect
$error = 'Could not connect to the database';
mysql_connect('localhost','root','') or die($error);
mysql_select_db('phpbb3') or die($error);
//include functions.php phpbb script
require 'forum/includes/functions.php';
if ($_POST['login'])
{
//get form data
$username = addslashes(strip_tags(strtolower($_POST['username'])));
$password = addslashes(strip_tags($_POST['password']));
if (!$username||!$password)
echo "Please enter a username and password<p />";
else
{
//find username
$find = mysql_query("SELECT * FROM phpbb_users WHERE username_clean='$username'");
if (mysql_num_rows($find)==0)
echo "Username not found<p />";
else
{
while ($find_row = mysql_fetch_assoc($find))
{
// grab password hash for user
$password_hash = $find_row['user_password'];
$userid_hash = $find_row['user_id'];
$usergroup_hash = $find_row['group_id'];
}
$check = phpbb_check_hash($password, $password_hash);
if ($check==FALSE)
echo "Incorrect password<p />";
else if ($check==TRUE)
{
$_SESSION['username']=$username;
$_SESSION['UserLogin']=$username;
$_SESSION['UserID']=$userid_hash;
$_SESSION['GroupID']=$usergroup_hash;
$_COOKIE['arabicLogin'] = $username;
header("Location:login.php?Login=True");
//exit();
}
}
}
}
?>
<form action="login.php" method="POST">
Username:<br />
<input type="text" name="username"><p />
Password:<br />
<input type="password" name="password"><p />
<input type="submit" name="login" value="Log in">
</form>
_________________
Girish Baraskar
Web Designer/Developer
http://www.agnisdesigners.com
http://www.eindianpaintings.com
http://www.realestatekolhapur.com |
 |
 |
mamboBROWN
Posts: 1713
|
| Posted: 05/16/2010, 11:40 AM |
|
girish_327
Have you been able to resolve this??
|
 |
 |
girish_327
Posts: 108
|
| Posted: 05/16/2010, 9:15 PM |
|
Hello MamboBrown,
Yes I resolved this issue. See Below Code
global $CCSLocales;
global $Redirect;
//connect
$error = 'Could not connect to the database';
if($_SERVER['SERVER_NAME']=="www.abc.com")
{
mysql_connect('localhost','abc_user','password') or die($error);
mysql_select_db('abc_db') or die($error);
} else
{
mysql_connect('localhost','root','') or die($error);
mysql_select_db('abc_local') or die($error);
}
//include functions.php phpbb script
require './forum/includes/functions.php';
if ($_POST['Button_DoLogin'])
{
//get form data
$username = addslashes(strip_tags(strtolower($_POST['username'])));
$password = addslashes(strip_tags($_POST['password']));
if (!$username||!$password)
echo "Please enter a username and password<p />";
else
{
//find username
$find = mysql_query("SELECT * FROM phpbb_users WHERE username_clean='$username'");
if (mysql_num_rows($find)==0)
echo "Username not found<p />";
else
{
while ($find_row = mysql_fetch_assoc($find))
{
// grab password hash for user
$password_hash = $find_row['user_password'];
$userid_hash = $find_row['user_id'];
$usergroup_hash = $find_row['group_id'];
}
$check = phpbb_check_hash($password, $password_hash);
if ($check==FALSE)
echo "Incorrect password<p />";
else if ($check==TRUE)
{
$_SESSION['username']=$username;
$_SESSION['UserID']=$userid_hash;
$_SESSION['UserLogin']=$username;
$_SESSION['GroupID']=$usergroup_hash;
if($username=="admin")
{
$_SESSION['Group_ID']="3";
}
else
{
$_SESSION['Group_ID']="1";
}
header("Location: ./index.php");
exit();
}
}
}
}
_________________
Girish Baraskar
Web Designer/Developer
http://www.agnisdesigners.com
http://www.eindianpaintings.com
http://www.realestatekolhapur.com |
 |
 |
|