Jump to content

kevin_newbie

Members
  • Posts

    48
  • Joined

  • Last visited

    Never

Everything posted by kevin_newbie

  1. @ChemicalBliss - WOW thanks so much for all this. But the thing I am having in issue is how can I pick how many sentences I want and display it without saying "array"? Thank you once again and I really appreciate this.
  2. I found this expression that involves dr, mr, mrs and so forth. <([DM][rs]{1,2}). Just having a hard time incorporating it with my current expressions. :/
  3. Okay tried the ellipsis and it works perfect for that part. But with "mrs." it stops at that word with the period. So it is broken for that part.
  4. Why use the str_ireplace? Case sensitive?
  5. I don't want to remove those I just want the function to skip over those so that it is not considered an end to a sentence. Right now I am doing a function that replace the word to full words. function replaceWord($description) { $abrev = array("dr.","dr", "DR.", "DR", "Dr.", "Dr" ); $words = array("doctor", "doctor", "Doctor", "Doctor", "Doctor", "Doctor"); $change = str_replace($abrev, $words, $description); return $change; } It is alright for now but I want it more dynamic than listing out every possible ways. Thanks.
  6. Yeah the function is doing that but it breaks if there is something like "Mr." or "Dr." anything that is two letters with a "." in front of it.
  7. Hello, I have an update, I found a function where it grabs the first leading or however many sentence you want from a string. So it finds the sentence that either has a "! . or ?" which are considered leading sentences. Now is there a way to find a match where if there are any "something." with in this function we can just skip over that? function getLeadingSentences($data, $max) { $re = "[^s*[^.?!]+[.?!]+s*]"; $out = ""; for($i = 0; $i < $max; $i++) { if(preg_match($re, $data, $match)) { //if a sentence is found, take it out of $data and add it to $out $out .= $match[0]; $data = preg_replace($re, "", $data); } else { $i = $max; } } return $out; } Thanks
  8. @ Andy-H - I did your code and I got this error "Notice: Undefined offset: 1 . . . " :/ @sug15 - so did you ended up using the split function in php?
  9. Why does it remove the last letter of word before it puts a period? Also can I add in a "? and !" part?
  10. Hello, I am working on a project and I want to explode after the second period of the description but if the sentence has a "Dr." I don't want that to be counted as part of the array. This is what I have now: $content = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc Dr. Tom id lectus ante. Suspendisse potenti. Fusce eu ante mattis eros hendrerit imperdiet. Fusce at ante mauris, vel dapibus quam. Duis vel vestibulum neque. Aenean viverra condimentum ante, ut vulputate diam volutpat non. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Fusce nibh diam, sollicitudin at vulputate a, commodo nec ligula." $explode = explode('.', $content); echo $content[0] . '.' . $content[1] . '.' ; The code above displays on the browser as: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc Dr. I would like it to skip the "Dr." if possible. Is it? Thanks for your help
  11. Okay so using this function is echoing out one integer which is the day correct? DateDiff(startdate(now()), enddate(datetime from db))
  12. Hello, I have noticed that sites usually format dates of entries like: "Submitted 1 hour ago. or Submitted 1 day 2 hours ago. " What is the logic of doing something like this? Right now I have the date already inserted in the db along with the entries and just want to be able to format with days instead of the traditional Jan. 25th 2009 @ 4:25pm. Thanks, kevin_newbie.
  13. OH nice thanks Crayon, I did this just before the imagettftext $newcode = ''; $codearray = str_split($code); for($i = 0;$i < count($codearray);$i++) { $newcode .= $codearray[$i].' '; }
  14. Maybe I wasn't clear on it but my string is doing "a4fd5" I want spaces in between those letters so that it is like "a 4 f d 5". Hopes that helps.
  15. When you tried image source did you use absolute link instead of relative link? So when you display image it should go along the lines of <img src="http://yourdomain.com/image/to/path" width="" height="" alt="" /> Then it should work. Along with having the header stating that there is html and image file in the email. http://php.net/manual/en/function.mail.php That page should help you as far as what headers you need in this case. Hopes that helps you out.
  16. Hello, I have a captcha going with a custom font. The only thing I am having trouble with creating space between each letter. what area should I work on to achieve this? <?php session_start(); class CaptchaSecurityImages { var $font = 'monofont.ttf'; function generateCode($characters) { $possible = '23456789bcdfghjkmnpqrstvwxyz'; $code = ''; $i = 0; while ($i < $characters) { $code .= substr($possible, mt_rand(0, strlen($possible)-1), 1); $i++; } return $code; } function CaptchaSecurityImages($width='100',$height='30',$characters='6') { $code = $this->generateCode($characters); /* font size will be 75% of the image height */ $font_size = $height * 0.65; $image = @imagecreate($width, $height) or die('Cannot initialize new GD image stream'); /* set the colours */ $background_color = imagecolorallocate($image, 255, 255, 255); $text_color = imagecolorallocate($image, 0, 59, 84); $noise_color = imagecolorallocate($image, 100, 120, 180); /* create textbox and add text */ $textbox = imagettfbbox($font_size, 0, $this->font, $code) or die('Error in imagettfbbox function'); $x = ($width - $textbox[4])/2; $y = ($height - $textbox[5])/2; imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font , $code) or die('Error in imagettftext function'); /* output captcha image to browser */ header('Content-Type: image/jpeg'); imagejpeg($image); imagedestroy($image); $_SESSION['securityCode'] = $code; } } $width = isset($_GET['width']) ? $_GET['width'] : '100'; $height = isset($_GET['height']) ? $_GET['height'] : '30'; $characters = isset($_GET['characters']) && $_GET['characters'] > 1 ? $_GET['characters'] : '6'; $captcha = new CaptchaSecurityImages($width,$height,$characters); ?>
  17. I have an idea just not sure if its a good one, first grab the time when they entered into the site and then when they leave the site track the time then. Then from within the query subtract it I get the time from there? THe thing I am not sure is how can I grab the time of when they left the site?
  18. Hello, I want to be able to track how long a visitor on each page? Right now I am grabbing useragent, time indexed, sessionid, page name. I want to have a column that says timeTrack. That basically track how long they have been on that page. Any idea? Thanks
  19. Thank you guys very much. Both methods worked
  20. Mchl, So from what you are saying I can, i tried but it's not doing it; SELECT id,name,orderList FROM states WHERE orderList = 1 UNION SELECT id,name,orderList FROM states ORDER BY name ASC
  21. Mchl - That makes sense what union does now, but I only have one table not two. kickstart - I went the route of adding another column and having everything have 2 while california have 1. When i do the query though it does california first then everything else not in alphabetical order? SELECT id,name,orderList FROM states ORDER BY orderList ASC I'm I missing something? Thanks
  22. kickstart - It's only going to be california, I am not going to change it. mchl - What do you mean a union of two selects? I haven't done anything like this (Union).
  23. Hello, What is the best way to display an entry (Mysql and php) first when even though you have it set to alphabetical order? For example i current have the list of a few states as followed; Alabama Alaska Arizona Arkansas California Colorado But I want to be able to put California first then the rest follow so like this: California Alabama Alaska Arizona Arkansas Colorado What is the best way to achieve that? Thanks
×
×
  • 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.