Skip to content
Snippets Groups Projects
Commit 57eca90c authored by V Harish Ragavendher's avatar V Harish Ragavendher
Browse files

Merge branch 'push' into 'master'

changes from day 46 mvc part 1 and corrected the fingerprint and loading using...

See merge request !8
parents 4087ed8a 7518e9cf
No related branches found
No related tags found
1 merge request!8changes from day 46 mvc part 1 and corrected the fingerprint and loading using...
Pipeline #3821 passed
Showing
with 167 additions and 188 deletions
ErrorDocument 404 /error.php
\ No newline at end of file
<section class="py-5 text-center container">
<div class="row py-lg-5">
<div class="col-lg-6 col-md-8 mx-auto">
<h1 class="fw-light">Album example</h1>
<p class="lead text-muted">Something short and leading about the collection below—its contents, the creator, etc. Make it short and sweet, but not too short so folks don’t simply skip over it entirely.</p>
<p>
<a href="#" class="btn btn-primary my-2">Main call to action</a>
<a href="#" class="btn btn-secondary my-2">Secondary action</a>
</p>
</div>
</div>
</section>
\ No newline at end of file
<main class="px-3">
<h1>ERROR 404 !</h1>
<p class="lead"> No such page is available please redirect to Home
<p class="lead">
<a href="/" class="btn btn-lg btn-light fw-bold border-white bg-white">Go Home</a>
</p>
</main>
\ No newline at end of file
......@@ -8,13 +8,34 @@
<meta name="description" content="">
<meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
<meta name="generator" content="Hugo 0.104.2">
<title>Album example · Bootstrap v5.2</title>
<title>PHOTOGRAM</title>
<link rel="canonical" href="https://getbootstrap.com/docs/5.2/examples/album/">
<link
href="<?=get_config("base_path")?>assets/dist/css/bootstrap.min.css"
rel="stylesheet">
<!--script for fingerprintjs cdn.... -->
<script src="https://code.jquery.com/jquery-3.6.1.js"
integrity="sha256-3zlB5s2uwoUzrXK3BT7AX3FyvojsraNFxCc2vC/7pNI=" crossorigin="anonymous"></script>
<script>
// Initialize the agent at application startup.
const fpPromise = import(
'https://openfpcdn.io/fingerprintjs/v4') //NOTE:Ad blocker blocks the visibility of the fingerprint ID:
.then(FingerprintJS => FingerprintJS.load())
// Get the visitor identifier when you need it.
fpPromise
.then(fp => fp.get())
.then(result => {
// This is the visitor identifier:
const visitorId = result.visitorId;
console.log(visitorId);
$("#fingerprint").val(visitorId);
})
</script>
<!-- the code for implementing fingerprintjs from github and to get the value above ahidden class had been written-->
<!--//print(basename($_SERVER['PHP_SELF'], ".php").".css")-->
<?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . get_config("base_path") . "css/" . basename($_SERVER['PHP_SELF'], ".php") . ".css")) {?>
......
<!doctype html>
<html lang="en">
<?php sessions::loadTemplate('__head');?>
<body>
<?php
sessions::loadTemplate('__header');?>
<main>
<?php
//here we need to authorize the sessions and load things
if (sessions::$isError) {
sessions::loadTemplate('__error');
} else {
sessions::loadTemplate(sessions::currentScript());
}?>
</main>
<?php sessions::loadTemplate('__footer');?>
<script
src="<?=get_config("base_path")?>assets/dist/js/bootstrap.bundle.min.js">
</script>
</body>
</html>
\ No newline at end of file
<?php
if (sessions::isAuthenticated()) {
sessions::loadTemplate('index/__calltact');
} else {
sessions::loadTemplate('index/__login');
}
sessions::loadTemplate('index/__photos');
<section class="py-5 text-center container">
<div class="row py-lg-5">
<div class="col-lg-6 col-md-8 mx-auto">
<h1 class="fw-light">Wanna To Get Started</h1>
<p class="lead text-muted">We took an oauth preserve your memories with unique snaps and you...?</p>
<p>
<a href="#" class="btn btn-success my-2">upload</a>
<a href="#" class="btn btn-danger my-2">clear</a>
</p>
</div>
</div>
</section>
\ No newline at end of file
<section class="py-5 text-center container">
<div class="row py-lg-5">
<div class="col-lg-6 col-md-8 mx-auto">
<h1 class="fw-light">Make Your Moments Beautiful</h1>
<p class="lead text-muted">We took an oauth preserve your memories with unique snaps and you...?</p>
<p>
<a href="#" class="btn btn-Warning my-2">Login</a>
<a href="#" class="btn btn-Info my-2">Register</a>
</p>
</div>
</div>
</section>
\ No newline at end of file
<?php
print($fingerprint);
$login = false;
if(isset($_POST['password']) and isset($_POST['Username'])) {
//$fingerprint = $_POST['fingerprint'];
// setcookie('fingerprint', $fingerprint);
echo $_POST['fingerprint'];
$password = $_POST['password'];
$user = $_POST['Username'];
$result = user::login($user, $password);
$result = userSession::Authenticate($user, $password);
$login = true;
}?>
<?php
if($login) {
if($result) {?>
<div class="my-5">
<div class="p-5 text-center bg-body-tertiary">
<div class="container py-5">
<h1 class="text-body-emphasis">login Success</h1>
<p class="col-lg-8 mx-auto lead">
<p>Hello
<?print($email)?> hope you're doing good
</p>
<p>You can <a
href="<?php get_config("base_path")?>index.php">Continue</a>
by clicking</p>
</p>
</div>
</div>
</div>
<script>
window.location.href = "<?=get_config('base_path')?>"
</script>
<?php } else {?>
<div class="my-5">
<div class="p-5 text-center bg-body-tertiary">
<div class="container py-5">
<h1 class="text-body-emphasis">Oops incorrect username or password</h1>
<h1 class="text-body-emphasis">Oops Login Failed incorrect username or password</h1>
<p class="col-lg-8 mx-auto lead">
<p>please<a
href="<?php get_config("base_path")?>login_page.php">tryagain</a>
href="<?php get_config("base_path")?>login.php">tryagain</a>
by clicking</p>
</p>
</div>
......@@ -42,23 +29,23 @@ if($login) {
<?php }
} else {?>
<main class="form-signin w-100 m-auto">
<form method="post" action="login_page.php">
<form method="post" action="login.php">
<img class="mb-4"
src="<?php get_config("base_path")?>assets/img/logo.png"
alt="poke img" width="300" height="150">
<h1 class="h3 mb-3 fw-normal">Please sign in</h1>
<h1 class="h3 mb-3 fw-normal">Please Log in</h1>
<div class="form-floating">
<input name="Username" type="Username" class="form-control" id="floatingInput" placeholder="Username"
width="40" height="60">
<label for="floatingInput">Username</label>
<input name="Username" type="text" class="form-control" id="floatingInput" placeholder="Username" width="40"
height="60">
<label for="floatingInput">Username or Email address</address></label>
</div>
<div class="form-floating">
<input name="password" type="password" class="form-control" id="floatingPassword" placeholder="password"
width="40" height="60">
<label for="floatingPassword">Password</label>
</div>
<input name="fingerprint" type="hidden" class="form-control" id="fingerprint">
<input name="fingerprint" type="hidden" class="form-control" id="fingerprint" value="">
<!--to add fingerprint from fingrptint.js-->
<div class="form-check text-start my-3">
......@@ -76,6 +63,5 @@ if($login) {
<!--<p class="mt-5 mb-3 text-body-secondary">&copy; 2017–2023</p>-->
</form>
</main>
<?php }?>
\ No newline at end of file
......@@ -18,7 +18,7 @@ if ($signup) {
<h1 class="text-body-emphasis">Signup success</h1>
<p class="col-lg-8 mx-auto lead">
<p>You can <a
href="<?=get_config("base_path")?>login_page.php">Login</a>
href="<?=get_config("base_path")?>login.php">Login</a>
from here</p>
</p>
</div>
......@@ -32,9 +32,9 @@ if ($signup) {
<form method="post" action="signup.php">
<!-- <img class="mb-4"
<img class="mb-4"
src="<?=get_config("base_path")?>assets/img/logo.png"
alt="poke img" width="300" height="150"> -->
alt="poke img" width="300" height="150">
<h1 class="h3 mb-3 fw-normal">Please signup </h1>
<div class="form-floating">
<input name="username" type="tinytext" class="form-control" id="floatingInput" placeholder="text" width="40"
......
......@@ -11,14 +11,13 @@ body {
max-width: 330px;
padding: 1rem;
background: inherit;
filter:;
}
.form-signin .form-floating:focus-within {
z-index: 2;
}
.form-signin input[type="Username"] {
.form-signin input[type="text"] {
margin-bottom: -1px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
......
<?php
include 'libs/load.php';
sessions::$isError = true;
sessions::renderPage();
<?php include 'libs/load.php'
// as we already said only including load makes our task easier?>
<!doctype html>
<html lang="en">
<?php
<?php load_template('__head');?>
<body>
<?php load_template('__header');?>
<main>
<?php load_template('__calltact');?>
<?php load_template('__photos');?>
</main>
<?php load_template('__footer');?>
<script
src="<?=get_config("base_path")?>assets/dist/js/bootstrap.bundle.min.js">
</script>
</body>
</html>
\ No newline at end of file
include 'libs/load.php';
// as we already said only including load makes our task easier
sessions::renderPage();
......@@ -2,6 +2,7 @@
class sessions
{
public static $isError = false;
public static function start()
{
session_start();
......@@ -35,4 +36,33 @@ class sessions
return $default;
}
}
public static function loadTemplate($name)
{
//print(" including $name.php");
$script = $_SERVER["DOCUMENT_ROOT"] . get_config("base_path") . "__templates/$name.php";
if(is_file($script)) {
include $script;
} else {
sessions::loadTemplate('__error');
}
/* we are generally using this function and making multiple calls over our index.php file there all we need to do
is call the function with the right name for eg load_template('__header') and here we gave the location of the
file along with the extension .php and also this works because of our include function above and location is all that
matters even a single/ makes a big issue....there are 4 functions like include,include_once
(require,require_once or it could be given as __Dir__."/../__templates/$name.php") */
//this load_template has been moved from load.php to sessions.class.php for architecturing our framework
}
public static function renderPage()
{
sessions::loadTemplate('_master');
}
public static function currentScript()
{
return basename($_SERVER['SCRIPT_NAME'], '.php');
}
public static function isAuthenticated()
{
return false;
}
}
......@@ -39,44 +39,5 @@ function load_template($name)
file along with the extension .php and also this works because of our include function above and location is all that
matters even a single/ makes a big issue....there are 4 functions like include,include_once
(require,require_once or it could be given as __Dir__."/../__templates/$name.php") */
//this load_template has been moved from load.php to sessions.class.php for architecturing our framework
}
// function validate($Email,$password)
// {
// if($Email=="abcd@123" and $password="qwerty"){
// return 1;
// }else{
// return 0;
// }
// }
// function login($email, $pass)
// {
// $servername = "mysql.selfmade.ninja:3306";
// $username = "HarishRaghav";
// $password = "@7532159$";
// $dbname = "HarishRaghav_Photogram";
// // Create connection
// $conn = new mysqli($servername, $username, $password, $dbname);
// // Check connection
// if ($conn->connect_error) {
// die("Connection failed: " . $conn->connect_error);
// }
// $sql = "SELECT id,'Password'FROM user_data WHERE 'Password'='$pass' and Email FROM user_data WHERE Email='$email'";
// $result = $conn->query($sql);
// $end=false;
// if ($result->num_rows > 0) {
// // output data of each row
// $end=true;
// } else {
// $end=false;
// }
// $conn->close();
// return $end;
// }
<?php
include 'libs/load.php';
sessions::renderPage();
<?php
include 'libs/load.php';
?>
<html>
<?php load_template('__head');?>
<body>
<?php load_template('__header');?>
<main>
<?php load_template('__login')?>
</main>
<?php load_template('__footer');?>
<!--script for fingerprintjs cdn.... -->
<script src="https://code.jquery.com/jquery-3.6.1.js"
integrity="sha256-3zlB5s2uwoUzrXK3BT7AX3FyvojsraNFxCc2vC/7pNI=" crossorigin="anonymous"></script>
<script
src="<?=get_config("base_path")?>assets/dist/js/bootstrap.bundle.min.js">
</script>
<script>
// Initialize the agent at application startup.
const fpPromise = import(
'https://openfpcdn.io/fingerprintjs/v4') //NOTE:Ad blocker blocks the visibility of the fingerprint ID:
.then(FingerprintJS => FingerprintJS.load())
// Get the visitor identifier when you need it.
fpPromise
.then(fp => fp.get())
.then(result => {
// This is the visitor identifier:
const visitorId = result.visitorId;
console.log(visitorId);
$("#fingerprint").val(visitorId);
})
</script>
<!-- the code for implementing fingerprintjs from github and to get the value above ahidden class had been written-->
</body>
</html>
\ No newline at end of file
<?php
include 'libs/load.php';
?>
<html>
<?php load_template('__head');?>
<body>
<?php load_template('__header');?>
<main>
<?php load_template('__signup');?>
</main>
<?php load_template('__footer');?>
<script
src="<?php get_config("base_path")?>assets/dist/js/bootstrap.bundle.min.js">
</script>
</body>
</html>
\ No newline at end of file
include 'libs/load.php';
sessions::renderPage();
......@@ -10,7 +10,18 @@ $result = null;
print_r($_SERVER['DOCUMENT_ROOT']);
print_r($_SERVER['PHP_SELF']);
print("the base name we want is " . basename($_SERVER['PHP_SELF'], ".php") . ".css");
print(get_config(" base_path") . "assets/dist/css/bootstrap.min.css")
print(get_config(" base_path") . "assets/dist/css/bootstrap.min.css");
if($_POST['fingerprint']) {
print_r($_POST['fingerprint'] . "\n");
} else {
echo "error done \n";
}
if(sessions::get('visitor_id')) {
print "true";
print "thsi is the key " . sessions::get('visitor_id');
} else {
print "false";
}
/* if(sessions::get('login')) {
$username = sessions::get('sessusername');
$userobj = new user($username);
......
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