Advertisement
Guest User

Untitled

a guest
May 12th, 2017
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.80 KB | None | 0 0
  1. <?php
  2. session_set_cookie_params(172800);
  3. session_start();
  4. require('core/config.php');
  5. require('core/auth.php');
  6. require('core/system.php');
  7. require('core/geo.php');
  8. require('core/phpmailer/PHPMailerAutoload.php');
  9. $auth = new Auth;
  10. $geo = new Geo;
  11. $system = new System;
  12. $mail = new PHPMailer;
  13.  
  14. $system->domain = $domain;
  15. $system->db = $db;
  16.  
  17. $ip = $_SERVER['REMOTE_ADDR'];
  18.  
  19. if(!file_exists('install/install.lock')) {
  20. header('Location: install/index.php');
  21. exit;
  22. }
  23.  
  24. // Geolocation
  25. $longitude = $_SESSION['longitude'];
  26. $latitude = $_SESSION['latitude'];
  27.  
  28. $geo_info = $geo->getInfo($latitude,$longitude);
  29. $city = $geo_info['geonames'][0]['name'];
  30. $country = $geo_info['geonames'][0]['countryName'];
  31.  
  32. $settings = $system->getSettings();
  33. if(isset($_POST['register'])) {
  34.  
  35. $full_name = ucwords($_POST['full_name']);
  36. $email = $_POST['email'];
  37. $password = trim($_POST['password']);
  38. $time = time();
  39. $age = $_POST['age'];
  40. $gender = $_POST['gender'];
  41.  
  42. $check_d = $db->query("SELECT id FROM users WHERE email='".$email."'");
  43. $check_d = $check_d->num_rows;
  44. if($check_d == 0) {
  45. $db->query("INSERT INTO users (profile_picture,full_name,email,password,registered,credits,age,gender,ip,country,city,longitude,latitude,sexual_interest) VALUES ('default_avatar.png','$full_name','$email','".$auth->hashPassword($password)."','$time','100','$age','$gender','$ip','".$country."','".$city."','".$longitude."','".$latitude."','1')");
  46. setcookie('justRegistered', 'true', time()+6);
  47. setcookie('mm-email',$email,time()+60*60*24*30,'/');
  48.  
  49. $_SESSION['auth'] = true;
  50. $_SESSION['email'] = $email;
  51. $_SESSION['user_id'] = $db->insert_id;
  52. $_SESSION['full_name'] = $full_name;
  53. $_SESSION['is_admin'] = 0;
  54.  
  55. $db->query("UPDATE users SET last_login=UNIX_TIMESTAMP(),ip='".$ip."',longitude='".$longitude."',latitude='".$latitude."' WHERE email='".$email."'");
  56.  
  57. $mail->isSMTP();
  58. $mail->Host = $settings->smtp_host;
  59. $mail->SMTPAuth = true;
  60. $mail->Username = $settings->smtp_username;
  61. $mail->Password = $settings->smtp_password;
  62. $mail->SMTPSecure = $settings->smtp_encryption;
  63. $mail->Port = $settings->smtp_port;
  64.  
  65. $mail->setFrom($settings->email_sender);
  66. $mail->addAddress($email);
  67.  
  68. $mail->isHTML(true);
  69.  
  70. $code = substr(md5(uniqid()),0,10);
  71. $mail->Subject = sprintf($lang['Verify_Account_Title'],$site_name);
  72. $content = '<a href="'.$system->getDomain().'/verify-email.php?code='.$code.'">this link</a>';
  73. $mail->Body = sprintf($lang['Verify_Account_Content'],$content);
  74.  
  75. if(!$mail->send()) {
  76. die('An error occurred, Mail could not be sent / '.$mail->ErrorInfo);
  77. }
  78.  
  79. $db->query("INSERT INTO activation_codes(user_id,code,time) VALUES (".$_SESSION['user_id'].",'".$code."',".time().")");
  80.  
  81. header('Location: '.$domain.'/wizard');
  82. exit;
  83.  
  84. }
  85.  
  86. }
  87.  
  88. if(isset($_POST['login'])) {
  89.  
  90. $email = $_POST['email'];
  91. $password = trim($_POST['password']);
  92.  
  93. $check = $db->query("SELECT * FROM users WHERE email='$email'");
  94. if($check->num_rows >= 1) {
  95. $user = $check->fetch_array();
  96. if($auth->hashPassword($password) == $user['password']) {
  97.  
  98. if(isset($_POST['remember'])) {
  99. setcookie('mm-email',$email,time()+60*60*24*30,'/');
  100. } else {
  101. setcookie('mm-email', null, -1, '/');
  102. $remember = "";
  103. }
  104.  
  105. $_SESSION['auth'] = true;
  106. $_SESSION['email'] = $user['email'];
  107. $_SESSION['user_id'] = $user['id'];
  108. $_SESSION['full_name'] = $user['full_name'];
  109. $_SESSION['is_admin'] = $user['is_admin'];
  110.  
  111. $db->query("UPDATE users SET last_login=UNIX_TIMESTAMP(),ip='".$ip."',longitude='".$longitude."',latitude='".$latitude."' WHERE email='".$email."'");
  112.  
  113. if($user->is_verified == 1) {
  114. if($user['updated_preferences'] == 1) {
  115. header('Location: '.$domain.'/encounters');
  116. exit;
  117. } else {
  118. header('Location: '.$domain.'/wizard');
  119. exit;
  120. }
  121. } else {
  122. header('Location: '.$domain.'/verify-email');
  123. exit;
  124. }
  125. } else {
  126. $error = $lang['Invalid Credentials'];
  127. }
  128.  
  129. } else {
  130. $error = $lang['Invalid Credentials'];
  131. }
  132.  
  133. }
  134.  
  135. $users = $db->query("SELECT * FROM users ORDER BY RAND() LIMIT 20");
  136. $users_count = $db->query("SELECT * FROM users");
  137.  
  138. if(isset($_GET['lang'])) {
  139. $_SESSION['language'] = $_GET['lang'];
  140. }
  141.  
  142. if(!isset($_SESSION['language'])) {
  143. $language = 'english';
  144. } else {
  145. $language = $_SESSION['language'];
  146. }
  147. $path = 'languages/'.strtolower($language).'/language.php';
  148. require($path);
  149.  
  150. if(isset($_GET['login'])) {
  151. $current = '?login';
  152. } elseif(isset($_GET['register'])) {
  153. $current = '?register';
  154. }
  155. if(isset($_GET['login']) || isset($_GET['register'])) {
  156. $combine = '&';
  157. } else {
  158. $combine = '?';
  159. }
  160.  
  161. // Get landing page ad
  162. $ads = $db->query("SELECT * FROM ads LIMIT 1");
  163. $ad = $ads->fetch_object();
  164.  
  165. ?>
  166. <!DOCTYPE HTML>
  167. <!--[if lt IE 7 ]><html class="ie ie6 ie-lt10 ie-lt9 ie-lt8 ie-lt7 no-js" lang="en"><![endif]-->
  168. <!--[if IE 7 ]><html class="ie ie7 ie-lt10 ie-lt9 ie-lt8 no-js" lang="en"><![endif]-->
  169. <!--[if IE 8 ]><html class="ie ie8 ie-lt10 ie-lt9 no-js" lang="en"><![endif]-->
  170. <!--[if IE 9 ]><html class="ie ie9 ie-lt10 no-js" lang="en"><![endif]-->
  171. <!--[if gt IE 9]><!--><html class="no-js" lang="en"><!--<![endif]-->
  172. <head>
  173. <meta http-equiv="content-type" content="text/html; charset=utf-8">
  174. <meta charset="utf-8">
  175. <title><?php echo $site_name?> - Online Dating Community</title>
  176. <meta name="keywords" content="" />
  177. <meta name="description" content="" />
  178. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
  179. <link href="<?=$system->getDomain()?>/assets/bootstrap3/css/bootstrap.css" rel="stylesheet">
  180. <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">
  181. <link href="<?=$system->getDomain()?>/assets/landing/slick/slick.css" rel="stylesheet">
  182. <link href="<?=$system->getDomain()?>/assets/landing/slick/slick-theme.css" rel="stylesheet">
  183. <link href="<?=$system->getDomain()?>/assets/landing/chosen/chosen.css" rel="stylesheet">
  184. <link rel="stylesheet" href="<?=$system->getDomain()?>/assets/landing/bootstrap-social/bootstrap-social.css">
  185. <link href="<?=$system->getDomain()?>/assets/landing/styles.css" rel="stylesheet">
  186. </head>
  187. <body>
  188. <!-- Navigation -->
  189. <nav class="navbar navbar-default navbar-static-top" role="navigation">
  190. <div class="container">
  191. <!-- Brand and toggle get grouped for better mobile display -->
  192. <div class="navbar-header">
  193. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
  194. <span class="sr-only">Toggle navigation</span>
  195. <span class="icon-bar"></span>
  196. <span class="icon-bar"></span>
  197. <span class="icon-bar"></span>
  198. </button>
  199. <a class="navbar-brand" href="index.php"><img src="<?=$system->getDomain()?>/img/logo-small.png"></a>
  200. </div>
  201. <!-- Collect the nav links, forms, and other content for toggling -->
  202. <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
  203. <ul class="nav navbar-nav navbar-right">
  204. <li>
  205. <div class="dropdown">
  206. <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
  207. <i class="fa fa-globe"></i>
  208. </button>
  209. <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
  210. <?php
  211. $lang_dir = scandir('languages');
  212. foreach($lang_dir as $file) {
  213. if(file_exists('languages/'.$file.'/language.php')) {
  214. if($_SESSION['language'] == $file) {
  215. echo '<li><a href="'.$_SERVER['PHP_SELF'].''.$current.$combine.'lang='.$file.'" style="font-weight:600!important;">'.ucfirst($file).'</a></li>';
  216. } else {
  217. echo '<li><a href="'.$_SERVER['PHP_SELF'].''.$current.$combine.'lang='.$file.'">'.ucfirst($file).'</a></li>';
  218. }
  219. }
  220. }
  221. ?>
  222. </ul>
  223. </div>
  224. </li>
  225. <?php if(!isset($_GET['login'])) { ?>
  226. <li>
  227. <a href="<?=$system->getDomain()?>/index.php?login"><?=$lang['index_3']?></a>
  228. </li>
  229. <? } else { ?>
  230. <li>
  231. <a href="<?=$system->getDomain()?>/index.php?register"><?=$lang['index_2']?></a>
  232. </li>
  233. <? } ?>
  234. </ul>
  235. </div>
  236. <!-- /.navbar-collapse -->
  237. </div>
  238. <!-- /.container -->
  239. </nav>
  240.  
  241. <!-- Full Width Image Header with Logo -->
  242. <!-- Image backgrounds are set within the full-width-pics.css file. -->
  243. <header class="image-bg-fixed-height">
  244. <h1><?=$lang['index_1']?></h1>
  245. <div class="col-lg-4 col-md-4 col-sm-6">
  246. <form action="fb-login.php" method="post">
  247. <button type="submit" name="fb-login" class="btn btn-subsection btn-social btn-lg btn-block btn-facebook" style="text-align:left;"><i class="fa fa-facebook"></i><?=$lang['Log_In_With_Facebook']?></button> <br>
  248. </form>
  249. <div class="well form-container">
  250. <?php if(!isset($_GET['login'])) { ?>
  251. <div class="form-title"><?=$lang['index_2']?></div>
  252. <div class="clearfix"></div>
  253. <form action="" method="post">
  254. <input type="text" name="full_name" placeholder="<?=$lang['Full_Name']?>" class="form-control" required> <br>
  255. <input type="email" name="email" placeholder="<?=$lang['Email']?>" class="form-control" required> <br>
  256. <input type="password" name="password" placeholder="<?=$lang['Password']?>" class="form-control" required> <br>
  257. <select name="age" autocomplete="off" required class="form-control">
  258. <option value="" disabled selected><?=$lang['Age']?></option>
  259. <?php for($i = $minimum_age; $i <= 100; $i++) { ?>
  260. <option value="<?php echo $i?>"> <?php echo $i?> </option>
  261. <?php } ?>
  262. </select> <br>
  263. <select name="gender" autocomplete="off" required class="form-control">
  264. <option value="" disabled selected><?=$lang['Gender']?></option>
  265. <option value="Male"><?=$lang['Male']?></option>
  266. <option value="Female"><?=$lang['Female']?></option>
  267. </select> <br>
  268. <input type="submit" name="register" class="btn btn-primary btn-block" value="<?=$lang['index_7']?>">
  269. </form>
  270. <? } else { ?>
  271. <div class="form-title"><?=$lang['index_4']?></div>
  272. <div class="clearfix"></div>
  273. <?php if(isset($error)) { echo '<div class="alert alert-warning">'.$error.'</div>'; } ?>
  274. <form action="" method="post">
  275. <input type="text" name="email" placeholder="<?=$lang['Email']?>" class="form-control" required> <br>
  276. <input type="password" name="password" placeholder="<?=$lang['Password']?>" class="form-control" required> <br>
  277. <input type="submit" name="login" class="btn btn-primary pull-left" value="<?=$lang['index_3']?>">
  278. </form>
  279. <? } ?>
  280. </div>
  281. </div>
  282. </header>
  283.  
  284. <!-- Content Section -->
  285. <section>
  286. <div class="container">
  287. <div class="row">
  288. <div class="col-lg-12">
  289. <h1 class="section-heading"><?=sprintf($lang['index_5'],number_format($users_count->num_rows))?></h1>
  290. <p class="lead section-lead"><?=$lang['index_6']?></p>
  291. <div class="user-slider">
  292. <?php
  293. while($user = $users->fetch_object()) {
  294. echo '<img src="'.$system->getProfilePicture($user).'" class="img-circle" style="height:100px!important;width:100px!important;margin:10px;">';
  295. }
  296. ?>
  297. </div>
  298. <?=$ad->ad_1?>
  299. </div>
  300. </div>
  301. </div>
  302. </section>
  303.  
  304. </div>
  305. <!-- /.container -->
  306. <script src="<?=$system->getDomain()?>/assets/js/jquery-1.10.2.js"></script>
  307. <script src="<?=$system->getDomain()?>/assets/bootstrap3/js/bootstrap.js"></script>
  308. <script src="<?=$system->getDomain()?>/assets/landing/slick/slick.js"></script>
  309. <script>
  310. navigator.geolocation.getCurrentPosition(getPosition);
  311. function getPosition(position) {
  312. $.get('<?=$system->getDomain()?>/ajax/setPosition.php?longitude='+position.coords.longitude+'&latitude='+position.coords.latitude);
  313. }
  314. setInterval(function() {
  315. var width = $(window).width();
  316. if (width <= 500) {
  317. window.location = '<?=$system->getDomain()?>/mobile';
  318. }
  319. }, 1000);
  320. $('.user-slider').slick({
  321. infinite: true,
  322. slidesToShow: 9,
  323. slidesToScroll: 3,
  324. arrows: true,
  325. responsive: true,
  326. autoplay: true
  327. });
  328. </script>
  329. </body>
  330. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement