Jump to content

$php_mysql$

Members
  • Posts

    391
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

$php_mysql$'s Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. well ill make it 1mb anything larger than that gets resized that is wht i want. guess ill have to remove the file size limit?
  2. how could we put this into a form? $username = "@yahoo.com"; $password = "pass"; // do login to facebook $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "https://login.facebook.com/login.php?m&next=http://m.facebook.com/home.php"); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_POSTFIELDS, "email=" . $username . "&pass=" . $password . "&login=Log In"); curl_setopt($curl, CURLOPT_ENCODING, ""); curl_setopt($curl, CURLOPT_COOKIEJAR, getcwd() . '/cookies_facebook.cookie'); $curlData = curl_exec($curl); curl_close($curl); // do get post url $urlPost = substr($curlData, strpos($curlData, "action=\"/a/home") + ; $urlPost = substr($urlPost, 0, strpos($urlPost, "\"")); $urlPost = "http://m.facebook.com" . $urlPost; // do get some parameters for updating the status $fbDtsg = substr($curlData, strpos($curlData, "name=\"fb_dtsg\"")); $fbDtsg = substr($fbDtsg, strpos($fbDtsg, "value=") + 7); $fbDtsg = substr($fbDtsg, 0, strpos($fbDtsg, "\"")); $postFormId = substr($curlData, strpos($curlData, "name=\"post_form_id\"")); $postFormId = substr($postFormId, strpos($postFormId, "value=") + 7); $postFormId = substr($postFormId, 0, strpos($postFormId, "\"")); // do update facebook status $statusMessage = "Status updated :-)"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $urlPost); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, "fb_dtsg=" . $fbDtsg . "&post_form_id=" . $postFormId . "&status=" . $statusMessage . "&update=Update Status"); curl_setopt($curl, CURLOPT_ENCODING, ""); curl_setopt($curl, CURLOPT_COOKIEFILE, getcwd() . '/cookies_facebook.cookie'); curl_setopt($curl, CURLOPT_COOKIEJAR, getcwd() . '/cookies_facebook.cookie'); $curlData = curl_exec($curl); curl_close($curl); echo "Your Facebook status already updated with '" . $statusMessage . "'";
  3. ok i got this one people says it works but when i run it, in my browaer i get like this [+] Sending GET request to: http://m.facebook.com/ [+] Sending POST data to: [-] charset_test= [-] lsd= [-] email=useremail%40yahoo.com [-] pass=userpass [-] login=Log+in [+] Sending POST data to: http://m.facebook.com [-] charset_test= [-] fb_dtsg= [-] post_form_id= [-] status=It+works+%3A%29 [-] update=Share <?php /* PHP Curl status update script by http://360percents.com Please use for educational and legal purposes */ function update($email, $pass, $status){ /*======================================================================== 1. GET: http://m.facebook.com/ Parse the webpage and collect login parameters (chartest, lsd, formaction). ========================================================================*/ $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0"); curl_setopt($ch, CURLOPT_URL,"http://m.facebook.com/"); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $fbhome = curl_exec ($ch); //execute the curl command echo "\n[+] Sending GET request to: http://m.facebook.com/\n\n"; preg_match("/<form action=\"(.*)\" method=\"post\">/U", $fbhome, $formaction); urlencode(preg_match("/<input type=\"hidden\" name=\"charset_test\" value=\"(.*)\" \/>/U", $fbhome, $chartest)); preg_match("/<input type=\"hidden\" name=\"lsd\" value=\"(.*)\" autocomplete=\"off\" \/>/U", $fbhome, $lsd); curl_close ($ch); //cleanup unset($fbhome); unset($ch); /*======================================================================== 2. LOGIN: POST to facebook login form (formaction) with previously collected parameters lsd, chartest, email, pass and login. Collect parameters from the form which updates status (formaction, chartest, dtsg, formid). ========================================================================*/ $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0"); curl_setopt($ch, CURLOPT_URL, $formaction[1]); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "charset_test=".$chartest[1]."&lsd=".$lsd[1]."&email=$email&pass=$pass&login=Log+in"); $loggedin = curl_exec ($ch); //execute the curl command echo "[+] Sending POST data to: ".html_entity_decode(urldecode($formaction[1]))."\n[-] charset_test=".$chartest[1]."\n[-] lsd=".$lsd[1]."\n[-] email=$email\n[-] pass=$pass\n[-] login=Log+in\n\n"; preg_match("/<form action=\"(.*)\" method=\"post\">/U", $loggedin, $formaction); urlencode(preg_match("/<input type=\"hidden\" name=\"charset_test\" value=\"(.*)\" \/>/U", $loggedin, $chartest)); preg_match("/<input type=\"hidden\" name=\"fb_dtsg\" value=\"(.*)\" autocomplete=\"off\" \/>/U", $loggedin, $dtsg); preg_match("/<input type=\"hidden\" name=\"post_form_id\" value=\"(.*)\" \/>/U", $loggedin, $formid); //cleanup curl_close ($ch); unset($loggedin); unset($ch); /*======================================================================== 3. UPDATE STATUS: Use previously collected form data to send a post query which will update our status. ========================================================================*/ $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0"); curl_setopt($ch, CURLOPT_URL, 'http://m.facebook.com'.$formaction[1]); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "charset_test=".$chartest[1]."&fb_dtsg=".$dtsg[1]."&post_form_id=".$formid[1]."&status=$status&update=Share"); $buf2 = curl_exec ($ch); //execute the curl command echo "[+] Sending POST data to: http://m.facebook.com".html_entity_decode($formaction[1])."\n[-] charset_test=".$chartest[1]."\n[-] fb_dtsg=".$dtsg[1]."\n[-] post_form_id=".$formid[1]."\n[-] status=$status\n[-] update=Share\n\n"; //cleanup curl_close ($ch); unset($ch); if(strlen($buf2)>0){echo "[+] Status update response:$buf2\n\n";}//errors will probably appear here if it fails unset($buf2); /*======================================================================== End funtion update and return. ========================================================================*/ return 0; } //Call the update function with your email, password and status parameters. $status = 'It works '; update(urlencode('your@email.com'),'yourpassword',urlencode($status)); ?> what could be wrong?
  4. how could i implant it to my script above? could help me with it please? im new to all these. thanks
  5. hi i found this on google. how could i use it, could someone give example of usage? here is the class // // change Facebook status with curl // Thanks to Alste (curl stuff inspired by nexdot.net/blog) function setFacebookStatus($status, $login_email, $login_pass, $debug=false) { //CURL stuff //This executes the login procedure $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://login.facebook.com/login.php?m&next=http%3A%2F%2Fm.facebook.com%2Fhome.php'); curl_setopt($ch, CURLOPT_POSTFIELDS, 'email=' . urlencode($login_email) . '&pass=' . urlencode($login_pass) . '&login=' . urlencode("Log in")); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HEADER, 0); //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIEJAR, "my_cookies.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "my_cookies.txt"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //make sure you put a popular web browser here (signature for your web browser can be retrieved with 'echo $_SERVER['HTTP_USER_AGENT'];' curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.12) Gecko/2009070611 Firefox/3.0.12"); curl_exec($ch); //This executes the status update curl_setopt($ch, CURLOPT_POST, 0); curl_setopt($ch, CURLOPT_URL, 'http://m.facebook.com/home.php'); $page = curl_exec($ch); //echo htmlspecialchars($page); curl_setopt($ch, CURLOPT_POST, 1); //this gets the post_form_id value preg_match("/input type=\"hidden\" name=\"post_form_id\" value=\"(.*?)\"/", $page, $form_id); preg_match("/input type=\"hidden\" name=\"fb_dtsg\" value=\"(.*?)\"/", $page, $fb_dtsg); preg_match("/input type=\"hidden\" name=\"charset_test\" value=\"(.*?)\"/", $page, $charset_test); preg_match("/input type=\"submit\" class=\"button\" name=\"update\" value=\"(.*?)\"/", $page, $update); //we'll also need the exact name of the form processor page //preg_match("/form action=\"(.*?)\"/", $page, $form_num); //sometimes doesn't work so we search the correct form action to use //since there could be more than one form in the page. preg_match_all("#<form([^>]*)>(.*)</form>#Ui", $page, $form_ar); for($i=0;$i<count($form_ar[0]);$i++) if(stristr($form_ar[0][$i],"post_form_id")) preg_match("/form action=\"(.*?)\"/", $page, $form_num); $strpost = 'post_form_id=' . $form_id[1] . '&status=' . urlencode($status) . '&update=' . urlencode($update[1]) . '&charset_test=' . urlencode($charset_test[1]) . '&fb_dtsg=' . urlencode($fb_dtsg[1]); if($debug) { echo "Parameters sent: ".$strpost."<hr>"; } curl_setopt($ch, CURLOPT_POSTFIELDS, $strpost ); //set url to form processor page curl_setopt($ch, CURLOPT_URL, 'http://m.facebook.com' . $form_num[1]); curl_exec($ch); if ($debug) { //show information regarding the request print_r(curl_getinfo($ch)); echo curl_errno($ch) . '-' . curl_error($ch); echo "<br><br>Your Facebook status seems to have been updated."; } //close the connection curl_close($ch); } and define (‘FACEBOOK_EMAIL_LOGIN’, ‘xxxxx’); define (‘FACEBOOK_PASSWORD’, ‘yyyyy’); define (‘FACEBOOK_DEBUG’, false); require_once ‘includes / minibots.class.php’; $ M = new Minibots (); if (isset ($ _GET ['status'])) ( $ M-> setFacebookStatus ($ _GET ['status'], FACEBOOK_EMAIL_LOGIN, FACEBOOK_PASSWORD, FACEBOOK_DEBUG); ) if (isset ($ _GET ['post'])) ( $ M-> postToFacebookPage ($ _GET ['post'], ‘wall.php’ FACEBOOK_EMAIL_LOGIN, FACEBOOK_PASSWORD, FACEBOOK_DEBUG); ) how could one use this?
  6. could someone help in how to resize a uploaded image size, say if someone is uploading a 1mb photo to my server, i wish for it to become 100kb and also resize its width and height? here is my code //////////////////////////////////////uploader else if($action=="uploader") { echo "Upload your picture and copy the link <br/>after uploading to user it at gallery.<br/><br/>"; echo "<form method=\"post\" enctype=\"multipart/form-data\" action=\"index.php?action=uploaded&sid=$sid\">"; echo "Choose Picture: <br />"; echo "<input name=\"uploaded\" type=\"file\" /><br /><br />"; echo "<input type=\"submit\" value=\"Upload\" />"; echo "</form><br/>"; echo "<p align=\"center\">"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; } //////////////////////////////////////uploader else if($action=="uploaded") { $blacklist = array(".php", ".php.jpg", ".php.jpeg", ".php.gif", ".php.png", ".phtml", ".php3", ".php4"); foreach ($blacklist as $item) { if(preg_match("/$item\$/i", $_FILES['uploaded']['name'])) { echo "<p align=\"center\">"; echo "Oops sorry we do not allow those files.<br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; exit; } } $target = "../images/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; if (file_exists("../images/" . $_FILES["uploaded"]["name"])) { echo "<p align=\"center\">"; echo $_FILES["file"]["name"] . "Oops file name already exists<br/> kindly rename your picture and upload again. <br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; }else{ //This is our size condition if ($uploaded_size > 25600){ echo "Your file is too large. We have a 25kb limit.<br/>"; $ok=0; } $types = array('image/jpeg', 'image/gif', 'image/png'); if (in_array($_FILES['uploaded']['type'], $types)) { // file is okay continue } else { $ok=0; } //Here we check that $ok was not set to 0 by an error if ($ok==0){ echo "<p align=\"center\">"; Echo "Sorry your file was not uploaded.<br/> It may be the wrong filetype. <br/>We only allow JPG, GIF, and PNG filetypes.<br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; } //If everything is ok we try to upload it else{ if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)){ echo "<p align=\"center\">"; echo "The file ". basename( $_FILES['uploadedfile']['name']). " Picture uploaded successfully.<br/><br/><b>$target <br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; } else{ echo "<p align=\"center\">"; echo "Sorry, there was a problem uploading your file.<br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; } } } }
×
×
  • 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.