Location: PHPKode > scripts > WH Social > wh_social/admin/appointments.php
<?php

    if(file_exists('handler/stay.php') == TRUE) {

        require('handler/stay.php');

        }else{

        echo '<p class="red_span" align="center">Error - Fehler</p>';
        exit;
        }

?>

<?php define('INCLUDE_CHECK',1); define('MYSQL_CHECK',1); ?>

<?php require('../framework/config.php'); ?>
<?php require('../framework/mysql.php'); ?>
<?php require('../framework/constants.php'); ?>
<?php require('../framework/class/cache_class.php'); no_cache(); ?>
<?php require('../framework/security.php'); ?>
<?php require('handler/language.php'); ?>

<?php require('structure/header.inc.php'); ?>

    <div class="menu">
        <div class="menu_left">
            <ul id="admin_navi">
                <li class="active"><a href="index.php"><?php echo $lang['blank_admin_area']; ?></a></li>
                <li><a href="members.php"><?php echo $lang['admin_members']; ?></a></li>
                <li><a href="discussions.php"><?php echo $lang['discussions']; ?></a></li>
                <li><a href="topics.php"><?php echo $lang['blank_topics']; ?></a></li>
                <li><a href="news.php"><?php echo $lang['news']; ?></a></li>
                <li><a href="events.php"><?php echo $lang['events']; ?></a></li>
                <li><a href="newsletter.php"><?php echo $lang['newsletter']; ?></a></li>
                <li><a href="statistic.php"><?php echo $lang['statistic']; ?></a></li>
            </ul>
        </div>
        <div class="menu_right">
            <?php

            if(isset($_SESSION['admin']) && $_SESSION['admin'] == TRUE) {

            echo '<div class="admin_settings">
            <a class="admin_account"><span>' . $lang['blank_navigation'] . '</span></a>
            <div class="admin_submenu" style="display: none;">
                <ul class="root">
                    <li><a href="' . $url . '" target="_blank">' . $lang['goto_network'] . '</a></li>
                    <li><a href="signout.php">' . $lang['signout'] . '</a></li>
                </ul>
            </div>
            </div>';
            }

            ?>
        </div>
    </div>
</div>

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

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

    <?php

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

        $query = "SELECT do FROM appointments";
        $tasking = mysql_query($query) OR die(mysql_error());
        $admin_tasks = mysql_num_rows($tasking);

        echo '<p class="p_space"><strong>' . intval($admin_tasks) . '</strong> ' . $lang['count_of_appointments'] . '</p>';

        mysql_free_result($tasking);

        $goto = 'appointments.php';
    	$autoforward = 2;

    	echo '<form action="" method="post" name="appointments">
        <p>' . $lang['add_new_task'] . '<br>
        <input name="task" type="text" size="40" maxlength="40" class="textfields" required></p>
        <p><small>' . $lang['priority'] . '</small><br>
        <select name="priority" class="captchas" title="' . $lang['priority'] . '">
        <option>1</option>
        <option>2</option>
        <option selected="selected">3</option>
        <option>4</option>
        <option>5</option>
        </select></p>
        <p><input type="submit" name="newtodo" value="' . $lang['add_task'] . '" class="buttons"></p>
        </form>';

    	echo '<div id="line">&nbsp;</div>';

    	if(isset($_REQUEST['newtodo'])) {

    	$newtask = mysql_query("INSERT INTO appointments (`do`,`id2`,`task`,`priority`,`success`) VALUES (NULL,'" . $_SESSION['admin'] . "','" . $_REQUEST['task'] . "','" . $_REQUEST['priority'] . "','0')") OR die(mysql_error());

    		if($newtask == TRUE) {

                echo '<p class="success">' . $lang['success_todo'] . '</p>
                <meta http-equiv="refresh" content="' . $autoforward . '; URL=' . $goto . '">';
                }
    	    }

    	$checktask = mysql_query("SELECT * FROM appointments WHERE `id2`='" . $_SESSION['admin'] . "' AND `success`='0' ORDER BY priority DESC") OR die(mysql_error());

        if(!$checktask) {

        echo '<p class="false">' . $lang['no_undone_tasks'] . '</p>' . mysql_error();

            }else{

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

            echo '<p class="false">' . $lang['no_undone_tasks'] . '</p>' . mysql_error();

        }else{

        while($row = mysql_fetch_array($checktask)) {

    		echo '<table width="100%" cellpadding="5" class="tasks">
            <tr>
            <td colspan="3"><span class="red_span"><strong>' . $lang['pending_task'] . '</strong></span></td>
            </tr>
            <tr>
            <td width="11"><a href="appointments.php?success=1&do=' . $row['do'] . '"><img src="../style/images/done.png" border="0" title="' . $lang['done'] . '"></a></td>
            <td width="11"><a href="appointments.php?del=true&do=' . $row['do'] . '"><img src="../style/images/delete.png" border="0" title="' . $lang['blank_delete'] . '"></a></td>
            <td><strong>' . htmlentities($row['task'], ENT_QUOTES) . '</strong></td>
            </tr></table>';
            }
        }
        }

    	$checktask = mysql_query("SELECT * FROM appointments WHERE `id2`='" . $_SESSION['admin'] . "' AND `success`='1' ORDER BY priority DESC") OR die(mysql_error());

        while($row = mysql_fetch_array($checktask)) {

    		echo '<table width="100%" cellpadding="5" class="tasks">
            <tr>
            <td colspan="2"><span class="green_span"><strong>' . $lang['done_task'] . '</strong></span></td>
            </tr>
            <tr>
            <td width="11"><a href="appointments.php?del=true&do=' . $row['do'] . '"><img src="../style/images/delete.png" border="0" title="' . $lang['blank_delete'] . '"></a></td>
            <td><strong>' . htmlentities($row['task'], ENT_QUOTES) . '</strong></td>
            </tr></table>';
            }

    	if(isset($_REQUEST['success'])) {

    	$uptask = mysql_query("UPDATE appointments SET `success` = '1' WHERE `do` = '" . $_REQUEST['do'] . "' AND `id2`='" . $_SESSION['admin'] . "'") OR die(mysql_error());

    		if($uptask == TRUE) {

                echo '<p class="success">' . $lang['completed_task'] . '</p>
                <meta http-equiv="refresh" content="' . $autoforward . '; URL=' . $goto . '">';
                }
    	    }

    	if(isset($_REQUEST['del'])) {

    	$deltask = mysql_query("DELETE FROM appointments WHERE `do` = '" . $_REQUEST['do'] . "' AND `id2`='" . $_SESSION['admin'] . "'") OR die(mysql_error());

    		if($deltask == TRUE) {

                echo '<p class="success">' . $lang['deleted_task'] . '</p>
                <meta http-equiv="refresh" content="' . $autoforward . '; URL=' . $goto . '">';
                }
    	    }

        echo '<div class="clear"></div>';

    ?>

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