[PHP] Statistics function
Hello everybody, How does the behind the scenes work by PHP exactly go? Does the PHP thread remain active so long as the information is sent to the visitor? Or will PHP parse the code and send it to Apache which will send the data to the user itself? The reason that I'm asking this is I'm writing a statistics add-on for one of my sites and was wondering whether the code below would give the time in which PHP parses the code or in which the data gets streamed to the user. $time_one = microtime(void); fpassthru($file); $time_two = microtime(void); // + here will be the code to calculate the difference //betweeen $time_one and $time_two Would I get information about my server (parsing time) or would I get some information about the requesters internet connection (how fast will my files get to the user). Both would be pretty important! PS What are the advanced statistics programs out there? I wouldn't mind seeing a sample report (any commercial or non-commercial). Thanks in advance in advance! Yours, Lauri -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Creating thumbnails
Hello everybody, I just finished reading a message from the server root and I have been told that the server I have to work with by our current project doesn't support GD and they can't install it neither. We will, however, need to create thumbnails from larger images (JPEG). Are there any other solutions that don't require installing? Some CGI scripts or something similar perhaps? Or does anybody have any other ideas? Perhaps letting another server to do the thumbnailing? There will be only a max of 20 images per day which have to be converted to a 100*200px image. Our main scripting language will be PHP and the database will be some form of SQL. Thanks in advance! Yours, Lauri -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Templating solutions?
Hi there! During the last two weeks or so, I've been bugged by a question deep inside me. It's about various templating solutions used with dynamic web applications. Oftentimes simply embedding the code into the HTML template does the trick. Othertimes the include("header.inc");and include("footer.inc"); works its magic. There are, however, also moments when such approaches aren't enough and something else is required. What does one do when the templates of most pages within one site differ in look and feel? One possibility would be to specify a template, load it into a variable and replace certain marked spots (a la "") with the dynamically created code/text using eregi_replace() or something similar. What are the templating solutions available? Pros and cons? How do you solve your templating? Yours, Lauri -- Tharapita Creations [dynamic web applications] [EMAIL PROTECTED] Mobile: +372 53 410 610 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] multiple replaces...
Hello there, I have about 30 markers in the text which need to be replaced with the value of a variable or an array. Common sense comes up with eregi_replace("!one!","blah",eregi_replace("!heh!",'foobar',eregi_replace("blah","ho-ho-ho",text))); The list above could go on and on... I'm sure there are better ways to replace many markers or spans of text with something else. A loop? Something even more easier and better? Thanks, Lauri -- Tharapita Creations [dynamic web applications] [EMAIL PROTECTED] Mobile: +372 53 410 610 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] multiple replaces...
Hi Nick, Yes, I thought about that. But, what should I do when the markers are absolutely NOT in any sequence. I also thought about something like $replace[1][1] = "!one!"; //marker $replace[1][2] = "hehee"; //replace with $replace[1][1] = "test";//marker $replace[1][2] = "foobar"; //replace with $replace[1][1] = "repl";//marker $replace[1][2] = "humpty-dumpty"; //replace with $replace[1][1] = "blah";//marker $replace[1][2] = "boo"; //replace with Now, when I would do a loop thingie that goes through all those, then it would be a pretty nice and compact solution... What about speed issues regarding this solution? Yours, Lauri -- Tharapita Creations [dynamic web applications] [EMAIL PROTECTED] Mobile: +372 53 410 610 -Original Message- From: Nick Wilson [mailto:[EMAIL PROTECTED]] Sent: 12. jaanuar 2002. a. 13:53 To: [EMAIL PROTECTED] Subject: Re: [PHP] multiple replaces... If the 'markers' are in some kind of sequence (like marker1, marker2 etc) you could use a loop. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Whoops (was:RE: [PHP] multiple replaces...)
Whoops, forgot to change the first number in every one of those. The first numbers in the brackets should increase after every two lines... The correct one: $replace[1][1] = "!one!"; //marker $replace[1][2] = "hehee"; //replace with $replace[2][1] = "test";//marker $replace[2][2] = "foobar"; //replace with $replace[3][1] = "repl";//marker $replace[3][2] = "humpty-dumpty"; //replace with $replace[4][1] = "blah";//marker $replace[4][2] = "boo"; //replace with Now, when I would do a loop thingie that goes through all those, then it would be a pretty nice and compact solution... What about speed issues regarding this solution? Yours, Lauri -- Tharapita Creations [dynamic web applications] [EMAIL PROTECTED] Mobile: +372 53 410 610 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Two SQL tables: asking data in chronological order??
Hi there, I have a somewhat urgent issue so I'll get right to the point. There are two tables and for simplicitys sake I stripped about 2/3 of the tables structure. I need to order the data from two SQL tables by date. Basically a chronological list from the two tables. Now, ordinarily I would do two queries and put disbursements into one list and activities into another one, just above it. But in this case they need to be mixed so that it would be a TRUE chronological list. One way would be to do two queries and load all of the dates from the two tables into a PHP array (and also define whether it's a disbursement or activity) and then sort it in ascending order. Then I would have a chronological list with information about ties of that table. Now I could ask for the data by the name of the table and the date when I loop through that PHP array and display it. That, however, is a bit "around the edge". Do I have any simple alternatives? CREATE TABLE activities ( id int(11) DEFAULT '0' NOT NULL auto_increment, matterid int(11), costtype enum('unit','hour'), cost float(10,2), actcount float(10,2), fillin date, PRIMARY KEY (id) ); CREATE TABLE disbursements ( id int(11) DEFAULT '0' NOT NULL auto_increment, matterid int(11), disdesc varchar(30), discost float(10,2), fillin date, PRIMARY KEY (id) ); Thanks in advance. Yours, Lauri -- Tharapita Creations [dynamic web applications] [EMAIL PROTECTED] Mobile: +372 53 410 610 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calendar - loop 365 times?
Hello there, I have a task to modify a quite problematic calendar that wasn't created by me -- currently only weeks and months are shown (for that, all days of the week/month are looped through). For every day, 7 queries are done -- one for each table (there are different tables for weekly, monthly, annually etc recurring events). When there is an event for that day in a particular table, then the DetailsID will be returned and the details table will be queried about closer information regarding the event (time, name, desc etc). I don't really think that looping though the entire year would be such a wise idea (that would be 365 * 7 queries sent to mySQL database). Can you think of an alternative? The queries are as shown below. /// nr. 1 SELECT CalendarDetailsID FROM phpCalendar_Daily WHERE ".$LocQuery." AND Active = '1' AND ( ('$queryDate' = StartDate AND StopDate = '-00-00') OR (StopDate != '-00-00' AND '$queryDate' BETWEEN StartDate AND StopDate) ) /// nr. 2 SELECT CalendarDetailsID FROM phpCalendar_Daily WHERE ".$LocQuery." AND Active = '1' AND ( ('$queryDate' = StartDate AND StopDate = '-00-00') OR (StopDate != '-00-00' AND '$queryDate' BETWEEN StartDate AND StopDate) ) /// nr. 3 SELECT CalendarDetailsID, DaysOfWeek FROM phpCalendar_Weekly WHERE ".$LocQuery." AND Active = '1' AND ( ('$queryDate' >= DisplayStart AND DisplayStop = '-00-00') OR (DisplayStop != '-00-00' AND '$queryDate' BETWEEN DisplayStart AND DisplayStop) ) /// nr. 4 SELECT CalendarDetailsID FROM phpCalendar_Monthly WHERE ".$LocQuery." AND Active = '1' AND DayOfMonth = '$q' AND ( ('$queryDate' >= DisplayStart AND DisplayStop = '-00-00') OR (DisplayStop != '-00-00' AND '$queryDate' BETWEEN DisplayStart AND DisplayStop) ) /// nr. 5 SELECT CalendarDetailsID FROM phpCalendar_Yearly WHERE ".$LocQuery." AND Active = '1' AND DayOfMonth = '$q' AND Month = '$Month' AND ( ('$queryDate' >= DisplayStart AND DisplayStop = '-00-00') OR (DisplayStop != '-00-00' AND '$queryDate' BETWEEN DisplayStart AND DisplayStop) ) /// nr. 6 SELECT CalendarDetailsID, WeekDays FROM phpCalendar_PeriodicalMonthly WHERE ".$LocQuery." AND Active = '1' AND WeekNumber = '$numOfTodays' AND ( ('$queryDate' >= DisplayStart AND DisplayStop = '-00-00') OR (DisplayStop != '-00-00' AND '$queryDate' BETWEEN DisplayStart AND DisplayStop) ) /// nr. 7 SELECT CalendarDetailsID, WeekDays FROM phpCalendar_PeriodicalYearly WHERE ".$LocQuery." AND Active = '1' AND WeekNumber = '$numOfTodays' AND Month = '$Month' AND ( ('$queryDate' >= DisplayStart AND DisplayStop = '-00-00') OR (DisplayStop != '-00-00' AND '$queryDate' BETWEEN DisplayStart AND DisplayStop) ) Are there any wiser ways to solve this instead of making 2555 queries per time the calendar will be requested by a visitor??? TIA Yours, Lauri -- Tharapita Creations [dynamic web applications] [EMAIL PROTECTED] Mobile: +372 53 410 610 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CMS -- central module handling
Hello there, I'm seriously researching some aspects of writing a content management system that would be 'relatively' easy to extend. My biggest problem is the ground level -- how should the central system (that registers modules) work? Ideally, it should be possible to easily extended the system -- running the install.php file (or something similar) will tell (insert new database rows or will add new rows to the configuration file) the central module that a new module was just added and also gives instructions, how to use it, with which other modules it integrates and where the new files are. The basic idea is that modifications to existing files (modules) shouldn't be made (except the central module, which handles all others). Each module should be totally *independent*, but should still integrate with the rest of the modules (when marked as possible in the database). What I mean by 'integrate' is the following: there are two modules, for example, "image gallery" and "articles". Both of them should appear in "What's new" part (when the appropriate checkbox will be checked). Also, it would be nice when one could choose the option "Publish to articles" when inserting a new image gallery (a client event for example -- story in pictures). Yes, that's a simplified example. So, the problem is that there might only be the "article" module at first. Later, the "articles" and "What's new" module will be added and all three of them should now work together. I hope you catch my drift. I have quite a few ideas, but I'm sure that our team is just re-inventing the wheel. What are your experiences? Are there any good books on the subject of creating an extendable content management system (preferably from the coders point of view, but not language-specific). Thanks, Lauri -- Tharapita Creations [server-client web applications] [EMAIL PROTECTED] Mobile: +372 53 410 610 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP editor for windows
> www.editplus.com I second this recommendation! Really good program. Thanks, Lauri -- Tharapita Creations [server-client web applications] [EMAIL PROTECTED] Mobile: +372 53 410 610 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PayPal: Instant Payment Notification
Hello there, Has anybody worked with PayPal's Instant Payment Notification? How exactly does it work -- will the payer ever go to PayPal's site itself (and leave my site for a sec) or will all contact with PayPal's servers be handled by my script? I have to write a system that enables payments via this service, but I'm low on documentation and this service is a new one for me. An overview of the process and pointers would be great! Thanks, Lauri -- Tharapita Creations [server-client web applications] [EMAIL PROTECTED] Mobile: +372 53 410 610 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading files in Russian? (urgent)
Hello there, I'm having quite a few problems at the moment. The story is as follows. The designer created 14 HTML files. That includes two language versions (so basically there are only 7 different files... the rest are same files in a different language). One language is English, the second one is Russian. I have to embed some PHP code so all the submitted data would go into the database. I have never dealt Russian webpages before. My problem is that the designer uploaded the files and the texts were already in Russian before. Now, I did my modifications and uploaded the file. The forms worked like charm, but the text looked completely different from what there was before (I don't speak Russian myself, but one could easily see that it wasn't the original text any more). Then I did another test. I downloaded a file, where the text was in Russian, from the server and uploaded the *exactly* same file again. I stood there astonished -- the text changed again. This time, I made no modifications, whatsoever. Does anybody have any ideas? Do I need to install Russian language packs on my computer? Do I need to pass a header in PHP, which would define the charset to use? Anything else? Which encoding to use (currently: )? Please let me know of your thoughts. Thanks, Lauri -- Tharapita Creations [dynamic web applications] [EMAIL PROTECTED] Mobile: +372 53 410 610 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] (htaccess) not letting php to parse
Hi there, I would prefer to take away the possibility for PHP to parse my documents in the /uploaded/ directory. What has to be written into the .htaccess file for PHP *not* to parse *anything* therein (not .php, not .phtml, not .html, not .php3, not .blah... in a word -- NOTHING). It would be very bad when somebody could upload malicious code to my server, wouldn't it! Thanks! Lauri -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Can Anyone translate my script to php?
Hi Ceyhun > http://www.akademihastanesi.com.tr/kocak/resimgoster.php > look here > I have tried to do it but notting happens? Open that page in your browser and 'View source'. You don't seem to have PHP enabled on your server. Yours, Lauri -- Tharapita Creations [dynamic web applications] [EMAIL PROTECTED] Mobile: +372 53 410 610 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Russian encoding problems
Hello, I have some problems related to a site in Russian (I don't speak Russian myself, so I can't consult tutorials in Russian). The encoding, passed via HTML, is koi8-r. Then the form will be submitted and PHP will send out an e-mail with the encoding koi8-r. Everything seems to work fine now, but there are problems with data from the <.SELECT> boxes. The e-mail response. Comments marked with "//": START Kliendi info: Nimi: óÉÍÂÅÒÇ íÁÒÉÎÁ Telefon: óÉÍÂÅÒÇ íÁÒÉÎÁ E-post: simberg@.com Päring: Kategooria: òóð // should be "ÔÕÒ" Sihtpunkt: óÉÍÂÅÒÇ íÁÒÉÎÁ Lähtepunkt: ðÞÊÊÕÌÌ // should be "ôÁÌÌÉÎÎ" Kuupäevad: óÉÍÂÅÒÇ íÁÒÉÎÁ Lisatingimused: óÉÍÂÅÒÇ íÁÒÉÎÁ END ** The form itself lies at http://www.sputnik.ee/new/vorm_4_rus.php Thanks, Lauri -- Tharapita Creations [dynamic web applications] [EMAIL PROTECTED] Mobile: +372 53 410 610 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PDF print page creation...
Hello, A client requested a script to create a page to print out the list of clients that are subscribed to a chosen service. This list will be printed and then faxed to an outer source because that's how the second company that oursources the service requests it. The present script creates a HTML page with an image, text and a few tables. The problem with the HTML page is that the browser prints the web address of the script to the lower left corner of the sheet (and also things like "Page 1 from 1"). The PDF is meant to eliminate it all. How complex would it be to code this script to generate the PDF file. How much time would it take to make a PDF creator based on existing script that gets the data out of the database? Remember, the PDF would have to contain tables and a logo as well (image). The text has to be positioned and aligned as requested by the client. So my questions: 1. How hard would it be to create such a script? 2. How much time would it take? (any common pitfalls that could make coding time longer?) 3. What are the best classes/wrappers out there to handle the job? 4. Or would it be better to get a HTML to PDF converter (do such things exist and do they do a good job?) Thanks in advance! Yours, Lauri -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Writing "xxx" OR "yyy" with a regular expressions`?
Hello there, I need to write all of the href="" contents into an array. Presently I use the following code, which works like charm: <.CODE>preg_match('!HREF=[\"\' ]{0,}([^\"\'>]*)[\"\'>]!i', $Content, $reg_array)<./CODE> That, however, doesn't support Frames so I would need to make the script match "HREF" or "SRC". I tried the following code, but it doesn't want to support frames and ceases to support usual HREF's as well. <.CODE>preg_match('!(HREF|SRC)=[\"\' ]{0,}([^\"\'>]*)[\"\'>]!i', $Content, $reg_array)<./CODE> In other words I replace <.CODE>HREF<./CODE> with <.CODE>(HREF|SRC)<./CODE>. Any ideas how to make the script support both? Yours, Lauri -- Tharapita Creations [dynamic web applications] [EMAIL PROTECTED] Mobile: +372 53 401 312 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Fulltext-Search
Hello Martin, At 10:13 PM 12/23/2001 +0100, Martin wrote: >Hello! Does anybody know a good script to search the own web-server?! >Would be nice if the script could display the whole sentence where the >word was found... If you want to have more hands on fun then check out the following class/how-to: http://www.evolt.org/article/Boolean_Fulltext_Searching_with_PHP_and_MySQL/18/15 665/index.html Yours, Lauri -- Tharapita Creations [dynamic web applications] [EMAIL PROTECTED] Mobile: +372 53 410 610 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] File uploading?
Hello everybody, I'm trying to do a file upload from the users computer via HTML file form element to a Linux server running Apache. The file is selected by the user from her or his computer, they hit the submit button and the file goes to /print/ folder (dir relative to uploading script on the server). I use the following code: /**Upload'i file*/ function upload($file) { $name = split("",$file); // Get filename $name = end($name); $fd = fopen($file, "w+");/*BTW, this is line 12 */ $filedata = addslashes(fread($fd, filesize($pilt))); fputs("/print/$name", stripslashes($filedata)); fclose($fd); /*copy($file,"print/".$name); Kopeeri fail kausta fputs($fp, $header); fclose($fp); unlink($file);*/ return $name; } /**Upload'i file*/ I get the following error code: / ERROR */ Warning: fopen("C:\\Data\\Lauri\\Selja_seadused.doc","w+") - Permission denied in /home/saue/public_html/oigusaktid/funktsioonid.php3 on line 12 Warning: Supplied argument is not a valid File-Handle resource in /home/saue/public_html/oigusaktid/funktsioonid.php3 on line 13 Warning: Supplied argument is not a valid File-Handle resource in /home/saue/public_html/oigusaktid/funktsioonid.php3 on line 14 Warning: Supplied argument is not a valid File-Handle resource in /home/saue/public_html/oigusaktid/funktsioonid.php3 on line 15 / ERROR */ Thanks for your help in advance! Yours truly, Lauri -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]