forked from RetroAchievements/RAWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
controlpanel.php
715 lines (600 loc) · 24.7 KB
/
controlpanel.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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
<?php
require_once('db.inc.php');
if( RA_ReadCookieCredentials( $user, $points, $truePoints, $unreadMessageCount, $permissions ) )
{
if( getAccountDetails( $user, $userDetails ) == FALSE )
{
// Immediate redirect if we cannot validate user!
header( "Location: http://" . AT_HOST . "?e=accountissue" );
exit;
}
}
else
{
// Immediate redirect if we cannot validate cookie!
header( "Location: http://" . AT_HOST . "?e=notloggedin" );
exit;
}
//if( $user == "Scott" )
//{
// log_email("Hi Scott! Testing!");
// echo "Hi Scott!";
//}
$points = $userDetails['RAPoints'];
$fbUser = $userDetails['fbUser'];
$fbPrefs = $userDetails['fbPrefs'];
$websitePrefs = $userDetails['websitePrefs'];
$emailAddr = $userDetails['EmailAddress'];
$permissions = $userDetails['Permissions'];
$contribCount = $userDetails['ContribCount'];
$contribYield = $userDetails['ContribYield'];
$userWallActive = $userDetails['UserWallActive'];
$apiKey = $userDetails['APIKey'];
$userMotto = htmlspecialchars( $userDetails['Motto'] );
$pageTitle = "My Settings";
$cookie = RA_ReadCookie( 'RA_Cookie' );
$errorCode = seekGET( 'e' );
RenderDocType();
?>
<head>
<?php RenderSharedHeader( $user ); ?>
<?php RenderTitleTag( $pageTitle, $user ); ?>
<?php RenderGoogleTracking(); ?>
<script type='text/javascript' src="/js/all.js"></script>
<script>
function GetAllResettableGamesList()
{
$( '#resetgameselector' ).empty();
var posting = $.post( "/requestuserplayedgames.php", { u: '<?php echo $user; ?>' } );
posting.done( OnGetAllResettableGamesList );
$( '#loadingiconreset' ).attr( 'src', 'http://i.retroachievements.org/Images/loading.gif' ).fadeTo( 100, 1.0 );
}
function OnGetAllResettableGamesList( data )
{
if( data !== "ERROR3" )
{
//alert( data );
var htmlToAdd = "<select id='resetgameselector' onchange=\"ResetFetchAwarded()\" >"
htmlToAdd += "<option>--</option>";
var gameList = JSON.parse( data );
for( var i = 0; i < gameList.length; ++i )
{
var object = gameList[i];
var nextID = object.ID;
var console = object.ConsoleName;
var title = object.GameTitle;
var numAw = object.NumAwarded;
var numPoss = object.NumPossible;
htmlToAdd += "<option value='" + nextID + "'>" + title + " (" + console + ") (" + numAw + " / " + numPoss + " won)";
}
htmlToAdd += "</select>";
$( '#resetgameselector' ).html( htmlToAdd );
$( '#loadingiconreset' ).attr( 'src', 'http://i.retroachievements.org/Images/tick.png' ).delay( 750 ).fadeTo( "slow", 0.0 );
}
ResetFetchAwarded();
}
function ResetFetchAwarded()
{
var gameID = parseInt( $( '#resetgameselector :selected' ).val() );
if( gameID > 0 )
{
var posting = $.post( "/requestunlockssite.php", { u: '<?php echo $user; ?>', g: gameID } );
posting.done( onFetchComplete );
$( '#resetachievementscontainer' ).empty();
$( '#warning' ).html( 'Status: Updating...' );
}
}
function onFetchComplete( data )
{
if( data.substr( 0, 2 ) !== "OK" )
{
$( '#warning' ).html( 'Status: Errors...' );
alert( data );
}
else
{
$( '#warning' ).html( 'Status: OK...' );
var achList = data.substr( 3 );
var achData = achList.split( "::" );
if( achData.length > 0 && achData[0].length > 0 )
{
//alert( achData );
$( '#resetachievementscontainer' ).append( "<option value='9999999' >All achievements for this game</option>" );
}
for( var index = 0; index < achData.length; ++index )
{
var nextData = achData[index];
var dataChunks = nextData.split( "_:_" );
//alert( dataChunks );
if( dataChunks.length < 2 )
continue;
var achTitle = dataChunks[0];
var achID = dataChunks[1];
if( achID[0] == 'h' )
{
// Hardcore:
achTitle = achTitle + " (Hardcore)";
$( '#resetachievementscontainer' ).append( "<option value='" + achID + "'>" + achTitle + "</option>" );
}
else
{
// Casual:
$( '#resetachievementscontainer' ).append( "<option value='" + achID + "'>" + achTitle + "</option>" );
}
}
}
}
function ResetProgressForSelection()
{
var achID = $( '#resetachievementscontainer :selected' ).val();
var isHardcore = 0;
if( achID[0] == 'h' )
{
achID = achID.substr( 1 );
isHardcore = 1;
}
if( achID == 9999999 )
{
// 'All Achievements' selected: reset this game entirely!
var gameID = $( '#resetgameselector :selected' ).val();
//alert( "Game ID is " + gameID );
var posting = $.post( "/requestresetachievements.php", { u: '<?php echo $user; ?>', g: gameID } );
posting.done( onResetComplete );
}
else if( achID > 0 )
{
// Particular achievement selected: reset just this achievement
//alert( "Ach ID is " + achID );
//alert( "isHardcore is " + isHardcore );
var posting = $.post( "/requestresetachievements.php", { u: '<?php echo $user; ?>', a: achID, h: isHardcore } );
posting.done( onResetComplete );
}
$( '#warning' ).html( 'Status: Updating...' );
$( '#loadingiconreset' ).attr( 'src', 'http://i.retroachievements.org/Images/loading.gif' ).fadeTo( 100, 1.0 );
}
function onResetComplete( data )
{
if( data.substr( 0, 2 ) !== "OK" )
{
alert( data );
}
else
{
$( '#loadingiconreset' ).attr( 'src', 'http://i.retroachievements.org/Images/tick.png' ).delay( 750 ).fadeTo( "slow", 0.0 );
//window.location = '/controlpanel.php?e=resetok';
if( $( '#resetachievementscontainer' ).children('option').length > 2 )
ResetFetchAwarded(); // Just reset ach. list
else
GetAllResettableGamesList(); // last ach reset: fetch new list!
return false;
}
}
function DoChangeUserPrefs()
{
var newUserPrefs = 0;
for( i = 0; i < 16; ++i )
{
var checkbox = document.getElementById( "UserPref" + i );
if( checkbox != null && checkbox.checked )
newUserPrefs += (1<<i);
}
$('#loadingicon').attr( 'src', 'http://i.retroachievements.org/Images/loading.gif' ).fadeTo( 100, 1.0 );
var posting = $.post( "/requestchangesiteprefs.php", { u: '<?php echo $user; ?>', p: newUserPrefs } );
posting.done( OnChangeUserPrefs );
}
function OnChangeUserPrefs( object )
{
//console.log( object )
$('#loadingicon').attr( 'src', 'http://i.retroachievements.org/Images/tick.png' ).delay( 750 ).fadeTo( "slow", 0.0 );
}
function DoChangeFBUserPrefs()
{
var newUserPrefs = 0;
for( i = 0; i < 16; ++i )
{
var checkbox = document.getElementById( "FBUserPref" + i );
if( checkbox != null && checkbox.checked )
newUserPrefs += (1<<i);
}
$('#loadingiconfb').attr( 'src', 'http://i.retroachievements.org/Images/loading.gif' ).fadeTo( 100, 1.0 );
var posting = $.post( "/requestchangefb.php", { u: '<?php echo $user; ?>', p: newUserPrefs } );
posting.done( OnChangeFBUserPrefs );
}
function OnChangeFBUserPrefs( object )
{
console.log( object )
if( object == 'OK' )
$('#loadingiconfb').attr( 'src', 'http://i.retroachievements.org/Images/tick.png' ).delay( 750 ).fadeTo( "slow", 0.0 );
}
function UploadNewAvatar()
{
// New file
var photo = document.getElementById("uploadimagefile");
var file = photo.files[0];
var reader = new FileReader();
reader.onload = function() {
$('#loadingiconavatar').fadeTo( 100, 1.0 );
$.post( 'doupload.php', { r: "uploaduserpic", f: file.name.split('.').pop(), i: reader.result }, onUploadImageComplete );
}
reader.readAsDataURL( file );
return false;
}
function onUploadImageComplete( data )
{
$('#loadingiconavatar').fadeTo( 100, 0.0 );
var response = JSON.parse( data );
//if( data.substr( 0, 2 ) == "OK" )
if( true )
{
var d = new Date();
$('.userpic').attr( 'src', '/UserPic/<?php echo $user; ?>' + '.png?' + d.getTime() );
}
else
{
alert( data );
}
}
GetAllResettableGamesList();
window.fbAsyncInit = function() {
FB.init({
appId : '490904194261313',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Here we subscribe to the auth.authResponseChange JavaScript event. This event is fired
// for any authentication related change, such as login, logout or session refresh. This means that
// whenever someone who was previously logged out tries to log in again, the correct case below
// will be handled.
FB.Event.subscribe('auth.authResponseChange', function(response) {
//alert( response.status );
// Here we specify what we do with the response anytime this event occurs.
if (response.status === 'connected')
{
FB.api('/me', function(response)
{
var postingupdate = $.post( '/requestassociatefb.php', { u: '<?php echo $user; ?>', f: response.id } );
postingupdate.done( function(data)
{
console.log('FB associate: ' + data + '.');
<?php
if( $fbUser == 0 ) // Refresh if it was 0
echo "window.location = '/controlpanel.php?e=associateok'";
?>
}
);
});
} else if (response.status === 'not_authorized') {
// In this case, the person is logged into Facebook, but not into the app, so we call
// FB.login() to prompt them to do so.
// In real-life usage, you wouldn't want to immediately prompt someone to login
// like this, for two reasons:
// (1) JavaScript created popup windows are blocked by most browsers unless they
// result from direct interaction from people using the app (such as a mouse click)
// (2) it is a bad experience to be continually prompted to login upon page load.
FB.login(function(response) {
// handle the response
}, {scope: 'publish_actions'});
} else {
// In this case, the person is not logged into Facebook, so we call the login()
// function to prompt them to do so. Note that at this stage there is no indication
// of whether they are logged into the app. If they aren't then they'll see the Login
// dialog right after they log in to Facebook.
// The same caveats as above apply to the FB.login() call here.
FB.login(function(response) {
// handle the response
}, {scope: 'publish_actions'});
}
});
};
// Load the SDK asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
</head>
<body>
<?php RenderTitleBar( $user, $points, $truePoints, $unreadMessageCount, $errorCode ); ?>
<?php RenderToolbar( $user, $permissions ); ?>
<div id="mainpage">
<div id="leftcontainer">
<?php RenderErrorCodeWarning( 'left', $errorCode ); ?>
<div class='component' >
<h2>User Details</h3>
<?php
// Render user panel
echo "<p style='min-height:62px'>";
echo "<img class='userpic' src='/UserPic/$user.png' alt='$user' align='right' width='64' height='64'>";
echo "<strong><a href='/User/$user'>$user</a></strong> ($points points)<br/>";
echo "Account: ($permissions) " . PermissionsToString( $permissions ) . "<br/>";
if( isset( $userMotto ) && strlen( $userMotto ) > 1)
echo "<span class='usermotto'>$userMotto</span><br/>";
echo "</p>";
if( $permissions == Permissions::Unregistered )
echo "<div id='warning'>Warning: Email address not confirmed. Please check your inbox or spam folders, or click <a href='/requestresendactivationemail.php?u=$user'>here</a> to resend your activation email!</div>";
?>
</div>
<?php
if( $permissions > 0 )
{
echo "<div class='component'>";
echo "<h3>Account Privileges</h3>";
echo "<table><tbody>";
if( $permissions >= 1 )
{
$userMottoString = isset( $userMotto ) ? $userMotto : "";
echo "<tr>";
echo "<td>User Motto:</td>";
echo "<td>";
echo "<form method='POST' action='requestsubmitusermotto.php'>";
echo "<input type='text' name='m' value=\"$userMottoString\" size='50' maxlength='49' id='usermottoinput'/>";
echo "<input type='hidden' name='u' VALUE='$user'>";
echo "<input type='hidden' name='c' VALUE='$cookie'>";
echo " <input value='Set Motto' name='submit' type='submit' size='37' />";
echo "</form>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo "<a href='/APIDemo.php'>API Key:</a>";
echo "</td>";
echo "<td>";
echo "<input size='60' readonly type='text' value='$apiKey' /></td>";
echo "</td>";
echo "</tr>";
}
if( $permissions >= 1 )
{
echo "<tr><td>Twitch.tv streamkey:</td><td><input size='60' readonly type='text' value='live_46798798_5tO2CCgggTMoi5458BLKUADECNpOrq' /></td></tr>";
}
if( $permissions >= 0 )
{
echo "<tr>";
echo "<td>";
echo "Allow Comments on my User Wall: ";
echo "</td>";
echo "<td>";
echo "<form method='POST' action='requestsubmituserprefs.php'>";
$checkedStr = ( $userWallActive == 1 ) ? "checked" : "";
echo "<input type='checkbox' name='v' value=\"1\" id='userwallactive' $checkedStr/>";
echo "<input type='hidden' name='u' value='$user'>";
echo "<input type='hidden' name='c' value='$cookie'>";
echo "<input type='hidden' name='t' value='wall'>";
echo " <input value='Save' name='submit' type='submit' size='37' />";
echo "</form>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo "Remove all comments from my User Wall: ";
echo "</td>";
echo "<td>";
echo "<form method='POST' action='requestsubmituserprefs.php'>";
echo "<input type='hidden' name='u' value='$user'>";
echo "<input type='hidden' name='c' value='$cookie'>";
echo "<input type='hidden' name='t' value='cleanwall'>";
echo " <input value='Delete All Comments' name='submit' type='submit' size='37' />";
echo "</form>";
echo "</td>";
echo "</tr>";
}
echo "</tbody></table>";
echo "</div>";
}
?>
<div class='component'>
<h3>Facebook</h3>
<?php if( $fbUser !== "0" )
{
$loggedIn = RenderFBDialog( $fbUser, $fbRealName, $fbURL, $user );
if( $fbUser !== 0 )
{
echo "<image class='rightfloat' src='http://graph.facebook.com/$fbUser/picture?type=square' width='50' height='50'>";
echo "Logged in as: ";
echo "<a href='$fbURL'>$fbRealName</a><br/>";
}
if( $errorCode == 'associateOK' )
{
echo "<div id=\"warning\">Facebook associated OK, $fbRealName! Please confirm below what you would prefer to have cross-posted to your facebook wall:</div>";
}
?>
<br/>
<h4>Facebook Preferences</h4>
When would you like RetroAchievements to automatically post on your Facebook wall?
<table><tbody>
<!--<tr><th>Action</th><th>Post on Facebook?</th></tr>-->
<tr>
<td>When I earn achievements:</td>
<td><input id='FBUserPref0' type="checkbox" onchange='DoChangeFBUserPrefs(); return false;' value="1" <?php if( BitSet( $fbPrefs, FBUserPref::PostFBOn_EarnAchievement ) ) { echo "checked"; } ?> ></td>
</tr>
<tr class='alt'>
<td>When I fully complete a game:</td>
<td><input id='FBUserPref1' type="checkbox" onchange='DoChangeFBUserPrefs(); return false;' value="1" <?php if( BitSet( $fbPrefs, FBUserPref::PostFBOn_CompleteGame ) ) { echo "checked"; } ?> ></td>
</tr>
<tr>
<td>When I upload an achievement:</td>
<td><input id='FBUserPref2' type="checkbox" onchange='DoChangeFBUserPrefs(); return false;' value="1" <?php if( BitSet( $fbPrefs, FBUserPref::PostFBOn_UploadAchievement ) ) { echo "checked"; } ?> ></td>
</tr>
</tbody></table>
<img id='loadingiconfb' style='opacity: 0; float: right;' src='http://i.retroachievements.org/Images/loading.gif' width='16' height='16' alt='loading icon' />
<br/>
<h4>Unlink Facebook</h4>
Click <a href="/requestremovefb.php?u=<?php echo $user;?>">here</a> to remove Facebook from your RetroAchievements account.
Please note you will also need to remove permissions from within Facebook to fully disassociate this app,
by visiting <a href="http://www.facebook.com/settings?tab=applications">this page</a> on Facebook.
<br/><br/>
<?php
}
else
{
echo "<fb:login-button show-faces='false' width='200' max-rows='1' data-perms='publish_actions'></fb:login-button>";
//RenderFBLoginPrompt();
//echo "<div class='fb-login-button' scope='publish_stream;publish_actions'>Login with Facebook</div>";
echo "<br/>";
}
?>
</div>
<div class='component'>
<h3>Notifications</h3>
When would you like to be notified?
<table class='smalltable'><tbody>
<tr><th>Event</th><th>Email Me</th><th>Site Msg</th></tr>
<tr>
<td>If someone comments on my activity:</td>
<td><input id='UserPref0' type="checkbox" onchange='DoChangeUserPrefs(); return false;' value="1" <?php if( BitSet( $websitePrefs, UserPref::EmailOn_ActivityComment ) ) { echo "checked"; } ?> ></td>
<td><input id='UserPref8' type="checkbox" onchange='DoChangeUserPrefs(); return false;' value="1" <?php if( BitSet( $websitePrefs, UserPref::SiteMsgOn_ActivityComment ) ) echo "checked"; ?> ></td>
</tr>
<tr class='alt'>
<td>If someone comments on an achievement I created:</td>
<td><input id='UserPref1' type="checkbox" onchange='DoChangeUserPrefs(); return false;' value="1" <?php if( BitSet( $websitePrefs, UserPref::EmailOn_AchievementComment ) ) echo "checked"; ?> ></td>
<td><input id='UserPref9' type="checkbox" onchange='DoChangeUserPrefs(); return false;' value="1" <?php if( BitSet( $websitePrefs, UserPref::SiteMsgOn_AchievementComment ) ) echo "checked"; ?> ></td>
</tr>
<tr>
<td>If someone comments on my user wall:</td>
<td><input id='UserPref2' type="checkbox" onchange='DoChangeUserPrefs(); return false;' value="1" <?php if( BitSet( $websitePrefs, UserPref::EmailOn_UserWallComment ) ) echo "checked"; ?> ></td>
<td><input id='UserPref10' type="checkbox" onchange='DoChangeUserPrefs(); return false;' value="1" <?php if( BitSet( $websitePrefs, UserPref::SiteMsgOn_UserWallComment ) ) echo "checked"; ?> ></td>
</tr>
<tr class='alt'>
<td>If someone comments on a forum topic I'm involved in:</td>
<td><input id='UserPref3' type="checkbox" onchange='DoChangeUserPrefs(); return false;' value="1" <?php if( BitSet( $websitePrefs, UserPref::EmailOn_ForumReply ) ) echo "checked"; ?> ></td>
<td><input id='UserPref11' type="checkbox" onchange='DoChangeUserPrefs(); return false;' value="1" <?php if( BitSet( $websitePrefs, UserPref::SiteMsgOn_ForumReply ) ) echo "checked"; ?> ></td>
</tr>
<tr>
<td>If someone adds me as a friend:</td>
<td><input id='UserPref4' type="checkbox" onchange='DoChangeUserPrefs(); return false;' value="1" <?php if( BitSet( $websitePrefs, UserPref::EmailOn_AddFriend ) ) echo "checked"; ?> ></td>
<td><input id='UserPref12' type="checkbox" onchange='DoChangeUserPrefs(); return false;' value="1" <?php if( BitSet( $websitePrefs, UserPref::SiteMsgOn_AddFriend ) ) echo "checked"; ?> ></td>
</tr>
<tr class='alt'>
<td>If someone sends me a private message:</td>
<td><input id='UserPref5' type="checkbox" onchange='DoChangeUserPrefs(); return false;' value="1" <?php if( BitSet( $websitePrefs, UserPref::EmailOn_PrivateMessage ) ) echo "checked"; ?> ></td>
<td><input id='UserPref13' type="checkbox" onchange='DoChangeUserPrefs(); return false;' value="1" disabled checked ></td>
</tr>
<tr>
<td>With the weekly RA Newsletter:</td>
<td><input id='UserPref6' type="checkbox" onchange='DoChangeUserPrefs(); return false;' value="1" <?php if( BitSet( $websitePrefs, UserPref::EmailOn_Newsletter ) ) echo "checked"; ?> ></td>
<td><input id='UserPref14' type="checkbox" onchange='DoChangeUserPrefs(); return false;' value="1" disabled ></td>
</tr>
</tbody></table>
<img id='loadingicon' style='opacity: 0; float: right;' src='http://i.retroachievements.org/Images/loading.gif' width='16' height='16' alt='loading icon' />
</div>
<div class='component'>
<h3>Change Password</h3>
<?php
if( $errorCode == 'baddata' || $errorCode == 'generalerror' )
echo "<div id=\"warning\">Info: Errors changing your password. Please check and try again!</div>";
else if( $errorCode == 'badnewpass' )
echo "<div id=\"warning\">Info: Errors changing your password, passwords too short!</div>";
else if( $errorCode == 'passinequal' )
echo "<div id=\"warning\">Info: Errors changing your password, new passwords were not identical!</div>";
else if( $errorCode == 'badpassold' )
echo "<div id=\"warning\">Info: Errors changing your password, old password was incorrect!</div>";
else if( $errorCode == 'changepassok' )
echo "<div id=\"warning\">Info: Password changed OK!</div>";
?>
<form method='post' action='requestchangepassword.php'>
<table id='controlpanelinput'><tbody>
<tr>
<td class='firstrow'>Old Password:</td>
<td><input size='22' type='password' name="p" /></td>
</tr>
<tr>
<td class='firstrow'>New Password: </label></td>
<td><input size='22' type='password' name="x" /></td>
</tr>
<tr>
<td class='firstrow'>New Password again: </label></td>
<td><input size='22' type='password' name="y" /></td>
</tr>
<tr>
<td></td><td><input value="Change Password" name='submit' type='submit' size='37'></td>
</tr>
<input type="hidden" name="u" value="<?php echo $user; ?>">
</tbody></table>
</form>
</div>
<div class='component'>
<h3>Change Email Address</h3>
<?php
if( $errorCode == 'e_baddata' || $errorCode == 'e_generalerror' )
echo "<div id=\"warning\">Info: Errors changing your email address. Please check and try again!</div>";
else if( $errorCode == 'e_badnewemail' )
echo "<div id=\"warning\">Info: Errors changing your email address, the new email doesn't appear to be valid!</div>";
else if( $errorCode == 'e_notmatch' )
echo "<div id=\"warning\">Info: Errors changing your email address, new emails were not identical!</div>";
else if( $errorCode == 'e_badcredentials' )
echo "<div id=\"warning\">Info: Errors changing your email address, session invalid. Please log out and back in, and try again!</div>";
else if( $errorCode == 'e_changeok' )
echo "<div id=\"warning\">Info: Email address changed OK!</div>";
?>
<form method='post' action='requestchangeemailaddress.php'>
<table id='controlpanelinput'><tbody>
<tr>
<td class='firstrow'>Old Email Address:</td>
<td><div class="field_container"><input type="text" class="inputtext" size='30' disabled VALUE="<?php echo $emailAddr; ?>" /></div></td>
</tr>
<tr>
<td class='firstrow'>New Email Address:</td>
<td><div class="field_container"><input type="text" class="inputtext" name="e" size='30' /></div></td>
</tr>
<tr>
<td class='firstrow'>New Email Address again:</td>
<td><div class="field_container"><input type="text" class="inputtext" name="f" size='30' /></div></td>
</tr>
<tr>
<td></td><td><input value="Change Email Address" type='submit' size='37'></td>
</tr>
<input TYPE="hidden" NAME="u" VALUE="<?php echo $user; ?>">
<input TYPE="hidden" NAME="c" VALUE="<?php echo $cookie; ?>">
</tbody></table>
</form>
</div>
<div class='component'>
<h3>Reset Game Progress</h3>
<?php
echo "Reset all achievements for a certain game:</br>";
echo "<select id='resetgameselector' onchange=\"ResetFetchAwarded()\" >";
echo "<option>--</option>";
echo "</select>";
echo "<div id='resetachievementscontrol'>";
echo "<select id='resetachievementscontainer'></select>"; // Filled by JS
echo "</div>";
echo "<input value='Reset Progress for selection' type='submit' onclick=\"ResetProgressForSelection()\" >";
echo "</form>";
echo "<img id='loadingiconreset' style='opacity: 0; float: right;' src='http://i.retroachievements.org/Images/loading.gif' width='16' height='16' alt='loading icon' />";
echo "<br/>";
?>
</div>
<div class='component'>
<h3>Reset All Achievements</h3>
Enter password to confirm! Please note: this is <b>not</b> reversible!
<form method=post action="requestresetachievements.php">
<INPUT TYPE="hidden" NAME="u" VALUE="<?php echo $user; ?>">
<INPUT TYPE="password" NAME="p" VALUE="">
<INPUT value="Permanently Reset Achievements!" type='submit' size='67'>
</form>
</div>
</div>
<div id='rightcontainer'>
<div class='component'>
<h3>Request Score Recalculation</h3>
<form method=post action="requestscorerecalculation.php">
<input TYPE="hidden" NAME="u" VALUE="<?php echo $user; ?>">
If you feel your score is inaccurate due to point values varying during achievement development, you can request a recalculation by using the button below.<br/><br/>
<input value="Recalculate My Score" type='submit' size='37'>
</form>
</div>
<div class='component' >
<h2>Change User Pic</h2>
New image should be less than 1MB, png/jpeg/gif supported.</br>
</br>
<input style='padding: 4px;' type='file' name='file' id='uploadimagefile' onchange='return UploadNewAvatar();' />
<img id='loadingiconavatar' style='opacity: 0; float: right;' src='http://i.retroachievements.org/Images/loading.gif' width='16' height='16' alt='loading icon' />
</div>
</div>
<?php RenderFooter(); ?>
</body>
</html>