Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Get Data From Flash*/
- $choice = $_GET['choice'];
- /* Get Data From XML*/
- $xml = simplexml_load_file('intelpoll.xml');
- $choice1 = (string)$xml->choice1;
- $choice2 = (string)$xml->choice2;
- $choice3 = (string)$xml->choice3;
- $choice4 = (string)$xml->choice4;
- $choice5 = (string)$xml->choice5;
- $choice6 = (string)$xml->choice6;
- $choice7 = (string)$xml->choice7;
- $choice8 = (string)$xml->choice8;
- $choice9 = (string)$xml->choice9;
- $choice10 = (string)$xml->choice10;
- $choice11 = (string)$xml->choice11;
- $choice12 = (string)$xml->choice12;
- $choice13 = (string)$xml->choice13;
- $choice14 = (string)$xml->choice14;
- $choice15 = (string)$xml->choice15;
- $choice16 = (string)$xml->choice16;
- $choice17 = (string)$xml->choice17;
- $choice18 = (string)$xml->choice18;
- $choice19 = (string)$xml->choice19;
- $choice20 = (string)$xml->choice20;
- $choice21 = (string)$xml->choice21;
- $choice22 = (string)$xml->choice22;
- $choice23 = (string)$xml->choice23;
- $choice24 = (string)$xml->choice24;
- $choice25 = (string)$xml->choice25;
- /*Compute Poll Data*/
- for ( $i = 1; $i <= 25; $i++) {
- if($choice == $i){
- $chosen = 'choice'.$i;
- $$chosen = $$chosen + 1;
- echo 'choice'.$i.': '.$$chosen;
- }
- }
- /* Create RSS/XML */
- $feedContent = "<?xml version='1.0' encoding='UTF-8'?>\r\n";
- $feedContent = $feedContent . "<items type='array'>\r\n";
- $feedContent = $feedContent . "<choice1>" . $choice1 . "</choice1>\r\n";
- $feedContent = $feedContent . "<choice2>" . $choice2 . "</choice2>\r\n";
- $feedContent = $feedContent . "<choice3>" . $choice3 . "</choice3>\r\n";
- $feedContent = $feedContent . "<choice4>" . $choice4 . "</choice4>\r\n";
- $feedContent = $feedContent . "<choice5>" . $choice5 . "</choice5>\r\n";
- $feedContent = $feedContent . "<choice6>" . $choice6 . "</choice6>\r\n";
- $feedContent = $feedContent . "<choice7>" . $choice7 . "</choice7>\r\n";
- $feedContent = $feedContent . "<choice8>" . $choice8 . "</choice8>\r\n";
- $feedContent = $feedContent . "<choice9>" . $choice9 . "</choice9>\r\n";
- $feedContent = $feedContent . "<choice10>" . $choice10 . "</choice10>\r\n";
- $feedContent = $feedContent . "<choice11>" . $choice11 . "</choice11>\r\n";
- $feedContent = $feedContent . "<choice12>" . $choice12 . "</choice12>\r\n";
- $feedContent = $feedContent . "<choice13>" . $choice13 . "</choice13>\r\n";
- $feedContent = $feedContent . "<choice14>" . $choice14 . "</choice14>\r\n";
- $feedContent = $feedContent . "<choice15>" . $choice15 . "</choice15>\r\n";
- $feedContent = $feedContent . "<choice16>" . $choice16 . "</choice16>\r\n";
- $feedContent = $feedContent . "<choice17>" . $choice17 . "</choice17>\r\n";
- $feedContent = $feedContent . "<choice18>" . $choice18 . "</choice18>\r\n";
- $feedContent = $feedContent . "<choice19>" . $choice19 . "</choice19>\r\n";
- $feedContent = $feedContent . "<choice20>" . $choice20 . "</choice20>\r\n";
- $feedContent = $feedContent . "<choice21>" . $choice21 . "</choice21>\r\n";
- $feedContent = $feedContent . "<choice22>" . $choice22 . "</choice22>\r\n";
- $feedContent = $feedContent . "<choice23>" . $choice23 . "</choice23>\r\n";
- $feedContent = $feedContent . "<choice24>" . $choice24 . "</choice24>\r\n";
- $feedContent = $feedContent . "<choice25>" . $choice25 . "</choice25>\r\n";
- $feedContent = $feedContent . "</items>";
- /* Save Generated Data */
- $local_file = 'intelpoll.xml';
- if (strlen($feedContent) > 10)
- {
- file_put_contents($local_file, $feedContent);
- $destination_file = 'intel/'.$local_file;
- #"/developers/uploadftp/aditya/".$myFileName; //where you want to throw the file on the webserver (relative to your login dir)
- // connection settings
- $ftp_server = 'ftp.cachefly.com'; //address of ftp server.
- $ftp_user_name = 'joystick'; // Username
- $ftp_user_pass = '440236b0'; // Password
- $conn_id = ftp_connect($ftp_server) or die("<span style='color:#FF0000'><h2>Couldn't connect to $ftp_server</h2></span>"); // set up basic connection
- #print_r($conn_id);
- $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass) or die("<span style='color:#FF0000'><h2>You do not have access to this ftp server!</h2></span>"); // login with username and password, or give invalid user message
- if ((!$conn_id) || (!$login_result)) { // check connection
- // wont ever hit this, b/c of the die call on ftp_login
- echo "<span style='color:#FF0000'><h2>FTP connection has failed! <br />";
- echo "Attempted to connect to $ftp_server for user $ftp_user_name</h2></span>";
- exit;
- } else {
- // echo "Connected to $ftp_server, for user $ftp_user_name <br />";
- }
- $upload = ftp_put($conn_id, $destination_file, $local_file, FTP_BINARY); // upload the file
- if (!$upload) { // check upload status
- echo "<span style='color:#FF0000'><h2>FTP upload of $myFileName has failed!</h2></span> <br />";
- } else {
- echo "<span style='color:#339900'><h2>Uploading $myFileName Completed Successfully!</h2></span><br /><br />";
- }
- ftp_close($conn_id); // close the FTP stream
- }
- ?>
Add Comment
Please, Sign In to add comment