Esempio n. 1
0
 private function db_connect()
 {
     $this->db_link = mysql_connect($this->db_host, $this->db_user, $this->db_password);
     $db_test2 = mysql_select_db($this->db_table, $this->db_link);
     if (!$this->db_link or !$db_test2) {
         mainFuncs::print_html('mysql_error');
         exit;
     }
 }
Esempio n. 2
0
} 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 ($_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)\r\n    \t\t  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';
Esempio n. 3
0
<?php

/*
Twando.com Free PHP Twitter Application
http://www.twando.com/
*/
include 'inc/include_top.php';
//Twitter can be slow
set_time_limit(0);
if (mainFuncs::is_logged_in() != true) {
    $return_url = "";
    //Don't want to try and redirect straight to this page
    mainFuncs::print_html('not_logged_in');
} else {
    $ap_creds = $db->get_ap_creds();
    //Connect to Twitter
    $connection = new TwitterOAuth($ap_creds['consumer_key'], $ap_creds['consumer_secret'], $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
    $access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']);
    $_SESSION['access_token'] = $access_token;
    //Remove request tokens
    unset($_SESSION['oauth_token']);
    unset($_SESSION['oauth_token_secret']);
    //Check response
    if ($connection->http_code == 200) {
        //All OK, store credentials in database for this user
        $access_token = $_SESSION['access_token'];
        $connection = new TwitterOAuth($ap_creds['consumer_key'], $ap_creds['consumer_secret'], $access_token['oauth_token'], $access_token['oauth_token_secret']);
        $content = $connection->get('account/verify_credentials');
        //Update DB
        $tw_user = array('id' => $content->id, 'oauth_token' => $access_token['oauth_token'], 'oauth_token_secret' => $access_token['oauth_token_secret'], 'profile_image_url' => $content->profile_image_url, 'screen_name' => $content->screen_name, 'followers_count' => $content->followers_count, 'friends_count' => $content->friends_count, 'log_data' => 1, 'last_updated' => date("Y-m-d H:i:s"));
        $db->store_authed_user($tw_user);