Location: PHPKode > scripts > WH Social > wh_social/reply.php
<?php require('framework/session.php'); ?>
<?php require('framework/ready.php'); ?>
<?php require('style/layout/header.php'); ?>

<div id="content_wrapper">
    <div class="content">

    <?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="discussions.php" style="z-index:8;">' . $lang['discussions'] . '</a></li>
                <li><a href="read_discussion.php?id=' . intval($_GET['id']) . '" style="z-index:7;">' . $lang['read_disc'] . '</a></li>
                <li><a href="#" style="z-index:6;">' . $lang['reply'] . '</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();
			}

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

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

			}else{

			if(sha1($_POST["zip"]) != $_POST["zip2"]) {

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

            }else{

    		$errors = array();

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

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

		if(!empty($errors)) {

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

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

			}else{

			$sql = "INSERT INTO
						discussions(content, topic, date, author)
					VALUES ('" . mysql_real_escape_string($_POST['reply']) . "',
						'" . $id . "',
						NOW(),
						'" . (int)$_SESSION['id'] . "'
                        )";

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

		if(!$result) {

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

			}else{

			$autoforward = 3;

            echo '<p class="success">' . $lang['success_reply'] . '!</p>
            <p><meta http-equiv="refresh" content="' . $autoforward . '; URL=read_discussion.php?id=' . $id . '">
            <small>(' . $lang['redirected_in'] . ' ' . $autoforward . ' ' . $lang['seconds'] . '...)</small></p>
            <p>' . $lang['not_redirected'] . ' [ <a href="read_discussion.php?id=' . $id . '">' . $lang['click_here'] . '</a> ]</p>';
            }

        }}}

	?>

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