Nov 21, 2014 11:55 PM
(This post was last modified: Nov 22, 2014 03:42 AM by Br4v0.)
Hello everyone , 😉
I need to make a user interface that can directly give input to file name "crontab" (without any extension)
Here is frontend i made :
Time in Hours Minutes Seconds:
Spoiler (Click to View)
Jquery Date Selector
Spoiler (Click to View)
form
i need to know how to input exact value in crontab to make it working
here is my current code :
i need accurate value like this :
please help me 🤝
I need to make a user interface that can directly give input to file name "crontab" (without any extension)
Here is frontend i made :
Time in Hours Minutes Seconds:
Spoiler (Click to View)
Jquery Date Selector
Spoiler (Click to View)
form
Code
<form id="settingsForm" action="schedule_engine.php" method="post">
<div class="form-group">
<label for="source">Source</label>
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon fa fa-info"></span></span>
<select name="source" id="source" style="width:130px;" class="form-control">
<option value='9gag_new'>9gag_new</option><option value='fresh'>fresh</option><option value='hot'>hot</option><option value='main'>main</option><option value='trending'>trending</option><option value='videos'>videos</option> </select>
</div>
</div>
<div class="form-group">
<label for="next_launch">Starting From</label>
<input style="width:160px;" name="next_launch" class="form-control" id="datepicker"></input>
</div>
<div class="form-group">
<label for="day_interval">Time Between Launches <i>(Days, Hours, Minutes)</i></label>
<div class="input-group" id="time_intervals">
<span class="input-group-addon"><span class="glyphicon fa fa-info"></span></span>
<input class="form-control" style="width:130px;" name="day_interval" id="day_interval" defaultValue="Days"></input>
<input class="form-control" style="width:130px; margin-left:5px;" name="hour_interval" id="hour_interval" defaultValue="Hours"></input>
<input class="form-control" style="width:130px; margin-left:5px;" name="minute_interval" id="minute_interval" defaultValue="Minutes"></input>
</div>
</div>
<div class="form-group">
<label for="posts">Number of Posts to Scrape at Once</label>
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon fa fa-info"></span></span>
<input type="text" name="posts" style="width:130px; margin-left:5px;" id="posts" placeholder="Number of Posts to Fetch">
</div>
</div>
<div class="form-group">
<label for="source">Mode</label>
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon fa fa-info"></span></span>
<select name="status" id="status" style="width:130px;" class="form-control">
<option value="0">Manual</option>
<option value="1">Automatic</option>
</select>
</div>
</div>[b]<!--[/b] panel body -->
<div class="panel-footer clearfix">
<button type="submit" id="submitButton" class="btn btn-default btn-success btn-lg pull-right">Update Site Settings</button>
</div><!--panel-footer clearfix-->
</form>here is my current code :
Code
$next_launch = '20'.$_POST['next_launch'].':00';
$next_launch = strtotime($next_launch);
$time_interval = intval($_POST['day_interval']) * 3600 * 24 + intval($_POST['hour_interval']) * 3600 + intval($_POST['minute_interval']) * 60;
if($next_launch < time())
$next_launch = time() + $time_interval;
$date_str = date('i H d m',$next_launch);
$file = file_get_contents('../crontab');
$next_launch += $time_interval;
$date_str = round(date('s i H d m Y',$next_launch));
$source = $_POST['source'];
$mysqli->query("update jobs set next_launch = \"$date_str\", time_interval = $time_interval, posts = $posts where name=\"{$_POST['source']}\"");
$file .= $date_str;
$str = "$file * /usr/local/bin/php ".PATH_TO_ENGINE."scraping_engine/{$_POST['source']}.php";
file_put_contents('../crontab',"MAILTO=\"\"\n$str\n");
exec('crontab crontab');i need accurate value like this :
Code
1 1 1 * * execute.phpplease help me 🤝


![[Image: jhzFW3t.png]](https://i.imgur.com/jhzFW3t.png)
![[Image: uWxX26G.png]](https://i.imgur.com/uWxX26G.png)