session_start(); include "../affconfig.php"; include "./lang/$language"; if ($_POST['userid']!='' && $_POST['password']!='') { // protection against script injection $userid = preg_replace('/[^a-zA-Z0-9_]/', '', $_POST['userid']); $password = preg_replace('/[^a-zA-Z0-9_]/', '', $_POST['password']); // if the user has just tried to log in $db_conn = mysql_connect($server, $db_user, $db_pass) or die ("Database CONNECT Error (line 11)"); mysql_select_db($affdatabase, $db_conn); $query = "select * from affiliates where refid='$userid' and pass='$password'"; $result = mysql_query($query, $db_conn); if (mysql_num_rows($result) >0 ) { // if they are in the database register the user id $_SESSION['aff_valid_user'] = $userid; // logout admin if he was logged in before $_SESSION['aff_valid_admin'] = ''; unset($_SESSION['aff_valid_admin']); echo ""; exit; } } include "header.php"; if(aff_check_security()) { aff_redirect('members_only.php'); exit; } else { if (isset($_POST['userid'])) { // if they've tried and failed to log in echo AFF_I_CANNOTLOG; } else { // they have not tried to log in yet or have logged out echo AFF_I_NOTLOGGED; } // provide form to log in ?>
=AFF_I_NOTAFFILIATE?> =AFF_I_SIGNUP?>
} ?>