Тема: e107 site system
Показать сообщение отдельно
Старый 02.12.2004, 23:09
Skudarnov вне форума Посмотреть профиль Отправить личное сообщение для Skudarnov Посетить домашнюю страницу Skudarnov Найти все сообщения от Skudarnov
  № 1  
Skudarnov

Регистрация: Jul 2003
Адрес: Крым Керчь
Сообщений: 113
Отправить сообщение для Skudarnov с помощью ICQ
По умолчанию e107 site system

Меня интересует кто-ть уже "скрестил" этут штуку а Flash? А именно, хочется сделать login и search
е107 использует РНР и MySQL

Вот так написано в примене на www.kirupa.com
<?
//this pulls the variables from the flash movie when the user
//hits submit. Use this when your global variables are off.
//I don't know how to toggle global variables, so I just put
//it in all the time
$user=$_POST['user'];
$pass=$_POST['pass'];

//connect to database
if ($user && $pass){
mysql_pconnect("mysql.yourhost.com","yourusername","yourpassword") or die ("didn't connect to mysql");
mysql_select_db("yourdatabase") or die ("no database");
//make query
$query = "SELECT * FROM auth WHERE username = '$user' AND userpassword = '$pass'";
$result = mysql_query( $query ) or die ("didn't query");

//see if there's an EXACT match
$num = mysql_num_rows( $result );
if ($num == 1){
print "status=You're in&checklog=1";
} else {
print "status=Sorry, but your user name and password did not match a user name/password combination in our database. Usernames and passwords are entered in from a different file. Thank you for visiting test login script!!&checklog=2";
}
}
?>


А Вот так у меня в login.php
<?php
@include(e_LANGUAGEDIR.$language."/lan_login.php");
class userlogin{
function userlogin($username, $userpass, $autologin){
/* Constructor
# Class called when user attempts to log in
#
# - parameters #1: string $username, $_POSTED user name
# - parameters #2: string $userpass, $_POSTED user password
# - return boolean
# - scope public
*/
global $pref;
$sql = new db;


Помогите мне сделать мой файл login.php
if($pref['auth_method'] && $pref['auth_method'] != "e107"){
$auth_file=e_PLUGIN."alt_auth/".$pref['auth_method']."_auth.php";
if(file_exists($auth_file)){
require_once(e_PLUGIN."alt_auth/alt_auth_login_class.php");
$result = new alt_login($pref['auth_method'],$username, $userpass);
}
}

if($username != "" && $userpass != ""){
$username = ereg_replace("\sOR\s|\=|\#", "", $username);
$userpass = md5($userpass);
if(!$sql -> db_Select("user", "*", "user_name='$username' ")){
define("LOGINMESSAGE", LAN_300."<br /><br />");
return FALSE;
}else if(!$sql -> db_Select("user", "*", "user_name='$username' AND user_password='$userpass'")){
define("LOGINMESSAGE", LAN_301."<br /><br />");
return FALSE;
}else if(!$sql -> db_Select("user", "*", "user_name='$username' AND user_password='$userpass' AND user_ban!=2 ")){
define("LOGINMESSAGE", LAN_302."<br /><br />");
return FALSE;
}else{
list($user_id) = $sql-> db_Fetch();

if($pref['user_tracking'] == "session"){
$_SESSION[$pref['cookie_name']] = $user_id.".".$userpass;
}else{
if($autologin == 1){
cookie($pref['cookie_name'], $user_id.".".$userpass, ( time()+3600*24*30));
}else{
cookie($pref['cookie_name'], $user_id.".".$userpass, ( time()+3600*3));
}
}

$redir = (e_QUERY ? e_SELF."?".e_QUERY : e_SELF);
echo "<script type='text/javascript'>document.location.href='$redir'</script>\n";

/*
if(!eregi("Apache", $_SERVER['SERVER_SOFTWARE'])){
header("Refresh: 0; URL: ".$redir);
exit;
}else{
header("Location: ".$redir);
exit;
}
*/
}
}else{
define("LOGINMESSAGE", LAN_27."<br /><br />");
return FALSE;
}
}
}
?>
__________________
ICQ 121409065 (Leader)
http://www.skudarnov.com