Hi,
On my site I have a login/pasword protect memberarea. The login and password are provide by me and cannot be changed.
Now I want to set up a forum (SMF) in that memberarea. I register the members myself.
I was thinking about linking the login-script and the forum, so the members could sign in with the same password as in the forum. They also could change their password (for both membersarea and forum) in the forum.
The script I use to login works great. Now i tried to change the table name and column-name with those I found for SMF in the SQL-database. Now the script doesn't work anymore.
EDIT: I noticed that the password gets encrypted different by SMF. When i use the standard md5 encryption it gives a completely other result.
Anyone familiar with the SMF-way of encrypting to help me out?
Here is the login-script I use (in the inline comments you can see what I've changed from the original script)
PHP Code:<?php
ob_start();
$host="localhost";
$username="blahblah";
$password="blahblah";
$db_name="blahblah";
$tbl_name="smf_members"; // my tablename used to be here.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$lid=$_POST['lid'];
$pasw=$_POST['pasw'];
$pasw_md5=md5($pasw);
session_start();
$_SESSION['lid'] = $lid;
$_SESSION['pasw_en'] = $pasw_md5;
$_SESSION['pasw'] = $pasw;
if (($lid == "bart") and ($pasw == "kaell"))
header("location:index3.php");
else
$sql="
SELECT memberName, passwd FROM $tbl_name WHERE memberName='$lid' and passwd='$pasw_md5'";
// used to be SELECT * FROM $tbl_name WHERE lid='$lid' and pas_en='$pasw_md5'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
file "login_success.php"
echo "Beste ", $lid, ", we verbinden u nu door...";
header("location:member.php");
}
else {
echo "<span id='bainv2'>Verkeerde login en/of paswoord. Probeer opnieuw...</span><br>";
echo "<span id='bainv2'>klik op de knop om terug te gaan naar de website</span><br>";
echo "<br>";
echo "<FORM><INPUT type='button' value='www.bluearmyneerpelt.be' onClick='history.back()'></FORM> ";
}
ob_end_flush();
?>



Reply With Quote

Bookmarks