%PDF- %PDF-
Direktori : /home/nailstv/public_html/ |
Current File : /home/nailstv/public_html/login.php |
<?php require_once 'config/config.php'; $p['title'] = 'Nails Tv login'; $p['desc'] = 'Login to the surface of Nails.tv'; $p['keywords'] = 'nail, nail artist, nail technician, login'; $p['pagename'] = 'Login'; $page = new Page(Registry::get('site'), false, $p, false); Registry::set('page', $page); $page->assign('content', content()); $page->display('page.tpl.html'); //////////////////////////////////////////////////////////////////////////////// function content() { $db = Registry::get('db'); $c = new Content(); $c->assign('jobb_banner', Page::banner(2,'jobb')); Page::seoFromDb(3); if(isset($_POST['func']) && $_POST['func'] == 'belepes') { $user = new User(Registry::get('site'), 'felhasznalo'); if($user->checkLogin($_POST['login'], $_POST['pass'], 'login')) { $bind = array($_SESSION[Registry::get('site')]['user_id']); $sql = "SELECT last_login FROM felhasznalo WHERE id = ?"; $row = $db->GetRow($sql, $bind); $ma = date("Y-m-d H:i:s"); if(substr($row['last_login'], 0, 10) != substr($ma, 0, 10)) { User::pont($_SESSION[Registry::get('site')]['user_id'], 5); } $ip = $_SERVER['REMOTE_ADDR']; $bind = array($ma, $ip, $_SESSION[Registry::get('site')]['user_id']); $sql = "UPDATE felhasznalo SET last_login = ?, last_ip = ? WHERE id = ?"; $db->query($sql, $bind); $uid = $_SESSION[Registry::get('site')]['user_id']; checkFacebook($uid); header("Location: " . $_SESSION['redirect_to']); die; } else { $c->assign('login_error', 'Incorrect username or password.'); } } else { //$_SESSION['redirect_to'] = Registry::get('referer_full'); $_SESSION['redirect_to'] = !empty($_SESSION['last_url']) ? $_SESSION['last_url'] : Registry::get('wwwroot'); } //echo $_SESSION['redirect_to']; return $c->fetch('belepes.tpl.html'); } function checkFacebook($uid) { $db = Registry::get('db'); $bind = array($uid); $sql = "SELECT facebook FROM felhasznalo WHERE id = ?"; $row = $db->GetRow($sql, $bind); if(!empty($row['facebook'])){ $url = "http://mukorom.hu/fb/index.php?func=ver&id=". $row['facebook']; $ch = curl_init($url); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); $result = curl_exec($ch); curl_close($ch); $mystring = $result; $findme = 'Exception'; $pos = strpos($mystring, $findme); if ( !($pos === false)) { //$sql = "UPDATE felhasznalo SET facebook = '' WHERE id = ?"; //$db->query($sql, $bind); //$sql = "DELETE FROM facebook WHERE uid = ". $row['facebook']; //$db->query($sql); } if(!empty($result) || $result != ''){ } } } ?>