Location: PHPKode > scripts > WH Board > wh_board/edit_profile.php
<?php require('style/layout/header.php'); ?>

    <div class="content_left">
        <ul id="breadcrumbs">
            <li><a href="index.php"><?php echo $lang['main_page']; ?></a></li>
            <li><a href="myprofile.php"><?php echo $lang['user_area']; ?></a></li>
            <li><a href="edit_profile.php" class="actual"><?php echo $lang['edit_profile']; ?></a></li>
        </ul>
    </div>
    <div class="content_right"><form method="post" id="search" action="search.php?search">
        <input type="text" name="search" placeholder="<?php echo $lang['enter_search_term']; ?>..." class="searchfield">
        <input type="hidden" name="submit" value="<?php echo $lang['search']; ?>" alt="<?php echo $lang['search']; ?>">
        </form>
    </div>

    <div class="clear"></div>

    <div id="headline">&nbsp;</div>

    <?php

        if(!isset($_SESSION['signed_in'])) {

		echo '<p class="false">' . $lang['only_for_registered'] . '</p>
        <p>' . $lang['you_have_to'] . ' <a href="signin.php">' . $lang['small_signin'] . '</a>. ' . $lang['not_yet'] . ' <a href="signup.php">' . $lang['registered'] . '</a>?</p>';

		}else{

		if($_SERVER['REQUEST_METHOD'] != 'POST') {

        include_once('functions/bbcode.php');
		include_once('functions/badwords.php');

		$sql = "SELECT
					user_sex,
					user_bday,
					user_email,
					user_showmail,
					user_homepage,
					user_icq,
					user_live,
					user_skype,
					user_facebook,
					user_twitter,
					user_about,
					user_signature
				FROM
					users
				WHERE
					user_id = " . (int)$_SESSION['user_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 class="green">User Name: <span class="blue">' . $_SESSION['user_name'] . '</span> <small>(User ID = ' . (int)$_SESSION['user_id'] . ')</small></p></td>
        </tr>
        <tr>
        <td width="250">'; if($row['user_sex']=='male') {

        echo '<input type="radio" name="user_sex" value="male" checked> ' . $lang['male'] . '&nbsp;&nbsp;&nbsp;';
        echo '<input type="radio" name="user_sex" value="female"> ' . $lang['female'] . '';

        }elseif ($row['user_sex']=='female') {

        echo '<input type="radio" name="user_sex" value="male"> ' . $lang['male'] . '&nbsp;&nbsp;&nbsp;';
        echo '<input type="radio" name="user_sex" value="female" checked> ' . $lang['female'] . '';

        }else{

        echo '<input type="radio" name="user_sex" value="male"> ' . $lang['male'] . '&nbsp;&nbsp;&nbsp;';
        echo '<input type="radio" name="user_sex" value="female"> ' . $lang['female'] . '';
        }

        echo '</td>
        <td><span class="tables_description">' . $lang['sex'] . '</span></td>
        </tr>
        <tr>
        <td width="250"><input name="user_bday" type="text" value="'; if($row['user_bday'] > 0) {

        echo date('Y-m-d', strtotime($row['user_bday']));

        }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="user_email" type="text" value="' . htmlentities($row['user_email'], ENT_QUOTES) . '" class="textfields" size="40" maxlength="70"></td>
        <td><span class="tables_description">' . $lang['email_adress'] . '</td>
        </tr>
        <tr>
        <td width="250">'; if($row['user_showmail']=='1') {

        echo '<input type="radio" name="user_showmail" value="1" checked> ' . $lang['yes'] . ' &nbsp;&nbsp;&nbsp;
        <input type="radio" name="user_showmail" value="0"> ' . $lang['no'] . '';

        }else{

        echo '<input type="radio" name="user_showmail" value="1"> ' . $lang['yes'] . ' &nbsp;&nbsp;&nbsp;
        <input type="radio" name="user_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="user_homepage" type="text" value="' . htmlentities($row['user_homepage'], ENT_QUOTES) . '" class="textfields" size="40" maxlength="70"></td>
        <td><span class="tables_description">Homepage</span></td>
        </tr>
        <tr>
        <td width="250"><input name="user_icq" type="text" value="' . htmlentities($row['user_icq'], ENT_QUOTES) . '" class="textfields" size="40" maxlength="35"></td>
        <td><span class="tables_description">ICQ</span></td>
        </tr>
        <tr>
        <td width="250"><input name="user_live" type="text" value="' . htmlentities($row['user_live'], ENT_QUOTES) . '" class="textfields" size="40" maxlength="50"></td>
        <td><span class="tables_description">Live Messenger</span></td>
        </tr>
        <tr>
        <td width="250"><input name="user_skype" type="text" value="' . htmlentities($row['user_skype'], ENT_QUOTES) . '" class="textfields" size="40" maxlength="50"></td>
        <td><span class="tables_description">Skype</span></td>
        </tr>
        <tr>
        <td width="250"><input name="user_facebook" type="text" value="' . htmlentities($row['user_facebook'], ENT_QUOTES) . '" class="textfields" size="40" maxlength="70"></td>
        <td><span class="tables_description">Facebook</span></td>
        </tr>
        <tr>
        <td width="250"><input name="user_twitter" type="text" value="' . htmlentities($row['user_twitter'], ENT_QUOTES) . '" class="textfields" size="40" maxlength="70"></td>
        <td><span class="tables_description">Twitter</span></td>
        </tr>
        <tr>
        <td colspan="2"><p class="dark">' . $lang['about_me'] . '</p><textarea cols="45" rows="8" name="user_about" id="user_about" class="textareas"  maxlength="500">' . stripslashes($row['user_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="user_signature" id="user_signature" class="textareas"  maxlength="100">' . stripslashes($row['user_signature']) . '</textarea><br><small>(max. 100 Zeichen)</small></td>
        </tr>
        </table>
        <p><input type="submit" name="submit" value="' . $lang['save_profile']. '" alt="' . $lang['save_profile'] . '" class="buttons"></p>';

        echo '</form>';
		
		}else{

		$profile = "UPDATE 
						users
					SET
						user_sex = '" . mysql_real_escape_string($_POST['user_sex']) . "',
						user_bday = '" . mysql_real_escape_string($_POST['user_bday']) . "',
						user_email = '" . mysql_real_escape_string($_POST['user_email']) . "',
						user_showmail = '" . mysql_real_escape_string($_POST['user_showmail']) . "',
						user_homepage = '" . mysql_real_escape_string($_POST['user_homepage']) . "',
						user_icq = '" . mysql_real_escape_string($_POST['user_icq']) . "',
						user_live = '" . mysql_real_escape_string($_POST['user_live']) . "',
						user_skype = '" . mysql_real_escape_string($_POST['user_skype']) . "',
						user_facebook = '" . mysql_real_escape_string($_POST['user_facebook']) . "',
						user_twitter = '" . mysql_real_escape_string($_POST['user_twitter']) . "',
						user_about = '" . mysql_real_escape_string($_POST['user_about']) . "',
						user_signature = '" . mysql_real_escape_string($_POST['user_signature']) . "'
					WHERE
						user_id = " . (int)$_SESSION['user_id'];

		mysql_query($profile) OR die(mysql_error());

		if(mysql_affected_rows() == 1) {

		echo '<p class="success">' . $lang['edit_profile_success'] . '!</p>';

			}else{

			echo '<p class="false">' . $lang['edit_profile_failed'] . '</p>';
			}
		}
		}

	?>

<?php require('style/layout/footer.php'); ?>
Return current item: WH Board