Skip to content
Snippets Groups Projects
Commit ff2e4a1c authored by dharaneesh . r ravi's avatar dharaneesh . r ravi
Browse files

signup implementation basic

parent 9ae669c6
No related branches found
No related tags found
No related merge requests found
<head>
<script src="../assets/js/color-modes.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="DHARANEESH">
<meta name="generator" content="Hugo 0.118.2">
<title>PHOTOGRAM</title>
<link href="/photogram/assets/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
\ No newline at end of file
<?php
$signup = false;
if (isset($_POST['username']) and isset($_POST['password']) and isset($_POST['email_address']) and isset($_POST['phone'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email_address'];
$phone = $_POST['phone'];
$error = signup($username, $password, $email, $phone);
$signup = true;
}
?>
<?
if($signup)
{
if(!$error)
{
?>
<main class="container">
<div class="bg-body-tertiary p-5 rounded mt-3">
<h1>SIGNUP SUCCESS</h1>
<p class="lead">Now You Can Login From <a href="/photogram/login.php">Here</a>.</p>
</div>
</main>
<?
}
else
{
?>
<main class="container">
<div class="bg-body-tertiary p-5 rounded mt-3">
<h1>SIGNUP FAIL</h1>
<p class="lead">Something Went Wrong. <?=$error ?></p>
</div>
</main>
<?
}
}
else {
?>
<main class="form-signup w-100 m-auto">
<form action="signup.php" method="post">
<img class="mb-4" src="https://git.selfmade.ninja/uploads/-/system/appearance/header_logo/1/logo-text.png" alt="" width="" height="50">
<h1 class="h3 mb-3 fw-normal">Please sign up</h1>
<div class="form-floating">
<input name="username" type="text" class="form-control" id="floatingInput" placeholder="name@example.com">
<label for="floatingInput">Username</label>
</div>
<div class="form-floating">
<input name="password" type="password" class="form-control" id="floatingPassword" placeholder="Password">
<label for="floatingPassword">Password</label>
</div>
<div class="form-floating">
<input name="email_address" type="email" class="form-control" id="floatingPassword" placeholder="Password">
<label for="floatingPassword">Email</label>
</div>
<div class="form-floating">
<input name="phone" type="text" class="form-control" id="floatingPassword" placeholder="Password">
<label for="floatingPassword">Phone</label>
</div>
<div class="form-check text-start my-3">
<input class="form-check-input" type="checkbox" value="remember-me" id="flexCheckDefault">
<label class="form-check-label" for="flexCheckDefault">
Remember me
</label>
</div>
<button class="btn btn-primary w-100 py-2 " type="submit">Sign up</button>
</form>
</main>
<?}?>
\ No newline at end of file
...@@ -65,21 +65,5 @@ ...@@ -65,21 +65,5 @@
.bd-mode-toggle .dropdown-menu .active .bi { .bd-mode-toggle .dropdown-menu .active .bi {
display: block !important; display: block !important;
} }
.form-signin {
max-width: 330px;
padding: 1rem;
}
.form-signin .form-floating:focus-within {
z-index: 2;
}
.form-signin input[type="email"] {
margin-bottom: -1px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
</style> </style>
\ No newline at end of file
...@@ -2,17 +2,9 @@ ...@@ -2,17 +2,9 @@
include "libs/load.php"; ?> include "libs/load.php"; ?>
<!doctype html> <!doctype html>
<html lang="en" data-bs-theme="auto"> <html lang="en" data-bs-theme="auto">
<head> <?load_templates('_head')?>
<script src="../assets/js/color-modes.js"></script> <?load_templates('_style');?>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="DHARANEESH">
<meta name="generator" content="Hugo 0.118.2">
<title>PHOTOGRAM</title>
<link href="/photogram/assets/dist/css/bootstrap.min.css" rel="stylesheet">
<?load_templates('_style');?>
</head>
<body> <body>
<?load_templates('_meta');?> <?load_templates('_meta');?>
<?load_templates('_header');?> <?load_templates('_header');?>
......
...@@ -11,3 +11,27 @@ function validate_credentials($username, $password) { ...@@ -11,3 +11,27 @@ function validate_credentials($username, $password) {
return false; return false;
} }
} }
function signup($user, $pass, $email, $phone) {
$servername = "mysql.selfmade.ninja";
$username = "dharaneesh";
$password = "jayanthi1234";
$dbname = "dharaneesh_photogram";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO `auth` (`username`, `password`, `email`, `phone`, `blocked`, `active`)
VALUES ('$user', '$pass', '$email', '$phone',0,1)";
$error = false;
if ($conn->query($sql) === TRUE) {
$error = false;
} else {
//echo "Error: " . $sql . "<br>" . $conn->error;
printf("Error message: %s\n", $conn->error);
$error = false;
}
$conn->close();
return $error;
}
<?php <?php
include "libs/load.php"; include "libs/load.php";
?> ?>
<!doctype html> <!doctype html>
<html lang="en" data-bs-theme="auto"> <html lang="en" data-bs-theme="auto">
<head> <style>
<script src="../assets/js/color-modes.js"></script> .form-signin {
<meta charset="utf-8"> max-width: 330px;
<meta name="viewport" content="width=device-width, initial-scale=1"> padding: 1rem;
<meta name="description" content=""> }
<meta name="author" content="DHARANEESH"> .form-signin .form-floating:focus-within {
<meta name="generator" content="Hugo 0.118.2"> z-index: 2;
<title>LOGIN TO PHOTOGRAM</title> }
<link href="/photogram/assets/dist/css/bootstrap.min.css" rel="stylesheet"> .form-signin input[type="email"] {
margin-bottom: -1px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
</style>
<?load_templates('_head');?>
<?load_templates('_style');?> <?load_templates('_style');?>
</head> <body>
<body> <?load_templates('_meta');?>
<?load_templates('_meta');?> <?load_templates('_header');?>
<?load_templates('_header');?> </header>
</header> <main>
<main> <?load_templates('_login');?>
<?load_templates('_login');?> </main>
</main> <?load_templates('_footer');?>
<?load_templates('_footer');?> <script src="/photogram/assets/dist/js/bootstrap.bundle.min.js"></script>
<script src="/photogram/assets/dist/js/bootstrap.bundle.min.js"></script> </body>
</body>
</html> </html>
\ No newline at end of file
<?php
include "libs/load.php";
?>
<!doctype html>
<html lang="en" data-bs-theme="auto">
<style>
.form-signup {
max-width: 330px;
padding: 1rem;
}
.form-signup .form-floating:focus-within {
z-index: 2;
}
.form-signup input[type="username"] {
margin-bottom: -1px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-signup input[type="password"] {
margin-bottom: -1px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.form-signup input[type="email"] {
margin-bottom: -1px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-signup input[type="phone"] {
margin-bottom: -1px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
</style>
<?load_templates('_head')?>
<?load_templates('_style');?>
<body>
<?load_templates('_meta');?>
<?load_templates('_header');?>
</header>
<main>
<?load_templates('_signup');?>
</main>
<?load_templates('_footer');?>
<script src="/photogram/assets/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
\ No newline at end of file
<pre>
<?php
print("_SERVER\n");
print_r($_SERVER);
print("_GET\n");
print_r($_GET);
print("_POST\n");
print_r($_POST);
print("_FILES\n");
print_r($_FILES);
print("_COOKIE\n");
print_r($_COOKIE);
<?php
include "libs/load.php";
// print("_SERVER\n");
// print_r($_SERVER);
// print("_GET\n");
// print_r($_GET);
// print("_POST\n");
// print_r($_POST);
// print("_FILES\n");
// print_r($_FILES);
// print("_COOKIE\n");
// print_r($_COOKIE);
// testing the signup function
if (signup("sam", "password", "sam@123", "6369239993")) {
echo "success";
} else {
echo "fail";
}
?> ?>
</pre>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment