Advertisement
Guest User

Untitled

a guest
Apr 17th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.29 KB | None | 0 0
  1. <html class=""><head>
  2. <?php
  3.  
  4. require_once("functions.php");
  5. if(isset($_SESSION['user_id'])) {
  6. header('Location: index.php');
  7. exit();
  8. }else {
  9. $register_errors= $login_error = array();
  10. if('POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['register'])) {
  11. $fields = array(
  12. 'full_name',
  13. 'username',
  14. 'email',
  15. 'password'
  16. );
  17. foreach ($fields as $field) {
  18. if (isset($_POST[$field])) $posted[$field] = stripslashes(trim($_POST[$field])); else $posted[$field] = '';
  19. }
  20. if ($posted['full_name'] == null)
  21. array_push($register_errors, sprintf('<strong>Notice</strong>: Please enter the User Full Name.', 'neem'));
  22. if ($posted['email'] == null)
  23. array_push($register_errors, sprintf('<strong>Notice</strong>: Please enter the User Email.', 'neem'));
  24. if ($posted['password'] == null)
  25. array_push($register_errors, sprintf('<strong>Notice</strong>: Please enter the User Password.', 'neem'));
  26. if ($posted['username'] == null )
  27. array_push($register_errors, sprintf('<strong>Notice</strong>: Please enter the User Username.', 'neem'));
  28. if(usernameExist($posted['username'])){
  29. array_push($register_errors, sprintf('<strong>Notice</strong>: The Entered Username Already Exist.', 'neem'));
  30. }
  31. $reg_errors = array_filter($register_errors);
  32. if (empty($reg_errors)) { //Check whether everything entered to create new user.
  33. register($posted['full_name'], $posted['username'], $posted['password'], $posted['email']);
  34. }
  35. }
  36. if('POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['login'])) {
  37. $username = stripslashes(trim($_POST['username']));
  38. $password = stripslashes(trim($_POST['password']));
  39. $mismatchErr = '';
  40. if ($password == null )
  41. array_push($login_error, sprintf('<strong>Notice</strong>: Please enter the User Password.', 'neem'));
  42. if ($username == null )
  43. array_push($login_error, sprintf('<strong>Notice</strong>: Please enter the User Username.', 'neem'));
  44. $log_error = array_filter($login_error);
  45. if (empty($log_error)) { //Check whether everything entered to create new user.
  46. $loginn = login($username, $password);
  47. if($loginn){
  48. $_SESSION['user_id'] = $loginn;
  49. header('Location: index.php');
  50. exit();
  51. }else {
  52. $mismatchErr .= sprintf('<p> <strong>Notice</strong>: Please enter Valid Credentials. </p>', 'neem');
  53. }
  54. }
  55. }
  56. ?>
  57. <head>
  58. <title> Login - Kvcodes</title>
  59. <link href="https://fonts.googleapis.com/css?family=Lato|Open+Sans|PT+Sans|Roboto|Roboto+Slab|Titillium+Web" rel="stylesheet">
  60. <style class="cp-pen-styles">* { box-sizing:border-box; }
  61.  
  62. body {
  63. font-family: 'PT Sans', sans-serif;
  64. /*font-family: 'Open Sans', sans-serif;
  65. font-family: 'Lato', sans-serif;
  66. font-family: 'PT Sans', sans-serif;
  67. font-family: 'Roboto Slab', serif;
  68. font-family: 'Titillium Web', sans-serif;*/
  69. background: #ebebeb;
  70. -webkit-font-smoothing: antialiased;
  71. }
  72.  
  73. hgroup { text-align:center; margin-top: 3em; opacity: 0.7; padding: 30px; background: #03a9f4;}
  74. h1, h3 { font-weight: 300; }
  75. h1 { color: #fff; }
  76. form { padding: 30px; padding-top: 60px; background: #fff;}
  77. .powered{ padding: 10px; margin-top: -16px; line-height: 25px; background: #03a9f4;}
  78. .powered a { color: #ddd; text-decoration: none;}
  79. .powered a:hover { font-style:italic;}
  80. .group { position: relative; margin-bottom: 45px; }
  81.  
  82. input { font-size: 18px; padding: 10px 10px 10px 5px; -webkit-appearance: none; display: block; background: transparent; color: #03a9f4; width: 100%; border: none; border-radius: 0; border-bottom: 1px solid #ddd;}
  83.  
  84. input:focus { outline: none; }
  85.  
  86. /* Label */
  87. label { color: #999; font-size: 18px; font-weight: normal; position: absolute; pointer-events: none; left: 5px; top: 10px; -webkit-transition:all 0.2s ease; transition: all 0.2s ease;}
  88.  
  89. /* active */
  90.  
  91. input:focus ~ label, input.used ~ label { top: -20px; -webkit-transform: scale(.75); transform: scale(.75); left: -2px; color: #4a89dc;}
  92.  
  93. /* Underline */
  94. .bar { position: relative; display: block; width: 100%;}
  95. .bar:before, .bar:after { content: ''; height: 2px; width: 0; bottom: 1px; position: absolute; background: #4a89dc; -webkit-transition:all 0.2s ease; transition: all 0.2s ease;}
  96. .bar:before { left: 50%; }
  97. .bar:after { right: 50%; }
  98.  
  99. /* active */
  100. input:focus ~ .bar:before, input:focus ~ .bar:after { width: 50%; }
  101.  
  102. /* Highlight */
  103. .highlight { position: absolute; height: 60%; width: 100px; top: 25%; left: 0; pointer-events: none; opacity: 0.5;}
  104.  
  105. /* active */
  106. input:focus ~ .highlight { -webkit-animation: inputHighlighter 0.3s ease; animation: inputHighlighter 0.3s ease;}
  107.  
  108. /* Animations */
  109. @-webkit-keyframes inputHighlighter {
  110. from { background: #4a89dc; }
  111. to { width: 0; background: transparent; }
  112. }
  113.  
  114. @keyframes inputHighlighter {
  115. from { background: #4a89dc; }
  116. to { width: 0; background: transparent; }
  117. }
  118.  
  119. div.background{ position: fixed; width: 100%; z-index: -1; height: 100%; right: -10%;}
  120. div.background2 { position: fixed; width: 100%; z-index: -1; height: 100%; left: 6%;}
  121. div.background:before { content: ''; position: absolute; top: 0; right: 0; width: 80%; height: 70%; /* opacity: 0.8; */ background-color: #03A9F4; border-bottom: 30px solid #2196F3; -webkit-transform-origin: 100% 100%; -ms-transform-origin: 100% 100%; transform-origin: 100% 100%; -webkit-transform: skewX(30deg); -ms-transform: skewX(30deg); transform: skewY(30deg); -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-shadow: 0px 0px 20px #89898a;}
  122. div.background2:before { content: ''; position: absolute; bottom: 0; left: 0; width: 50%; height: 100%; background-color: #03A9F4; border-right: 50px solid #2196F3; -webkit-transform-origin: 100% 100%; -ms-transform-origin: 100% 100%; transform-origin: 100% 100%; -webkit-transform: skewX(60deg); -ms-transform: skewX(60deg); transform: skewX(60deg); -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-shadow: 0px 0px 20px #89898a;}
  123. html, body{ background-size:cover; margin:0;padding:0; height:100%;}
  124. .buttonui { position: relative; padding: 8px 45px; line-height: 30px; overflow: hidden; border-width: 0; outline: none; border-radius: 2px; box-shadow: 0 1px 4px rgba(0, 0, 0, .6); background-color: #03a9f4; color: #ecf0f1; transition: background-color .3s;}
  125. .buttonui:before { content: ""; position: absolute; top: 50%; left: 50%; display: block; width: 0; padding-top: 0; border-radius: 100%; background-color: rgba(236, 240, 241, .3); -webkit-transform: translate(-50%, -50%); -moz-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); -o-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}
  126. .buttonui span { padding: 12px 24px; font-size:16px;}
  127. .loginForm { width: 420px; margin: 0 auto; z-index: 99; display: block; margin-top: 5%; background: transparent; border-radius: .25em .25em .4em .4em; text-align: center; box-shadow: 0 0 20px rgba(0, 0, 0, 0.2); color: #fff;}
  128. /* Ripples container */
  129.  
  130. .ripples { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; background: transparent;}
  131. .ripplesCircle { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); opacity: 0; width: 0; height: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.25);}
  132. .ripples.is-active .ripplesCircle { -webkit-animation: ripples .4s ease-in; animation: ripples .4s ease-in;}
  133.  
  134. /* Ripples animation */
  135.  
  136. @-webkit-keyframes ripples {
  137. 0% { opacity: 0; }
  138.  
  139. 25% { opacity: 1; }
  140.  
  141. 100% {
  142. width: 200%;
  143. padding-bottom: 200%;
  144. opacity: 0;
  145. }
  146. }
  147.  
  148. @keyframes ripples {
  149. 0% { opacity: 0; }
  150.  
  151. 25% { opacity: 1; }
  152.  
  153. 100% {
  154. width: 200%;
  155. padding-bottom: 200%;
  156. opacity: 0;
  157. }
  158. }
  159. .error, .success {
  160.  
  161. margin:20px auto;
  162. padding:0 10px;
  163. border-radius:5px;
  164. color: #dd2200;
  165. text-align:justify;
  166.  
  167. /*-webkit-box-shadow: 0px 0px 15px 2px rgba(0,0,0,0.75);
  168. -moz-box-shadow: 0px 0px 15px 2px rgba(0,0,0,0.75);
  169. box-shadow: 0px 0px 15px 2px rgba(0,0,0,0.75);*/
  170. }
  171.  
  172. .error {
  173. background-color: #FAFFBD;
  174. border: 1px solid #DAAAAA;
  175. color: #D8000C;
  176.  
  177. }
  178.  
  179. .success {
  180. background-color: #BBF6E2;
  181. border: 1px solid #6ADE95;
  182. }
  183. </style></head><body>
  184. <div class="background"></div>
  185. <div class="background2"></div>
  186. <div class="loginForm">
  187. <?php //print_r($_SESSION);
  188. if(isset($_GET['action']) && $_GET['action'] == 'register') { ?>
  189. <hgroup>
  190. <h1>Kvcodes Register</h1>
  191. </hgroup>
  192. <form action="" method="post" >
  193. <?php if(!empty($reg_errors)) {
  194. echo '<div class="error">';
  195. foreach ($register_errors as $error) {
  196. echo '<p>'.$error.'</p>';
  197. }
  198. echo '</div>';
  199. } ?>
  200. <div class="group">
  201. <input type="text" name="full_name" ><span class="highlight"></span><span class="bar"></span>
  202. <label>Full name</label>
  203. </div>
  204. <div class="group">
  205. <input type="email" name="email" ><span class="highlight"></span><span class="bar"></span>
  206. <label>Email</label>
  207. </div>
  208. <div class="group">
  209. <input type="text" name="username" ><span class="highlight"></span><span class="bar"></span>
  210. <label>Username</label>
  211. </div>
  212. <div class="group">
  213. <input type="text" name="password" ><span class="highlight"></span><span class="bar"></span>
  214. <label>Password</label>
  215. </div>
  216. <input type="hidden" name="register" value="yes" >
  217. <button type="submit" class="buttonui "> <span> Register </span>
  218. <div class="ripples buttonRipples"><span class="ripplesCircle"></span></div>
  219. </button>
  220.  
  221. <a class="buttonui " href="login.php?action=login" style="line-height:4em; text-decoration: none; padding:2%" > <span> Login Back </span> <div class="ripples buttonRipples"><span class="ripplesCircle"></span></div></a>
  222.  
  223. </form>
  224. <?php } else { ?>
  225. <hgroup>
  226. <h1>Kvcodes Login</h1>
  227. </hgroup>
  228. <form action="" method="post" >
  229. <?php if(!empty($log_error) || (isset($mismatchErr) && $mismatchErr != '')) {
  230. echo '<div class="error">';
  231. foreach ($login_error as $error) {
  232. echo '<p>'.$error.'</p>';
  233. }
  234. echo $mismatchErr.'</div>';
  235. } ?>
  236. <div class="group">
  237. <input type="text" class="used" name="username" ><span class="highlight"></span><span class="bar"></span>
  238. <label>Username</label>
  239. </div>
  240. <div class="group">
  241. <input type="password" name="password" ><span class="highlight"></span><span class="bar"></span>
  242. <label>Password</label>
  243. </div>
  244. <input type="hidden" name="login" value="yes" >
  245. <button type="submit" class="buttonui "> <span> Login </span>
  246. <div class="ripples buttonRipples"><span class="ripplesCircle"></span></div>
  247. </button>
  248. <a class="buttonui " href="login.php?action=register" style="line-height:4em; text-decoration: none; padding:2%" > <span> Register </span> <div class="ripples buttonRipples"><span class="ripplesCircle"></span></div></a>
  249. </form>
  250. <?php } ?>
  251. <div class="powered">
  252. Powered by <a href="http://www.kvcodes.com"> Kvcodes </a>
  253. </div>
  254. </div>
  255. <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
  256. <script>$(window, document, undefined).ready(function() {
  257.  
  258. $('input').blur(function() {
  259. var $this = $(this);
  260. if ($this.val())
  261. $this.addClass('used');
  262. else
  263. $this.removeClass('used');
  264. });
  265.  
  266. var $ripples = $('.ripples');
  267.  
  268. $ripples.on('click.Ripples', function(e) {
  269.  
  270. var $this = $(this);
  271. var $offset = $this.parent().offset();
  272. var $circle = $this.find('.ripplesCircle');
  273.  
  274. var x = e.pageX - $offset.left;
  275. var y = e.pageY - $offset.top;
  276.  
  277. $circle.css({
  278. top: y + 'px',
  279. left: x + 'px'
  280. });
  281.  
  282. $this.addClass('is-active');
  283.  
  284. });
  285.  
  286. $ripples.on('animationend webkitAnimationEnd mozAnimationEnd oanimationend MSAnimationEnd', function(e) {
  287. $(this).removeClass('is-active');
  288. });
  289.  
  290. });
  291.  
  292. </script>
  293. </body></html>
  294. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement