Hello all,
I'm completly new to this forum and I hope someone can really help me.
Let me first explain something:
I have two websites.
1 - main website
2 - ladder/cup website
What I want is that the users of the main website dont have to register again for the ladder/cup website. This should be possible, but I don't know how.
My question, is here somebody who can take a look at it?
this is the login check og the main website:
$ws_pwd=md5($_POST['pwd']);
include("_mysql.php");
include("_settings.php");
$ws_user = $_POST['ws_user'];
$check = safe_query("SELECT * FROM ".PREFIX."user WHERE username='$ws_user'");
$anz = mysql_num_rows($check);
if($anz) {
$check = safe_query("SELECT * FROM ".PREFIX."user WHERE username='$ws_user' AND activated='1'");
if(mysql_num_rows($check)) {
$ds=mysql_fetch_array($check);
// check password
$login = 0;
if($ws_pwd == $ds[password]) {
//session
session_name('ws_session');
session_start();
$_SESSION['ws_auth'] = $ds['userID'].":".$ws_pwd;
$_SESSION['ws_lastlogin'] = $ds[lastlogin];
$_SESSION['referer'] = $_SERVER['HTTP_REFERER'];
//cookie
setcookie("ws_auth", $ds['userID'].":".$ws_pwd, time()+($sessionduration*60*60));
$login = 1;
}
elseif(!($ws_pwd == $ds[password])) {
if($sleep) sleep(5);
$error='Je hebt een ongeldig wachtwoord gebruikt.<br><br><a href="javascript:history.back()">Ga terug en probeer het nog eens!</a>';
}
}
else $error='Jouw account is nog niet geactiveerd<br><br>
<a href="javascript:history.back()">Ga terug en probeer het nog eens!</a>';
}
else $error='Geen gebruiker met gebruikersnaam <b>'.htmlspecialchars($ws_user).'</b> geregistreerd.<br><br>
<a href="javascript:history.back()">Ga terug en probeer het nog eens!</a>';
This is the login.php of the ladder/cup website
function set($login){
global $config;
$login[pass] = md5(md5($login[pass]));
if(!mysql_num_rows(mysql_query("SELECT id FROM members WHERE name='$login[name]' AND password='$login[pass]'"))){
$mes="1";
login($mes);
exit;
}
$getid=mysql_query("SELECT id,act FROM members WHERE name='$login[name]'");
$getid=mysql_fetch_array($getid);
if($getid[act] == 0){
error("Your account is not activated yet, you must click the link provided in your welcome email.");
}
//Set Cookies
setcookie("tid",$getid[id], time()+60 * $login[clength]);
setcookie("user",$login[name], time()+60 * $login[clength]);
setcookie("pass",$login[pass], time()+60 * $login[clength]);
note: Both websites are connecting with the same database, but read info from different tables.
I did attach the complete files too.
checklogin.txt = the main website
login.txt = the ladder website
Any help would be great, the things I tried before didn't work. 🙁