diff --git a/app/api/apiclient.php b/app/api/apiclient.php index c99f7cb..e48febd 100644 --- a/app/api/apiclient.php +++ b/app/api/apiclient.php @@ -126,7 +126,8 @@ function client_check_auth($login, $pwd){ return ['error' => 'client not found']; } - $hash_pwd = md5($login.$client['clientpassword']); + $hash_pwd = client_secret($client['client_id'], $client['clientpassword']); + if ($pwd == $hash_pwd){ return ['data' => $client]; @@ -138,6 +139,11 @@ function client_check_auth($login, $pwd){ } +function client_secret($id, $password){ + return md5($id.$password); +} + + function client_add_password($client_id, $password, $confirm, $minlen = 5){ diff --git a/app/pub/css/an.css b/app/pub/css/an.css index c8915ac..b697c8b 100644 --- a/app/pub/css/an.css +++ b/app/pub/css/an.css @@ -118,24 +118,6 @@ h1 { position:relative; } -#container_form{ - width:450px; - height: 500px; - background-color: rgba(24, 33, 52, 0.7); - margin: 250px auto 0 auto; - text-align: center; - box-shadow: 0 -5px 0 #3adbfd; - } - - -input[type="text"],input[type="password"], input[type="email"]{ - width: 300px; - height:50px; - font-size: 18px; - margin-bottom: 25px; - border-radius: 4px; - padding-left: 10px; -} @media screen and (max-width: 560px) { diff --git a/app/routes/anpdf.php b/app/routes/anpdf.php index 24bc46e..c32476b 100644 --- a/app/routes/anpdf.php +++ b/app/routes/anpdf.php @@ -11,7 +11,7 @@ function anpromo_kuri($page = 1, $scale = 1){ $file = SITEPATH.'pub/files/source/742.pdf'; $data = pdfs_init($file, $page); - $pdfile = $data['pdfpgurl']; + $pdfile = SITE.$data['pdfpgurl']; $fullpdf = $data['pdfurl']; diff --git a/app/routes/auth.php b/app/routes/auth.php index 941fc2c..abe462c 100644 --- a/app/routes/auth.php +++ b/app/routes/auth.php @@ -18,6 +18,10 @@ function login_kuri(){ } } + + // if (isset($_COOKIE['chitatel'])){ + // out(); + // } $tempcontent = VIEWPATH.'login.phtml'; include VIEWPATH.'layout_lite.phtml'; @@ -29,11 +33,15 @@ function login_kuri(){ function out_kuri(){ - unset($_COOKIE['user']); - setcookie('user', null, -1,'/'); - - unset($_COOKIE['pwd']); - setcookie('pwd', null, -1, '/'); + if (isset($_COOKIE['chitatel'])) { + unset($_COOKIE['chitatel']); + setcookie('chitatel', null, -1,'/', $_SERVER['HTTP_HOST']); + } + + if (isset($_COOKIE['code'])) { + unset($_COOKIE['code']); + setcookie('code', null, -1, '/', $_SERVER['HTTP_HOST']); + } header('Location: '.SITE.'login'); @@ -48,8 +56,10 @@ function add_user_cookie($user, $pwd){ // ini_set ("session.use_trans_sid", true); // session_start(); - setcookie ("user", $user, $timeout, '/'); - setcookie ("pwd", md5($user.$pwd), $timeout, '/'); + $secret = client_secret($user, $pwd); + + setcookie ("chitatel", $user, $timeout, '/', $_SERVER['HTTP_HOST']); + setcookie ("code", $secret, $timeout, '/', $_SERVER['HTTP_HOST']); } @@ -59,7 +69,7 @@ function check_login_kuri(){ //ini_set ("session.use_trans_sid", true); //session_start(); - $client = client_check_auth($_COOKIE['user'], $_COOKIE['pwd']); + $client = client_check_auth($_COOKIE['chitatel'], $_COOKIE['code']); if (!isset($client['data'])){ return $client; diff --git a/app/routes/client.php b/app/routes/client.php index 0e4ad96..68c7716 100644 --- a/app/routes/client.php +++ b/app/routes/client.php @@ -84,10 +84,13 @@ function mybooks_kuri($page = 1){ $login = check_login_kuri(); - if (!isset($login['data']['clienthash'])){ - header('Location: '.SITE.'login'); - exit; + + if (!isset($login['client_id'])){ + header('Location: '.SITE.'login'); + exit; } + + $limit = 25; $client = api_client_kuri($login['data']['clienthash']); diff --git a/app/views/layout.phtml b/app/views/layout.phtml index 90986b8..0190a0e 100644 --- a/app/views/layout.phtml +++ b/app/views/layout.phtml @@ -1,9 +1,10 @@ Еженедельник Аргументы Недели - <?=$title?> + "> - + diff --git a/app/views/login.phtml b/app/views/login.phtml index c0bce1b..7115467 100644 --- a/app/views/login.phtml +++ b/app/views/login.phtml @@ -4,7 +4,7 @@

-

+

diff --git a/app/views/reset.phtml b/app/views/reset.phtml index 078887c..00fd6cb 100644 --- a/app/views/reset.phtml +++ b/app/views/reset.phtml @@ -4,7 +4,7 @@

-

+