Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Photogram project PHP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Raghav
Photogram project PHP
Commits
5edc0058
Commit
5edc0058
authored
4 weeks ago
by
Raghav
Browse files
Options
Downloads
Patches
Plain Diff
Tested database connection: Success
parent
da4926ea
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
_templates/head.php
+19
-17
19 additions, 17 deletions
_templates/head.php
libs/load.php
+45
-13
45 additions, 13 deletions
libs/load.php
test.php
+13
-10
13 additions, 10 deletions
test.php
with
77 additions
and
40 deletions
_templates/head.php
+
19
−
17
View file @
5edc0058
<head>
<script
src=
"/photogram-project-php/assets/js/color-modes.js"
></script>
<script
src=
"/photogram-project-php/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=
"Mark Otto, Jacob Thornton, and Bootstrap contributors"
>
<meta
name=
"generator"
content=
"Hugo 0.122.0"
>
<title>
Album example · Bootstrap v5.3
</title>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<meta
name=
"description"
content=
""
>
<meta
name=
"author"
content=
"Mark Otto, Jacob Thornton, and Bootstrap contributors"
>
<meta
name=
"generator"
content=
"Hugo 0.122.0"
>
<title>
Album example · Bootstrap v5.3
</title>
<link
rel=
"canonical"
href=
"https://getbootstrap.com/docs/5.3/examples/album/"
>
<link
rel=
"canonical"
href=
"https://getbootstrap.com/docs/5.3/examples/album/"
>
<link
rel=
"stylesheet"
href=
"https://cdn.jsdelivr.net/npm/@docsearch/css@3"
>
<link
href=
"/photogram-project-php/assets/dist/css/bootstrap.min.css"
rel=
"stylesheet
"
>
<link
rel=
"stylesheet"
href=
"https://cdn.jsdelivr.net/npm/@docsearch/css@3
"
>
<!-- CSS for login and signup page -->
<link
href=
"/photogram-project-php/assets/dist/css/bootstrap.min.css"
rel=
"stylesheet"
>
<!-- CSS for login and signup page -->
<!-- Checks if the file is exists -->
<?
if
(
file_exists
(
$_SERVER
[
'DOCUMENT_ROOT'
]
.
'/photogram-project-php/assets/dist/css/'
.
basename
(
$_SERVER
[
'PHP_SELF'
],
".php"
)
.
'.css'
))
{
?>
<link
href=
"/photogram-project-php/assets/dist/css/
<?=
basename
(
$_SERVER
[
'PHP_SELF'
],
".php"
)
?>
.css"
rel=
"stylesheet"
>
<?
}
?>
<!-- Checks if the file is exists -->
<?
if
(
file_exists
(
$_SERVER
[
'DOCUMENT_ROOT'
]
.
'/photogram-project-php/assets/dist/css/'
.
basename
(
$_SERVER
[
'PHP_SELF'
],
".php"
)
.
'.css'
)){
?>
<link
href=
"/photogram-project-php/assets/dist/css/
<?=
basename
(
$_SERVER
[
'PHP_SELF'
],
".php"
)
?>
.css"
rel=
"stylesheet"
>
<?
}
?>
</head>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
libs/load.php
+
45
−
13
View file @
5edc0058
<?php
function
load_template
(
$name
){
include
$_SERVER
[
'DOCUMENT_ROOT'
]
.
"/photogram-project-php/_templates/
$name
.php"
;
}
function
validate_credentials
(
$username
,
$password
){
if
(
$username
==
"raghav@gmail.com"
and
$password
==
"raghav"
){
return
true
;
}
else
{
return
false
;
}
}
?>
\ No newline at end of file
function
load_template
(
$name
)
{
include
$_SERVER
[
'DOCUMENT_ROOT'
]
.
"/photogram-project-php/_templates/
$name
.php"
;
}
// Function to validate the credentials.
function
validate_credentials
(
$username
,
$password
)
{
if
(
$username
==
"raghav@gmail.com"
and
$password
==
"raghav"
)
{
return
true
;
}
else
{
return
false
;
}
}
// Connecting to database
function
signup
(
$username
,
$password
,
$email
,
$phone
)
{
$servername
=
"mysql.selfmade.ninja"
;
$username
=
"raghav"
;
$password
=
"R1a2g1h3av"
;
$dbname
=
"raghav_photogram"
;
// Create connection
$conn
=
new
mysqli
(
$servername
,
$username
,
$password
,
$dbname
);
// Check connection
if
(
$conn
->
connect_error
)
{
die
(
"Connection failed: "
.
$conn
->
connect_error
);
}
else
{
print
(
"Connect Success!"
);
}
// $sql = "INSERT INTO MyGuests (firstname, lastname, email)
// VALUES ('John', 'Doe', 'john@example.com')";
// if ($conn->query($sql) === TRUE) {
// echo "New record created successfully";
// } else {
// echo "Error: " . $sql . "<br>" . $conn->error;
// }
$conn
->
close
();
}
This diff is collapsed.
Click to expand it.
test.php
+
13
−
10
View file @
5edc0058
<pre>
<?php
print
(
"_SERVER
\n
"
);
print_r
(
$_SERVER
);
print
(
"_GET
\n
"
);
print_r
(
$_GET
);
print
(
"_POST
\n
"
);
print_r
(
$_POST
);
include
'libs/load.php'
;
// print("_SERVER\n");
// print_r($_SERVER);
// print("_GET\n");
// print_r($_GET);
// print("_POST\n");
// print_r($_POST);
print
(
"_FILE
\n
"
);
print_r
(
$_FILES
);
//
print("_FILE\n");
//
print_r($_FILES);
print
(
"_COOKIE
\n
"
);
print_r
(
$_COOKIE
);
// print("_COOKIE\n");
// print_r($_COOKIE);
signup
(
""
,
""
,
""
,
""
);
?>
</pre>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment