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
6ab43ffb
Commit
6ab43ffb
authored
1 month ago
by
Raghav
Browse files
Options
Downloads
Patches
Plain Diff
Data inserted into DB, Failed to execute page when data is not correct
parent
e1dd03fd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
_templates/signup-content.php
+73
-30
73 additions, 30 deletions
_templates/signup-content.php
libs/load.php
+5
-4
5 additions, 4 deletions
libs/load.php
test.php
+16
-16
16 additions, 16 deletions
test.php
with
94 additions
and
50 deletions
_templates/signup-content.php
+
73
−
30
View file @
6ab43ffb
<main
class=
"form-signup w-100 m-auto"
>
<?php
<form
action=
"/photogram-project-php/test.php"
method=
"post"
>
<img
class=
"mb-4 center"
src=
"/photogram-project-php/assets/brand/devyani_logo_edit_light copy.svg"
alt=
""
width=
"72"
height=
"77"
>
<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=
"Username"
>
$signup
=
false
;
<label
for=
"floatingInput"
>
Username
</label>
</div>
// checks if all the values are received from form.
if
(
isset
(
$_POST
[
'username'
])
and
isset
(
$_POST
[
'password'
])
and
isset
(
$_POST
[
'email'
])
and
isset
(
$_POST
[
'phone'
]))
{
<div
class=
"form-floating"
>
$username
=
$_POST
[
'username'
];
<input
name=
"email"
type=
"email"
class=
"form-control"
id=
"floatingInput"
placeholder=
"name@example.com"
>
$password
=
$_POST
[
'password'
];
<label
for=
"floatingInput"
>
Email address
</label>
$email
=
$_POST
[
'email'
];
</div>
$phone
=
$_POST
[
'phone'
];
<div
class=
"form-floating"
>
$error
=
signup
(
$username
,
$password
,
$email
,
$phone
);
<input
name=
"password"
type=
"password"
class=
"form-control"
id=
"floatingPassword"
placeholder=
"Password"
>
$signup
=
true
;
<label
for=
"floatingPassword"
>
Password
</label>
}
</div>
<div
class=
"form-floating"
>
// checks if the data stored in database
<input
name=
"phone"
type=
"text"
class=
"form-control"
id=
"floatingInput"
placeholder=
"Phone number"
>
if
(
$signup
)
{
<label
for=
"floatingInput"
>
Phone number
</label>
if
(
!
$error
)
{
?>
<main
class=
"container"
>
<div
class=
"bg-body-tertiary p-5 rounded"
>
<h1>
Signup Success
</h1>
<p
class=
"lead"
>
Know you can login
<a
href=
"login.php"
>
here
</a>
.
</p>
<a
class=
"btn btn-lg btn-primary"
href=
"/docs/5.3/components/navbar/"
role=
"button"
>
View navbar docs »
</a>
</div>
</div>
</main>
<div
class=
"form-check text-start my-3"
>
<?php
}
else
{
?>
<input
class=
"form-check-input"
type=
"checkbox"
value=
"remember-me"
id=
"flexCheckDefault"
>
<main
class=
"container"
>
<label
class=
"form-check-label"
for=
"flexCheckDefault"
>
<div
class=
"bg-body-tertiary p-5 rounded"
>
Remember me
<h1>
Something went wrong..
</h1>
</label>
<p
class=
"lead"
>
Please try again ..
<a
href=
"login.php"
>
here
</a>
.
</p>
<?=
$error
?>
<a
class=
"btn btn-lg btn-primary"
href=
"/docs/5.3/components/navbar/"
role=
"button"
>
View navbar docs »
</a>
</div>
</div>
<button
class=
"hvr-grow-shadow btn btn-primary w-100 py-2 "
type=
"submit"
>
Sign Up
</button>
</main>
</form>
<?php
}
</main>
}
else
{
\ No newline at end of file
?>
<main
class=
"form-signup w-100 m-auto"
>
<form
action=
"/photogram-project-php/signup.php"
method=
"post"
>
<img
class=
"mb-4 center"
src=
"/photogram-project-php/assets/brand/devyani_logo_edit_light copy.svg"
alt=
""
width=
"72"
height=
"77"
>
<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=
"Username"
>
<label
for=
"floatingInput"
>
Username
</label>
</div>
<div
class=
"form-floating"
>
<input
name=
"email"
type=
"email"
class=
"form-control"
id=
"floatingInput"
placeholder=
"name@example.com"
>
<label
for=
"floatingInput"
>
Email address
</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=
"phone"
type=
"text"
class=
"form-control"
id=
"floatingInput"
placeholder=
"Phone number"
>
<label
for=
"floatingInput"
>
Phone number
</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=
"hvr-grow-shadow btn btn-primary w-100 py-2 "
type=
"submit"
>
Sign Up
</button>
</form>
</main>
<?php
}
?>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
libs/load.php
+
5
−
4
View file @
6ab43ffb
...
@@ -32,15 +32,16 @@ function signup($user, $pass, $email, $phone)
...
@@ -32,15 +32,16 @@ function signup($user, $pass, $email, $phone)
$sql
=
"INSERT INTO `auth` (`username`, `password`, `email`, `phone`, `block`, `active`)
$sql
=
"INSERT INTO `auth` (`username`, `password`, `email`, `phone`, `block`, `active`)
VALUES ('
$user
', '
$pass
', '
$email
', '
$phone
', '0', '1');"
;
VALUES ('
$user
', '
$pass
', '
$email
', '
$phone
', '0', '1');"
;
$result
=
false
;
$error
=
false
;
if
(
$conn
->
query
(
$sql
)
===
TRUE
)
{
if
(
$conn
->
query
(
$sql
)
===
TRUE
)
{
$
result
=
tru
e
;
$
error
=
fals
e
;
}
else
{
}
else
{
echo
"Error: "
.
$sql
.
"<br>"
.
$conn
->
error
;
echo
"Error: "
.
$sql
.
"<br>"
.
$conn
->
error
;
$
result
=
false
;
$
error
=
$conn
->
error
;
}
}
$conn
->
close
();
$conn
->
close
();
return
$
result
;
return
$
error
;
}
}
This diff is collapsed.
Click to expand it.
test.php
+
16
−
16
View file @
6ab43ffb
<pre>
<pre>
<?php
<?php
include
'libs/load.php'
;
include
'libs/load.php'
;
//
print("_SERVER\n");
print
(
"_SERVER
\n
"
);
//
print_r($_SERVER);
print_r
(
$_SERVER
);
//
print("_GET\n");
print
(
"_GET
\n
"
);
//
print_r($_GET);
print_r
(
$_GET
);
//
print("_POST\n");
print
(
"_POST
\n
"
);
//
print_r($_POST);
print_r
(
$_POST
);
//
print("_FILE\n");
print
(
"_FILE
\n
"
);
//
print_r($_FILES);
print_r
(
$_FILES
);
//
print("_COOKIE\n");
print
(
"_COOKIE
\n
"
);
//
print_r($_COOKIE);
print_r
(
$_COOKIE
);
if
(
signup
(
"raghav"
,
"raghav"
,
"raghav@example.com"
,
"9566743991"
)){
//
if(signup("raghav","raghav","raghav@example.com","9566743991")){
print
(
"Data inserted"
);
//
print("Data inserted");
}
else
{
//
}else{
print
(
"Failed to inserted"
);
//
print("Failed to inserted");
echo
"Error: "
.
$sql
.
"<br>"
.
$conn
->
error
;
//
echo "Error: " . $sql . "<br>" . $conn->error;
}
//
}
?>
?>
</pre>
</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