-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprofile.php
47 lines (37 loc) · 1.09 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
<?php
/**
* Displays user information with according id GET param.
* The user has the ability to change their personal data.
* Otherwise, if the user is a guest, the site will offer him to fill out a sign up form.
*/
require_once 'includes/requires.php';
require_once 'controllers/handlers.php';
if ( isset( $_SESSION['user'] ) )
{
$id = @$_GET['id'];
if ( !$id )
{
$id = $_SESSION['user']->id;
}
/**
* For email change procedure.
*/
if ( $_GET['code'] == $_SESSION['code'] && isset( $_GET['code'] ) && isset( $_SESSION['code'] ) )
{
$account = R::findOne( 'users', 'id = ?', array( $_SESSION['user']->id ) );
$account->email = $_SESSION['email'];
R::store( $account );
unset( $_SESSION['email'] );
unset( $_SESSION['code'] );
echo '<script>alert("New email saved successfully!");</script>';
}
$Handler = new ChangeAvatarHandler( $_POST, $id );
if ( isset( $_POST['g-recaptcha-response'] ) )
{
$errors = $Handler->isValid();
}
$Handler->showResult( 'profile.html', @$errors );
} else
{
header( 'Location: signup.php' );
}