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

Merge branch 'push' into 'master'

changes with get_config by adding base path

See merge request !1
parents d7a1399e cbae7e6a
No related branches found
No related tags found
1 merge request!1changes with get_config by adding base path
Pipeline #3615 passed
......@@ -8,14 +8,16 @@
<link rel="canonical" href="https://getbootstrap.com/docs/5.2/examples/album/">
<link href="/Php/photogram/App/assets/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="<?get_config(" base_path")?>/App/assets/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- <?//print(basename($_SERVER['PHP_SELF'], ".php").".css")?> -->
<?if (file_exists($_SERVER['DOCUMENT_ROOT']."/Php/photogram/App/css/".basename($_SERVER['PHP_SELF'], ".php").".css")) {?>
<!--//print(basename($_SERVER['PHP_SELF'], ".php").".css")-->
<?if (file_exists($_SERVER['DOCUMENT_ROOT'] . get_config("base_path") . "/App/css/" . basename($_SERVER['PHP_SELF'], ".php") . ".css")) {?>
<link
href="/Php/photogram/App/css/<?=basename($_SERVER['PHP_SELF'], ".php")?>.css"
href="<?=get_config("base_path")?>/App/css/<?=basename($_SERVER['PHP_SELF'], ".php")?>.css"
rel="stylesheet">
<!-- here we are loading the css file in an autoamted way like we already know document root has the location to htdocs
and after that we are giving the css folder location there we are using base name function from php self which is the
file name we are using for eg: login.php will be in php self means basename will give the output like login and we are
manually adding .css which results the file name -->
<?}?>
</head>
\ No newline at end of file
<?php
print($fingerprint);
if(isset($_POST['password']) and isset($_POST['Username'])) {
//$fingerprint = $_POST['fingerprint'];
// setcookie('fingerprint', $fingerprint);
$password = $_POST['password'];
$user = $_POST['Username'];
$result = user::login($user, $password);
$login = true;
}?>
......@@ -23,7 +19,9 @@ if($login) {
<p>Hello
<?print($email)?> hope you're doing good
</p>
<p>You can <a href="/Php/photogram/App/index.php">Continue</a> by clicking</p>
<p>You can <a
href="/Php<?=get_config("base_path")?>/App/index.php">Continue</a>
by clicking</p>
</p>
</div>
</div>
......@@ -34,7 +32,9 @@ if($login) {
<div class="container py-5">
<h1 class="text-body-emphasis">Oops incorrect username or password</h1>
<p class="col-lg-8 mx-auto lead">
<p>please<a href="/Php/photogram/App/login_page.php">tryagain</a> by clicking</p>
<p>please<a
href="/Php<?=get_config("base_path")?>/App/login_page.php">tryagain</a>
by clicking</p>
</p>
</div>
</div>
......@@ -43,16 +43,19 @@ if($login) {
} else {?>
<main class="form-signin w-100 m-auto">
<form method="post" action="login_page.php">
<img class="mb-4" src="/Php/photogram/App/assets/logo.png" alt="poke img" width="300" height="150">
<img class="mb-4"
src="<?=get_config("base_path")?>/App/assets/logo.png"
alt="poke img" width="300" height="150">
<h1 class="h3 mb-3 fw-normal">Please sign in</h1>
<div class="form-floating">
<input name="Username" type="Username" class="form-control" id="floatingInput"
placeholder="name@example.com" width="40" height="60">
<input name="Username" type="Username" class="form-control" id="floatingInput" placeholder="Username"
width="40" height="60">
<label for="floatingInput">Username</label>
</div>
<div class="form-floating">
<input name="password" type="password" class="form-control" id="floatingPassword" width="40" height="60">
<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">
......
<?php
$signup=false;
$signup = false;
if(isset($_POST['username']) and isset($_POST['email']) and isset($_POST['password']) and isset($_POST['Phone'])) {
$username=$_POST['username'];
$email=$_POST['email'];
$password=$_POST['password'];
$phone=$_POST['Phone'];
$result=user::validate($username, $email, $password, $phone);
$signup=true;
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
$phone = $_POST['Phone'];
$result = user::validate($username, $email, $password, $phone);
$signup = true;
// print("hello");
}?>
<?php
......@@ -17,7 +17,7 @@ if ($signup) {
<div class="container py-5">
<h1 class="text-body-emphasis">Signup success</h1>
<p class="col-lg-8 mx-auto lead">
<p>You can <a href="/Php/photogram/App/login_page.php">Login</a> from here</p>
<p>You can <a href="<?=get_config("base_path")?>/App/login_page.php">Login</a> from here</p>
</p>
</div>
</div>
......@@ -30,7 +30,7 @@ if ($signup) {
<form method="post" action="signup.php">
<img class="mb-4" src="/Php/photogram/App/assets/logo.png" alt="poke img" width="300" height="150">
<img class="mb-4" src="<?=get_config("base_path")?>/App/assets/logo.png" 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"
......
......@@ -23,7 +23,7 @@ include 'libs/load.php';
<?load_template('__footer');?>
<script src="/Php/photogram/App/assets/dist/js/bootstrap.bundle.min.js"></script>
<script src="<?=get_config("base_path")?>/App/assets/dist/js/bootstrap.bundle.min.js"></script>
</body>
......
......@@ -10,7 +10,7 @@ class webAPI
} elseif(php_sapi_name() == 'apache2handler') {
global $__site_config;
$__site_config = file_get_contents($_SERVER["DOCUMENT_ROOT"]."/../photogramconfig.json");
$__site_config = file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/../photogramconfig.json");
}
database::getconnetion();
}
......
......@@ -16,8 +16,8 @@ from anywhere including cli like how we used to do with the web........ */
$webapi = new webAPI();
$webapi->initiateSession();
// global $__site_config;
// $__site_config = file_get_contents($_SERVER["DOCUMENT_ROOT"]."/../photogramconfig.json");
global $__site_config;
$__site_config = file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/../photogramconfig.json");
function get_config($key, $default = null)
{
global $__site_config;
......@@ -33,7 +33,7 @@ function get_config($key, $default = null)
function load_template($name)
{
//print(" including $name.php");
include $_SERVER["DOCUMENT_ROOT"] . "/Php/photogram/App/__templates/$name.php";
include $_SERVER["DOCUMENT_ROOT"] . get_config('base_path') . "/App/__templates/$name.php";
/* 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
......
......@@ -2,19 +2,11 @@
include 'libs/load.php';
?>
<!doctype html>
<html lang="en">
<html>
<?load_template('__head');?>
<body>
<?php load_template('__header');?>
<main>
<?load_template('__login')?>
......@@ -27,12 +19,14 @@ include 'libs/load.php';
<script src="https://code.jquery.com/jquery-3.6.1.js"
integrity="sha256-3zlB5s2uwoUzrXK3BT7AX3FyvojsraNFxCc2vC/7pNI=" crossorigin="anonymous"></script>
<script src="/Php/photogram/App/assets/dist/js/bootstrap.bundle.min.js"></script>
<script
src="<?=get_config("base_path")?>/App/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:
'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.
......@@ -47,8 +41,6 @@ include 'libs/load.php';
})
</script>
<!-- the code for implementing fingerprintjs from github and to get the value above ahidden class had been written-->
<?//print($Email);?>
</body>
</html>
\ No newline at end of file
<pre>
<?php
include "libs/load.php";
......@@ -7,10 +6,8 @@ print("SESSION");
print_r($_SESSION);
print_r($_SERVER);
if(sessions::isset('a')) {
print("existing value ".sessions::get('a')."\n");
print("existing value " . sessions::get('a') . "\n");
} else {
sessions::set('a', time());
print("assigning new value $_SESSION[a] \n");
}
?>
</pre>
\ No newline at end of file
<?php
include 'libs/load.php';
?>
<html>
<?load_template('__head');?>
<body>
......@@ -20,7 +19,9 @@ include 'libs/load.php';
<?load_template('__footer');?>
<script src="/Php/photogram/App/assets/dist/js/bootstrap.bundle.min.js"></script>
<script
src="<?=get_config("base_path")?>/App/assets/dist/js/bootstrap.bundle.min.js">
</script>
<?//print($Email);?>
</body>
......
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