Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. Yea, my post was directed to Laffin's code. Sorry if I made you think I was questioning your code
  2. You would use the session_set_cookie_params and set the expire time to time + 90 minutes, or you can set this interval inside of php.ini using the: Session Configuration To be 90 minutes (note the value needs to be in seconds).
  3. Hard to help you without the code you are using to attempt to send the email.
  4. Well I guess I meant that 50 is dead in between the lowest number of 0 and highest of 100. I am just trying to figure out why laffin's script does not properly weight the items, as given that copper has a weight of 75 should it not be a higher percentage then silver? My answer was that 50 would be more likely to be chosen more often since it is dead center where as the copper is more towards the upper end. Just wondering (Sorry for the confusion I never was "great" at math problems).
  5. Use file_get_contents as that was what it was made for: $source_file = 'scan0001.txt'; $fp_s = file_get_contents($source_file); echo $fp_s If you want to use fopen, look at the examples found at fread.
  6. Hey meant read the manual on empty to see its proper usage: if (!empty($var1) && !empty($var2 && !empty($var3)) { Would be correct syntax for what you wanted todo.
  7. Maybe I was not making myself clear or what not, but what I was getting at is that this: Loop of 500 lint found 348 times (%69.6) copper coin found 46 times (%9.2) silver coin found 82 times (%16.4) gold coin found 24 times (%4. It is always true that silver will be retrieved more often then the copper, but yet the copper is suppose to be weighted heavier (given the 75). Is it simply because 50 is the median and will pull in more hits as appose to 75, since that is closer to one side as appose to being in the exact middle?
  8. Is this more or less what you were after: $text = 'some string <a href="http://www.ask.com" title="none">none</a> exra string'; function returnAnchor($text) { preg_match('~<a(.*?)</a>~', $text, $matches); return (is_array($matches)?$matches[0]:''); } echo returnAnchor($text);
  9. I do have a question laffin, I tried your code that you posted and noticed that the silver always displays a higher percentage then the copper coin, I do not think that is correct, but I could not see why it was doing it, either way just curious as I do find this subject interesting.
  10. Yea, my original idea: You are missing a comma between: '".$Comment."''".$PName." Did you even replace your INSERT INTO statement with the correct one I posted, if not here is what the above should look like: '".$Comment."','".$PName." Note the comma separating those two items. That needs to be there to signify 2 separate fields, as that is what they are.
  11. <?php $text = '<a href="http://www.ask.com" title="none">none</a>'; function returnAnchor($text) { preg_match('~href="(.*?)"~', $text, $matches); return (is_array($matches)?$matches[1]:''); } echo returnAnchor($text); ?> Using preg_match this is easily possible
  12. In test.php you are using smart quote around the HTML name field: name=”3Dchild4” Change those to be regular quotes: name="3Dchild4" On all fields and it should work just fine. As Smart quotes are not valid HTML.
  13. How are you using the term scanner? Are you referring to the piece of hardware that scans in photos or are you referring to "Scanning" over a webpage and downloading the photos that way?
  14. It means you have 1 too many or 1 few columns in your mysql query: $query="INSERT INTO HOH (House, Name, Surname, Query, Pupil_Name, Pupil_Surname, Year, Contact_No)VALUES ('".$House."','".$Name."','".$Surname."','".$Comment."','".$PName."','".$PSurname."','".$Year."','".$Contact."')"; You were missing a comma between: '".$Comment."''".$PName."
  15. You can close it by clicking the "Mark Solved" button on top left hand corner of the "Quick Reply".
  16. If you have a local server, you can possibly use curl (not sure how they do on file upload forms) and use glob with copy and unlink to basically do this: Scan images to a local folder "new_scanned" use Windows Tasks or a CRON job on Linux to run a local script on your local PHP server. You open the directory of the new_scanned images (using glob) read the file to the script then use that to construct POST data to the remote page form and send it that way using curl. Once it is completed, copy the image (if you want to) to an "old_scanned" directory and then unlink the image inside of the "new_scanned" directory. Unsure if that is what you were after, but is about the only I could see doing it with PHP. That is if curl can send files to scripts I am not sure on that part.
  17. You should be able to use the [url=] bbCode to get it clickable. So for those too lazy to copy, this should work: http://www.maximumpc.com/article/news/windows_7_“god_mode”_has_all_controls But if you ask me, that is a flaw in their system allowing quotes in the URL.
  18. It will match the following: \n \r \r\n \n\r The 1,2 means it will only match 1 or both of those items and no more, the + would match any number of characters \r\n\n\r as long as they were sequential and replace them once.
  19. <?php $text = "this is just \r test \r\n text inside \n of text \n\r more text \r\n\r\n after the window \n\r\n\r ok"; $text = preg_replace("#[\r\n]{1,2}#", "\n", $text); echo $text; Should give: this is just test text inside of text more text after the window ok
  20. I do not know how you are getting double line breaks. Using this code it: <?php $text = "this is just \r test \r\n text inside \n of text \n\r more text"; $text2 = preg_replace("#[\r\n]+#", "REPLACED", $text); echo $text2 . "<br /><pre>"; $text = preg_replace("#[\r\n]+#", "\n", $text); echo $text; ?> Displays this: this is just REPLACED test REPLACED text inside REPLACED of text REPLACED more text this is just test text inside of text more text Like it should.
  21. Please see: http://www.phpfreaks.com/forums/index.php/topic,282865.msg1341141.html#new For the solution.
  22. Just \r\n. Please do not create multiple topics on the same subject. One will suffice, for future reference. Try this for your preg code: $text = preg_replace("#[\r\n]+#", "\n", $text); As the \r\n characters are taken literally inside of single quotes, but inside of double quotes they are the actual linebreak characters. EDIT: If you want to be able to see it by reading it you can use this to verify that it works: $text = preg_replace("#[\r\n]+#", " REPLACED ", $text); That way, any \n, \r etc characters that get replaced are visible by the REPLACED word.
  23. Just use str_replace as this is rather simple: $text = str_replace("\r\n", "\n", $text); You generally only want to use the preg functions when you need advance replacement / finding of contents inside a string. Since you do not, str_replace will due and would be preferred.
  24. The math is still the same, it works for PHP using the %. So (1 % 2) would equal .5, give it a try: $num = (1%2); echo $num; It calculates if there is a remainder, if there is then you have not reached that number, if it is equaled to 0, you have reached your number and would want to insert a break. EDIT: And for the PHP reference of its usage: Arithmetic Operators.
  25. You would want to look into the modulus (%) operator.
×
×
  • 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.