-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathtweet_settings.php
executable file
·62 lines (48 loc) · 1.64 KB
/
tweet_settings.php
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/*
Twando.com Free PHP Twitter Application
http://www.twando.com/
*/
include('inc/include_top.php');
set_time_limit(0); //For large file uploads
//Set return page
$return_url = "tweet_settings.php?id=" . strip_tags($_GET['id']);;
$pass_msg = "";
//Check if logged in
if (mainFuncs::is_logged_in() != true) {
$page_select = "not_logged_in";
} else {
$page_select = "tweet_settings";
$header_info['on_load'] = "ajax_tweet_settings_tab('tab1');";
$header_info['js_scripts'] = '<script type="text/javascript" src="inc/scripts/anytime.c.js"></script>' . "\n" . '<link rel="stylesheet" type="text/css" href="inc/scripts/anytime.c.css" />' . "\n";
//Get data here
$q1a = $db->get_user_data($_GET['id']);
if (empty($_POST['a']))
{ $_POST['a'] = ""; }
if ($_POST['a'] == 'csv_upload') {
//Bulk CSV upload
$header_info['on_load'] = "ajax_tweet_settings_tab('tab4');";
if ($_FILES['csv_file']['name']) {
//Not ideal, but saves reminding user to chmod a directory
$handle = @fopen($_FILES['csv_file']['tmp_name'],'r');
$valid_rows = 0;
while (($data = @fgetcsv($handle, 1000, ",")) !== FALSE) {
if (count($data) == 2) {
$valid_rows ++;
$db->query("INSERT INTO " . DB_PREFIX . "scheduled_tweets (owner_id, tweet_content, time_to_post)
VALUES ('" . $db->prep($q1a['id']) . "','" . $db->prep($data[1]) . "','" . $db->prep($data[0]) . "')");
}
}
@fclose($handle);
//Check valid rows
if ($valid_rows == 0) {
$pass_msg = 19;
} else {
$pass_msg = 20;
}
}
}
}
mainFuncs::print_html($page_select);
include('inc/include_bottom.php');
?>