Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Summative_Sam_Markey
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sam.markey
Summative_Sam_Markey
Commits
14191047
Commit
14191047
authored
Apr 29, 2021
by
sam.markey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
registering script
parent
b6ad3089
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
0 deletions
+64
-0
create_account.php
OTHER_INFORMATION/php files/create_account.php
+64
-0
No files found.
OTHER_INFORMATION/php files/create_account.php
0 → 100644
View file @
14191047
<?php
require_once
'connect_db.php'
;
if
(
isset
(
$_POST
[
'username'
])
&&
isset
(
$_POST
[
'firstname'
])
&&
isset
(
$_POST
[
'lastname'
])
&&
isset
(
$_POST
[
'password'
]))
{
$key
=
'fu4823yfu03$&u3Sy(48%$>gh)83*hf201*&fg3"!fh9HFG8'
;
require_once
'encode_decode.php'
;
$username
=
htmlspecialchars
(
$_POST
[
'username'
]);
$firstname
=
encrypt
(
htmlspecialchars
(
$_POST
[
'firstname'
]),
$key
);
$lastname
=
encrypt
(
htmlspecialchars
(
$_POST
[
'lastname'
]),
$key
);
$password
=
htmlspecialchars
(
password_hash
(
$_POST
[
'password'
],
PASSWORD_DEFAULT
));
//init the connection and sql
$stmt
=
mysqli_stmt_init
(
$connect
);
if
(
AccountCheck
(
$username
,
$connect
))
{
echo
"username_taken"
;
exit
();
}
else
{
$sql
=
"INSERT INTO user_museum VALUES (?,?,?,?);"
;
if
(
!
mysqli_stmt_prepare
(
$stmt
,
$sql
))
{
echo
"failure"
;
}
else
{
mysqli_stmt_bind_param
(
$stmt
,
"ssss"
,
$username
,
$firstname
,
$lastname
,
$password
);
mysqli_stmt_execute
(
$stmt
);
echo
"success"
;
}
mysqli_stmt_close
(
$stmt
);
exit
();
}
}
function
AccountCheck
(
$username
,
$connect
)
{
$sql2
=
'SELECT * FROM user_museum WHERE username= ?;'
;
$stmt2
=
mysqli_stmt_init
(
$connect
);
if
(
!
mysqli_stmt_prepare
(
$stmt2
,
$sql2
))
{
echo
"sql_error"
;
}
else
{
mysqli_stmt_bind_param
(
$stmt2
,
's'
,
$username
);
mysqli_stmt_execute
(
$stmt2
);
$result
=
mysqli_stmt_get_result
(
$stmt2
);
if
(
mysqli_fetch_assoc
(
$result
))
{
mysqli_stmt_close
(
$stmt2
);
return
true
;
}
else
{
mysqli_stmt_close
(
$stmt2
);
return
false
;
}
}
};
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment