Location: PHPKode > scripts > WH Social > wh_social/modules/management/addresses.inc.php
<?php

    echo '<h1 class="p_space">' . $lang['my_addresses'] . '</h1>';

    $id = (int)$_SESSION['id'];

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

    echo '<form method="post" action="">
    <table width="800" border="0">
    <tr>
    <td width="200"><label for="name"><span class="blue_span">' . $lang['re_name'] . '</span></label><input type="text" name="name" id="name" required maxlength="80" class="adresses"></td>
    <td width="200"><label for="email"><span class="blue_span">' . $lang['e_mail_adress'] . '</span></label><input type="text" name="email" id="email" required maxlength="100" class="adresses"></td>
    <td width="200"><label for="phone"><span class="blue_span">' . $lang['phone'] . '</span></label><input type="text" name="phone" id="phone" required maxlength="50" class="adresses"></td>
    <td width="200"><label for="address"><span class="blue_span">' . $lang['address'] . '</span></label><input type="text" name="address" id="address" required maxlength="120" class="adresses"></td>
    </tr>
    </table>
    &nbsp;<input type="submit" name="' . $lang['add_address'] . '" id="' . $lang['add_address'] . '" value="' . $lang['add_address'] . '" class="buttons">
    </form>';

    echo '<div class="head_spacer"></div>
    <div id="search_line"></div>
    <div class="spacer"></div>';

        }else{

        $errors = array();

        if(isset($_POST['name'])) {
        if(trim($_POST['name']) == "") {
        $errors[] = $lang['type_name'];
        }

        if(!empty($errors)) {

        echo '<p class="false">' . $lang['not_filled_in_all_fields'] . ' - <a href="javascript:history.back();" class="false_link">' . $lang['back'] . '</a></p>';
        echo '<ul>';

        foreach($errors as $key => $value) {
        echo '<li>&#8226; ' . $value . '</li>';
        }
        echo '</ul>';

    }else{

    $addbook = "INSERT INTO
                    addresses(id2, name, email, phone, address)
                VALUES ('" . $id . "',
                        '" . mysql_real_escape_string($_POST['name']) . "',
                        '" . mysql_real_escape_string($_POST['email']) . "',
                        '" . mysql_real_escape_string($_POST['phone']) . "',
                        '" . mysql_real_escape_string($_POST['address']) . "'
                        )";

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

    if(mysql_affected_rows() == 1) {

    $autoforward = 3;

    echo '<p class="success">' . $lang['succes_address'] . ' - <a href="management.php?site=addresses" class="success_link">' . $lang['go_on'] . '</a></p>
    <meta http-equiv="refresh" content="' . $autoforward . '; URL=management.php?site=addresses">';

        }else{

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

    }}}

    $sql = "SELECT * FROM addresses WHERE id2 = '" . $id . "' ORDER BY name DESC";

    $result = mysql_query($sql) OR die(mysql_error());

    if(intval(mysql_num_rows($result)) == 0) {

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

        }else{

        echo '<table width="100%" cellpadding="5" class="tables">
        <tr>
        <td width="17%"><span class="blue_span">' . $lang['name'] . '</span></td>
        <td width="28%"><span class="blue_span">' . $lang['email_adress'] . '</span></td>
        <td width="15%"><span class="blue_span">' . $lang['phone'] . '</span></td>
        <td width="30%"><span class="blue_span">' . $lang['address'] . '</span></td>
        <td width="10%" align="right"><span class="red_span">' . $lang['blank_delete'] . '</span></td>
        </tr>';

    while($row = mysql_fetch_assoc($result)) {

        echo '<tr>
        <td width="17%"><span class="blue">' . htmlentities($row['name'], ENT_QUOTES) . '</span></td>
        <td width="28%"><a href="mailto:' . htmlentities($row['email'], ENT_QUOTES) . '">' . htmlentities($row['email'], ENT_QUOTES) . '</a></td>
        <td width="15%">' . htmlentities($row['phone'], ENT_QUOTES) . '</td>
        <td width="30%">' . htmlentities($row['address'], ENT_QUOTES) . '</td>
        <td width="10%" align="right"><a href="management.php?site=remove&id=' . (int)$row['id'] . '&id2=' . $id . '"><img src="style/icons/delete.png" border="0" title="' . $lang['address_delete'] . '"></a></td>
        </tr>';
        }

    echo '</table>';
    }

?>
Return current item: WH Social