-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcronT.php
More file actions
45 lines (30 loc) · 1.56 KB
/
cronT.php
File metadata and controls
45 lines (30 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
require_once("config/dbconfig.php");
require_once("config/twconfig.php");
require_once('config/twitter.class.php');
////
$consumerKey = YOUR_CONSUMER_KEY;
$consumerSecret = YOUR_CONSUMER_SECRET;
$date = time();
$tws = 100 ; // عدد المستخدمين في كل دقيقة
////
$users1 = mysqli_query($con,"SELECT * FROM users WHERE `nextOk` <= $date");
while($rows = mysqli_fetch_assoc($users1)) { // لولب آلإرسال
//$rows['section'];
$tweets = mysqli_fetch_assoc(mysqli_query($con,"SELECT * FROM `tweetst` WHERE `section` = '".$rows['section']."' ORDER BY RAND() LIMIT 0,1 "));
$txtwi = $tweets['tweet'] ;
$accessToken = $rows['accessToken'];
$accessTokenSecret =$rows['accessTokenSecret'];
$twitter = new Twitter($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
$oksend = $twitter->send($txtwi);
if($oksend == 0) { // عدم نجاح عملية آلإرسال
$twitter = new Twitter($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
$oksend = $twitter->send($txtwi);
mysqli_query($con,"UPDATE `cron` SET `users` = `users`+1");
mysqli_query($con,"UPDATE `users` SET `nextOk` = `next`+`".$date."`");
}else { // نجاح العملية
mysqli_query($con,"UPDATE `cron` SET `users` = `users`+1");
mysqli_query($con,"UPDATE `users` SET `nextOk` = `next`+`".$date."`");
}
}// نهاية اللولب
?>