Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
sopham
/
todolist
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
337dc2cc
authored
May 11, 2019
by
sopham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add userID to database
parent
5e5d4c66
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
38 deletions
insert.php
login_check.php
insert.php
View file @
337dc2cc
<?php
session_start
();
include_once
"dbconnection.php"
;
$query
=
"INSERT INTO toDoList (task) VALUES (?) "
;
$query
=
$link
->
prepare
(
$query
);
$query
->
bind_param
(
's'
,
$_POST
[
'task'
]);
$query
->
execute
();
//$query = "INSERT INTO toDoList (task) VALUES (?) ";
$query1
=
"INSERT INTO toDoList (task, userID) VALUES (?,?) "
;
$query1
=
$link
->
prepare
(
$query1
);
$query1
->
bind_param
(
'si'
,
$_POST
[
'task'
],
$_SESSION
[
'id'
]);
//$query -> bind_param('si', $_POST['task']);
$query1
->
execute
();
$last_id
=
mysqli_insert_id
(
$link
);
echo
$last_id
;
$query
->
close
();
$query
1
->
close
();
$link
->
close
();
?>
login_check.php
deleted
100755 → 0
View file @
5e5d4c66
<?php
error_reporting
(
0
);
$user
=
$_POST
[
'username'
];
$pass
=
$_POST
[
'password'
];
//login
if
(
isset
(
$_POST
[
'submit'
])){
if
(
$user
==
"admin"
&&
$pass
==
"admin"
){
header
(
'Location:index.php'
);
session_name
(
$user
);
session_start
();
}
else
{
echo
"Wrong Username or/and Password"
;
}
}
//logout
if
(
isset
(
$_POST
[
'logout'
]))
{
session_name
(
$user
);
session_start
();
session_unset
();
session_destroy
();
session_write_close
();
setcookie
(
session_name
(),
''
,
0
,
'/'
);
session_regenerate_id
(
true
);
header
(
'Location: login_page.php'
);
exit
();
}
?>
\ 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