Jump to content

phpsycho

Members
  • Posts

    164
  • Joined

  • Last visited

    Never

Everything posted by phpsycho

  1. Okay.. how bout this lol anybody know of a different place on the web that someone would know the problems going on with this? Thanks
  2. bump
  3. I have some code that it supposed to pull the image code in a attachment and the decode it so it can be viewed. <?php include ('includes/conn.php'); $id = $_GET['id']; $num = $_GET['num']; $mime = strtolower($_GET['mime']); $transfer = $_GET['transfer']; header("Content-type: image/$mime"); $servr = "imap.**.com:143/novalidate-cert/tls"; $user = "adam@**"; $passwd = "**"; $pop = imap_open('{'.$servr.'}', $user, stripslashes($passwd)); $img = imap_fetchbody($pop, $id, $num); imap_close($pop); if ($transfer == 'BASE64'){ $img = base64_decode($img); }else if ($transfer == 'QUOTED-PRINTABLE'){ $img = imap_qprint($img); } echo $img; ?> All I see is a blank page when I run this. I commented out the header() so I can see the code just to check if its showing something or not. It does. That code should display the image shouldn't it? I checked the email message on thunderbird and the image is viewable there. it says its base64 too. Is there something I am missing in this code? I posted once before about this problem, hope its not a problem to repost this; hadn't got any help on it yet. I'm just in a time crunch so trying to get it finished quick. Thanks guys.
  4. bump
  5. hmm okay, think that may work.. but now I am just getting blank page. Would it be alright if I PM you the code? I rather not stick it out for the public to see. Thanks
  6. ah okay. Well those errors are fixed. but.. PHP Fatal error: Cannot break/continue 1 level in /var/www/alpha/my/bots/crawl10.php on line 120 Fatal error: Cannot break/continue 1 level in /var/www/alpha/my/bots/crawl10.php on line 120 It must be something with my if statement, but I think I am doing it right.. <?php $parse = parse_url($url); if(isset($parse['path'])){ $haystack = pathinfo($parse['path'], PATHINFO_EXTENSION); if(!preg_match("/(php|html|htm|asp|aspx|shtml|php4|php5|cfm|pl|jsp)/is", $haystack)){ continue; } }?> second if statement..
  7. Why not just have the form action say.. http://site.com/signup.php?gotoafter=currentlink then when you are done signing up, have it redirect you to $_GET['goafter'] EDIT: oops.. the link to signup should be contain the current url and then when you click on it it will send that data to the signup page, from there you can redirect back.
  8. I am trying to build a small script that will scrape links for other links and images. Already got things like asking robots.txt and I'm using curl, not file get contents. Although.. I am using file() to get info from the robots.txt.. that way I can get info from each line. Problem is though.. no links are being added.. and when I save an image to my server I want to read its info like is it color, width, height, extension, etc But I keep getting these errors: IMG ADDED: http://***.com/images/status-busy.png PHP Warning: exif_read_data(5525611904.png): File not supported in /var/www/alpha/my/bots/crawl10.php on line 172 IMG ADDED: http://***.com/images/status-busy.png PHP Warning: exif_read_data(2322371467.png): File not supported in /var/www/alpha/my/bots/crawl10.php on line 172 IMG ADDED: http://***.com/images/status-busy.png PHP Fatal error: Cannot break/continue 1 level in /var/www/alpha/my/bots/crawl10.php on line 120 Just noticed its trying to add the images more than once.. which is odd. but the last one is what I was really wondering about.. Lines 120ish: <?php $parse = parse_url($url); if(isset($parse['path'])){ $haystack = pathinfo($parse['path'], PATHINFO_EXTENSION); if(!preg_match("/(php|html|htm|asp|aspx|shtml|php4|php5|cfm|pl|jsp)/is", $haystack)){ continue; } } ?> And for this query here.. <?php mysql_query("INSERT INTO `search_images` (`url`,`file`,`name`,`from`,`width`,`height`,`color`,`size`,`type`,`datetime`) values ('$img[2]','$file','$name','$link[2]','$width','$height','$color','$size','$extention','$datetime')"); ?> I have in a foreach loop. foreach($imgs as $img) can I just add another foreach inside that one that says foreach($links as $link)? so I can get $link[2] which is where the image came from.
  9. $(function() { $("#mail") .mouseover(function() { var src = $(this).attr("src").match(/[^\.]+/) + "_over.png"; $(this).attr("src", src); $(this).css("bottom", 10); $(".msg").text("Signup for Alpha Web Pro, you get your own email account with us. [username]@alphawebpro.com").fadeIn("fast"); }) .mouseout(function() { var src = $(this).attr("src").replace("_over", ""); $(this).attr("src", src); $(this).css("bottom", "5"); $(".msg").text("").fadeOut("fast"); }); $("#user") .mouseover(function() { var src = $(this).attr("src").match(/[^\.]+/) + "_over.png"; $(this).attr("src", src); $(this).css("bottom", 10); $(".msg").text("Check out the Alpha Web Pro community. There you can interact with your programming friends and post things to the forum").fadeIn("fast"); }) .mouseout(function() { var src = $(this).attr("src").replace("_over", ""); $(this).attr("src", src); $(this).css("bottom", "5"); $(".msg").text("").fadeOut("fast"); }); $("#analytics") .mouseover(function() { var src = $(this).attr("src").match(/[^\.]+/) + "_over.png"; $(this).attr("src", src); $(this).css("bottom", 10); $(".msg").text("COMING SOON! - Website analytics for any and all of your websites you wish to monitor").fadeIn("fast"); }) .mouseout(function() { var src = $(this).attr("src").replace("_over", ""); $(this).attr("src", src); $(this).css("bottom", "5"); $(".msg").text("").fadeOut("fast"); }); $("#shop") .mouseover(function() { var src = $(this).attr("src").match(/[^\.]+/) + "_over.png"; $(this).attr("src", src); $(this).css("bottom", 10); $(".msg").text("Go shopping at Alpha Web Pro.com; we have what you are looking for. Website templates, scripts, and ebooks for noobs all the way to master coder").fadeIn("fast"); }) .mouseout(function() { var src = $(this).attr("src").replace("_over", ""); $(this).attr("src", src); $(this).css("bottom", "5"); $(".msg").text("").fadeOut("fast"); }); }); when I put my mouse over an image it changes and moves up 5px then displays a msg div box with content in it. that box flashes. It shows then hides shows and hides and shows until you move the mouse away. Is that related to to having the image move up 5px? if so.. how could I fix that? Thanks
  10. I just removed those two options that are causing issues. doesn't look like I need them but I may be wrong. So far its working without them, but I think I may need those two for getting an attachment image, or downloading any kind of attachment. Not totally sure though.. <?php include ('includes/conn.php'); $id = $_GET['id']; $num = $_GET['num']; $mime = strtolower($_GET['mime']); $transfer = $_GET['transfer']; header("Content-type: image/$mime"); $servr = "imap.**.com:143/novalidate-cert/tls"; $user = "adam@**"; $passwd = "**"; $pop = imap_open('{'.$servr.'}', $user, stripslashes($passwd)); $img = imap_fetchbody($pop, $id, $num); imap_close($pop); if ($transfer == 'BASE64'){ $img = base64_decode($img); }else if ($transfer == 'QUOTED-PRINTABLE'){ $img = imap_qprint($img); } echo $img; ?> All that code does now is spit out a blank page. I commented out the header() and it displayed the source of the image decoded using base64_decode. but when I try displaying it, it comes up with nothing. Any ideas?
  11. Okay great! Thanks very much!
  12. ah alright, so just the id of the session, no other data. Feeling better about this lol. Instead of using that code I posted, does setting this option: session.cookie_domain = .mydomain.com in the php.ini file gunna do the same? Because it seems much more simpler to just do it that way.
  13. Okay so using this: session_set_cookie_params(0, '/', '.example.com'); session_start(); Would do the trick? and thats secure, correct? I'm confused with the "set_cookie".. is that setting a cookie to your browser with session data in it? If so.. that can't be very secure I would imagine.. Secure: If TRUE cookie will only be sent over secure connections. can you define "secure connection"? Thanks again
  14. I was wondering how to allow php sessions to be held and used across all sub domains securely? Thanks!
  15. function aff_mail($servr, $user, $passwd, $folder, $mail, $verbose) { $mailhost = $servr; GLOBAL $attach_tab; GLOBAL $PHP_SELF; $glob_body = ''; $subject = $from = $to = $cc = ''; $pop = @imap_open('{' . $mailhost . '}' . $folder, $user, $passwd); $num_messages = @imap_num_msg($pop); $ref_contenu_message = @imap_header($pop, $mail); $struct_msg = @imap_fetchstructure($pop, $mail); if (sizeof($struct_msg->parts) > 0) GetPart($struct_msg, NULL, false); else GetSinglePart($struct_msg, htmlspecialchars(imap_fetchheader($pop, $mail)), @imap_body($pop, $mail)); ///other code here } function GetPart($this_part, $part_no, $display_rfc822) { GLOBAL $attach_tab; $att_name = '[unknown]'; if ($this_part->ifdescription == TRUE) $att_name = $this_part->description; for ($lcv = 0; $lcv < count($this_part->parameters); $lcv++) { $param = $this_part->parameters[$lcv]; if (($param->attribute == 'NAME') || ($param->attribute == 'name')) { $att_name = $param->value; break; } }$obj= (object) $array; switch ($this_part->type) { case TYPETEXT: $mime_type = 'text'; break; case TYPEMULTIPART: $mime_type = 'multipart'; for ($i = 0; $i < count($this_part->parts); $i++) { if ($part_no != '') $part_no = $part_no . '.'; for ($i = 0; $i < count($this_part->parts); $i++) { // if it's an alternative, we skip the text part to only keep the HTML part if (strtolower($this_part->subtype) == "alternative")// && $read == true) GetPart($this_part->parts[++$i], $part_no . ($i + 1), $display_rfc822); else GetPart($this_part->parts[$i], $part_no . ($i + 1), $display_rfc822); } } break; case TYPEMESSAGE: $mime_type = 'message'; // well it's a message we have to parse it to find attachments or text message $num_parts = count($this_part->parts[0]->parts); if ($num_parts > 0) for ($i = 0; $i < $num_parts; $i++) GetPart($this_part->parts[0]->parts[$i], $part_no . '.' . ($i + 1), $display_rfc822); else GetPart($this_part->parts[0], $part_no . '.1', $display_rfc822); break; // Maybe we can do something with the mime types later ?? case TYPEAPPLICATION: $mime_type = 'application'; break; case TYPEAUDIO: $mime_type = 'audio'; break; case TYPEIMAGE: $mime_type = 'image'; break; case TYPEVIDEO: $mime_type = 'video'; break; case TYPEMODEL: $mime_type = 'model'; break; default: $mime_type = 'unknown'; } $full_mime_type = $mime_type . '/' . $this_part->subtype; switch ($this_part->encoding) { case ENC7BIT: $encoding = '7BIT'; break; case ENC8BIT: $encoding = '8BIT'; break; case ENCBINARY: $encoding = 'BINARY'; break; case ENCBASE64: $encoding = 'BASE64'; break; case ENCQUOTEDPRINTABLE: $encoding = 'QUOTED-PRINTABLE'; break; default: $encoding = 'none'; break; } if (($full_mime_type == 'message/RFC822' && $display_rfc822 == true) || ($mime_type != 'multipart' && $full_mime_type != 'message/RFC822')) { if ($this_part->ifparameters == TRUE) while ($obj = array_pop($this_part->parameters)) if ($obj->attribute == 'CHARSET') $charset = $obj->value; $tmp = Array( 'number' => ($part_no != '' ? $part_no : 1), 'id' => $this_part->id, 'name' => $att_name, 'mime' => $full_mime_type, 'transfer' => $encoding, 'charset' => $this_part->charset, 'size' => ($this_part->bytes > 1000) ? ceil($this_part->bytes / 1000) : 1); array_unshift($attach_tab, $tmp); } } $pop = @imap_open('{' . $mailhost . '}' . $folder, $user, $passwd); $struct_msg = @imap_fetchstructure($pop, $mail); GetPart($struct_msg, NULL, false); function GetPart($this_part, $part_no, $display_rfc822)
  16. still getting this.. Notice: Undefined property: stdClass::$id in /var/www/awp/pages/user/email/functions.php on line 288 Notice: Undefined property: stdClass::$charset in /var/www/awp/pages/user/email/functions.php on line 292 heres a snippet of what the errors are referring to if (($full_mime_type == 'message/RFC822' && $display_rfc822 == true) || ($mime_type != 'multipart' && $full_mime_type != 'message/RFC822')) { if ($this_part->ifparameters == TRUE) while ($obj = array_pop($this_part->parameters)) if ($obj->attribute == 'CHARSET') $charset = $obj->value; $tmp = Array( 'number' => ($part_no != '' ? $part_no : 1), 'id' => $this_part->id, 'name' => $att_name, 'mime' => $full_mime_type, 'transfer' => $encoding, 'charset' => $this_part->charset, 'size' => ($this_part->bytes > 1000) ? ceil($this_part->bytes / 1000) : 1); array_unshift($attach_tab, $tmp); } I'm a newb when it comes to imap functions lol, didn't know they even existed until couple weeks ago.
  17. I found these functions online and I edited them A LOT lol very buggy.. but now I'm stuck on one of these bugs. Here is the code: function aff_mail($servr, $user, $passwd, $folder, $mail, $verbose) { $mailhost = $servr; GLOBAL $attach_tab; GLOBAL $PHP_SELF; $glob_body = ''; $subject = $from = $to = $cc = ''; $pop = @imap_open('{' . $mailhost . '}' . $folder, $user, $passwd); $num_messages = @imap_num_msg($pop); $ref_contenu_message = @imap_header($pop, $mail); $struct_msg = @imap_fetchstructure($pop, $mail); if (sizeof($struct_msg->parts) > 0) GetPart($struct_msg, NULL, false); else GetSinglePart($struct_msg, htmlspecialchars(imap_fetchheader($pop, $mail)), @imap_body($pop, $mail)); if ($verbose == 1 && $use_verbose == 1) $header = htmlspecialchars(imap_fetchheader($pop, $mail)); else $header = ''; $tmp = array_pop($attach_tab); if (eregi('text/html', $tmp['mime']) || eregi('text/plain', $tmp['mime'])) { if ($tmp['transfer'] == 'QUOTED-PRINTABLE') $glob_body = imap_qprint(imap_fetchbody($pop, $mail, $tmp['number'])); elseif ($tmp['transfer'] == 'BASE64') $glob_body = base64_decode(imap_fetchbody($pop, $mail, $tmp['number'])); else $glob_body = imap_fetchbody($pop, $mail, $tmp['number']); $glob_body = remove_stuff($glob_body, $tmp['mime']); } else array_push($attach_tab, $tmp); @imap_close($pop); if (strtolower($struct_msg->subtype) != "alternative" && strtolower($struct_msg->subtype) != "related") { switch (sizeof($attach_tab)) { case 0: $link_att = ''; break; case 1: $link_att = link_att($mailhost, $mail, $attach_tab, $display_part_no); break; default: $link_att = link_att($mailhost, $mail, $attach_tab, $display_part_no); break; } } $subject_array = imap_mime_header_decode($ref_contenu_message->subject); for ($j = 0; $j < count($subject_array); $j++) $subject .= $subject_array[$j]->text; $from_array = imap_mime_header_decode($ref_contenu_message->fromaddress); for ($j = 0; $j < count($from_array); $j++) $from .= $from_array[$j]->text; $to_array = imap_mime_header_decode($ref_contenu_message->toaddress); for ($j = 0; $j < count($to_array); $j++) $to .= $to_array[$j]->text; if(!empty($ref_contenu_message->ccaddress)){ $cc_array = imap_mime_header_decode($ref_contenu_message->ccaddress); for ($j = 0; $j < count($cc_array); $j++){ $cc .= $cc_array[$j]->text; } }else{ $cc = ""; } $content = Array( 'from' => htmlspecialchars($from), 'to' => htmlspecialchars($to), 'cc' => htmlspecialchars($cc), 'subject' => htmlspecialchars($subject), 'date' => $ref_contenu_message->udate, 'att' => $link_att, 'body' => $glob_body, 'body_mime' => $tmp['mime'], 'body_transfer' => $tmp['transfer'], 'header' => $header, 'verbose' => $verbose); return ($content); } /* ----------------------------------------------------- */ // based on a function from [email protected] function GetPart($this_part, $part_no, $display_rfc822) { GLOBAL $attach_tab; $att_name = '[unknown]'; if ($this_part->ifdescription == TRUE) $att_name = $this_part->description; for ($lcv = 0; $lcv < count($this_part->parameters); $lcv++) { $param = $this_part->parameters[$lcv]; if (($param->attribute == 'NAME') || ($param->attribute == 'name')) { $att_name = $param->value; break; } } switch ($this_part->type) { case TYPETEXT: $mime_type = 'text'; break; case TYPEMULTIPART: $mime_type = 'multipart'; for ($i = 0; $i < count($this_part->parts); $i++) { if ($part_no != '') $part_no = $part_no . '.'; for ($i = 0; $i < count($this_part->parts); $i++) { // if it's an alternative, we skip the text part to only keep the HTML part if (strtolower($this_part->subtype) == "alternative")// && $read == true) GetPart($this_part->parts[++$i], $part_no . ($i + 1), $display_rfc822); else GetPart($this_part->parts[$i], $part_no . ($i + 1), $display_rfc822); } } break; case TYPEMESSAGE: $mime_type = 'message'; // well it's a message we have to parse it to find attachments or text message $num_parts = count($this_part->parts[0]->parts); if ($num_parts > 0) for ($i = 0; $i < $num_parts; $i++) GetPart($this_part->parts[0]->parts[$i], $part_no . '.' . ($i + 1), $display_rfc822); else GetPart($this_part->parts[0], $part_no . '.1', $display_rfc822); break; // Maybe we can do something with the mime types later ?? case TYPEAPPLICATION: $mime_type = 'application'; break; case TYPEAUDIO: $mime_type = 'audio'; break; case TYPEIMAGE: $mime_type = 'image'; break; case TYPEVIDEO: $mime_type = 'video'; break; case TYPEMODEL: $mime_type = 'model'; break; default: $mime_type = 'unknown'; } $full_mime_type = $mime_type . '/' . $this_part->subtype; switch ($this_part->encoding) { case ENC7BIT: $encoding = '7BIT'; break; case ENC8BIT: $encoding = '8BIT'; break; case ENCBINARY: $encoding = 'BINARY'; break; case ENCBASE64: $encoding = 'BASE64'; break; case ENCQUOTEDPRINTABLE: $encoding = 'QUOTED-PRINTABLE'; break; default: $encoding = 'none'; break; } if (($full_mime_type == 'message/RFC822' && $display_rfc822 == true) || ($mime_type != 'multipart' && $full_mime_type != 'message/RFC822')) { if ($this_part->ifparameters == TRUE) while ($obj = array_pop($this_part->parameters)) if ($obj->attribute == 'CHARSET') $charset = $obj->value; $tmp = Array( 'number' => ($part_no != '' ? $part_no : 1), 'id' => $this_part->id, 'name' => $att_name, 'mime' => $full_mime_type, 'transfer' => $encoding, 'charset' => $this_part->charset, 'size' => ($this_part->bytes > 1000) ? ceil($this_part->bytes / 1000) : 1); array_unshift($attach_tab, $tmp); } } $title = "Message"; include ('header.php'); $id = $_GET['id']; $servr = "imap.***.com:143/novalidate-cert/tls"; $user = "adam@***.com"; $passwd = "***"; $folder = "INBOX"; $verbose = 0; $content = aff_mail($servr, $user, stripslashes($passwd), $folder, $id, $verbose); if ($content['cc'] != '') { echo $content["cc"]; } if ($content['subject'] == ''){ $content['subject'] = "No Subject"; } echo $content['subject']; echo $content['date']; echo $content['att']; echo $content['body']; while ($tmp = array_shift($attach_tab)) { // $attach_tab is the array of attachments // If it's a text/plain, display it if ($display_text_attach && eregi ('text/plain', $tmp['mime'])) echo '<hr />'.view_part($servr, $user, stripslashes($passwd), $folder, $mail, $tmp['number'], $tmp['transfer'], $tmp['charset'], $charset); if ($display_img_attach && (eregi ('image', $tmp['mime']) && ($tmp['id'] == ''))) { // if it's an image, display it $img_type = array_pop(explode('/', $tmp['mime'])); if (eregi('JPEG', $img_type) || eregi('JPG', $img_type) || eregi('GIF', $img_type) || eregi ('PNG', $img_type)) { echo '<hr />'; echo $tmp['number']; } } } include('footer.php'); All the errors so far are.. Notice: Undefined property: stdClass::$id in /var/www/awp/pages/user/email/functions.php on line 287 Notice: Undefined property: stdClass::$charset in /var/www/awp/pages/user/email/functions.php on line 291 Notice: Undefined property: stdClass::$id in /var/www/awp/pages/user/email/functions.php on line 287 Notice: Undefined property: stdClass::$charset in /var/www/awp/pages/user/email/functions.php on line 291 Any idea why $this_part->id $this_part->charset are empty? Seems like anything from $this_part is gone.. I'm confused
  18. the script is here: http://anantgarg.com/2009/05/13/gmail-facebook-style-jquery-chat/
  19. I have a web IM script and its written in Jquery/PHP. For some reason.. when it spits out so many chat boxes that it goes off the page, the body isn't detecting any content overflow.. therefore I can't scroll the page to get to the other boxes. I tried having it spit the boxes into a div and having that div grow in width each time a chat box was added and still it won't detect any content overflow within the page. Any ideas as to how to get it to detect the content overflow?
  20. That works perfectly! Thanks!
  21. You're going to shoot me lol I'm sorry, didn't explain it very well. The text that is still being left is: &feature=related so I want anything that comes after the video id v= to be removed. because there are different things that tend to come after the video id. the text after &feature=related should be left alone. Just this code here that was supposed to remove the &feature=related, [^[]*]+ would remove everything including the text after the link which shouldn't be removed.
  22. That works but its leaving the text there.. can it be totally removed?
  23. <?php $string = "http://www.youtube.com/watch?v=4JipHEz53sU <br><br>testing youtube videos ^^"; $expr = '~(?:http://){0,1}(?:www.){0,1}youtube.com/watch\?.*?v=([^&[]++)[^[]*+~is'; $replacement = '<iframe width="475" height="300" src="http://www.youtube.com/embed/${1}" frameborder="0" allowfullscreen></iframe>'; //${1} = 4JipHEz53sU <br><br>testing youtube videos ^^ $string = preg_replace($expr, $replacement, $string); ?>
  24. hmmm another problem.. I needed this to remove anything after the video id but once there is white space to stop. because right now basically I have the link and then I have text, the text is being removed and in another case the text is being inserted along with the video id.
  25. I feel so dumb lol such a simple fix. thank you though, 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.