| ... | ... |
@@ -16,7 +16,7 @@ if(!defined("_LOGINCHECK")) exit( );
|
| 16 | 16 |
if($passwd['user_password'] == $encryptedpassword) {
|
| 17 | 17 |
if(!isset($_SESSION)) session_start( ); |
| 18 | 18 |
$_SESSION[$sitekey."_useruid"] = $passwd['user_id']; |
| 19 |
- $_SESSION[$sitekey."_salt"] = md5($passwd['user_email']+$encryptedpassword); |
|
| 19 |
+ $_SESSION[$sitekey."_salt"] = md5($passwd['user_email'] . $encryptedpassword); |
|
| 20 | 20 |
if(isset($_POST['cookiecheck'])) {
|
| 21 | 21 |
$cookie_exp = time() + 3600*24*30; } else { $cookie_exp = time() + 3600*3;
|
| 22 | 22 |
} |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,71 @@ |
| 1 |
+<?php |
|
| 2 |
+ if(isset($_POST['submit']) && preg_match("!^[a-z0-9_ ]{3,30}$!i", $_POST['penname'])) {
|
|
| 3 |
+if(!defined("_LOGINCHECK")) exit( );
|
|
| 4 |
+ define("_BASEDIR", "");
|
|
| 5 |
+ include("config.php");
|
|
| 6 |
+ $settings = dbquery("SELECT tableprefix, maintenance FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
|
|
| 7 |
+ list($tableprefix, $maintenance) = dbrow($settings); |
|
| 8 |
+ include("includes/queries.php");
|
|
| 9 |
+ $result = dbquery("SELECT * FROM "._AUTHORTABLE." LEFT JOIN ".$tableprefix."fanfiction_authorprefs AS ap ON ap.uid = "._UIDFIELD." WHERE "._PENNAMEFIELD." = '".$_POST['penname']."'");
|
|
| 10 |
+ $passwd = dbassoc($result); |
|
| 11 |
+ if($maintenance && $passwd['level'] == 0) {
|
|
| 12 |
+ header("Location: maintenance.php");
|
|
| 13 |
+ exit( ); |
|
| 14 |
+ } |
|
| 15 |
+ $encryptedpassword = md5($_POST['password']); |
|
| 16 |
+ if($passwd['user_password'] == $encryptedpassword) {
|
|
| 17 |
+ if(!isset($_SESSION)) session_start( ); |
|
| 18 |
+ $_SESSION[$sitekey."_useruid"] = $passwd['user_id']; |
|
| 19 |
+ $_SESSION[$sitekey."_salt"] = md5($passwd['user_email']+$encryptedpassword); |
|
| 20 |
+ if(isset($_POST['cookiecheck'])) {
|
|
| 21 |
+ $cookie_exp = time() + 3600*24*30; } else { $cookie_exp = time() + 3600*3;
|
|
| 22 |
+ } |
|
| 23 |
+ $cookie_value = $passwd['user_id'].".".$passwd['user_password']; |
|
| 24 |
+ setcookie("fusion_user", $cookie_value, $cookie_exp);
|
|
| 25 |
+ setcookie("fusion_lastvisit", $userdata['user_lastvisit'], time() + 3600);
|
|
| 26 |
+ define("USERUID", $passwd['uid']);
|
|
| 27 |
+ define("USERPENNAME", $passwd['penname']);
|
|
| 28 |
+ if(!isset($_SESSION[$sitekey."_skin"])) $siteskin = $passwd['userskin']; |
|
| 29 |
+ else $siteskin = $_SESSION[$sitekey."_skin"]; |
|
| 30 |
+ define("uLEVEL", $passwd['level']);
|
|
| 31 |
+ define("isADMIN", uLEVEL > 0 ? true : false);
|
|
| 32 |
+ define("isMEMBER", true);
|
|
| 33 |
+ if(!isset($_SESSION[$sitekey."_agecontsent"])) $ageconsent = $passwd['ageconsent']; |
|
| 34 |
+ else $ageconsent = $_SESSION[$sitekey."_agecontsent"]; |
|
| 35 |
+ $cookie_value = $passwd['user_id'].".".$passwd['user_password']; |
|
| 36 |
+ setcookie("fusion_user", $cookie_value, time() + 3600, "/", "", "0");
|
|
| 37 |
+ if (empty($_COOKIE['fusion_lastvisit'])) |
|
| 38 |
+ setcookie("fusion_lastvisit", $userdata['user_lastvisit'], time() + 3600, "/", "", "0");
|
|
| 39 |
+ } |
|
| 40 |
+ else {
|
|
| 41 |
+ require_once("header.php");
|
|
| 42 |
+ //make a new TemplatePower object |
|
| 43 |
+ if(file_exists("$skindir/default.tpl")) $tpl = new TemplatePower( "$skindir/default.tpl" );
|
|
| 44 |
+ else $tpl = new TemplatePower("default_tpls/default.tpl");
|
|
| 45 |
+ include_once("includes/pagesetup.php");
|
|
| 46 |
+ $output2 .= "<div id=\"pagetitle\">"._MEMBERLOGIN."</div>"; |
|
| 47 |
+ $output2 .= "<div style='text-align: center;'>"._WRONGPASSWORD."</div>"; |
|
| 48 |
+ $tpl->assign("output", $output);
|
|
| 49 |
+ $tpl->printToScreen( ); |
|
| 50 |
+ dbclose( ); |
|
| 51 |
+ exit( ); |
|
| 52 |
+ } |
|
| 53 |
+ } |
|
| 54 |
+ else {
|
|
| 55 |
+if(!defined("_CHARSET")) exit( );
|
|
| 56 |
+ $output .= "<div id=\"pagetitle\">"._MEMBERLOGIN."</div>"; |
|
| 57 |
+ $output .= "<div style=\"width: 250px; margin: 0 auto; text-align: center;\"><form method=\"POST\" enctype=\"multipart/form-data\" action=\"user.php?action=login".(isset($_GET['sid']) && isNumber($_GET['sid']) ? "&sid=".$_GET['sid'] : "")."\"> |
|
| 58 |
+ <div class=\"label\" style=\"float: left; width: 30%; text-align: right;\"><label for=\"penname\">"._PENNAME.":</label></div><INPUT type=\"text\" class=\"textbox\" name=\"penname\" id=\"penname\"><br /> |
|
| 59 |
+ <div class=\"label\" style=\"float: left; width: 30%; text-align: right;\"><label for=\"pswd\">"._PASSWORD.":</label></div><INPUT type=\"password\" class=\"textbox\" id=\"pswd\" name=\"password\"><br /> |
|
| 60 |
+ <INPUT type=\"checkbox\" class=\"checkbox\" name=\"cookiecheck\" id=\"cookiecheck\" value=\"1\"><label for=\"cookiecheck\">"._REMEMBERME."</label><br /> |
|
| 61 |
+ <INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"> |
|
| 62 |
+ </form></div>"; |
|
| 63 |
+ $linkquery = dbquery("SELECT * from ".TABLEPREFIX."fanfiction_pagelinks WHERE link_name = 'login' OR link_name = 'lostpassword'");
|
|
| 64 |
+ while($link = dbassoc($linkquery)) {
|
|
| 65 |
+ if($link['link_access'] && !isMEMBER) continue; |
|
| 66 |
+ if($link['link_access'] == 2 && !isADMIN) continue; |
|
| 67 |
+ $pagelinks[$link['link_name']] = array("id" => $link['link_id'], "text" => $link['link_text'], "url" => _BASEDIR.$link['link_url'], "link" => "<a href=\"".$link['link_url']."\" title=\"".$link['link_text']."\"".($link['link_target'] ? " target=\"_blank\"" : "").($current == $link['link_name'] ? " id=\"current\"" : "").">".$link['link_text']."</a>");
|
|
| 68 |
+ } |
|
| 69 |
+ $output .= "<div style='text-align: center;'>".$pagelinks['register']['link']." | ".$pagelinks['lostpassword']['link']."</div>"; |
|
| 70 |
+ } |
|
| 71 |
+?> |
|
| 0 | 72 |
\ No newline at end of file |