Guest User

Untitled

a guest
Jan 3rd, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.57 KB | None | 0 0
  1. <?php require_once "includes/config.php";
  2. $oConf = new conf();
  3. $db = $oConf->get_db();
  4. $dbQuery = $oConf->get_db();
  5. $Returnresult = 0;
  6. if($_SESSION['Userid'] == "")
  7. {
  8.  
  9. if($_POST['action'] == "login")
  10. {
  11. $Username = $_POST['txtUsername'];
  12. $Upassword = $_POST['txtPassword'];
  13. $UpdateQuery = "CALL SP_CHECKLOGINUSERS('$Username','$Upassword')";
  14. //echo $UpdateQuery;
  15. if ($dbQuery->multi_query($UpdateQuery))
  16. {
  17. do
  18. {
  19.  
  20. /* store first result set */
  21. if ($result1 = $dbQuery->store_result())
  22. {
  23. while ($rowResult = $result1->fetch_row())
  24. {
  25. //print_r($rowResult);
  26. $_SESSION['Userid'] = $rowResult[0];
  27. $_SESSION['Name'] = $rowResult[1];
  28. $_SESSION['Mobile'] = $rowResult[4];
  29. $_SESSION['Username'] = $rowResult[3];
  30. $_SESSION['RoleCode'] = $rowResult[7];
  31. if($rowResult[7] == "USER_ROLE_TYPE")
  32. {
  33. $allClasses->forRedirect('ImageUpload.php');
  34. }
  35. else if($rowResult[7] =="ADMIN_ROLE_TYPE"){
  36. $allClasses->forRedirect('Index.php');
  37. }
  38. }
  39. $result1->close();
  40. }
  41. } while ($dbQuery->next_result());
  42. }
  43. //$dbQuery->query($UpdateQuery);
  44. if ($dbQuery->connect_errno) {
  45. echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
  46. }
  47. $dbQuery->close();
  48.  
  49. //echo "mobile :".$_SESSION['Userid'];
  50. }
  51.  
  52. }
  53. if($_SESSION['Userid'] == "")
  54. {
  55.  
  56. if($_POST['action'] == "register")
  57. {
  58. $Name = $_POST['txtName'];
  59. $Upassword = $_POST['txt_Password'];
  60. $Username = $_POST['txt_Username'];
  61. $Mobilenumber = $_POST['txtMobilenumber'];
  62. //echo "mobile :".$Mobilenumber;
  63. $UpdateQuery = "CALL SP_INSERTUSERS(0,'$Username','$Name','$Username','$Upassword','$Mobilenumber',0,0,1001,@Result)";
  64. //echo $UpdateQuery;
  65. if ($db->multi_query($UpdateQuery))
  66. {
  67. do
  68. {
  69. if ($result1 = $db->store_result())
  70. {
  71. while ($rowResult = $result1->fetch_row())
  72. {
  73. $returnResult = $rowResult[0];
  74. //echo $returnResult;
  75. $Returnresult = $returnResult;
  76. if($returnResult == 1)
  77. {
  78. $Username_Code= base64_encode($Username);
  79. include('Mail.php');
  80. include('Mail/mime.php');
  81. $recipients = $Email;
  82. $message = "Hello $Name!</br></br>";
  83. $message .= "Welcome to Amazon Image Audit Application,</br></br>";
  84. $message .= "Please confirm the below link to confirm your email address and set yourself a password to proceed further </br></br><a href='".$CONF_COMPANY_URL_OUT."activeuser.php?UserCode=".$Username_Code."' >Confirm Email address</a></br></br></br></br>";
  85. $message .= "Thank you</br></br>";
  86. $message .= "Regards,</br></br>";
  87. $message .= "Amazon Team";
  88.  
  89. $html = $message;
  90.  
  91. $crlf = "\n";
  92. $hdrs = array(
  93. 'From' => $default_mailid,
  94. 'To' => $Username,
  95. 'Subject' => 'Account information - trackedin services'
  96. );
  97.  
  98. $mime = new Mail_mime($crlf);
  99.  
  100. $mime->setTXTBody($text);
  101. $mime->setHTMLBody($html);
  102.  
  103. $body = $mime->get();
  104. $hdrs = $mime->headers($hdrs);
  105.  
  106. $smtpinfo["host"] = "mail.manthansol.com";
  107. $smtpinfo["port"] = "25";
  108. $smtpinfo["auth"] = true;
  109. $smtpinfo["username"] = $smtpusername;
  110. $smtpinfo["password"] = $smtppassword;
  111. /* Create the mail object using the Mail::factory method */
  112. $mail_object =& Mail::factory("smtp", $smtpinfo);
  113. /* Ok send mail */
  114. $mail_object->send($recipients, $hdrs, $body);
  115.  
  116. if (PEAR::isError($mail_object)) {
  117. echo("<p>" . $mail_object->getMessage() . "</p>");
  118. } else {
  119. //echo("<p>Message successfully sent!</p>");
  120. }
  121.  
  122.  
  123. }
  124. }
  125. $result1->close();
  126. }
  127. } while ($db->next_result());
  128. }
  129.  
  130. $db->close();
  131. }
  132. }
  133. ?>
  134.  
  135. <!doctype html>
  136. <html>
  137. <head>
  138. <meta charset="utf-8">
  139. <title>:: Amazon Image audit application ::</title>
  140. <link href="css/bootstrap.min.css" rel="stylesheet">
  141. <link href="css/style.css" rel="stylesheet">
  142. <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
  143. <script type="text/javascript" src="js/bootstrap.min.js" ></script>
  144. <link href="css/sweet-alert.css" rel="stylesheet">
  145. <script type="text/javascript" src="js/sweet-alert.js" ></script>
  146. <script type="text/javascript">$(function() {
  147. if('<?=$Returnresult?>' == 2)
  148. {
  149. sweetAlert("Oops...", "Username already exists.", "error");
  150. }
  151. else
  152. {
  153. if('<?=$Returnresult?>' == 1)
  154. {
  155. sweetAlert("Oops...", "Registration successful. Please check your mail and activate your account.", "error");
  156. }
  157. }
  158. $('#login-form-link').click(function(e) {
  159. $("#login-form").delay(100).fadeIn(100);
  160. $("#register-form").fadeOut(100);
  161. $('#register-form-link').removeClass('active');
  162. $(this).addClass('active');
  163. e.preventDefault();
  164. });
  165. $('#register-form-link').click(function(e) {
  166. $("#register-form").delay(100).fadeIn(100);
  167. $("#login-form").fadeOut(100);
  168. $('#login-form-link').removeClass('active');
  169. $(this).addClass('active');
  170. e.preventDefault();
  171. });
  172.  
  173. });
  174. function CheckLogin()
  175. {
  176. var Username = $("#txtUsername").val();
  177. var Password = $("#txtPassword").val();
  178. if(Username == "")
  179. {
  180. sweetAlert("Oops...", "Enter Email Address", "error");
  181. //alert("Enter Username");
  182. $("#txtUsername").focus();
  183. return false;
  184. }
  185. if(Password == "")
  186. {
  187. sweetAlert("Oops...", "Enter Password", "error");
  188. //alert("Enter Username");
  189. $("#txtPassword").focus();
  190. return false;
  191. }
  192.  
  193.  
  194. }
  195. function CheckRegistration()
  196. {
  197. var Name = $("#txtName").val();
  198. var Username = $("#txt_Username").val();
  199. var Password = $("#txt_Password").val();
  200. var Mobilenumber = $("#txtMobilenumber").val();
  201. if(Name == "")
  202. {
  203. sweetAlert("Oops...", "Enter Name", "error");
  204. $("#txtName").focus();
  205. return false;
  206. }
  207. if(Username == "")
  208. {
  209. sweetAlert("Oops...", "Enter Email Address", "error");
  210. $("#txt_Username").focus();
  211. return false;
  212. }
  213. if(Password == "")
  214. {
  215. sweetAlert("Oops...", "Enter Password", "error");
  216. $("#txt_Password").focus();
  217. return false;
  218. }
  219. if(Mobilenumber == "")
  220. {
  221. sweetAlert("Oops...", "Enter Mobile Number", "error");
  222. $("#txtMobilenumber").focus();
  223. return false;
  224. }
  225. }
  226.  
  227.  
  228.  
  229. </script>
  230. </head>
  231.  
  232. <body>
  233. <header>Amazon Image Audit Application </header>
  234. <div class="navigation">
  235. <?php require_once "includes/header.php"; ?>
  236.  
  237. </div>
  238. <div class="container">
  239. <div class="row">
  240. <div class="col-md-6 col-md-offset-3">
  241.  
  242. <?php if($_SESSION['Userid'] == "")
  243. {
  244. ?>
  245. <div class="panel panel-login">
  246. <div class="panel-heading">
  247. <div class="row">
  248. <div class="col-xs-6"> <a href="#" class="active" id="login-form-link"><span class="glyphicon glyphicon glyphicon-user" aria-hidden="true"></span>Login</a> </div>
  249. <div class="col-xs-6"> <a href="#" id="register-form-link"><span class="glyphicon glyphicon glyphicon-lock" aria-hidden="true"></span>Register</a> </div>
  250. </div>
  251. <hr>
  252. </div>
  253. <div class="panel-body">
  254. <div class="row">
  255. <div class="col-lg-12">
  256.  
  257. <form id="login-form" action="" method="post" role="form" style="display: block;">
  258. <input type="hidden" name="action" value="login" />
  259. <div class="form-group">
  260. <input type="text" name="txtUsername" id="txtUsername" tabindex="1" class="form-control" placeholder="Email Address" maxlength="100">
  261. </div>
  262. <div class="form-group">
  263. <input type="password" name="txtPassword" id="txtPassword" tabindex="2" class="form-control" placeholder="Password" maxlength="15" >
  264. </div>
  265. <div class="form-group text-center" style="display:none;">
  266. <input type="checkbox" tabindex="3" class="" name="remember" id="remember">
  267. <label for="remember"> Remember Me</label>
  268. </div>
  269. <div class="form-group">
  270. <div class="row">
  271. <div class="col-sm-6 col-sm-offset-3">
  272. <input type="submit" name="login-submit" id="login-submit" tabindex="4" class="form-control btn btn-login" value="Log In" onClick="return CheckLogin()">
  273. </div>
  274. </div>
  275. </div>
  276. <div class="form-group" style="display:none;">
  277. <div class="row">
  278. <div class="col-lg-12">
  279. <div class="text-center"> <a href="#" tabindex="5" class="forgot-password">Forgot Password?</a> </div>
  280. </div>
  281. </div>
  282. </div>
  283. </form>
  284. <form id="register-form" action="#" method="post" role="form" style="display: none;">
  285. <input type="hidden" name="action" value="register" />
  286. <div class="form-group">
  287. <input type="text" name="txtName" id="txtName" tabindex="1" class="form-control" placeholder="Name" maxlength="100">
  288. </div>
  289. <div class="form-group">
  290. <input type="email" name="txt_Username" id="txt_Username" tabindex="1" class="form-control" placeholder="Email Address " maxlength="100">
  291. </div>
  292. <div class="form-group">
  293. <input type="password" name="txt_Password" id="txt_Password" tabindex="2" class="form-control" placeholder="Password" maxlength="15">
  294. </div>
  295. <div class="form-group">
  296. <input type="text" name="txtMobilenumber" id="txtMobilenumber" tabindex="2" class="form-control" placeholder="Mobile Number" maxlength="15">
  297. </div>
  298. <div class="form-group">
  299. <div class="row">
  300. <div class="col-sm-6 col-sm-offset-3">
  301. <input type="submit" name="register-submit" id="register-submit" tabindex="4" class="form-control btn btn-register" value="Register Now" onClick="return CheckRegistration()">
  302. </div>
  303. </div>
  304. </div>
  305. </form>
  306.  
  307. </div>
  308. </div>
  309. </div>
  310. </div>
  311. <?PHP } ?>
  312. </div>
  313. </div>
  314. </div>
  315.  
  316. <footer>Copyrights. 2016</footer>
  317. </body>
  318. </html>
Add Comment
Please, Sign In to add comment