I have done task management software using php.now I would to like to write a php code to(restrict) set deadline date and time in users taskmanagement page by admin.Deadline date already entered by admin in the database.if the deadline date expired the user cannot access his task management page and this will be redirect to something like “you don’t have authorize to view ur page. Please contact admin”. Can you please give me idea to write a code.


Recommended Answers

All 2 Replies

User's login to management page should check DB table column to see if it is available or not. That is column which value is changed by admin.
So, when user logs in to account or even as logged in member click the link to management page (in case there is some area you can still visit), there should be also check to see the value of deadline_expired (I.E.) column. That can be date or boolean or some in code predefined INT.

On admin page I soppose you have edit user. Just add one more input field for deadline_expired column

Is that good enough for you?

good . thanks tpojka. based on ur comment i have made my script.
i hereby mentioned my script also.

     $todays_date = date("F j Y g:i A e"); 
        $task_assigned_to = $_SESSION['SESSION_USER_NAME'];
     $result = $conn->prepare("SELECT task_end_date FROM `subadmin-task` where task_assigned_to = :task_assigned_to ORDER BY task_id DESC LIMIT 25");
        $result->bindParam(':task_assigned_to', $task_assigned_to); 
        $total = $result->rowCount();
        $row = $result->fetch();
    $deadline = $row['task_end_date'];
    $todays_date = date("Y-m-d");
$today = strtotime($todays_date);
$expiration_date = strtotime($deadline);
$timeDiff = abs($expiration_date-$today);
$num_day = $timeDiff/86400; // 1day = 86400 sec
$num_of_days = intval($num_day);

if($total > 0)
if ($expiration_date > $today) {
 // echo "<meta http-equiv='refresh' content='1;URL=subadmin_task.php'>"; //deadline is past user can't access 
echo "Still you will have&nbsp&nbsp"."$num_of_days"."&nbsp&nbspdays";
    else { 

  //echo "<meta http-equiv='refresh' content='1;URL=closed.php'>"; //deadline is past user can't access 
  header("location: closed.php");


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.