-
Notifications
You must be signed in to change notification settings - Fork 2
/
edit_user_php.php
50 lines (40 loc) · 1.19 KB
/
edit_user_php.php
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
<?php
session_start();
ini_set('display_errors', 'On');
error_reporting(E_ALL);
if($_POST["uploaded"]){
// Display images stored in the database
include "phpfunctions.php";
$db = new SunapeeDB();
$db->connect();
// if uploading new file
if (file_exists("profile_pictures/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. not uploading again<br>";
$file_path="blank";
}
else
{
$uniqname = uniqid().".jpeg";
move_uploaded_file($_FILES["file"]["tmp_name"], "profile_pictures/".$uniqname);
$file_path = "profile_pictures/".$uniqname;
echo "Stored in: " . "profile_pictures/" . $uniqname;
// upload file name
$uploadFilename = "profile_pictures/" . $uniqname;
// insert drawing in db
}
echo 'post password = \''.$_POST["password"].'\'<br>';
echo 'post password length = \''.strlen($_POST["password"]).'\'<br>';
// if the user is changing their password
if (strlen($_POST["password"]) > 0) {
$password = $_POST["password"];
}
else {
$password = "blank";
}
// submit to database
$db->edit_user($_SESSION["email"], $password, $_POST["name"], $_POST["affiliation"], $file_path);
// disconnect from db
$db->disconnect();
}
?>