[PHP] Re: PHP: inexplicable behaviour of pre- and post-increment operators

2010-03-01 Thread Martin Zvarík
Mess Dne 27.2.2010 5:01, clanc...@cybec.com.au napsal(a): A week ago Dasn asked a question about converting arrays, and I quoted one possible way of achieving his task, using the operation: $i = 0; while ($i< $k) { $b[$a[$i++]] = $a[$i++]; } I added the comment that "I have always been war

Re: [PHP] Array references - how to unset() ?

2009-09-02 Thread Martin Zvarík
AHA !!! OMG... how come I did not see that!? Instead this: $array =& $array[$final]; unset($array); This: unset($array[$final]); 3 AM in the morning... that must be the reason! .) Thanks. This is possible. You're just not giving enough consideration to your exit strategy :) array

Re: [PHP] Array references - how to unset() ?

2009-09-02 Thread Martin Zvarík
Robert Cummings napsal(a): Martin Zvarík wrote: $ARR = array( 'a' => array('b' => 'blah') ); function set($key) { global $ARR; foreach ($key as $i => $k) { if ($i == 0) { $sourcevar =& $ARR[$k];

[PHP] Array references - how to unset() ?

2009-09-02 Thread Martin Zvarík
$ARR = array( 'a' => array('b' => 'blah') ); function set($key) { global $ARR; foreach ($key as $i => $k) { if ($i == 0) { $sourcevar =& $ARR[$k]; } else { $sourcevar =& $sourcevar[$k]; } } // unset($sourcevar); // w

Re: [PHP] Re: Re: Re: Design Patterns

2009-08-13 Thread Martin Zvarík
Ralph Deffke napsal(a): NO NO NO OOP is the best ever inventet ! see my comments on this list, I will also come up with an pure oop opensource OMS very soon. I just think a dam big pattern catalog like this one is like an elephant chacing mice. I mean I can think of customers asking for a

[PHP] Re: file_set_contents() do several times?

2009-07-20 Thread Martin Zvarík
David Otton napsal(a): > 2009/7/20 Martin Zvarík : >> > $i = 0; >> do { >> $i++; >> $r = file_put_contents('file.txt', 'content'); >> } while($r === false && $i < 3); >> >> if ($r === false) die('error'

[PHP] file_set_contents() do several times?

2009-07-19 Thread Martin Zvarík
Makes sense? or is it enough to do it just once? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Lookup domain in directories VS database

2009-07-05 Thread Martin Zvarík
Imagine you are hosting 10.000 subdomains. SOLUTION #1: you create directories like: a/ b/ ... s/ s/some-subdomain.freehosting.com/ (this includes CONF.php, where you store some basic infos) Everytime visitor hits the page you do: @include('t/test-subdomain.freehosting.com/conf.php')

[PHP] Re: Image Type BMP @ "Save Image As" Dialog on IE

2009-06-28 Thread Martin Zvarík
Nitsan Bin-Nun napsal(a): I have wrote a PHP script that serves JPEG images in smaller size, the resize is done using GD on-the-fly. I have noticed an interesting issue during the "save image as..." dialog on serveral internet explorer browsers, somehow, for some strange reason, the JPEG file is

Re: [PHP] Re: XSS Preventing.

2009-06-23 Thread Martin Zvarík
Philip Thompson napsal(a): On Jun 23, 2009, at 9:29 AM, Martin Zvarík wrote: Don't htmlentiies() before DB save. In general: - mysql_real_escape_string() before DB insertion - htmlentities() before dispaly I, on the other hand, would do htmlentities() BEFORE insertion. Pros: --- The

Re: [PHP] Re: XSS Preventing.

2009-06-23 Thread Martin Zvarík
Eddie Drapkin napsal(a): 2. Can't display raw for the user (e.g. edit a forum post) Edit a forum? You display the data in TEXTAREA... Because seeing something like: "Yeah!" is what he said. Is awesome for the user experience. If you don't do html...() before putting to text

Re: [PHP] Re: XSS Preventing.

2009-06-23 Thread Martin Zvarík
Cons: 1. Can't easily edit information in the database True, so if you use phpmyadmin for editing - don't do what I suggested. 2. Can't display raw for the user (e.g. edit a forum post) Edit a forum? You display the data in TEXTAREA... 3. Uses more space in the DB True, although I

[PHP] Re: XSS Preventing.

2009-06-23 Thread Martin Zvarík
Don't htmlentiies() before DB save. In general: - mysql_real_escape_string() before DB insertion - htmlentities() before dispaly I, on the other hand, would do htmlentities() BEFORE insertion. Pros: --- The text is processed once and doesn't have to be htmlentitied() everytime you read

Re: [PHP] Re: Query stopping after 2 records?

2009-05-04 Thread Martin Zvarík
p, or do you get an error message? Depending on how long it's taking to perform the action, the script will stop just because it's taking a while. (by default, I think it's 30 seconds.) If so, use: ini_set("max_execution_time", "time in seconds"); On Mon, May

[PHP] Re: Query stopping after 2 records?

2009-05-04 Thread Martin Zvarík
Miller, Terion napsal(a): I need help/advice figuring out why my query dies after 2 records. Here is the query: // Build your INSERT statement here $query = "INSERT into `warrants` (wid, name, age, warrant, bond, wnumber, crime) VALUES ("; $query .= " '$wid', '$name', '$a

[PHP] Re: Resampling images -- need lock ? SOLVED

2009-04-20 Thread Martin Zvarík
Martin Zvarík napsal(a): I have 10 images of different sizes. If user clicks ROTATE, a script will go through all these 10 images and rotates them. If the user clicks TWICE, the first script will get aborted in the middle (so few images are already rotated) and then the second request will

Re: [PHP] Resampling images -- need lock ?

2009-04-20 Thread Martin Zvarík
I see... I will need this too: ignore_user_abort(true); kranthi napsal(a): i dont think flock will help in this case.. flock will b of help when u want to lock a particular file(to read/write) but it'll not help u to stop execution of a php script -- PHP General Mailing List (http://www.

Re: [PHP] Resampling images -- need lock ?

2009-04-20 Thread Martin Zvarík
kranthi napsal(a): yeh. if u want it to be on server side that is a good approach. but i feel it'll be very easy to do it with javascript... but what i did not understand is: what should happen if the user clicks ROTATE second time(when the script completed rotating say 5 images)? Well, few i

[PHP] Resampling images -- need lock ?

2009-04-20 Thread Martin Zvarík
I have 10 images of different sizes. If user clicks ROTATE, a script will go through all these 10 images and rotates them. If the user clicks TWICE, the first script will get aborted in the middle (so few images are already rotated) and then the second request will rotate all of them again.

Re: [PHP] Cygwin - compilation of PHP extension

2009-03-30 Thread Martin Zvarík
Martin Zvarík napsal(a): Per Jessen napsal(a): Martin Zvarík wrote: Hi, I am totally new in compiling under cygwin. I need to compile an PHP extension, and this is what I figured so far: I wouldn't expect cygwin to be that different to a real Linux environment - how about: unta

Re: [PHP] Cygwin - compilation of PHP extension

2009-03-30 Thread Martin Zvarík
Per Jessen napsal(a): Martin Zvarík wrote: Hi, I am totally new in compiling under cygwin. I need to compile an PHP extension, and this is what I figured so far: I wouldn't expect cygwin to be that different to a real Linux environment - how about: untar the extension cd dir p

[PHP] Cygwin - compilation of PHP extension

2009-03-30 Thread Martin Zvarík
Hi, I am totally new in compiling under cygwin. I need to compile an PHP extension, and this is what I figured so far: gcc -c extension_name.c (that's the only *.c file in that extension directory) ERROR: php.h: No such file... So, I changed the env PATH: PATH=$PATH:/usr/local/src/php-5.2.9

[PHP] Re: [PHP-DB] SQL for counting comments - is this smart?

2009-03-16 Thread Martin Zvarík
Chris napsal(a): Martin Zvarík wrote: Is it smart to use all of this on one page? Or should I rather do one SQL and let PHP count it? $q = $DB->q("SELECT COUNT(*) FROM comments"); $int_total = $DB->frow($q); $q = $DB->q("SELECT COUNT(*) FROM comments WHERE approved

Re: [PHP] Which hashing algorithm is best to check file duplicity?

2009-03-15 Thread Martin Zvarík
"Fastest" depends mostly on the size of the file, not the algorithm used. A 2gig file will take a while using md5 as it will using sha1. Using md5 will be slightly quicker than sha1 because generates a shorter hash so the trade-off is up to you. $ ls -lh file.gz 724M 2008-07-28 10:02 file.

[PHP] Which hashing algorithm is best to check file duplicity?

2009-03-15 Thread Martin Zvarík
I want to store the file's hash to the database, so I can check next time to see if that file was already uploaded (even if it was renamed). What would be the best (= fastest + small chance of collision) algorithm in this case? Is crc32 a good choice? Thank you in advance, Martin -- PHP Gen

Re: [PHP] Re: The PHP filter class I'm working on (securiity)

2009-03-14 Thread Martin Zvarík
Jan G.B. napsal(a): 2009/3/15 Martin Zvarík : "The browser will only execute script in source files from the white-listed domains and will disregard everything else, including embedded and inline scripts. " wtf, can't you just take care of the INPUT and type strip_tags

Re: [PHP] Re: The PHP filter class I'm working on (securiity)

2009-03-14 Thread Martin Zvarík
Michael A. Peters napsal(a): Martin Zvarík wrote: What's the point? The point is detailed on the (not fully complete) description page I just put up - http://www.clfsrpm.net/xss/ Yeah, I just had a quick look... "The browser will only execute script in source files from the wh

Re: [PHP] Re: The PHP filter class I'm working on (securiity)

2009-03-14 Thread Martin Zvarík
Jochem Maas napsal(a): Martin Zvarík schreef: What's the point? If user puts in a search input something like alert('I am super hacker'); And the website outputs: You are searching for: then what? it shows an alert(), who cares? replace the alert() with some c

[PHP] Re: The PHP filter class I'm working on (securiity)

2009-03-14 Thread Martin Zvarík
What's the point? If user puts in a search input something like alert('I am super hacker'); And the website outputs: You are searching for: then what? it shows an alert(), who cares? I, as an owner of this website, don't mind AT ALL. Aha, forget to mention the XSS on MySQL or

[PHP] Re: PHP/Apache: script unexpectedly invoked multiple times in parallel every 30 secs.

Marc Venturini napsal(a): Hi all, I wrote a PHP script running in Apache which takes more than 30 seconds to complete. It uses set_time_limit() to extend the time it is allowed to run. The script generates thumbnails from a list of images. Upon completion, the script redirects the browser to ano

[PHP] Re: Question about template systems

Matthew Croud napsal(a): Hello, First post here, I'm in the process of learning PHP , I'm digesting a few books as we speak. I'm working on a content heavy website that provides a lot of information, a template system would be great and so i've been looking at ways to create dynamic data with

Re: [PHP] syntax

Micah Gersten napsal(a): Martin Zvarík wrote: Chris napsal(a): Terion Miller wrote: Need syntax help when it comes to using a timestamp. What I'm trying to say in my query WHERE clause is to select records if the timestamp on the record is in the past 7 days from NOW() $

Re: [PHP] syntax

Chris napsal(a): Terion Miller wrote: Need syntax help when it comes to using a timestamp. What I'm trying to say in my query WHERE clause is to select records if the timestamp on the record is in the past 7 days from NOW() $query .= " WHERE stamp < NOW()-7 "; I have no clue here on this ...

Re: [PHP] Unique User Hashes

Ashley Sheridan napsal(a): On Thu, 2009-02-19 at 23:34 +0100, Martin Zvarík wrote: Chris napsal(a): Martin Zvarík wrote: Chris napsal(a): Martin Zvarík wrote: tedd napsal(a): At 5:28 PM +0100 2/19/09, Martin Zvarík wrote: tedd

Re: [PHP] Unique User Hashes

Chris napsal(a): Martin Zvarík wrote: Chris napsal(a): Martin Zvarík wrote: tedd napsal(a): At 5:28 PM +0100 2/19/09, Martin Zvarík wrote: tedd napsal(a): At 5:10 PM +0100 2/19/09, Martin Zvarík wrote: tedd napsal(a): At 1:49 AM +0100 2/19/09, Martin Zvarík wrote: Guys, I have not seen a

Re: [PHP] Unique User Hashes

Chris napsal(a): Martin Zvarík wrote: tedd napsal(a): At 5:28 PM +0100 2/19/09, Martin Zvarík wrote: tedd napsal(a): At 5:10 PM +0100 2/19/09, Martin Zvarík wrote: tedd napsal(a): At 1:49 AM +0100 2/19/09, Martin Zvarík wrote: Guys, I have not seen a poll where you need to input your email

Re: [PHP] Unique User Hashes

tedd napsal(a): At 5:28 PM +0100 2/19/09, Martin Zvarík wrote: tedd napsal(a): At 5:10 PM +0100 2/19/09, Martin Zvarík wrote: tedd napsal(a): At 1:49 AM +0100 2/19/09, Martin Zvarík wrote: Guys, I have not seen a poll where you need to input your email address - and if I would I would not

Re: [PHP] Unique User Hashes

tedd napsal(a): At 5:10 PM +0100 2/19/09, Martin Zvarík wrote: tedd napsal(a): At 1:49 AM +0100 2/19/09, Martin Zvarík wrote: Guys, I have not seen a poll where you need to input your email address - and if I would I would not vote - because it's a waste of my time... if you want me to

Re: [PHP] Unique User Hashes

tedd napsal(a): At 1:49 AM +0100 2/19/09, Martin Zvarík wrote: Guys, I have not seen a poll where you need to input your email address - and if I would I would not vote - because it's a waste of my time... if you want me to vote you do everything you can to make it as pleasant as pos

Re: [PHP] Unique User Hashes

Guys, I have not seen a poll where you need to input your email address - and if I would I would not vote - because it's a waste of my time... if you want me to vote you do everything you can to make it as pleasant as possible -- certainly that isn't requirement of an email validation. Andre

[PHP] Re: shell_exec - asynchronous would be cool!

German Geek napsal(a): Hi all, A while ago, i had a problem with shell_exec: I was writing some code to execute imagemagick to convert a bunch of images. This could take ages to execute and the page therefore ages to load. The solution was to get a linux box and append a & at the end to do it i

[PHP] Re: Unique User Hashes

I don't think there is more precise way to determine the visitor than by the IP address, and it sucks indeed. You can't rely on the cookies, can't rely on what's in 'HTTP_USER_AGENT' ... as said: registration could be a solution - but it's an annoyance for the visitors - although you can try O

[PHP] Re: Files redirect - using PHP and .htaccess

Martin Zvarík napsal(a): Hi, there are two choices (example): 1) file_redirect.php?src=file/root.jpg --- shows an image 2) .htaccess --- if is requested file/root.jpg than redirect to "xyzfile/root.jpg" In both cases I can restrict the access to some files only. If we talk abou

[PHP] Files redirect - using PHP and .htaccess

Hi, there are two choices (example): 1) file_redirect.php?src=file/root.jpg --- shows an image 2) .htaccess --- if is requested file/root.jpg than redirect to "xyzfile/root.jpg" In both cases I can restrict the access to some files only. If we talk about PHP, the file/image.jpg can be direc

Re: [PHP] Speed Opinion

Nathan Rixham napsal(a): Ashley Sheridan wrote: On Thu, 2009-02-05 at 09:44 +1100, Chris wrote: PHP wrote: Hi all, I am seeking some knowledge, hopefully I explain this right. I am wondering what you think is faster. Say you have 1000 records from 2 different tables that you need to get fro

Re: [PHP] cgi vs php

Thodoris napsal(a): Y In cgi i can use perl ,c etc suppose i use perl now how efficiency differs? How cgi written in perl and php is differ in working in context of web service? other difference?. but their differ. On Thu, Feb 5, 2009 at 6:45 PM, Jay Blanchard wrote: [snip] can any

Re: [PHP] Make New-Age Money Online with Google

Ashley Sheridan napsal(a): On Sat, 2009-01-24 at 10:14 +0200, Dora Elless wrote: That's why I am sending this email only to people I know and care about. And they send to a mailing list. Come again? Ash www.ashleysheridan.co.uk The sad thing though is that there will be always people who b

[PHP] Re: PHP webhosting - USA - conclusion

I should have said in the beginning it's a small website and I am not looking for a dedicated server. Howewer, I decided to move to Lypha.com Thanks for all your fruitful* comments :) Martin PS: PHP mailgroup rulz *) that was in dictionary -- PHP General Mailing List (http://www.php.net/) T

Re: [PHP] PHP webhosting - USA

That's an awful looking website, but thanks for reply. I am looking for rather a US hosting company. Andrew Williams napsal(a): go to www.willandy.co.uk <http://www.willandy.co.uk> best value for money On Sat, Jan 24, 2009 at 3:03 PM, Martin Zvarík <mailto:mzva...@gmail.com>

[PHP] PHP webhosting - USA

Hi, I currently host my site by Powweb, and I am WANT to change it - can you guys recommend me something good? Powweb's website looks awesome and it's the best marketing I think I had saw! After a minute it makes you think there is NO better hosting - and it's a LIE. What happened to me?

[PHP] Re: =.='' what wrong ? just simple code, however error.

It works as expected on my PHP 5.2.4 LKSunny napsal(a): "; } //i don't know why, when run this code, on 91.3 after expect is 91.2, however..91.2001 //who can help me ? and tell me why ? //Thank You. ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

[PHP] Re: get_browser() too slow

Martin Zvarík napsal(a): Hello, anyone has a good function for getting a user's browser, OS and crawler detection ? I have looked at google etc, but I ran only into long list of ineffective ereg()s functions or not checking if it's crawler... Is it possible to make an array lis

[PHP] get_browser() too slow

Hello, anyone has a good function for getting a user's browser, OS and crawler detection ? I have looked at google etc, but I ran only into long list of ineffective ereg()s functions or not checking if it's crawler... Is it possible to make an array list and just check using strpos() each on

[PHP] IP and gethostbyaddr() --- difference?

Hello, I am doing a view stats for my website. I've seen that many of such statistic scripts store two values to identify the visitor: IP and getHostByAddr(IP) I've been searching..., but I don't get why the IP address isn't enough by itself?! What is the getHostByAddr() = Internet host name

[PHP] Re: operators as callbacks?

Joe napsal(a): Is it possible to use a PHP operator as a callback? Suppose I want to add two arrays elementwise, I want to be able to do something like this: array_map('+', $array1, $array2) but this doesn't work as "+" is an operator and not a function. I can use the BC library's math function

[PHP] Re: Secure redirection?

I might have not read your post thorougly, but it's important to know, that Header sends a HTTP request to the browser - you are not hiding the destination URL. So, calling header("location: in PHP is basically same as redirect using JS. Martin Zoran Bogdanov napsal(a): Hi, I'm building a

[PHP] Re: how to kill a session by closing window or tab clicking on X?

Afan Pasalic napsal(a): hi. I'm sorry for posting this more javascript then php question, but it's somehow php related. here is the issue: very often people close the window/tab without logging out. I need solution how to "recognize" when [x] is clicked (or File >> Close) and kill the session

Re: [PHP] Dynamically creating multi-array field

2008/10/26 Martin Zvarík <[EMAIL PROTECTED]>: PHP Version 5.2.4 I really don't like to use the EVAL function, but do I have choice?? This sucks. Hi there, While this question can spur some neat solutions, it raises a red flag in that if you need to do this, you proba

Re: [PHP] create/write to psd file

What I know is that you can control GIMP over the command line = you can use PHP to do this. Though I guess GIMP doesn't support PSD files, I had to express myself anyways. vuthecuong napsal(a): Hi all Is there a way to create/read/write to psd file? (photoshop format) I would like to hea

Re: [PHP] Dynamically creating multi-array field

:-D :-D :-D :-D :-D :-D :-D :-D ok :) Robert Cummings napsal(a): On Mon, 2008-10-27 at 02:09 -0400, Robert Cummings wrote: On Sun, 2008-10-26 at 22:39 -0700, Jim Lucas wrote: Even slimmer It's buggy... you need to test for an blank string to properly handle the append to arr

Re: [PHP] Dynamically creating multi-array field

Nope, you have to use the eval() everytime for read/write. Martin Zvarík napsal(a): No offense, but I thought it's obvious what I want to print. print_r() shows null, and it should print what you just wrote = array field. It works when first defining with eval(): eval('$tpl'

Re: [PHP] Dynamically creating multi-array field

your quick reply, Martin Jim Lucas napsal(a): Martin Zvarík wrote: PHP Version 5.2.4 I really don't like to use the EVAL function, but do I have choice?? This sucks. You should print the results that you are looking for! Are you looking for something like this? Array ( [5

[PHP] Dynamically creating multi-array field

PHP Version 5.2.4 I really don't like to use the EVAL function, but do I have choice?? This sucks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] XCache, APC, Memcached... confused

iable? are the variables accessible across the whole server? I still don't really understand, but I am trying... Stut napsal(a): On 22 Oct 2008, at 22:19, Martin Zvarík wrote: I became confused after an hour trying to understand the PHP cache solutions. XCache, APC, eAccelerator and

Re: [PHP] XCache, APC, Memcached... confused

2 Oct 2008, at 22:19, Martin Zvarík wrote: I became confused after an hour trying to understand the PHP cache solutions. XCache, APC, eAccelerator and others are opcode cache systems... is memcache in the same category? or is it completely different? Memcache is completely different in that i

[PHP] Re: ZendOptimizer + APC

Jochem Maas napsal(a): anyone know whether running ZendOptimizer + APC simultaneously still causes allsorts of problems ... I know it did in the past but I can't find any very recent stuff about the issues online. I believe you should look up eAccelerator or XCache, which should work with Ze

[PHP] Re: XCache, APC, Memcached... confused

I guess the XCache everybody talks about is the open-source here: http://xcache.lighttpd.net/ But what about this: http://www.xcache.com/ ... is it the same author? :-O Martin Zvarík napsal(a): Hi, I became confused after an hour trying to understand the PHP cache solutions. XCache, APC

[PHP] XCache, APC, Memcached... confused

Hi, I became confused after an hour trying to understand the PHP cache solutions. XCache, APC, eAccelerator and others are opcode cache systems... is memcache in the same category? or is it completely different? If I install for example XCache, set it for certain directory... it will automa

[PHP] Re: searching by tags....

Ryan S napsal(a): Hey, this the first time I am actually working with "tags" but it seems quite popular and am adding it on a clients requests. By tags I mean something like wordpress' implementation of it, for example when an author writes an article on babies the tags might be baby,babies,

[PHP] PHP tags - any reasons to close ?>

Hi, I have seen some projects where people start with opening tag they DON'T close it with ?> This is especially the case of CONFIG.php files... 1) What's the reason of that? 2) What if you would not close any 100% PHP files? 3) What's the reason of making an empty space after ?> I've also see

Re: Re: [PHP] CMS-Blog system

Thank you for all the comments. Thanks for the WP tip: I don't know much about wordpress (it looks good), but I have tryed enough of open-source CMS to say that they are based on messy solutions (one for all = joomla) + it won't be free blog system, so I don't think using this free system woul

[PHP] CMS-Blog system

Hi, I am working on CMS-Blog system, which will be using approx. 10 000 users. I have a basic question - I believe there are only two options - which one is better? 1) having separate databases for each blog = fast (problem: what if I will need to do search in all of the blogs for some artic

[PHP] Installing php_pgsql.dll to Apache - this is unreal

Hi, I am trying now for almost 2 hours to get this working: I had Apache and PHP with modules installed as CGI (also tryed as module). Now I added extension (in php.ini) php_pgsql.dll and also installed postgreSQL. And it shows me error when starting apache: "module could not be found". The

[PHP] MIME email = Content-ID in CSS not supported

Hello, I am trying to send MIME type email with in message image attachments. It works OK when doing ...but it does not work in this style="background:url(cid:specialcode)"> I am trying to have fading background, is there any way I can achieve this without using IMG tag? Thank you, Mar

Re: [PHP] Something you can do with AJAX + PHP as well

lame... you can use javascript (which is faster) for this kind of stuff Mark napsal(a): Hey, I've made a nice video where you see ajax in combination with php. and it works really well although really is misspelled "realy". Here is the video: http://magedb.mageprojects.com/videos/MageDB%202nd%

[PHP] Sending lots of emails - 2 choices - choose the best one

Hello-- I want to send email to 100+ recipients. Two choices I thought of: 1) once call mail() and use BCC, but the negative of this method is that every recipient in BCC has header "To" same (so I used to put my email in here - not email of one of the recipients). 2) several calls to mail

Re: [PHP] Extract printable text from web page using preg_match

I believe it is better to use strpos() in this case because it's faster. '); // not necessary $end = strpos(strtolower($website_code), ''); $code = substr($website_code, $start, $end-$start); echo strip_tags($code); // clean text ?> This is very simple, but there are many HTML parsers out the

Re: [PHP] read file local not remote

Difference: You don't call file as http://www.myweb.com/ but instead you use the path like c:\some.txt or ../some.txt etc. PHP 5 = echo file_get_contents("some.txt"); PHP 4 = $fp = fopen("some.txt", "r"); echo fread($fp, filesize ("some.txt")); fclose($fp); Another solution

Re: [PHP] PHP+MySQL website cache ? Yes/No

in 300 files, can I?). So I decided to put the cache in database table - For each URL Name (news/, products/ etc) a Cache (which will be an array of all HTML blocks). Martin [EMAIL PROTECTED] napsal(a): Quoting Martin Zvarík <[EMAIL PROTECTED]>: I did a benchmark with and without c

RE: [PHP] PHP+MySQL website cache ? Yes/No

I did a benchmark with and without caching to HTML file and it's like: 0.0031 sec (with) and 0.0160 sec (with database) I know these miliseconds don't matter, but it will have significant contribution in high-traffic website, won't it? Martin -- PHP General Mailing List (http://www.php.net/)

Re: [PHP] PHP+MySQL website cache ? Yes/No

Lauri www.dwsasia.com - company web site www.lauri.se - personal web site www.carbonfree.org.uk - become Carbon Free -Original Message- From: Martin Zvarík [mailto:[EMAIL PROTECTED] Sent: Sunday, February 25, 2007 12:50 PM To: php-general@lists.php.net Subject: [PHP] PHP+MySQL website cache

[PHP] PHP+MySQL website cache ? Yes/No

Hi, I am making an eshop and I am thinking about caching system. You understand, that it cannot be entirely cached because visitor has it's own shopping cart etc. So, my thought is to cache only few blocks like "Categories", "Navigation menu" etc. by storing it to an HTML file. The advant

[PHP] MySQL - HEAP table type

Hi, I am sorry for this not being really a PHP question, anyway I use MySQL database, I have a table, which is HEAP (memory) type and I found out I can store only about 22000 entries in it, then when I want to insert new entry it gives me an error that the table is full. The question is: H

[PHP] Session - when they expirate ?

Hi, I was looking all over the internet and I don't understand when and how does the PHP session expirate. I suppose that it happens when the user is inactive. On my website I don't use cookies for session and it has standard php.ini configuration: session.gc_maxlifetime = 1440 session.gc_

Re: [PHP] forms and dynamic creation and unique field names

Jason Gerfen wrote: I have come upon a problem and am not sure how to go about resolving it. I have an web form which is generated dynamically from an imported file and I am not sure how I can loop over the resulting post variables within the global $_POST array due to the array keys not bei

[PHP] PHP Standard style of writing your code

Hi, I see everyone has its own way of writing the code. If there is 10 programmers working on same thing, it would be good if they would have same style of writing the PHP code. So, my question is: Is there anything what would define standard style of writing PHP code? Thanks, Martin --

Re: [PHP] Re: double lines

Barry wrote: clive wrote: Does the html add in \r. Normally not. But the mailing function might do. Replace every \n with and every \r with with str_replace And probably you see where the problem is It's because of the operation system. Win32 and Linux works different. Linux adds ex

Re: [PHP] MySQL close connection, what's the purpose?

Richard Lynch wrote: On Fri, March 31, 2006 2:30 pm, Martin Zvarík wrote: I was wondering why is it necessary to use mysql_close() at the end of your script. If you don't do it, it works anyways, doesn't it? Yes, but... Suppose you write a script to read data from

[PHP] MySQL close connection, what's the purpose?

Hi, I was wondering why is it necessary to use mysql_close() at the end of your script. If you don't do it, it works anyways, doesn't it? MZ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Upload with process meter

Hi, is it possible to upload a file and see the process of uploading (before the file is uploaded, there is something showing from 0% to 100%) using PHP and Javascript ? I saw some applications in Perl and mostly in JAVA, but I also found out something about some extension for PHP, but i think

[PHP] Script Multitasking

Hi, I have a file, which I run using command line. The file I am running, runs several files using passthru(). What I realise is, that it runs each file in sequence and waits for its result. I need to run all files at once and they don't have to return the result to the main file. How do I do

[PHP] Themes, pictures directory

Hi, I have a website, which uses themes. The web tree looks like this: * webroot o *themes* + default # images + red design # images o *index.php* Let's say I choose "red design" theme. All the pict