Commit 8eea1857 authored by Ehsan Fakhraie's avatar Ehsan Fakhraie

Registration Completed

parent 65209a70
<?php
require_once "../components/database/db.php";
if(isset($_GET["phone"])){
if(getUserByPhone($_GET["phone"])){
echo("0");
}else{
echo("1");
}
}else{
echo("0");
}
...@@ -64,6 +64,24 @@ function getUser($id) ...@@ -64,6 +64,24 @@ function getUser($id)
} }
return $user; return $user;
} }
function getUserByPhone($phone)
{
global $conn;
$sql = "SELECT * From users where phone=" . $phone;
$result = $conn->query($sql);
if($result->num_rows==0){
return 0;
}else{
$user = new User();
while ($row = $result->fetch_assoc()) {
$user = sqlDataToUser($row);
}
return $user;
}
}
function deleteUser($id) function deleteUser($id)
{ {
...@@ -81,24 +99,57 @@ function deleteUser($id) ...@@ -81,24 +99,57 @@ function deleteUser($id)
function createNewUser($phone){ function createNewUser($phone){
global $conn; global $conn;
$sql="INSERT INTO users (phone) values ('$phone')"; $user = new User();
if ($conn->query($sql) === TRUE) { $user->phone=$phone;
return $last_id = $conn->insert_id; $user->phoneVerified=1;
} else {
return 0; return insertUser($user);
}
} }
function insertUser(User $user) function insertUser(User $user)
{ {
global $conn; global $conn;
$sql = "INSERT INTO `users` (`registered`, `full_name`, `email`, `phone`, `password`, `national_code`, `address`, `movies`) VALUES ('" . $user->registered . "', $phoneD=0;
'" . $user->name . "', '" . $user->email . "', '" . $user->phone . "', '" . $user->password . "', '" . $user->nationalCode . "', '" . $user->address . "', '" . $user->movies . "')"; if(getUserByPhone($user->phone)){
if ($conn->query($sql) === TRUE) { $phoneD=1;
return 1;
} else {
return "Error: " . $sql . "<br>" . $conn->error;
} }
if($phoneD){
$sql ="UPDATE `users` SET
`full_name` = '$user->name', `email` = '$user->email',
`password` = '$user->password', `national_code` = '$user->nationalCode',
`address` = '$user->address', `movies` = '$user->movies' , `phone_verified`='$user->phoneVerified'
WHERE `users`.`phone` = $user->phone";
if ($conn->query($sql) === TRUE) {
$user2=getUserByPhone($user->phone);
if($user2!=0)
return getUserByPhone($user->phone)->id;
else return 0;
} else {
return "Error: " . $sql . "<br>" . $conn->error;
}
}
if(empty($user->id)){
$sql = "INSERT INTO `users` (`registered`, `full_name`, `email`, `phone`, `password`, `national_code`, `address`, `movies`,`phone_verified`) VALUES ('" . $user->registered . "',
'" . $user->name . "', '" . $user->email . "', '" . $user->phone . "', '" . $user->password . "', '" . $user->nationalCode . "', '" . $user->address . "', '" . $user->movies . "','$user->phoneVerified')";
if ($conn->query($sql) === TRUE) {
return $conn->insert_id;;
} else {
return "Error: " . $sql . "<br>" . $conn->error;
}
}else{
$sql ="UPDATE `users` SET
`full_name` = '$user->name', `email` = '$user->email',
`password` = '$user->password', `national_code` = '$user->nationalCode',
`address` = '$user->address', `movies` = '$user->movies' , `phone_verified`='$user->phoneVerified'
WHERE `users`.`id` = $user->id";
if ($conn->query($sql) === TRUE) {
return $conn->insert_id;;
} else {
return "Error: " . $sql . "<br>" . $conn->error;
}
}
} }
function sqlDataToUser($d) function sqlDataToUser($d)
...@@ -113,6 +164,7 @@ function sqlDataToUser($d) ...@@ -113,6 +164,7 @@ function sqlDataToUser($d)
$user->address = $d["address"]; $user->address = $d["address"];
$user->movies = $d["movies"]; $user->movies = $d["movies"];
$user->phoneVerified = $d["phone_verified"]; $user->phoneVerified = $d["phone_verified"];
$user->id=$d["id"];
return $user; return $user;
} }
...@@ -159,15 +211,13 @@ function checkValidationCode($phone, $code) ...@@ -159,15 +211,13 @@ function checkValidationCode($phone, $code)
{ {
global $conn; global $conn;
$sql = "select * from phone_verification where phone= " . $phone . " AND vcode= " . $code; $sql = "select * from phone_verification where phone= " . $phone . " AND vcode= " . $code;
$sql2 = "UPDATE users SET phone_verified=1 where phone=" . $phone;
$result = $conn->query($sql); $result = $conn->query($sql);
if ($result->num_rows == 0) { if ($result->num_rows == 0) {
return 0; return 0;
} else { } else {
if ($conn->query($sql2)) { return 1;
return 1;
} else
return 0;
} }
} }
......
...@@ -5,9 +5,7 @@ function css_include(){ ...@@ -5,9 +5,7 @@ function css_include(){
return " return "
<link rel=\"stylesheet\" media=\"screen\" href=\"https://fontlibrary.org/face/iranian-sans\" type=\"text/css\"/> <link rel=\"stylesheet\" media=\"screen\" href=\"https://fontlibrary.org/face/iranian-sans\" type=\"text/css\"/>
<link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css\" integrity=\"sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh\" crossorigin=\"anonymous\"> <link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css\" integrity=\"sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh\" crossorigin=\"anonymous\">
<link rel='stylesheet' href='style.css'> <link rel='stylesheet' href='style/style.css'>
<script src=\"script/ChangeNumbers.min.js\"></script>
"; ";
} }
......
<?php
include "../components/functions.php";
include "../components/database/db.php";
//todo server side validation
session_start();
if(isset($_SESSION["id"])){
$id=$_SESSION["id"];
$user=getUser($id);
if($_SERVER["REQUEST_METHOD"] == "POST"){
$error=0;
$pass_error="";
$name=trim($_POST["firstName"]);
$family=trim($_POST["familyName"]);
$email=trim($_POST["email"]);
$pass=trim($_POST["password"]);
$rePass=trim($_POST["rePassword"]);
$user->name=$name." ".$family;
$user->email=$email;
if($pass!=$rePass){
$pass_error="پسورد همخوانی ندارد";
$error=1;
}else{
$user->password=password_hash($pass,PASSWORD_DEFAULT);
}
if(!$error){
if(insertUser($user)){
header("location:login.php");
}
}
}
}else{
header("location:login.php");
}
?>
<!DOCTYPE> <!DOCTYPE>
<html> <html>
<head> <head>
<link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/iranian-sans" type="text/css"/> <?php
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> echo css_include();
<meta charset="utf-8"> echo script_include();
<link rel="stylesheet" href="style.css"> ?>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</head> </head>
<style> <style>
</style> </style>
<body style="text-align: right;font-family:'IranianSansRegular'"> <body >
<div class="container" id="login_container"> <div class="container" id="register_container">
<div class="flex-container"> <div class="flex-container">
<form class="border" id="form_border"> <form class="border" id="form_border" method="post" action="info.php">
<div class="form-group py-4"> <div class="form-group py-4">
<span class="login_title py-3" style="font-family:'B Titr'">ثبت نام</span> <span class="login_title py-3" style="font-family:'B Titr'">ثبت نام</span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="firstName">نام</label> <label for="firstName">نام</label>
<input type="text" class="form-control rounded-pill" id="firstName" aria-describedby="nameErr"> <input type="text" class="form-control rounded-pill" id="firstName" name="firstName" aria-describedby="nameErr">
<small id="nameErr" style="color:red"></small> <small id="nameErr" style="color:red"></small>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="familyName">نام خانوادگی</label> <label for="familyName">نام خانوادگی</label>
<input type="text" class="form-control rounded-pill" id="familyName" aria-describedby="familyErr"> <input type="text" class="form-control rounded-pill" id="familyName" name="familyName" aria-describedby="familyErr">
<small id="familyErr" style="color:red"></small> <small id="familyErr" style="color:red"></small>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="mobile">تلفن همراه</label> <label for="mobile">تلفن همراه</label>
<input type="text" class="form-control rounded-pill" id="mobile" aria-describedby="mobileErr" placeholder="۹۱۲-------" maxlength="10"> <input type="text" class="form-control rounded-pill" id="mobile" name="mobile" aria-describedby="mobileErr" maxlength="10" disabled value="<?php echo $user->phone ?>">
<small id="mobileErr" style="color: red"></small> <small id="mobileErr" style="color: red"></small>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="email">ایمیل</label> <label for="email">ایمیل</label>
<input type="text" class="form-control rounded-pill" id="email" aria-describedby="emailErr"placeholder="example@gmail.com"> <input type="text" class="form-control rounded-pill" id="email" name="email" aria-describedby="emailErr"placeholder="example@gmail.com">
<small id="emailErr" style="color:red"></small> <small id="emailErr" style="color:red"></small>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="exampleInputPassword1">رمز عبور</label> <label for="exampleInputPassword1">رمز عبور</label>
<input type="password" class="form-control rounded-pill" id="exampleInputPassword1" aria-describedby="passErr"> <input type="password" class="form-control rounded-pill" id="password" name="password" aria-describedby="passErr">
<small id="passErr" style="color:red"></small> <small id="passErr" style="color:red"></small>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="reExampleInputPassword1">تکرار رمز عبور</label> <label for="reExampleInputPassword1">تکرار رمز عبور</label>
<input type="password" class="form-control rounded-pill" id="reExampleInputPassword1" aria-describedby="rePassErr"> <input type="password" class="form-control rounded-pill" id="rePassword" name="rePassword" aria-describedby="rePassErr">
<small id="rePassErr" style="color:red"></small> <small id="rePassErr" style="color:red"></small>
</div> </div>
<div class="form-group"> <br>
<a href="#">قبلا اکانت ساخته ام</a>
</div>
<button type="submit" class="btn btn-primary rounded-pill pb-2" style="background-color: green;border-color: green;width: 100%">ثبت نام</button> <button type="button" class="btn btn-primary rounded-pill pb-2" style="background-color: green;border-color: green;width: 100%" onclick="checkInfo()">ثبت نام</button>
</form> </form>
...@@ -64,5 +104,61 @@ ...@@ -64,5 +104,61 @@
</div> </div>
</body> </body>
<script>
function _(el) {
return document.getElementById(el);
}
function validateEmail(email) {
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase());
}
function checkInfo() {
let name = document.getElementById("firstName").value;
let family = document.getElementById("familyName").value;
let email = document.getElementById("email").value;
let pass = document.getElementById("password").value;
let rePass = document.getElementById("rePassword").value;
_("nameErr").innerHTML="";
_("familyErr").innerHTML="";
_("passErr").innerHTML="";
_("rePassErr").innerHTML="";
_("emailErr").innerHTML="";
var error=0;
if(name.length===0){
_("nameErr").innerHTML="نام را وارد کنید.";
error=1;
}
if(family.length===0){
_("familyErr").innerHTML="نام خانوادگی را وارد کنید.";
error=1;
}
if(pass.length===0){
_("passErr").innerHTML="پسورد را وارد کنید.";
error=1;
}
if(rePass.length===0){
_("rePassErr").innerHTML="تکرار پسورد را وارد کنید.";
error=1;
}
if(!validateEmail(email)){
_("emailErr").innerHTML="ایمیل معتبر نیست";
error=1;
}
if(pass!==rePass){
_("rePassErr").innerHTML="پسورد با تکرار همخوانی ندارد";
error=1;
}
if(!error){
document.getElementById("form_border").submit();
}
}
</script>
</html> </html>
\ No newline at end of file
<!DOCTYPE>
<html>
<head>
<link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/iranian-sans" type="text/css"/>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</head>
<style>
#form_border{
padding: 50px;
border-radius: 20px;
position: relative;
}
.login_title {
font-family: JosefinSans-Bold;
font-size: 30px;
color: black;
line-height: 2;
text-align: center;
position: absolute;
background-color: darkgoldenrod;
width: 100%;
top: 0;
left: 0;
border-radius: 20px 20px 0px 0px;
}
.container{
margin-top: 10%;
max-width: 500px;
max-height: 500px;
}
</style>
<body style="text-align: right;font-family:'IranianSansRegular'">
<div class="container">
<div class="flex-container">
<form class="border" id="form_border">
<div class="form-group py-4">
<span class="login_title py-3" style="font-family:'B Titr'">ورود</span>
</div>
<div class="form-group">
<label for="mobile">تلفن همراه</label>
<input type="text" class="form-control rounded-pill" id="mobile" aria-describedby="mobileErr" placeholder="۹۱۲-------" maxlength="10">
<small id="mobileErr" style="color: red"></small>
</div>
<div class="form-group">
<label for="exampleInputPassword1">رمز عبور</label>
<input type="password" class="form-control rounded-pill" id="exampleInputPassword1" aria-describedby="passErr">
<small id="passErr" style="color:red"></small>
</div>
<div class="form-group">
<a href="#">رمز عبورم را فراموش کرده ام</a>
</div>
<button type="submit" class="btn btn-primary rounded-pill pb-2" style="position: absolute;left: 50px;background-color: green;border-color: green">ورود</button>
<button onclick="location.href='#';" type="button" class="btn btn-primary rounded-pill" >ثبت نام</button>
</form>
</div>
</div>
</body>
</html>
\ No newline at end of file
...@@ -29,7 +29,8 @@ if(isset($_GET["mobile"])){ ...@@ -29,7 +29,8 @@ if(isset($_GET["mobile"])){
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="mobile">تلفن همراه</label> <label for="mobile">تلفن همراه</label>
<input type="text" name="mobile" class="form-control rounded-pill" id="mobile" aria-describedby="mobileErr" placeholder="۰۹۱۲-------" maxlength="11" value="<?php echo $phone?>"> <input type="text" name="mobile" class="form-control rounded-pill" id="mobile"
aria-describedby="mobileErr" placeholder="۰۹۱۲-------" maxlength="11" value="<?php echo $phone?>" >
<small id="mobileErr" style="color: red"></small> <small id="mobileErr" style="color: red"></small>
</div> </div>
<br> <br>
...@@ -37,7 +38,7 @@ if(isset($_GET["mobile"])){ ...@@ -37,7 +38,7 @@ if(isset($_GET["mobile"])){
<div class="col-3"></div> <div class="col-3"></div>
<button <button
type="button" class="btn btn-primary rounded-pill col-6 " id="button" onclick="f()" >تایید شماره</button> type="button" class="btn btn-primary rounded-pill col-6 " id="button" onclick="checkPhone()" >تایید شماره</button>
<div class="col-3"></div> <div class="col-3"></div>
</div> </div>
...@@ -48,29 +49,65 @@ if(isset($_GET["mobile"])){ ...@@ -48,29 +49,65 @@ if(isset($_GET["mobile"])){
</body> </body>
<script> <script>
function f(e) { // function f(e) {
var v = document.getElementById("mobile").value; // var v = document.getElementById("mobile").value;
{ // {
if (v.length != 0) { // if (v.length !== 0) {
var flag=0; // var flag=0;
if(v.length!=11){ // if(v.length !== 11){
flag=1; // flag=1;
} // }
if(v[0]!="0"){ // if(v[0]!="0"){
flag=1; // flag=1;
} // }
if (flag) { // if (flag) {
console.log("sdfs"); // console.log("sdfs");
document.getElementById('mobileErr').innerHTML = 'شماره موبایل فاقد اعتبار است'; // document.getElementById('mobileErr').innerHTML = 'شماره موبایل فاقد اعتبار است';
return false; // return false;
} else { // } else {
location.replace("verify.php?mobile=" + v); // location.replace("verify.php?mobile=" + v);
// }
// } else {
// document.getElementById('mobileErr').innerHTML = 'شماره موبایل فاقد اعتبار است';
// return false;
// }
// }
// }
function checkPhone() {
let phone = document.getElementById("mobile").value;
var flag=1;
if(phone.length===11){
if(phone[0]==="0"){
if(phone.match(/^[0-9]+$/) != null){
flag=0;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
console.log(this.responseText);
if(this.responseText==="1"){
location.href=("verify.php?mobile=" + phone);
return 0;
}else{
document.getElementById('mobileErr').innerHTML="<br>";
document.getElementById('mobileErr').innerHTML += 'با این شماره قبلا اکانت ساخته شده است.<br>';
document.getElementById('mobileErr').innerHTML += "<a href='login.php'>بازگشت به صفحه ورود</a>";
location.href=("verify.php?mobile=" + phone);
return 0;
}
}
};
xmlhttp.open("GET", "../api/validPhoneNumber.php?phone=" + phone, true);
xmlhttp.send();
} }
} else {
document.getElementById('mobileErr').innerHTML = 'شماره موبایل فاقد اعتبار است';
return false;
} }
} }
if(flag){
document.getElementById('mobileErr').innerHTML="<br>";
document.getElementById('mobileErr').innerHTML+="شماره نامعتبر است";
}
} }
......
#form_border{ #form_border{
padding: 50px; padding: 50px;
border-radius: 20px; border-radius: 20px;
...@@ -23,6 +24,13 @@ ...@@ -23,6 +24,13 @@
max-height: 500px; max-height: 500px;
} }
#register_container{
margin-top: 5%;
margin-bottom: 5%;
max-width: 500px;
max-height: 500px;
}
.red_btn{ .red_btn{
border-color: red; border-color: red;
...@@ -43,4 +51,38 @@ ...@@ -43,4 +51,38 @@
} }
input{ input{
text-align: left; text-align: left;
} }
\ No newline at end of file #sp-line{
height:1px;
color: #f1b439;
border: hidden;
border-bottom:5px solid #f1b439
}
#dynamic{
height: 30px;
font-size: 20px;
}
#file-container{
display: none;
}
input[type="file"] {
display: none;
}
.custom-file-upload {
border: 1px solid #ccc;
display: inline-block;
padding: 6px 12px;
cursor: pointer;
}
.custom-file-upload{
display: block;
text-align: center;
border-radius:50rem!important;
background-color: green;
border-color: green;
color: white;
height: 40px;
}
<!DOCTYPE>
<html>
<head>
<link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/iranian-sans" type="text/css"/>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<script>
function move() {
var elem = document.getElementById("myBar");
var width = 1;
var id = setInterval(frame, 10);
elem.style.opacity="100";
function frame() {
if (width >= 100) {
clearInterval(id);
} else {
width++;
elem.style.width = width + '%';
}
}
}
</script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</head>
<style>
#form_border{
padding: 50px;
border-radius: 20px;
position: relative;
}
.login_title {
font-size: 30px;
color: black;
line-height: 2;
text-align: center;
position: absolute;
background-color: darkgoldenrod;
width: 100%;
top: 0;
left: 0;
border-radius: 20px 20px 0px 0px;
}
.container{
max-width: 700px;
max-height: 500px;
}
hr{
height:1px;
color: #ffa300;
border: hidden;
border-bottom:5px solid #a55b00;
}
</style>
<body style="text-align: right;font-family:'IranianSansRegular'">
<div class="container">
<div class="flex-container">
<div class="container">
<form class="border" id="form_border">
<div class="form-group py-4">
<span class="login_title py-3" style="font-family:'B Titr'">آپلود ویدیو</span>
</div>
<div class="form-group">
<label for="exampleFormControlFile1">فایل خود را انتخاب کنید</label>
<input type="file" class="form-control-file" id="exampleFormControlFile1" >
</div>
<div class="form-group">
<button onclick="move()" type="button" class="btn btn-primary rounded-pill pb-2" style="width:100%;background-color: green;border-color: green">تایید</button>
</div>
<div class="flex-container">
<div class="form-group">
<div class="flex-container">
<div>
<div id="myBar" class="w3-green" style="height:24px;width:0;opacity:0;"></div>
</div>
</div>
</div>
</div>
<hr>
<div class="form-group">
<p style="text-align: center;font-size: 30px" >اطلاعات شخصی</p>
</div>
<div class="form-group">
<label for="address">آدرس</label>
<input type="text" class="form-control rounded-pill" id="address" aria-describedby="addressErr" style="text-align: right">
<small id="addressErr" style="color:red"></small>
</div>
<div class="form-group">
<label for="zip">کد پستی</label>
<input type="text" class="form-control rounded-pill" id="zip" aria-describedby="zipErr">
<small id="zipErr" style="color:red"></small>
</div>
<div class="form-group">
<label for="mc">کد ملی</label>
<input type="text" class="form-control rounded-pill" id="mc" aria-describedby="mcErr"placeholder="0021234567">
<small id="mcErr" style="color:red"></small>
</div>
<div class="form-group">
<label for="fixedNumber">تلفن ثابت</label>
<input type="text" class="form-control rounded-pill" id="fixedNumber" aria-describedby="ftErr"placeholder="02122334455">
<small id="ftErr" style="color:red"></small>
</div>
<hr>
<div class="form-group">
<p style="text-align: center;font-size: 30px" >اطلاعات فیلم</p>
</div>
<div class="form-group">
<label for="groupMembers">نام اعضای گروه</label>
<input type="text" class="form-control rounded-pill" id="groupMembers" aria-describedby="gpmErr" style="text-align: right">
<small id="gpmErr" style="color:red"></small>
</div>
<div class="form-group">
<label for="movieName">نام فیلم</label>
<input type="text" class="form-control rounded-pill" id="movieName" aria-describedby="mnErr" style="text-align: right">
<small id="mnErr" style="color:red"></small>
</div>
<button type="submit" class="btn btn-primary rounded-pill pb-2" style="background-color: green;border-color: green;width: 100%">ارسال</button>
</form>
</div>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE>
<html>
<head>
<link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/iranian-sans" type="text/css"/>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script>
var counter = 60;
var url= "http://www.google.com";
var interval = setInterval(function() {
counter--;
// Display 'counter' wherever you want to display it.
if (counter < 0) {
clearInterval(interval);
document.getElementById("time").outerHTML="<a href=\"#\" target=\"_self\">کدی برای من ارسال نشده است</a>";
return;
}else{
document.getElementById("time").innerHTML=counter.toString(10);
console.log("Timer --> " + counter);
}
}, 1000);
</script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</head>
<style>
#time{
color: green;
}
.center {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
}
</style>
<body style="text-align: right;font-family:'IranianSansRegular'">
<div class="container" id="login_container">
<div class="flex-container">
<form class="border" id="form_border">
<div class="form-group py-4">
<span class="login_title py-3" style="font-family:'B Titr';font-size: larger">تلفن همراه خود را تایید کنید</span>
</div>
<div class="form-group">
<img src="https://assets.dryicons.com/uploads/icon/svg/6030/05a807e5-191c-4842-84a0-71d2e9442d36.svg"style="max-width: 100px;"class="center">
</div>
<div class="form-group">
<p style="text-align: center">09211759357</p>
</div>
<div class="form-group" id="codeInput">
<label for="mobile">کد پنج‌رقمی</label>
<input type="text" class="form-control rounded-pill" id="mobile" aria-describedby="mobileErr" placeholder="00000" maxlength="5" style="letter-spacing: 20px;text-align: center">
<small id="mobileErr" style="color: red"></small>
</div>
<div class="form-group">
<span id="dsc">لطفا کد ۵ رقمی ارسال شده به تلفن همراه خود را در فیلد بالا وارد کنید</span>
</div>
<div class="form-group">
<p id="time" style="text-align: center">60</p>
</div>
<div class="row">
<button type="submit"
class="btn btn-primary rounded-pill pb-2 col-5" id="submitButton">تایید</button>
<div class="col-2"></div>
<button onclick="location.href='#';"
type="button" class="btn btn-primary rounded-pill col-5" id="button" >تغییر شماره</button>
</div>
</form>
</div>
</div>
</body>
</html>
\ No newline at end of file
...@@ -5,19 +5,27 @@ include "../components/smsPanel.php"; ...@@ -5,19 +5,27 @@ include "../components/smsPanel.php";
//todo fix multiple sends //todo fix multiple sends
$phone=""; $phone = "";
$error=""; $error = "";
if(isset($_GET["mobile"])&&isset($_GET["code"])){ if (isset($_GET["mobile"]) && isset($_GET["code"])) {
$phone = $_GET["mobile"]; $phone = $_GET["mobile"];
if(checkValidationCode($_GET["mobile"],$_GET["code"])){ if (checkValidationCode($_GET["mobile"], $_GET["code"])) {
header("location:login.php"); $id = createNewUser($phone);
}else{ echo $id;
$error='کد نامعتبر است'; if($id!=0){
session_start();
$_SESSION["id"]=$id;
header("location:info.php");
}else{
$error = 'کد نامعتبر است';
}
} else {
$error = 'کد نامعتبر است';
} }
}else if(isset($_GET["mobile"])) { } else if (isset($_GET["mobile"])) {
$phone = $_GET["mobile"]; $phone = $_GET["mobile"];
sendCode($phone); sendCode($phone);
}else{ } else {
header("location:login.php"); header("location:login.php");
} }
?> ?>
...@@ -30,15 +38,15 @@ if(isset($_GET["mobile"])&&isset($_GET["code"])){ ...@@ -30,15 +38,15 @@ if(isset($_GET["mobile"])&&isset($_GET["code"])){
?> ?>
<script> <script>
var counter = 60; var counter = 60;
var interval = setInterval(function() { var interval = setInterval(function () {
counter--; counter--;
// Display 'counter' wherever you want to display it. // Display 'counter' wherever you want to display it.
if (counter < 0) { if (counter < 0) {
clearInterval(interval); clearInterval(interval);
document.getElementById("time").outerHTML="<a href=\"#\" target=\"_self\">کدی برای من ارسال نشده است</a>"; document.getElementById("time").outerHTML = "<a href=\"#\" target=\"_self\">کدی برای من ارسال نشده است</a>";
return; return;
}else{ } else {
document.getElementById("time").innerHTML=counter.toString(10); document.getElementById("time").innerHTML = counter.toString(10);
} }
}, 1000); }, 1000);
...@@ -47,7 +55,7 @@ if(isset($_GET["mobile"])&&isset($_GET["code"])){ ...@@ -47,7 +55,7 @@ if(isset($_GET["mobile"])&&isset($_GET["code"])){
</head> </head>
<style> <style>
#time{ #time {
color: green; color: green;
} }
...@@ -66,14 +74,16 @@ if(isset($_GET["mobile"])&&isset($_GET["code"])){ ...@@ -66,14 +74,16 @@ if(isset($_GET["mobile"])&&isset($_GET["code"])){
<span class="login_title py-3" style="font-family:'B Titr';font-size: larger">تلفن همراه خود را تایید کنید</span> <span class="login_title py-3" style="font-family:'B Titr';font-size: larger">تلفن همراه خود را تایید کنید</span>
</div> </div>
<div class="form-group"> <div class="form-group">
<img src="https://assets.dryicons.com/uploads/icon/svg/6030/05a807e5-191c-4842-84a0-71d2e9442d36.svg"style="max-width: 100px;"class="center"> <img src="https://assets.dryicons.com/uploads/icon/svg/6030/05a807e5-191c-4842-84a0-71d2e9442d36.svg"
style="max-width: 100px;" class="center">
</div> </div>
<div class="form-group"> <div class="form-group">
<p style="text-align: center"><?php echo fa_number($phone)?></p> <p style="text-align: center"><?php echo fa_number($phone) ?></p>
</div> </div>
<div class="form-group" id="codeInput"> <div class="form-group" id="codeInput">
<label for="mobile">کد پنج‌رقمی</label> <label for="mobile">کد پنج‌رقمی</label>
<input type="text" class="form-control rounded-pill" id="mobile" aria-describedby="mobileErr" placeholder="00000" maxlength="5" style="letter-spacing: 20px;text-align: center"> <input type="text" class="form-control rounded-pill" id="mobile" aria-describedby="mobileErr"
placeholder="00000" maxlength="5" style="letter-spacing: 20px;text-align: center">
<small id="mobileErr" style="color: red"> <small id="mobileErr" style="color: red">
<?php <?php
echo $error; echo $error;
...@@ -84,16 +94,18 @@ if(isset($_GET["mobile"])&&isset($_GET["code"])){ ...@@ -84,16 +94,18 @@ if(isset($_GET["mobile"])&&isset($_GET["code"])){
<span id="dsc">لطفا کد ۵ رقمی ارسال شده به تلفن همراه خود را در فیلد بالا وارد کنید</span> <span id="dsc">لطفا کد ۵ رقمی ارسال شده به تلفن همراه خود را در فیلد بالا وارد کنید</span>
</div> </div>
<div class="form-group"> <div class="form-group">
<p style="text-align: center"> <p style="text-align: center">
<label id="time" data-number-target="fa">60</label> <label id="time" data-number-target="fa">60</label>
</p> </p>
</div> </div>
<div class="row"> <div class="row">
<button type="button" <button type="button"
class="btn btn-primary rounded-pill pb-2 col-5" id="submitButton" onclick="f()">تایید</button> class="btn btn-primary rounded-pill pb-2 col-5" id="submitButton" onclick="f()">تایید
</button>
<div class="col-2"></div> <div class="col-2"></div>
<button onclick="location.href='register.php';" <button onclick="location.href='register.php';"
type="button" class="btn btn-primary rounded-pill col-5" id="button" >تغییر شماره</button> type="button" class="btn btn-primary rounded-pill col-5" id="button">تغییر شماره
</button>
</div> </div>
</form> </form>
<script src="script/ChangeNumbers.min.js"></script> <script src="script/ChangeNumbers.min.js"></script>
...@@ -104,23 +116,15 @@ if(isset($_GET["mobile"])&&isset($_GET["code"])){ ...@@ -104,23 +116,15 @@ if(isset($_GET["mobile"])&&isset($_GET["code"])){
<script> <script>
function f(e) { function f(e) {
var v = document.getElementById("mobile").value; var v = document.getElementById("mobile").value;
{ var code = document.getElementById("mobile").value;
if (v.length != 0) { if (code.length === 5) {
var flag=0; var params = "?mobile=<?php echo $phone?>&code=" + code;
if(v.length!=5){ location.href = "verify.php" + params;
flag=1; } else {
} document.getElementById('mobileErr').innerHTML = 'کد نامعتبر است';
if (flag) { return false;
document.getElementById('mobileErr').innerHTML = 'کد نامعتبر است';
return false;
} else {
var params="?mobile=<?php echo $phone?>&code="+v;
location.href="verify.php"+params;
}
} else {
document.getElementById('mobileErr').innerHTML = 'کد نامعتبر است';
}
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<head> <head>
<link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/iranian-sans" type="text/css"/> <link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/iranian-sans" type="text/css"/>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style/style.css">
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
</div> </div>
<br> <br>
<div class="row"> <div class="row">
<button type="submit" <button type="submit"
class="btn btn-primary rounded-pill pb-2 col-5 default_btn" id="submitButton">بازگشت به سایت</button> class="btn btn-primary rounded-pill pb-2 col-5 default_btn" id="submitButton">بازگشت به سایت</button>
<div class="col-2"></div> <div class="col-2"></div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment