<?php
echo '<h1 class="p_space">' . $lang['change_profile'] . '</h1>';
if($_SERVER['REQUEST_METHOD'] != 'POST') {
include_once('framework/functions/badwords.php');
$sql = "SELECT
members.*,
profiles.*
FROM
members
LEFT JOIN
profiles
ON
members.id = profiles.id
WHERE
members.id = " . (int)$_SESSION['id'];
$result = mysql_query($sql) OR die(mysql_error());
$row = mysql_fetch_assoc($result);
echo '<form id="profile" name="profile" method="post" action="">';
echo '<table width="100%" class="tables">
<tr>
<td colspan="2"><p>' . $lang['name'] . ': <span class="blue_span">' . $_SESSION['name'] . ' <small>(User ID = ' . (int)$_SESSION['id'] . ')</small></span></p></td>
</tr>
<tr>
<td width="250">'; if($row['sex']=='male') {
echo '<input type="radio" name="sex" value="male" checked> männlich ';
echo '<input type="radio" name="sex" value="female"> weiblich';
}elseif ($row['sex']=='female') {
echo '<input type="radio" name="sex" value="male"> männlich ';
echo '<input type="radio" name="sex" value="female" checked> weiblich';
}else{
echo '<input type="radio" name="sex" value="male"> männlich ';
echo '<input type="radio" name="sex" value="female"> weiblich';
}
echo '</td>
<td><span class="tables_description">' . $lang['sex'] . '</span></td>
</tr>
<tr>
<td width="250"><input name="birthday" type="text" value="'; if($row['birthday'] > 0) {
echo date('Y-m-d', strtotime($row['birthday']));
}else{
echo '';
}
echo '" class="textfields" size="40" maxlength="10"></td>
<td><span class="tables_description">' . $lang['birthday'] . '</span> <small>(yyyy-mm-dd)</small></td>
</tr>
<tr>
<td width="250"><input name="email" type="text" value="' . htmlentities($row['email'], ENT_QUOTES) . '" class="textfields" size="40" maxlength="70"></td>
<td><span class="tables_description">' . $lang['e_mail_adress'] . '</td>
</tr>
<tr>
<td width="250">'; if($row['showmail']=='1') {
echo '<input type="radio" name="showmail" value="1" checked> ' . $lang['yes'] . '
<input type="radio" name="showmail" value="0"> ' . $lang['no'] . '';
}else{
echo '<input type="radio" name="showmail" value="1"> ' . $lang['yes'] . '
<input type="radio" name="showmail" value="0" checked> ' . $lang['no'] . '';
}
echo '</td>
<td><span class="tables_description">' . $lang['show_email'] . '</span></td>
</tr>
<tr>
<td width="250"><input name="homepage" type="text" value="' . htmlentities($row['homepage'], ENT_QUOTES) . '" class="textfields" size="40" maxlength="70"></td>
<td><span class="tables_description">' . $lang['homepage'] . '</span></td>
</tr>
<tr>
<td width="250"><input name="icq" type="text" value="' . htmlentities($row['icq'], ENT_QUOTES) . '" class="textfields" size="40" maxlength="35"></td>
<td><span class="tables_description">' . $lang['icq'] . '</span></td>
</tr>
<tr>
<td width="250"><input name="live" type="text" value="' . htmlentities($row['live'], ENT_QUOTES) . '" class="textfields" size="40" maxlength="50"></td>
<td><span class="tables_description">' . $lang['live'] . '</span></td>
</tr>
<tr>
<td width="250"><input name="skype" type="text" value="' . htmlentities($row['skype'], ENT_QUOTES) . '" class="textfields" size="40" maxlength="50"></td>
<td><span class="tables_description">' . $lang['skype'] . '</span></td>
</tr>
<tr>
<td width="250"><input name="facebook" type="text" value="' . htmlentities($row['facebook'], ENT_QUOTES) . '" class="textfields" size="40" maxlength="70"></td>
<td><span class="tables_description">' . $lang['facebook'] . '</span></td>
</tr>
<tr>
<td width="250"><input name="twitter" type="text" value="' . htmlentities($row['twitter'], ENT_QUOTES) . '" class="textfields" size="40" maxlength="70"></td>
<td><span class="tables_description">' . $lang['twitter'] . '</span></td>
</tr>
<tr>
<td width="250"><input name="google" type="text" value="' . htmlentities($row['google'], ENT_QUOTES) . '" class="textfields" size="40" maxlength="70"></td>
<td><span class="tables_description">' . $lang['google'] . '</span></td>
</tr>
<tr>
<td colspan="2"><p class="dark">' . $lang['about_me'] . '</p><textarea cols="45" rows="8" name="about" id="about" class="textareas" maxlength="500">' . stripslashes(nl2br($row['about'])) . '</textarea><br><small>(max. 500 Zeichen)</small></td>
</tr>
<tr>
<td colspan="2"><p class="dark">' . $lang['signature'] . '</p><textarea cols="45" rows="8" name="signature" id="signature" class="textareas" maxlength="100">' . stripslashes(nl2br($row['signature'])) . '</textarea><br><small>(max. 100 Zeichen)</small></td>
</tr>
</table>
<p><input type="submit" name="submit" value="' . $lang['change_profile'] . '" alt="' . $lang['change_profile'] . '" class="buttons"></p>';
echo '</form>';
}else{
$profile = "UPDATE
members
LEFT JOIN
profiles
ON
members.id = profiles.id
SET
sex = '" . mysql_real_escape_string($_POST['sex']) . "',
birthday = '" . mysql_real_escape_string($_POST['birthday']) . "',
email = '" . mysql_real_escape_string($_POST['email']) . "',
showmail = '" . mysql_real_escape_string($_POST['showmail']) . "',
homepage = '" . mysql_real_escape_string($_POST['homepage']) . "',
icq = '" . mysql_real_escape_string($_POST['icq']) . "',
live = '" . mysql_real_escape_string($_POST['live']) . "',
skype = '" . mysql_real_escape_string($_POST['skype']) . "',
facebook = '" . mysql_real_escape_string($_POST['facebook']) . "',
twitter = '" . mysql_real_escape_string($_POST['twitter']) . "',
google = '" . mysql_real_escape_string($_POST['google']) . "',
about = '" . mysql_real_escape_string($_POST['about']) . "',
signature = '" . mysql_real_escape_string($_POST['signature']) . "'
WHERE
members.id = " . (int)$_SESSION['id'];
mysql_query($profile) OR die(mysql_error());
if(mysql_affected_rows() == 1) {
echo '<p class="success">Ihr Profil wurde erfolgreich aktualisiert - <a href="management.php?site=myprofile" class="success_link">' . $lang['go_on'] . '</a></p>';
}else{
echo '<p class="false">Ihr Profil konnte nicht aktualisiert werden - <a href="javascript:history.back();" class="false_link">' . $lang['back'] . '</a></p>';
}
}
?>