-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathavatar.php
72 lines (63 loc) · 2.23 KB
/
avatar.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
<?php
require 'lib/function.php';
require 'lib/layout.php';
$a = array(1 => "neutral", "angry", "tired/upset", "playful", "doom", "delight", "guru", "hope", "puzzled", "whatever", "hyperactive", "sadness", "bleh", "embarrassed", "amused", "afraid");
$me = false;
$form = '<b>Preview mood avatar for user...</b><br>
<form><select onChange="parent.location=this.options[this.selectedIndex].value" style="width:500px;">
<option value=avatar.php><Select a user></option>';
$users = $sql->query("SELECT id, name, moodurl FROM users WHERE moodurl != '' ORDER BY id ASC");
while ($u = $sql->fetch($users)) {
$selected = $fails = '';
if ($u['id'] == $id) {
$me = $u;
$selected = ' selected';
}
//if (strpos($u['moodurl'], '$') === FALSE)
// $fails = " (improper URL)";
$form .= "\r\n <option value='avatar.php?id=$u[id]'$selected>$u[id]: $u[name]$fails</option>";
}
$form .= "\r\n </select></form>";
if ($me) {
$script = '
<script type="text/javascript">
function avatarpreview(uid,pic) {
if (pic > 0) {
var moodav="'.htmlspecialchars($me['moodurl']).'";
document.getElementById(\'prev\').src=moodav.replace("$", pic);
}
else {
document.getElementById(\'prev\').src="images/_.gif";
}
}
</script>
';
$ret = "<tr>$tccellh colspan=2>$me[name]: <i>".htmlspecialchars($me['moodurl'])."</i></td></tr>";
$ret .= "<tr height=400px>$tccell1l width=200px><b>Mood avatar list:</b><br>";
foreach($a as $num => $name) {
$jsclick = "onclick='avatarpreview($me[id],$num)'";
$selected = (($num == 1) ? ' checked' : '');
$ret .= "<input type='radio' name='moodid' value='$num' id='mood$num' tabindex='". (9000 + $num) ."' style=\"height: 12px;\" $jsclick $selected>
<label for='mood$num' style=\"font-size: 12px;\"> $num: $name</label><br>\r\n";
}
$startimg = htmlspecialchars(str_replace('$', '1', $me['moodurl']));
$ret .= "</td>$tccell2 width=400px><img src=\"$startimg\" id=prev></td></tr>";
}
else {
$script = '';
$ret = '';
}
print "
<html><head><title>Mood Avatar Preview</title></head>
$body
$css
$script
<center>
<table height=100% valign=middle><tr><td>
$tblstart
<tr height=50px>$tccellh colspan=2>$form</td></tr>
$ret
$tblend
</td><tr></table></body></html>
";
?>