Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php require_once "includes/config.php";
- $oConf = new conf();
- $db = $oConf->get_db();
- $dbQuery = $oConf->get_db();
- $Returnresult = 0;
- if($_SESSION['Userid'] == "")
- {
- if($_POST['action'] == "login")
- {
- $Username = $_POST['txtUsername'];
- $Upassword = $_POST['txtPassword'];
- $UpdateQuery = "CALL SP_CHECKLOGINUSERS('$Username','$Upassword')";
- //echo $UpdateQuery;
- if ($dbQuery->multi_query($UpdateQuery))
- {
- do
- {
- /* store first result set */
- if ($result1 = $dbQuery->store_result())
- {
- while ($rowResult = $result1->fetch_row())
- {
- //print_r($rowResult);
- $_SESSION['Userid'] = $rowResult[0];
- $_SESSION['Name'] = $rowResult[1];
- $_SESSION['Mobile'] = $rowResult[4];
- $_SESSION['Username'] = $rowResult[3];
- $_SESSION['RoleCode'] = $rowResult[7];
- if($rowResult[7] == "USER_ROLE_TYPE")
- {
- $allClasses->forRedirect('ImageUpload.php');
- }
- else if($rowResult[7] =="ADMIN_ROLE_TYPE"){
- $allClasses->forRedirect('Index.php');
- }
- }
- $result1->close();
- }
- } while ($dbQuery->next_result());
- }
- //$dbQuery->query($UpdateQuery);
- if ($dbQuery->connect_errno) {
- echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
- }
- $dbQuery->close();
- //echo "mobile :".$_SESSION['Userid'];
- }
- }
- if($_SESSION['Userid'] == "")
- {
- if($_POST['action'] == "register")
- {
- $Name = $_POST['txtName'];
- $Upassword = $_POST['txt_Password'];
- $Username = $_POST['txt_Username'];
- $Mobilenumber = $_POST['txtMobilenumber'];
- //echo "mobile :".$Mobilenumber;
- $UpdateQuery = "CALL SP_INSERTUSERS(0,'$Username','$Name','$Username','$Upassword','$Mobilenumber',0,0,1001,@Result)";
- //echo $UpdateQuery;
- if ($db->multi_query($UpdateQuery))
- {
- do
- {
- if ($result1 = $db->store_result())
- {
- while ($rowResult = $result1->fetch_row())
- {
- $returnResult = $rowResult[0];
- //echo $returnResult;
- $Returnresult = $returnResult;
- if($returnResult == 1)
- {
- $Username_Code= base64_encode($Username);
- include('Mail.php');
- include('Mail/mime.php');
- $recipients = $Email;
- $message = "Hello $Name!</br></br>";
- $message .= "Welcome to Amazon Image Audit Application,</br></br>";
- $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>";
- $message .= "Thank you</br></br>";
- $message .= "Regards,</br></br>";
- $message .= "Amazon Team";
- $html = $message;
- $crlf = "\n";
- $hdrs = array(
- 'From' => $default_mailid,
- 'To' => $Username,
- 'Subject' => 'Account information - trackedin services'
- );
- $mime = new Mail_mime($crlf);
- $mime->setTXTBody($text);
- $mime->setHTMLBody($html);
- $body = $mime->get();
- $hdrs = $mime->headers($hdrs);
- $smtpinfo["host"] = "mail.manthansol.com";
- $smtpinfo["port"] = "25";
- $smtpinfo["auth"] = true;
- $smtpinfo["username"] = $smtpusername;
- $smtpinfo["password"] = $smtppassword;
- /* Create the mail object using the Mail::factory method */
- $mail_object =& Mail::factory("smtp", $smtpinfo);
- /* Ok send mail */
- $mail_object->send($recipients, $hdrs, $body);
- if (PEAR::isError($mail_object)) {
- echo("<p>" . $mail_object->getMessage() . "</p>");
- } else {
- //echo("<p>Message successfully sent!</p>");
- }
- }
- }
- $result1->close();
- }
- } while ($db->next_result());
- }
- $db->close();
- }
- }
- ?>
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>:: Amazon Image audit application ::</title>
- <link href="css/bootstrap.min.css" rel="stylesheet">
- <link href="css/style.css" rel="stylesheet">
- <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
- <script type="text/javascript" src="js/bootstrap.min.js" ></script>
- <link href="css/sweet-alert.css" rel="stylesheet">
- <script type="text/javascript" src="js/sweet-alert.js" ></script>
- <script type="text/javascript">$(function() {
- if('<?=$Returnresult?>' == 2)
- {
- sweetAlert("Oops...", "Username already exists.", "error");
- }
- else
- {
- if('<?=$Returnresult?>' == 1)
- {
- sweetAlert("Oops...", "Registration successful. Please check your mail and activate your account.", "error");
- }
- }
- $('#login-form-link').click(function(e) {
- $("#login-form").delay(100).fadeIn(100);
- $("#register-form").fadeOut(100);
- $('#register-form-link').removeClass('active');
- $(this).addClass('active');
- e.preventDefault();
- });
- $('#register-form-link').click(function(e) {
- $("#register-form").delay(100).fadeIn(100);
- $("#login-form").fadeOut(100);
- $('#login-form-link').removeClass('active');
- $(this).addClass('active');
- e.preventDefault();
- });
- });
- function CheckLogin()
- {
- var Username = $("#txtUsername").val();
- var Password = $("#txtPassword").val();
- if(Username == "")
- {
- sweetAlert("Oops...", "Enter Email Address", "error");
- //alert("Enter Username");
- $("#txtUsername").focus();
- return false;
- }
- if(Password == "")
- {
- sweetAlert("Oops...", "Enter Password", "error");
- //alert("Enter Username");
- $("#txtPassword").focus();
- return false;
- }
- }
- function CheckRegistration()
- {
- var Name = $("#txtName").val();
- var Username = $("#txt_Username").val();
- var Password = $("#txt_Password").val();
- var Mobilenumber = $("#txtMobilenumber").val();
- if(Name == "")
- {
- sweetAlert("Oops...", "Enter Name", "error");
- $("#txtName").focus();
- return false;
- }
- if(Username == "")
- {
- sweetAlert("Oops...", "Enter Email Address", "error");
- $("#txt_Username").focus();
- return false;
- }
- if(Password == "")
- {
- sweetAlert("Oops...", "Enter Password", "error");
- $("#txt_Password").focus();
- return false;
- }
- if(Mobilenumber == "")
- {
- sweetAlert("Oops...", "Enter Mobile Number", "error");
- $("#txtMobilenumber").focus();
- return false;
- }
- }
- </script>
- </head>
- <body>
- <header>Amazon Image Audit Application </header>
- <div class="navigation">
- <?php require_once "includes/header.php"; ?>
- </div>
- <div class="container">
- <div class="row">
- <div class="col-md-6 col-md-offset-3">
- <?php if($_SESSION['Userid'] == "")
- {
- ?>
- <div class="panel panel-login">
- <div class="panel-heading">
- <div class="row">
- <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>
- <div class="col-xs-6"> <a href="#" id="register-form-link"><span class="glyphicon glyphicon glyphicon-lock" aria-hidden="true"></span>Register</a> </div>
- </div>
- <hr>
- </div>
- <div class="panel-body">
- <div class="row">
- <div class="col-lg-12">
- <form id="login-form" action="" method="post" role="form" style="display: block;">
- <input type="hidden" name="action" value="login" />
- <div class="form-group">
- <input type="text" name="txtUsername" id="txtUsername" tabindex="1" class="form-control" placeholder="Email Address" maxlength="100">
- </div>
- <div class="form-group">
- <input type="password" name="txtPassword" id="txtPassword" tabindex="2" class="form-control" placeholder="Password" maxlength="15" >
- </div>
- <div class="form-group text-center" style="display:none;">
- <input type="checkbox" tabindex="3" class="" name="remember" id="remember">
- <label for="remember"> Remember Me</label>
- </div>
- <div class="form-group">
- <div class="row">
- <div class="col-sm-6 col-sm-offset-3">
- <input type="submit" name="login-submit" id="login-submit" tabindex="4" class="form-control btn btn-login" value="Log In" onClick="return CheckLogin()">
- </div>
- </div>
- </div>
- <div class="form-group" style="display:none;">
- <div class="row">
- <div class="col-lg-12">
- <div class="text-center"> <a href="#" tabindex="5" class="forgot-password">Forgot Password?</a> </div>
- </div>
- </div>
- </div>
- </form>
- <form id="register-form" action="#" method="post" role="form" style="display: none;">
- <input type="hidden" name="action" value="register" />
- <div class="form-group">
- <input type="text" name="txtName" id="txtName" tabindex="1" class="form-control" placeholder="Name" maxlength="100">
- </div>
- <div class="form-group">
- <input type="email" name="txt_Username" id="txt_Username" tabindex="1" class="form-control" placeholder="Email Address " maxlength="100">
- </div>
- <div class="form-group">
- <input type="password" name="txt_Password" id="txt_Password" tabindex="2" class="form-control" placeholder="Password" maxlength="15">
- </div>
- <div class="form-group">
- <input type="text" name="txtMobilenumber" id="txtMobilenumber" tabindex="2" class="form-control" placeholder="Mobile Number" maxlength="15">
- </div>
- <div class="form-group">
- <div class="row">
- <div class="col-sm-6 col-sm-offset-3">
- <input type="submit" name="register-submit" id="register-submit" tabindex="4" class="form-control btn btn-register" value="Register Now" onClick="return CheckRegistration()">
- </div>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- <?PHP } ?>
- </div>
- </div>
- </div>
- <footer>Copyrights. 2016</footer>
- </body>
- </html>
Add Comment
Please, Sign In to add comment