Hi everyone. I am trying to work on a script that will ban a user from accessing my website for x amount of time. Here is the html and sql code.
HTML
<?php $date = 'd-m-Y';
$endDate = strtotime($date);
?>
<tr>
<th>Length of Ban</th>
<th>:</th>
<th>
<select name="period">
<optgroup label="Temporary Ban Options">
<option value="D_1">1 Day (<?php echo date($date, time()+((60*60)*24)); ?> 12:00 AM)</option>
<option value="D_2">2 Days (<?php echo date($date, time()+((60*60)*48)); ?> 12:00 AM)</option>
<option value="D_3">3 Days (<?php echo date($date, time()+((60*60)*72)); ?> 12:00 AM)</option>
<option value="D_4">4 Days (<?php echo date($date, time()+((60*60)*96)); ?> 12:00 AM)</option>
<option value="D_5">5 Days (<?php echo date($date, time()+((60*60)*120)); ?> 12:00 AM)</option>
<option value="D_6">6 Days (<?php echo date($date, time()+((60*60)*144)); ?> 12:00 AM)</option>
<option value="D_7" selected="selected">1 Week (<?php echo date($date, time()+((60*60)*168)); ?> 12:00 AM)</option>
<option value="D_14">2 Weeks (<?php echo date($date, time()+((60*60)*336)); ?> 12:00 AM)</option>
<option value="D_21">1 Month (<?php echo date($date, time()+((60*60)*744)); ?> 12:00 AM)</option>
<option value="Y_1">1 Year (<?php echo date($date, time()+((60*60)*8765)); ?> 12:00 AM)</option>
<option value="Y_2">2 Years (<?php echo date($date, time()+((60*60)*17531)); ?> 12:00 AM)</option>
</optgroup>
<optgroup label="Permanent Ban Options">
<option value="PERMANENT">Permanent - Never Lift Ban</option>
</optgroup>
</select>
</th>
</tr>
SQL
CREATE TABLE `megainstrumentals`.`userban` (
`user_id` INT( 10 ) NOT NULL ,
`admin_id` INT( 10 ) NOT NULL ,
`bandate` INT( 10 ) NOT NULL ,
`liftdate` INT( 10 ) NOT NULL ,
`reason` VARCHAR( 250 ) NOT NULL ,
PRIMARY KEY ( `user_id` )
) ENGINE = MYISAM ;
I am having trouble writing the code to ban the user and insert it into the db. I am mainly stuck on the bandate and the liftdate fields as I would not know how to grab the length of the ban from the select menu and put into the db and then check it when the user logs in. I am sorry if I have not provided enough information and any help would be really appreciated.
Thanks in advance.