Jump to content
php.lv forumi

php fusion logins


ziedinjsh

Recommended Posts

Sveiki.

 

Kā pārtaisīt php fusion login sistēmu.. viņa sastā no diviem failiem.. login.php un setuser.php (setuser.php ietver arī logout)

 

login.php:

<?php

require_once "maincore.php";
if (iMEMBER) redirect("index.php");
echo "<link rel='stylesheet' href='".THEME."user.css' type='text/css' media='screen' />\n";
echo "<script type='text/javascript' language='javascript' src='".INCLUDES."capslock.js'></script>\n";

echo "<center><div id='login'>";
echo "<p style='text-align:center;'><img src='".BASEDIR.$settings['sitebanner']."' alt='".$settings['sitename']."'></p>";
echo "<form name='loginform' method='post' action='".FUSION_SELF."'>\n";
echo "<div align='center' >".(isset($loginerror) ? $loginerror : "")."</div>";
echo $locale['global_303']." <input type='text' name='user_email' id='login-box'><br />\n";
echo $locale['global_102']." <input type='password'  onkeypress=\"capLock(event)\" name='user_pass' id='login-box'><br />\n";
echo "<div id='caps_on' class='caps_on'>Tev Caps Lock taustiņš ir ieslēgts.</div>";
echo "<input type='submit' name='login' value='".$locale['global_104']."' id='login-button' />";
echo "</form>";

echo $locale['global_106'];
if ($settings['enable_registration']) {
	echo "<br>".$locale['global_105']."";
}
echo "</div></center>";

?>

setuser.php:

<?php
require_once "maincore.php";
include THEME."theme.php";
echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>\n";
echo "<html>\n<head>\n";
echo "<title>".$settings['sitename']."</title>\n";
echo "<meta http-equiv='refresh' content='2; url=index.php'>";
echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />\n";
echo "<meta name='description' content='".$settings['description']."' />\n";
echo "<meta name='keywords' content='".$settings['keywords']."' />\n";
echo "<link rel='stylesheet' href='".THEME."user.css' type='text/css' />\n";
if (function_exists("get_head_tags")) { echo get_head_tags(); }
echo "</head>";


echo "<div id='setuser'>";


echo "<img src='".IMAGES."logo95x95.png' alt='".$settings['sitename']."' /><br>";

if (iMEMBER && (isset($_REQUEST['logout']) && $_REQUEST['logout'] == "yes")) {
	header("P3P: CP='NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM'");
	setcookie(COOKIE_PREFIX."user", "", time() - 7200, "/", "", "0");
	setcookie(COOKIE_PREFIX."lastvisit", "", time() - 7200, "/", "", "0");
	$result = dbquery("DELETE FROM ".DB_ONLINE." WHERE online_ip='".USER_IP."'");
	echo "<div id='setuser-l'><strong>".$locale['global_192'].$userdata['user_name']."</strong></div>";

echo "<div id='setuser-i'>";
if ($userdata['user_avatar'] && file_exists(IMAGES."avatars/".$userdata['user_avatar'])) {
echo "<div id='setuser-inside' style='background-image:url(".IMAGES."avatars/".$userdata['user_avatar'].");'><img src='".THEME."images/setuser3.gif'></div>";

	echo "";
	} else {
echo "<div id='setuser-inside' style='background-image:url(".IMAGES."no-photo.jpg') border='0'/><img src='".THEME."images/setuser3.gif'></div>";

	}	

echo "</div>";		
} else {

if (isset($_GET['error']) && $_GET['error'] == 1) {
	echo "<div id='setuser-error'>".$locale['global_194']."</strong></div>";
} elseif (isset($_GET['error']) && $_GET['error'] == 2) {
	echo "<div id='setuser-error'>".$locale['global_195']."</strong></div>";
} elseif (isset($_GET['error']) && $_GET['error'] == 3) {
	echo "<div id='setuser-error'>".$locale['global_196']."</strong></div>";

echo "<br><center><img src='".THEME."images/setuser-error.gif'></center>";
} else {
	if (isset($_COOKIE[COOKIE_PREFIX.'user'])) {
		$cookie_vars = explode(".", $_COOKIE[COOKIE_PREFIX.'user']);
		$user_pass = preg_check("/^[0-9a-z]{32}$/", $cookie_vars['1']) ? $cookie_vars['1'] : "";
		$user_email = preg_replace(array("/\=/","/\#/","/\sOR\s/"), "", stripinput($_GET['user']));
		if (!dbcount("(user_id)", DB_USERS, "user_email='".$user_email."' AND user_password='".md5($user_pass)."'")) {
			echo "<strong>".$locale['global_196']."...</strong>";
		} else {
			$result = dbquery("DELETE FROM ".DB_ONLINE." WHERE online_user='0' AND online_ip='".USER_IP."'");
			echo "<div id='setuser-l'><strong>".$locale['global_193'].$userdata['user_name']."</strong></div>";
echo "<div id='setuser-i'>";
if ($userdata['user_avatar'] && file_exists(IMAGES."avatars/".$userdata['user_avatar'])) {
echo "<div id='setuser-inside' style='background-image:url(".IMAGES."avatars/".$userdata['user_avatar'].");'><img src='".THEME."images/setuser3.gif'></div>";

	echo "";
	} else {
    echo "<div id='setuser-inside' style='background-image:url(".IMAGES."no-photo.jpg') border='0'/><img src='".THEME."images/setuser3.gif'></div>";
	}	

echo "</div>";			}
	}
}
}



echo "</div>";
mysql_close();

ob_end_flush();
?>

 

Kā lai ieliek ielogošanās daļu no setuser.php iekš login.php un virs logina feildiem parādā erroru(-us)? un tad setuser.php atstāt tikai izlogošanos daļu..

Link to comment
Share on other sites

nu labi.. includoju.. parediģēju šo un to un tagad viss ir tā kā gribēju :) Jautājums atkal kā lai uztaisa to lai erroru parāda kad nospiež pogu login, bet bez lapas pārlādēšanas? līdzīgi kā caps lock detectors.. ieklikšķina formā sāk rakstīt ar caps lock un apakša zem feilda parādas ziņa ka ir caps lock ir ieslēgts.. to var panāk ar java vai ajax bet kā?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...