window.location = 'login.html?nogood=1';
";
exit;
}
//echo "ok"; exit;
$username=$_POST['username'];
$password=$_POST['password'];
$nogoodall=1;
$row = mysqli_fetch_array(mysqli_query($GLOBALS['conn'],"SELECT * FROM affiliate where email ='$username' and password = '$password';"));
//echo count($row); exit;
if (count($row)==1) {
unset($_SESSION['affiliateID']);
} else {
$_SESSION['affiliateID']=$row['affiliateID'];
$_SESSION['firstname']=$row['firstname'];
$_SESSION['lastname']=$row['lastname'];
$_SESSION['username']=$row['email'];
$nogoodall=0;
}
$row = mysqli_fetch_array(mysqli_query($GLOBALS['conn'],"SELECT * FROM contributors where email ='$username' and password = '$password';"));
if (count($row)==1) {
unset($_SESSION['contributorID']);
} else {
$_SESSION['contributorID']=$row['contributorID'];
$_SESSION['firstname']=$row['firstname'];
$_SESSION['lastname']=$row['lastname'];
$_SESSION['username']=$row['email'];
$_SESSION['contributorCourses']=$row['courses'];
$nogoodall=0;
}
$row = mysqli_fetch_array(mysqli_query($GLOBALS['conn'],"SELECT * FROM users where username ='$username' and password = '$password';"));
//echo count($row); exit;
if (count($row)==1) {
unset($_SESSION['userID']);
} else {
$nogoodall=0;
$_SESSION['firstname']=$row['firstname'];
# check to see if cookies are enable. if not, give disclaimer and exit.
if (!isset($_SESSION['firstname'])) {
echo "
Your browser appears to have cookies disabled. Folio Academy needs cookies enabled for our site in order to function properly. Please enable cookies for folioacademy.com. We will never use cookies for any kind of tracking or commercial purpose. They are used solely to facilitate logging in and viewing videos. They will be deleted when you close your browser window.
";
//echo "";
//include("footer.html");
exit;
}
$_SESSION['userID']=$row['userID'];
$_SESSION['username']=$row['username'];
$_SESSION['lastname']=$row['lastname'];
$_SESSION['email']=$row['email'];
$_SESSION['gender']=$row['gender'];
$_SESSION['age']=$row['age'];
$userID=$row['userID'];
# get all the videos he's bought
$_SESSION['courses']='';
setcourses($userID);
# loginstats
$elements = explode(".", $_SERVER['REMOTE_ADDR']);
$useragent=$_SERVER['HTTP_USER_AGENT'];
$ipnum = 16777216*$elements[0] + 65536*$elements[1] + 256*$elements[2] + $elements[3];
mysqli_query($GLOBALS['conn'],"INSERT INTO loginstats (userID, ipAddress, theTime, useragent) VALUES('$userID', '$ipnum', NOW(), '$useragent') ");
}
#echo "id ".$_SESSION['userID']."
";
#echo "username ".$_SESSION['username']."
";
#echo "lastname ".$_SESSION['lastname']."
";
#echo "email ".$_SESSION['email']."
";
//exit;
if ($nogoodall==1) {
//echo "nogood";
echo "";
exit;
} else {
//$sessionid=session_id();
echo "";
exit;
}
}
?>