15 years on The Web
miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
Specific miniBB Support Forums / Specific /   

Website Login difficulties

Author mrbigdog
#1 | Posted: 19 Oct 2009 16:36 
Hi all,

I have successfully installed my forum onto my 'localhost' system and have tried to integrate the login system to work on an external page of my site. The article on this was very good, and I have adapted the default scripts to suit my needs. However, although the form variables for username and password are being passed to the comparison script, no cookie is being set - so instead of returning to the page I logged in from and displaying a welcome message - the log in form is still there. Here is my code:

Log in page:

if(!isset($_SESSION['auth']) or !isset($_SESSION['ID'])){
// If the user isn't logged in, show them the form...

echo 'Please enter your log in details below, or</p>
<form action="my_auth.php" method="POST" name="login">
<table id="login_website" summary="Log in to the Karting Days web site.">
<th scope="col" abbr="login" class="nobg">login</th>

<th scope="col" abbr="login" class="nobg"><input type="text" name="login" size="27" value="" /></th>
<th scope="col" abbr="Password" class="nobg">Password</th>

<th scope="col" abbr="Password" class="nobg"><input type="password" name="password" size="27" value="" /></th>
<th scope="col" abbr="go" class="inputButton"><input type="submit" name="go" value="go" /></th>


else {echo 'You are logged in as '.$_SESSION['auth'].' (ID: '.$_SESSION['ID'].') <a href="my_auth.php?logout=1">Logout</a>';}


Now the Code for My_auth.php:

/* Comparison script */


if(isset($_POST['login']) and isset($_POST['password'])){

mysql_connect('localhost:8888', 'root', 'root') or die ('<b>Database/configuration error.</b>');
mysql_select_db('karting') or die ('<b>Database/configuration error (DB is missing).</b>');

if(isset($_POST['login'])) $name=htmlspecialchars(trim($_POST['login']),ENT_QUOTES); else $name='';
if(isset($_POST['password'])) $pass=htmlspecialchars(trim($_POST['password']),ENT_QUOTES); else $user_pwd='';

if($res=mysql_query("select ID, name, pass from my_users where name='{$name}' and pass='{$pass}'") and mysql_num_rows($res)>0 and $row=mysql_fetch_row($res)){



header("Location: $page");


Can anybody help? Is it because i'm using XAMPP/Mac and local server - or am i missing something obvious?

Any other topics on how to get this integrated?

Many thanks in advance!


Author Paul
Lead Developer
#2 | Posted: 20 Oct 2009 03:11 
You need to debug the script and make sure the data you pass is really present in the database. I guess the mysql_query condition is just not performing well, that's why the session may not be set.

Author mrbigdog
#3 | Posted: 20 Oct 2009 10:17 
Hi Paul,

Thanks for the reply! Iv'e checked the database and everything is present and correct. Does the code look ok to you? any obvious errors?


Author Paul
Lead Developer
#4 | Posted: 21 Oct 2009 04:43 
I see a lot of imperfect things in such code. Anyway, I can't say precisely what's wrong. Deep debugging is needed - may be it's something guilty on your server side.

Specific miniBB Support Forums / Specific / Website Login difficulties Top

Your Reply Click this icon to move up to the quoted message

 Short link for this topic:

You are welcome to post anonymously, by entering a nickname with no password (if the similar Username has not been taken yet), or by leaving both fields empty. If you have a forums account, you can also sign in from this page without posting a message, or sign in and post at once.

Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Install the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB