Jump to content

radiations3

Members
  • Posts

    191
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://radiations3.com/

Profile Information

  • Gender
    Not Telling

radiations3's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello, I want to know one thing lets say there is one variable $var1 and insert query is being assign to it then will mysql_query($query1) or die(mysql_error()); this code will make insertion successfully. moreover in the following transaction code will all the queries being inserted on $result = mysql_query('COMMIT'); and will the following code make sure that all the insertion successfully inserted into multiple tables because I have been trying to make such functionality that will make sure that on click all the values are being stored in the multiple tables of the database successfully and will not make insertion if insertion is being failed of one table or another. if (mysql_query('BEGIN')) { if ( mysql_query($query1) && mysql_query($query2) && mysql_query($query3) && mysql_query($insertSQL) ) $result = mysql_query('COMMIT'); // All queries looked OK, save else { mysql_query('ROLLBACK') ; // problems with queries, no changes echo "There are some problemo!!!"; }
  2. Following is the code that works fine if I am passing `/pageid/feed` to `facebook->api`, but when I change it to upload the image directly to my Facebook FAN PAGE photo album, it will not work. Kindly let me know what I am doing wrong in the following code: // Works fine $status = $facebook->api("/406221796071956/feed", 'post', $attachment); // Does not work $status = $facebook->api('/196878530339618/photos', 'post', $attachment); # Full Source <?php require 'src/facebook.php'; $app_id = "364900470214655"; $app_secret = "xxxx"; $facebook = new Facebook(array( 'appId' => $app_id, 'secret' => $app_secret, 'cookie' => true, 'fileUpload' => true, )); $user = $facebook->getUser(); if(($facebook->getUser())==0){ header("Location:{$facebook->getLoginUrl(array('req_perms' => 'photo_upload,user_status,publish_stream,user_photos,offline_access,manage_pages'))}"); exit; } else { $accounts_list = $facebook->api('/me/accounts'); echo "i am connected"; } $valid_files = array('image/jpeg', 'image/png', 'image/gif'); // To get the page access token to post as a page foreach($accounts_list['data'] as $account){ if($account['id'] == 194458563914948){ // my page id =123456789 $access_token = $account['access_token']; echo "<p>Page Access Token: $access_token</p>"; } } // Posting to the page wall if(isset($_FILES) && !empty($_FILES)){ $folder = "pak/".$_FILES['pic']['name']; // Getting the path of the folder $fold = 'http://radiations3.com/facebook/'.$folder; // URL Path to folder echo $fold."<br>"; if(move_uploaded_file($_FILES['pic']['tmp_name'], $folder)){ # Upload photo here $img = realpath($_FILES["pic"]["tmp_name"]); $album_id = '406221796071956'; $attachment = array( 'message' => $_POST['textfield'], 'source' => $fold, 'aid' => $album_id, 'no_story' => 1, 'access_token' => $access_token ); $status = $facebook->api("/196878530339618/photos", 'post', $attachment); } else{ echo 'Only jpg, png and gif image types are supported!'; } } ?> <body> <!-- Form for uploading the photo --> <div class="main"> <p>Select a photo to upload on Facebook Fan Page</p> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data"> <p>Select the image: <input type="file" name="pic" /> <br /> <label>Description <input type="text" name="textfield" id="textfield" /> </label> </p> <p><input class="post_but" type="submit" value="Upload to my album" /></p> </form> </div> </body>
  3. one last question kindly tell me the php code to delete any image from our server, So , it'll do the trick like -> firstly upload te image to my Server then FB then thtat pic got deleted from my server...
  4. Thanx for providing me a piece of code ... I have made successfully this functionality by uploading images first on my server and give its respective url to upload that pic on my FB FAN PAGE I wanted to do something like without uploading it on my server and directly upload it to my facebook page if you can give me a piece of code for that i'll really appreciate that.. Even i did that too successfully but when i put that piece of code in this one that didn't work and started to give errors like unvalid file format etc as mentioned in the description.... OLD CODE THT SUCCESSFULY UPLOADS IMAGES TO MY CERTAIN ALBUM OF PAGE if(isset($_FILES) && !empty($_FILES)){ if( !in_array($_FILES['pic']['type'], $valid_files ) ){ echo 'Only jpg, png and gif image types are supported!'; }else{ #Upload photo here $img = realpath($_FILES["pic"]["tmp_name"]); $args = array( 'message' => 'This photo was uploaded via Radiations3', 'image' => '@' . $img, 'aid' => $album_id, 'no_story' => 1, 'access_token' => $fanpage_token ); $photo = $facebook->api('/194458563914948/feed', 'post', $args); if( is_array( $photo ) && !empty( $photo['id'] ) ){ echo '<p><a target="_blank" href="http://www.facebook.com/photo.php?fbid='.$photo['id'].'">Click here to watch this photo on Facebook.</a></p>'; }
  5. I have this code and its working awsomely fine if i provide a direct link of an uploaded image. Just and just only one problem i am not able to pass my uploaded image to facebook->api (whether its valid or not) and the following always echo echo 'Only jpg, png and gif image types are supported!'; i even remove the check on image type and try to get the image from $img = realpath($_FILES["pic"]["tmp_name"]); but $img gets nothing in it and uploads a by default empty image on facebook as my page Kindly check my following code and let me know what is wrong with my code and what should i do instead to upload images Online link of the following CODE: http://radiations3.com/facebook/1.php <? require 'src/facebook.php'; $app_id = "364900470214655"; $app_secret = "xxxxxxxx"; $facebook = new Facebook(array( 'appId' => $app_id, 'secret' => $app_secret, 'cookie' => true, 'fileUpload' => true, )); $user = $facebook->getUser(); //echo $user; if(($facebook->getUser())==0) { header("Location:{$facebook->getLoginUrl(array('req_perms' => 'user_status,publish_stream,user_photos,offline_access,manage_pages'))}"); exit; } else { $accounts_list = $facebook->api('/me/accounts'); echo "i am connected"; } $valid_files = array('image/jpeg', 'image/png', 'image/gif'); //to get the page access token to post as a page foreach($accounts_list['data'] as $account){ if($account['id'] == 194458563914948){ // my page id =123456789 $access_token = $account['access_token']; echo "<p>Page Access Token: $access_token</p>"; } } //posting to the page wall if (isset($_FILES) && !empty($_FILES)) { if( !in_array($_FILES['pic']['type'], $valid_files ) ) { echo 'Only jpg, png and gif image types are supported!'; } else{ #Upload photo here $img = realpath($_FILES["pic"]["tmp_name"]); $attachment = array('message' => 'this is my message', 'access_token' => $access_token, 'name' => 'This is my demo Facebook application!', 'caption' => "Caption of the Post", 'link' => 'example.org', 'description' => 'this is a description', 'picture' => '@' . $img, 'actions' => array(array('name' => 'Get Search', 'link' => 'http://www.google.com')) ); $status = $facebook->api('/194458563914948/feed', 'POST', $attachment); // my page id =123456789 var_dump($status); } } ?> <body> <!-- Form for uploading the photo --> <div class="main"> <p>Select a photo to upload on Facebook Fan Page</p> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data"> <p>Select the image: <input type="file" name="pic" /></p> <p><input class="post_but" type="submit" value="Upload to my album" /></p> </form> </div> </body>
  6. My New issue of facebook: Now i am facing the issue of token can anyone please let me know how to get a permanent token or allow the access to every one cause every time i have to generate my token put it into my script then any one can post on the behalf of my token on FACEBOOK
  7. Hello, I have successfully made a script that will upload images to the album of my facebook page easily. Following is the link to that script http://radiations3.com/facebook/facebook_upload.php Now when i used the same script to upload status directly to my wall then the script is doing nothing kindly let me know what is the problem with my code //posting to the page wall $attachment = array('message' => 'this is my message', 'access_token' => $access_token, 'name' => 'This is my demo Facebook application!', 'caption' => "Caption of the Post", 'description' => 'this is a description', 'picture' => 'http://radiations3.com/images/logo.png', ); $status = $facebook->api('/194458563914948/feed', 'POST', $attachment); // my page id =123456789 var_dump($status);
  8. <select name="Gender" id="Gender"> <option selected="selected"><?php echo $row_Recordset1['Gender']; ?></option> <option value="Male">Male</option> <option value="Female">Female</option> </select>
  9. Thanks for helping me ouit what i am trying to do is My dropdown list isalready being defined and i want to set that option as selected which is equal to the value being returned from the database this could be done via javascripting too but i am getting problems with both approach as i am not a pro. i tried to echo as selected on the returned value but it make that value appears twice in the list so kindly help.....
  10. kindly check the following code i am trying to make such an script that'll allow you to upload images on facebook from your site i am running this script locally but getting different errors like Facebook.php is being downloaded from facebook api's (Kindly provide any other working example that would be fine with me too i just need the functionality) Warning: Missing argument 2 for Facebook::__construct(), called in C:\Users\Administrator\Desktop\face\abc.php on line 16 and defined in C:\Users\Administrator\Desktop\face\library\facebook.php on line 64 Notice: Undefined variable: secret in C:\Users\Administrator\Desktop\face\library\facebook.php on line 66 Notice: Undefined variable: secret in C:\Users\Administrator\Desktop\face\library\facebook.php on line 68 Fatal error: Call to undefined method Facebook::api() in C:\Users\Administrator\Desktop\face\abc.php on line 31 <html> <head> <title> Upload images to Facebook</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php $app_id = 332267477347; $app_secret = "989b7e58b48f17b3463ee54ea9c4f88d"; require_once 'library/facebook.php'; $facebook = new Facebook(array( 'appId' => $app_id, 'secret' => $app_secret, 'fileUpload' => true )); //It can be found at https://developers.facebook.com/tools/access_token/ $access_token = 'I pout here the key of my profile'; $params = array('access_token' => $access_token); //The id of the fanpage $fanpage = '194458563914948'; //The id of the album $album_id ='406221796071956'; //Replace arvind07 with your Facebook ID $accounts = $facebook->api('/faizan.gemeni/accounts', 'GET', $params); foreach($accounts['data'] as $account) { if( $account['id'] == $fanpage || $account['name'] == $fanpage ){ $fanpage_token = $account['access_token']; } } $valid_files = array('image/jpeg', 'image/png', 'image/gif'); if(isset($_FILES) && !empty($_FILES)){ if( !in_array($_FILES['pic']['type'], $valid_files ) ){ echo 'Only jpg, png and gif image types are supported!'; }else{ #Upload photo here $img = realpath($_FILES["pic"]["tmp_name"]); $args = array( 'message' => 'This photo was uploaded via WebSpeaks.in', 'image' => '@' . $img, 'aid' => $album_id, 'no_story' => 1, 'access_token' => $fanpage_token ); $photo = $facebook->api($album_id . '/photos', 'post', $args); if( is_array( $photo ) && !empty( $photo['id'] ) ){ echo '<p><a target="_blank" href="http://www.facebook.com/photo.php?fbid='.$photo['id'].'">Click here to watch this photo on Facebook.</a></p>'; } } } ?> <!-- Form for uploading the photo --> <div > <p>Select a photo to upload on Facebook Fan Page</p> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data"> <p>Select the image: <input type="file" name="pic" /></p> <p><input class="post_but" type="submit" value="Upload to my album" /></p> </form> </div> </body> </html>
  11. Hello, All i am trying to do is to set the selected value of drop down menu according to the particular value returned from the database like if person saved his gender as 'Male' and he wants to update his profile then the selected option shown on the Gender's dropdown llist should be shown as Male cause if this doesn't happen 'Poor guy becomes a female due to this small problem in my code' KINDLY HELP!!!!!!! <select name="select" id="select"> <option value="Male">Male</option> <option value="Female">Female</option> </select>
  12. yes you are riught and thanx for helping me out i got the idea now.....
  13. Hello, I am using the following code to get values from the database $age = $this->security->xss_clean($this->input->post('select')); // assigning Selected Age difference value to a variable $age $place = $this->security->xss_clean($this->input->post('select2')); // assigning Selected Age difference value to a variable $age $this->db->where('Place', $place); $query = $this->db->get('person'); // Select * from person where Place = $place return $query->result(); // returning result of queries but when i put restriction on it on the behalf of dates to calculate the results as per age limits then its not doing the filteration and displays all the records and if not value exist then return an error foreach($results as $row) { $date_db = $row->Dob; // Getting the date of the person returned from the database $date_current = date('d-m-Y'); // Getting the current date from the system $diff = abs(strtotime($date_current) - strtotime($date_db)); // Calculating the differences between two dates $years = floor($diff / (365*60*60*24)); // Storing the resultant age in the variable if ( $years>=$comp1 && $years<$comp2) // Comparing the results if less than or greater than to certain AGE limits return $query->result(); // returning result of queries else return false } [/code] Kindly let me know what is wrong with my code or how to return values as per filteration i seek for I'll be very thankful to YOU!!!
  14. @batwimp Thanx alot now i have understood the problem i was not taking care of placement of code which was rising many issues and also the things you mentioned before thanks alot for sparing your time for me to help me out and it means alot to me thank you very much!!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.