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

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

    $goto = 'management.php?site=tasks';
	$autoforward = 2;

	echo '<form action="" method="post" name="todo">
    <p>' . $lang['add_new_task'] . '<br>
    <input name="task" type="text" size="40" maxlength="40" class="textfields" placeholder="' . $lang['what_must_be_done'] . '?" 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 todo (`do`,`id2`,`task`,`priority`,`success`) VALUES (NULL,'" . $_SESSION['id'] . "','" . $_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 todo WHERE `id2`='" . $_SESSION['id'] . "' 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="management.php?site=tasks&success=1&do=' . $row['do'] . '"><img src="style/images/done.png" border="0" title="' . $lang['done'] . '"></a></td>
        <td width="11"><a href="management.php?site=tasks&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 todo WHERE `id2`='" . $_SESSION['id'] . "' 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="management.php?site=tasks&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 todo SET `success` = '1' WHERE `do` = '" . $_REQUEST['do'] . "' AND `id2`='" . $_SESSION['id'] . "'") 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 todo WHERE `do` = '" . $_REQUEST['do'] . "' AND `id2`='" . $_SESSION['id'] . "'") OR die(mysql_error());

		if($deltask == TRUE) {

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

?>
Return current item: WH Social