-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfact.php
More file actions
108 lines (95 loc) · 2.37 KB
/
fact.php
File metadata and controls
108 lines (95 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
include 'dao.php';
if(isset($_POST['login'])){
$name=$_POST['name'];
$pass=$_POST['pass'];
$user=array("name"=>$name,"pass"=>$pass);
if(login($user)){
session_start();
$_SESSION['n']=$name;
//$_SESSION['e']=$email;
header("location:welcome.php");
}
else{
session_start();
$_SESSION['msg']="user credential is wrong!!!";
header("location:login.php");
}
}
// if(isset($_POST['submit'])){
// $name=$_POST['name'];
// $email=$_POST['email'];
// $pass=$_POST['pass'];
// //echo $name." ".$email;
// //$re=;
// $user=array("name"=>$name,"email"=>$email,"pass"=>$pass);
// if(addUser($user)){
// session_start();
// //$_SESSION['e']=$email;
// $_SESSION['n']=$name;
// header("location:welcome.php");
// }
// else{
// header("location:form1.php");
// }
// }
$users=getUsers();
if(isset($_POST['del'])){
$id=$_POST['id'];
if(deleteUser($id)){
header("location:welcome.php");
}
else{
header("location:form1.php");
}
}
if(isset($_POST['edit'])){
$name=$_POST['name'];
$email=$_POST['email'];
$id=$_POST['id'];
$user=array('id'=>$id,'name'=>$name, 'email'=>$email);
if(editUser($user)){
header("location:welcome.php?id=$id");
}
else{
header("location:edit_user.php?id=$id");
}
}
if(isset($_POST['submit']) && $_FILES['profile']){
// echo "<pre>";
// print_r($_FILES['profile']);
// echo "</pre>";
$file=$_FILES['profile'];
$name=$file['name'];
$type=$file['type'];
$size=$file['size'];
$error=$file['error'];
$tmp_name=$file['tmp_name'];
if($error == 0){
if($size<1250000){
$ext=pathinfo($name,PATHINFO_EXTENSION);
$ext_l=strtolower($ext);
$n_name=uniqid("IMG-",true).".".$ext_l;
$path='upload/'.$n_name;
if(uploadFile($n_name)){
if(move_uploaded_file($tmp_name,$path)){
header("location:welcome.php");
}
}
else{
echo "false";
}
}
else{
echo "it exist maximum file size";
}
}
else{
echo "something went wrong!!";
}
}
function getIMG(){
$i=getFiles();
return $i;
}
?>