core/api/modules/login/index.php

44 lines
1.4 KiB
PHP
Raw Normal View History

2022-12-11 13:55:49 +05:00
<?php
//$mod = new main($smarty, $settings);
//echo BD_TYPE;
2022-12-17 18:15:09 +05:00
// $mod = new main(BD_NAME, BD_TYPE, BD_HOST, BD_USER, BD_PWD, MOD);
2022-12-11 13:55:49 +05:00
//$mod->db=$db;
//print_r($_POST);
//Array ( [email] => 1@yurecnt.ru [act] => auth [pwd] => 123 [remember] => on [ok] => Войти )
2022-12-17 18:15:09 +05:00
if ( $_POST['act'] == 'login' ) \core::login ( $_POST );
2022-12-11 13:55:49 +05:00
if ( $_POST['act'] == 'reg' ) $mod -> reg ( $_POST );
/*
if ( isset( $_POST['ok'] ) ){//если есть входящие данные
$email = @$_POST['email'];
$pwd = md5( @$_POST['pwd'] );
unset( $a );
$a['email'] = $email;
$a['pwd'] = $pwd;
$a['act'] = 1;
$id = $db -> get_val( 'users', $a, 'id' );
unset( $a );
$a['user_id'] = $id;
$dostup = $db -> get_val( 'users_groupe', $a, 'dostup' );
if ( $dostup ){
$db->free_sql('UPDATE `cart` SET `id` = "' . $id . '" WHERE `id` = "' . $_COOKIE['user_id'] .'"');
$_SESSION['dostup'] = $dostup;
$_SESSION['user_id'] = $id;
if ($_POST['save_me']=='on'){//пишем в куки
$tri_mes=time()+259200;
setcookie('email', $email, $tri_mes, '/', SITE);
setcookie('pwd', $pwd, $tri_mes, '/', SITE);
}
if($_SESSION['dostup'] == 'a' || $_SESSION['dostup'] == 'e')
header( 'Location: /admin/' );
else
header( 'Location: /' . $settings['default_mod_auth'] . '/' );
}
else
$smarty -> assign( 'error', 'Не верный логин или пароль' );
}
*/
?>