-
Notifications
You must be signed in to change notification settings - Fork 3
/
profile.php
56 lines (47 loc) · 1.43 KB
/
profile.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
51
52
53
54
55
56
<?php
require_once 'public/parameters.php';
require_once $dir_model.'initialize.php';
//facebook
$fb_title = "";
$fb_type = "";
$fb_image_url = "";
$fb_url = "";
$fb_description = "";
$fb_admin_userid = "";
//twitter
$tw_card = "";
$tw_url = "";
$tw_title = "";
$tw_description = "";
$tw_image = "";
$user = User::find_by_id($_SESSION['user_id']);
$user_items = Item::find_by_userid($_SESSION['user_id']);
if(isset($_POST['save'])){
$user->name = trim($_POST['name']);
$user->email = trim($_POST['email']);
$user->phone = trim($_POST['phone']);
$user->address = trim($_POST['address']);
$user->city = trim($_POST['city']);
if(!empty($_POST['password'])){ $user->password = trim(sha1($_POST['password']));}
$user->updated = $created;
if($user->update()){
$message = "Updated Successfully";
}else { $message = "Error";}
}
$page = !empty($_GET['page']) ? (int)$_GET['page'] : 1;
$per_page = 5;
$total_user_items = count($user_items);
$pagination = new Pagination($page, $per_page, $total_user_items);
//Checks Message
$user_messages = Message::find_messages_on('to_user_id', $_SESSION['user_id']);
$message_count = count($messages);
//requested Items
$requested_items = RequestedItem::find_on_user($session->user_id);
if(isMobile()){
include $dir_public_mobile.'profile.php';
}elseif(isFacebook()){
include $dir_facebook.'profile.php';
}else{
include $dir_public.'profile.php';
}
?>