Commit af8921ce by sopham

Merge branch 'master' of gitlab.pld.ttu.ee:sopham/todolist

parents 15421a6a 93475b3f
Showing with 31 additions and 54 deletions
<?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();
}
//write to list
if(isset($_POST['add-button'])){
$addTask = $_POST['add-task'];
$file = fopen("taskList.txt","a+") or die("Unable to open file");
$s = $addTask."\r\n";
fputs($file,$s) or die("Unable to open save");
fclose($file);
header('Location: index.php');
}
<?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
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
$('#imagePreview').css('background-image', 'url('+e.target.result +')');
$('#imagePreview').hide();
$('#imagePreview').fadeIn(650);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#imageUpload").change(function() {
readURL(this);
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment