Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ahjoyo
/
idc0007
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c84053bf
authored
May 06, 2019
by
mhasan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create asks for log in
parent
38bbac50
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
4 deletions
create.php
php/createTask.php
php/delete.php
php/index.php
create.php
View file @
c84053bf
...
...
@@ -4,7 +4,7 @@ require 'Twig/lib/Twig/Autoloader.php';
// $amount = $_POST['amount'];
Twig_Autoloader
::
register
();
// Load twig templating engine
// Load
s
twig templating engine
$loader
=
new
Twig_Loader_Filesystem
(
'views'
);
$twig
=
new
Twig_Environment
(
$loader
);
...
...
@@ -13,10 +13,10 @@ $twig = new \Twig\Environment($loader, ['debug' => true,]);
$twig
->
addExtension
(
new
\Twig\Extension\DebugExtension
());
if
(
isset
(
$_SESSION
[
'userName'
]))
{
echo
$twig
->
render
(
'create.html'
,
array
(
'login'
=>
"true"
));
echo
$twig
->
render
(
'create.html'
,
array
(
'login'
=>
"true"
));
//If user is logged in, the normal page is renderd
}
else
{
echo
$twig
->
render
(
'create.html'
);
echo
$twig
->
render
(
'create.html'
);
// Otherwise login is null, and does not let user access.
}
?>
...
...
php/createTask.php
View file @
c84053bf
<?php
/*
* Takes task (user input) and inserts into the databse. The name of the data table is also the username.
*/
session_start
();
require
"db_conn.php"
;
$e
=
NULL
;
...
...
php/delete.php
View file @
c84053bf
<?php
/*
* This takes a task ID and deletes it from the database.
*/
require
"db_conn.php"
;
session_start
();
$e
=
null
;
...
...
php/index.php
View file @
c84053bf
...
...
@@ -14,7 +14,7 @@ if (isset($_POST['submit'])) {
if
(
$isMatch
==
true
)
{
session_start
();
$_SESSION
[
'userName'
]
=
$_POST
[
'userName'
];
$_SESSION
[
'userName'
]
=
$_POST
[
'userName'
];
//Starts the session with the username!
header
(
"location: ../view.php"
);
//redirects user to view page upon successful login!
}
else
{
...
...
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