Location: PHPKode > scripts > WH Social > wh_social/modules/guestbook/entry.php
<?php

    echo '<div class="content_left">
    <div id="breadcrumb">
        <ul class="crumbs">
            <li class="first"><a href="index.php" style="z-index:9;"><span></span>' . $lang['index'] . '</a></li>
            <li><a href="guestbook.php" style="z-index:8;">' . $lang['guestbook'] . '</a></li>
            <li><a href="entry.php?id=' . intval($_GET['id']) . '" style="z-index:7;">' . $lang['do_entry'] . '</a></li>
        </ul>
    </div>
    </div>

    <div class="content_right">';

        include('modules/search.inc.php');
    echo '</div>

    <div class="clear_long"></div>';

    $ret = 1;

    echo '<div class="main_menu">';

        $ret = include 'framework/templates/'.$main_content['menu'];
    echo '<div id="line"></div>';

        $ret = include 'framework/templates/'.$main_content['infos'];
    echo '</div>';

    echo '<div class="main_content">';

    if((isset($_GET['id'])) && (is_numeric($_GET['id']))) {

    $id = mysql_real_escape_string($_GET['id']);
    $id = intval($_GET['id']);

    	}else{
    
    	echo '<p class="false">' . $lang['invalid_id'] . '</p>';
    	exit();
    	}

    echo '<h1>' . $lang['guestbook_entry'] . '</h1>';

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

    echo '<p class="p_space"><a href="guestbook.php?id=' . $id . '" class="buttons">' . $lang['guestbook_read'] . '</a></p>';

    echo '<form action="" method="post" name="gb">
    <p><input type="text" name="name" class="textfields" required size="40" maxlength="30"> ' . $lang['name'] . '*</p>
    <p><input type="text" name="email" class="textfields" size="40" maxlength="50"> ' . $lang['e_mail_adress'] . '</p>
    <p><input type="text" name="url" class="textfields" value="http://" size="40" maxlength="50"> ' . $lang['homepage'] . '</p>
    <p>' . $lang['message'] . ' *<br>
    <textarea name="post" class="textareas"></textarea></p>
    <p><input type="submit" class="buttons" value="' . $lang['do_entry'] . '" name="' . $lang['do_entry'] . '"></p>
    </form>';

    	}else{

        $errors = array();

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

        	}else{
        	$errors[] = $lang['name_must_be_filled'];
        	}

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

        	}else{
        	$errors[] = $lang['enter_a_text'];
        	}

        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{

        	$sql = "INSERT INTO
        				guestbook(id2, name, email, url, post, date)
        			VALUES ('" . $id . "',
        				'" . mysql_real_escape_string($_POST["name"]) . "',
        				'" . mysql_real_escape_string($_POST["email"]) . "',
        				'" . mysql_real_escape_string($_POST["url"]) . "',
        				'" . mysql_real_escape_string($_POST["post"]) . "',
        				NOW()
        				)";

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

        if(!$result) {

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

        	}else{

        	$autoforward = 3;

        	echo '<p class="success">' . $lang['success_gb_entry'] . ' - <a href="guestbook.php?id=' . $id . '" class="success_link">' . $lang['go_on'] . '</a></p>
            <meta http-equiv="refresh" content="' . $autoforward . '; URL=guestbook.php?id=' . $id . '">
            <p><em>(' . $lang['redirected_in'] . ' ' . $autoforward . ' ' . $lang['seconds'] . '...)</em><p>';
            }
        }
    }

?>
Return current item: WH Social