Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ByeCorps ID Legacy
Manage
Activity
Members
Labels
Plan
Wiki
JetBrains YouTrack
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ByeCorps
ID
ByeCorps ID Legacy
Commits
2260294a
Commit
2260294a
authored
1 year ago
by
Bye
Browse files
Options
Downloads
Patches
Plain Diff
start with BCIDs
parent
25baabc4
No related branches found
No related tags found
No related merge requests found
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
head.php
+7
-0
7 additions, 0 deletions
head.php
id_handler.php
+34
-0
34 additions, 0 deletions
id_handler.php
index.php
+35
-26
35 additions, 26 deletions
index.php
landing.html
+8
-10
8 additions, 10 deletions
landing.html
register.php
+56
-0
56 additions, 0 deletions
register.php
signin.php
+0
-0
0 additions, 0 deletions
signin.php
with
140 additions
and
36 deletions
head.php
0 → 100644
+
7
−
0
View file @
2260294a
<meta
charset=
"UTF-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
<?php
if
(
isset
(
$doc_title
))
{
echo
$doc_title
.
" | "
;
}
?>
ByeCorps ID
</title>
<link
rel=
"stylesheet"
href=
"/styles/global.css"
>
<link
rel=
"stylesheet"
href=
"/fontawesome/css/all.css"
>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
id_handler.php
0 → 100644
+
34
−
0
View file @
2260294a
<?php
function
ganerate_bcid
()
{
$CHARS
=
str_split
(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
);
return
$CHARS
[
array_rand
(
$CHARS
)]
.
$CHARS
[
array_rand
(
$CHARS
)]
.
$CHARS
[
array_rand
(
$CHARS
)]
.
$CHARS
[
array_rand
(
$CHARS
)]
.
$CHARS
[
array_rand
(
$CHARS
)]
.
$CHARS
[
array_rand
(
$CHARS
)]
.
$CHARS
[
array_rand
(
$CHARS
)];
}
function
validate_bcid
(
$bcid
)
{
$stripped_bcid
=
str_replace
([
" "
,
"-"
],
""
,
$bcid
);
$stripped_bcid
=
strtoupper
(
$stripped_bcid
);
if
(
!
preg_match
(
'/^[^A-Z^0-9]^/'
,
$stripped_bcid
)
&&
strlen
(
$stripped_bcid
)
==
7
)
{
return
1
;
}
return
0
;
// fail condition
}
$BCID
=
ganerate_bcid
();
echo
"<pre>"
;
echo
"Random BCID (unformatted):
$BCID
"
;
echo
"Check if BCID is valid: "
.
validate_bcid
(
$BCID
)
.
"
"
;
if
(
$query
[
'bcid'
])
{
echo
"BCID provided in the query: "
.
$query
[
'bcid'
]
.
"
"
;
echo
"Checking the BCID provided in the query: "
.
validate_bcid
(
$query
[
'bcid'
])
.
"
"
;
}
?>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
index.php
+
35
−
26
View file @
2260294a
...
...
@@ -2,10 +2,13 @@
session_start
();
include
(
"config.php"
);
$host_string
=
$_SERVER
[
'HTTP_HOST'
];
$host
=
explode
(
'.'
,
$host_string
);
$uri_string
=
$_SERVER
[
'REQUEST_URI'
];
$query_string
=
explode
(
'?'
,
$uri_string
);
$path
=
$query_string
[
0
];
$uri
=
array_values
(
array_filter
(
explode
(
'/'
,
$uri_string
)));
if
(
isset
(
$query_string
[
1
]))
{
...
...
@@ -21,37 +24,43 @@ else {
$query
=
array
();
}
$include
=
"404.html"
;
?>
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
ByeCorps ID
</title>
<link
rel=
"stylesheet"
href=
"/styles/global.css"
>
<link
rel=
"stylesheet"
href=
"/fontawesome/css/all.css"
>
</head>
<body>
<?php
include
(
"header.php"
);
?>
<main>
<?php
// routing
if
(
!
$uri
)
{
// empty array means index
include
(
"landing.html"
);
$
include
=
"landing.html"
;
}
else
if
(
$query_string
[
0
]
==
"/signin"
)
{
else
if
(
$path
==
"/signin"
)
{
$doc_title
=
"Sign in"
;
include
(
"signin.php"
);
exit
;
}
else
if
(
$path
==
"/register"
)
{
$doc_title
=
"Register"
;
include
(
"register.php"
);
exit
;
}
else
if
(
$path
==
"/tests/id"
)
{
include
(
"id_handler.php"
);
exit
;
}
else
{
$doc_title
=
"404"
;
http_response_code
(
404
);
include
(
"404.html"
);
}
?>
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<?php
include
(
"head.php"
);
?>
</head>
<body>
<?php
include
(
"header.php"
);
?>
<main>
<?php
include
(
$include
);
?>
</main>
<?php
include
(
"footer.php"
);
?>
</body>
...
...
This diff is collapsed.
Click to expand it.
landing.html
+
8
−
10
View file @
2260294a
<main>
<div
class=
"hero"
>
<div
class=
"hero-text"
>
<h1><span
class=
"bc-1"
>
Bye
</span><span
class=
"bc-2"
>
Corps
</span><span
class=
"bc-3"
>
ID
</span></h1>
...
...
@@ -8,4 +7,3 @@
<a
href=
"/register"
class=
"button"
>
Create an account
</a>
</div>
</div>
\ No newline at end of file
</main>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
register.php
0 → 100644
+
56
−
0
View file @
2260294a
<?php
if
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'POST'
)
{
$DB_SERVER
=
DB_ADDRESS
;
$DB_USER
=
DB_USERNAME
;
$DB_PASSWD
=
DB_PASSWORD
;
$DB_BASE
=
DB_DATABASE
;
$email
=
$_POST
[
'email'
];
$password
=
password_hash
(
$_POST
[
'password'
],
PASSWORD_DEFAULT
);
try
{
$conn
=
new
PDO
(
"mysql:host=
$DB_SERVER
;dbname=
$DB_BASE
"
,
$DB_USER
,
$DB_PASSWD
);
// set the PDO error mode to exception
$conn
->
setAttribute
(
PDO
::
ATTR_ERRMODE
,
PDO
::
ERRMODE_EXCEPTION
);
$sql
=
"INSERT INTO `accounts` (`email`, `password`, `verified`) VALUES ('
$email
', '
$password
', '0')"
;
try
{
$stmt
=
$conn
->
prepare
(
$sql
);
$stmt
->
execute
(
$query
);
$result
=
$stmt
->
fetch
();
echo
"Failed successfully:
$result
"
;
}
catch
(
PDOException
$e
)
{
http_response_code
(
500
);
die
(
"An error occured:
$e
"
);
}
}
catch
(
PDOException
$e
)
{
die
(
"Connection failed: "
.
$e
->
getMessage
());
}
echo
'<pre>'
;
print_r
(
$_POST
);
exit
;
}
?>
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<?php
include
(
"head.php"
);
?>
</head>
<body>
<?php
include
(
"header.php"
);
?>
<main>
<h2>
Sign in
</h2>
<form
action=
"#"
method=
"post"
>
<input
type=
"email"
name=
"email"
id=
"email"
placeholder=
"Email"
>
<input
type=
"password"
name=
"password"
id=
"password"
placeholder=
"Password"
>
<button
type=
"submit"
>
Submit
</button>
</form>
</main>
<?php
include
(
"footer.php"
);
?>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
signin.php
deleted
100644 → 0
+
0
−
0
View file @
25baabc4
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