Re: [PHP] PHP Command Line Scripts 'Aborting' at end ...
* Thus wrote Marc G. Fournier: Note that the following is based on php installed via the FreeBSD ports system ... I'm getting a core file, but if I try: gdb /usr/local/bin/php php.core ... its definitely not looking good: s# gdb /usr/local/bin/php php.core ... Core was generated by `php'. Program terminated with signal 6, Abort trap. Reading symbols from /usr/lib/libcrypt.so.2...done. Reading symbols from /usr/lib/libm.so.2...done. Reading symbols from /usr/lib/libc.so.4...done. Reading symbols from /usr/local/lib/php/20020429/interbase.so...done. Reading symbols from /usr/local/firebird/lib/libfbembed.so.1...Deprecated bfd_read called at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb/gdb/dwarf2read.c line 3049 in dwarf2_read_section Error while reading shared library symbols: Dwarf Error: Cannot handle DW_FORM_strp in DWARF reader. Reading symbols from /usr/lib/libncurses.so.5...done. Error while reading shared library symbols: ì: No such file or directory. Error while reading shared library symbols: ynamic: No such file or directory. Segmentation fault (core dumped) Interesting core dump :) Try running php directly from gdb instead of reading the core file: % gdb /usr/loca/bin/php ... run script.php ... bt See if that produces a better backtrace. mod_php4 appears to work fine, just the command line version seems to be off ... and its running, producing expected output, its just that last 'Abort' that tends to screw things up a bit ... My bet is you have a buggy library somewhere, ncurses being a viable candidate since it does not get loaded in mod_php4. Curt -- Quoth the Raven, Nevermore. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] output htmkl file as text
* Thus wrote Jerry Swanson: I want to output html file on the screen like text not like html file. I want a program to read html file and output source code to the screen. Any ideas how to fake browser, so browser will print html tags on the screen? By default php will send a header: Content-Type: text/html; charset=iso-8859-1 To the browser, so it will render the contents as html. You can override that by using the header() function sending: Content-Type: text/plain; charset=iso-8859-1 Then you can display html and the html will get displayed as if you were looking at it in notepad. Curt -- Quoth the Raven, Nevermore. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] required help on mail function
Dear friend, I am using PHP 4.3.4 version. Please tell how to unpload a mail function. Error comes on executing mail function is mail(): SMTP server response: 550 5.7.1 Unable to relay for [EMAIL PROTECTED] in C:\Program Files\Apache Group\Apache2\htdocs\testprodigious\MAIL\mail_enquiry.php on line 30 Scprit used is ? /* recipients */ $to = [EMAIL PROTECTED]; /* subject */ $subject = Automatic Weekly Reports of Marketing from Prodigious; /*making message body */ $message =Wekly Reprot; /* To send HTML mail, you can set the Content-type header. there header are nessare for maing table in php and even for html pahe without these header only script will send in mail no brwser look*/ $headers = MIME-Version: 1.0\r\n; $headers .= Content-type: text/html; charset=iso-8859-1\r\n; /* and now mail it */ mail($to, $subject, $message,$headers ); ? I will be grateful to you. With Best Regards `.(*.(`. .).*).` ..Er. Kunal Aggarwal .. `.(.*(. `.)*.).` Software Engineer ICL Certifications Limited 372, Industrial Area Phase 1 Panchkula Haryana India Voice Talk:-+91-98159-65988(Mobile), +91-0172-2563358 (Office) * 24, +91-0172-2563358 (Fax) Email: [EMAIL PROTECTED] Website: www.iclcertifications.com
Re: [PHP] Problem with Regular expression
* Thus wrote kioto: Hi all. I have a problem: i want subs any characters from a string but i don't have fix the problem. The string that i want to manipulate is the value from a text field of a search engine. The characters that i want to try substitute is , , +, -, |, ||, or, and, not in not case-sensitive mode with . I have create a pattern like this: $str = Sybase and PHP not ASP or JSP Oracle not Andy | Perl || Python + Ruby; $pattern = /(\band\b)|(\bnot\b)|(\bor\b)|(\b\b)|(\b\b)|(\b\.\b)|(\b\+\b)|(\b\|\|\b)|(\b\|\b)/i; echo $str = preg_replace($pattern, , $str, -1); But characters like + don't subs with . Thanks to all and sorry my bad language thats because + | are word boundaries. Also, you have to many sub patterns, you dont need all the () around each item, wrap the whole expression in (). And finally, you dont take into consideration of spaces, around each item you have a space so you'll end up with two spaces between each word. Your final expression should be: $pattern = /\s*(\band\b|\bnot\b|\bor\b|||\b\.\b|\+|\|\||\|)\s*/i; And replace all that with one space: $str = preg_replace($pattern, ' ', $str); HTH, Curt -- Quoth the Raven, Nevermore. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] required help on mail function
* Thus wrote kunal Aggarwal: Dear friend, I am using PHP 4.3.4 version. Please tell how to unpload a mail function. Error comes on executing mail function is mail(): SMTP server response: 550 5.7.1 Unable to relay for [EMAIL PROTECTED] in C:\Program Files\Apache Group\Apache2\htdocs\testprodigious\MAIL\mail_enquiry.php on line 30 google: 550 smtp Curt -- Quoth the Raven, Nevermore. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Php 4 and Php 5 on same box
Hi List, I have php 4 running all ok on a freebsd box installed from ports. What I would like to do is install php5 with all modules so's not to over right the php4 install and tell my users that they can test their scripts against the new php5 by including the path to php5 in their scripts before I make it the main php running on my box. I would really appreciate a simple (no brainer) set of steps to achieve this I ask the clever guys here to offer their pearls of wisdom. I thank anyone who helps with this fully in advance. Dave C -- UK Web Hosting @ http://www.ephgroup.com --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.783 / Virus Database: 529 - Release Date: 25/10/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php 4 and Php 5 on same box
The solution depends on the Webserver you are using, i think for Apache2.x there should be no big problem at all to use php4 and php5 concurrently - just search the web. For Apache1.3.x you can look here: http://www.schlitt.info/applications/blog/archives/83_How_to_run_PHP4_and_PHP_5_prallel.html I use for my Apache 1.3 Testserver a really simple solution: - PHP4 is installed as a module - PHP5 is compiled as CGI this is my php5 config: './configure' '--with-zlib' '--with-bzip' '--with-gd' '--enable-force-cgi-redirect' '--prefix=/usr/local/php5' '--enable-bcmath' '--enable-calendar' '--enable-ctype' '--enable-dbase' '--enable-discard-path' '--enable-exif' '--enable-filepro' '--enable-ftp' '--enable-gd-imgstrttf' '--enable-gd-native-ttf' '--enable-inline-optimization' '--enable-magic-quotes' '--enable-mbstr-enc-trans' '--enable-mbstring' '--enable-mbregex' '--enable-memory-limit' '--enable-safe-mode' '--enable-shmop' '--enable-sigchild' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid' '--enable-versioning' '--enable-wddx' '--with-bz2' '--with-dom=/usr/include/libxml2' '--with-ftp' '--with-gdbm' '--with-gettext' '--with-gmp' '--with-jpeg-dir=/usr' '--with-mcal=/usr' '--with-mcrypt' '--with-mhash' '--with-mysql=/usr' '--with-ndbm' '--with-png-dir=/usr' '--with-tiff-dir=/usr' '--with-ttf' '--with-freetype-dir=yes' '--with-xml' '--with-xpm-dir=/usr/X11R6' '--with-zlib=yes' '--with-qtdom=/usr/lib/qt3' '--with-gd' '--with-openssl' '--with-curl' '--enable-xslt' '--with-xslt-sablot' '--with-iconv' '--with-mm' '--enable-dba' Both PHP versions reside in different directories and use different php.ini's. To use PHP5 i simply put a .htaccess file like this in the root of the php5-project-directory: Action php5-script /cgi-php5/php AddHandler php5-script .php Options +ExecCGI Additionally i added this directive to my apache httpd.conf: ScriptAlias /cgi-bin/ /srv/www/cgi-bin/ ScriptAlias /cgi-php5/ /usr/local/php5/bin/ Directory /usr/local/php5/bin Options +ExecCGI Allow From All /Directory for my testenvironment, this works good enough. Dirk Am Donnerstag, 28. Oktober 2004 09:26 schrieb Dave Carrera: Hi List, I have php 4 running all ok on a freebsd box installed from ports. What I would like to do is install php5 with all modules so's not to over right the php4 install and tell my users that they can test their scripts against the new php5 by including the path to php5 in their scripts before I make it the main php running on my box. I would really appreciate a simple (no brainer) set of steps to achieve this I ask the clever guys here to offer their pearls of wisdom. I thank anyone who helps with this fully in advance. Dave C -- UK Web Hosting @ http://www.ephgroup.com --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.783 / Virus Database: 529 - Release Date: 25/10/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Validation and session variables
I guess my resolution was a fluke. Recap: Adding validation kills my session variables Now I tested a few things, SID is consistent across pages, so a new sid and cookie are not being generated. Perhaps it's a bug, Im on PHP 4.3.8 Here is the code again, perhaps something will jump out. ?php //Start the Session - begin Block @session_start(); header(Cache-control: private); //Connection statement require_once('Connections/x.php'); //Aditional Functions require_once('includes/functions.inc.php'); //load the tNG classes require_once('tNG/KT_tNG.inc.php'); restrictAccessToPage($,'x','AccessDenied.php','SignUp','SignUpID','Username','password','level',false,array()); ? ?php require_once(WA_ValidationToolkit/WAVT_Scripts_PHP.php); ? ?php require_once(WA_ValidationToolkit/WAVT_ValidatedForm_PHP.php); ? ?php if (isset($_POST[Submit])) { $WAFV_Redirect = ; $_SESSION['WAVT_page1'] = ; if ($WAFV_Redirect == ) { $WAFV_Redirect = $_SERVER[SCRIPT_NAME]; } $WAFV_Errors = ; $WAFV_Errors .= WAValidateAN(((isset($_POST[ListingName]))?$_POST[ListingName]:) . ,true,true,true,true,,true,1); $WAFV_Errors .= WAValidatePN(((isset($_POST[AltP1]))?$_POST[AltP1]:) . ,false,false,false,2); $WAFV_Errors .= WAValidatePN(((isset($_POST[AltP2]))?$_POST[AltP2]:) . ,false,false,false,3); $WAFV_Errors .= WAValidatePN(((isset($_POST[Pgr]))?$_POST[Pgr]:) . ,false,false,false,4); $WAFV_Errors .= WAValidateEM(((isset($_POST[El2]))?$_POST[El2]:) . ,false,5); $WAFV_Errors .= WAValidateEM(((isset($_POST[El3]))?$_POST[El3]:) . ,false,6); if ($WAFV_Errors != ) { PostResult($WAFV_Redirect,$WAFV_Errors,page1); } } ? ?php if ($_SERVER[REQUEST_METHOD] == POST) { Header ('Location: http://www.xx.com/page2.php?'.SID); } ? I just set an echo on page2 and page3 of the first session variable 'listingname'. If I have the validation code in page1 , it doesn't even make it to page2 I'm really sorry for posting this again. Maybe it's a bug or I'm posting my variables wrong or Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php mail help
I have php installed on my PC as well as an apache webserver and mysql. I am using cox.net as my cable internet provider. They block port 25 but I do not know if that affects what I am trying to do... which is: use the mail() function to send email for my user activation script. I am trying to test everything for my website on my computer before I pay for hosting. When I run the registration script I get this: Warning: mail(): sendmail_from not set in php.ini or custom From: header missing in C:\Program Files\Apache Group\Apache2\htdocs\campushotties\reghandle2.php on line 137 now the funny thing is i have the following code in my php.ini file: [mail function] ; For Win32 only. SMTP = smtp.east.cox.net smtp_port = 25 ; For Win32 only. sendmail_from = [EMAIL PROTECTED] from the error message one would think that the email would be delivered but with a bad From address field. However, nothing is delivered. I also tried switching the smtp_port to port 26.. that didnt work either. Thanks for any help, Pat
[PHP] Re: php mail help
*cough*quotes*cough* Patrick E Phillips wrote: I have php installed on my PC as well as an apache webserver and mysql. I am using cox.net as my cable internet provider. They block port 25 but I do not know if that affects what I am trying to do... which is: use the mail() function to send email for my user activation script. I am trying to test everything for my website on my computer before I pay for hosting. When I run the registration script I get this: Warning: mail(): sendmail_from not set in php.ini or custom From: header missing in C:\Program Files\Apache Group\Apache2\htdocs\campushotties\reghandle2.php on line 137 now the funny thing is i have the following code in my php.ini file: [mail function] ; For Win32 only. SMTP = smtp.east.cox.net smtp_port = 25 ; For Win32 only. sendmail_from = [EMAIL PROTECTED] from the error message one would think that the email would be delivered but with a bad From address field. However, nothing is delivered. I also tried switching the smtp_port to port 26.. that didnt work either. Thanks for any help, Pat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] urlencode and google search query
On Thu, Oct 28 2004 - 00:31, Marek Kilimajer wrote: I meant get parameters to google: http://www.google.com/search?q=helpie=utf-8oe=utf-8 you need to change ie parameter ^^ to whatever encoding you are using. yepee ! finally got it. so the tweak was : * don't use urlencode() * add ie=utf-8oe=utf-8 thanks a lot ! -- ,-- This mail runs -. ` NetBSD/i386 --' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Validation and session variables
See in-line comments... -Original Message- From: Stuart Felenstein [mailto:[EMAIL PROTECTED] Sent: 28 October 2004 08:54 To: [EMAIL PROTECTED] Subject: [PHP] Validation and session variables I guess my resolution was a fluke. Recap: Adding validation kills my session variables Now I tested a few things, SID is consistent across pages, so a new sid and cookie are not being generated. Perhaps it's a bug, Im on PHP 4.3.8 Here is the code again, perhaps something will jump out. ?php //Start the Session - begin Block @session_start(); header(Cache-control: private); [snip] if ($WAFV_Errors != ) { PostResult($WAFV_Redirect,$WAFV_Errors,page1); } I think we need to know what happens when this function returns the user to the script upon finding an error. Are all the form field values passed back? Does it do anything at all with the session? Does it pass the SID? } ? ?php if ($_SERVER[REQUEST_METHOD] == POST) { Header ('Location: http://www.xx.com/page2.php?'.SID); } ? I just set an echo on page2 and page3 of the first session variable 'listingname'. If I have the validation code in page1 , it doesn't even make it to page2 Are you saying that page1 always fails validation even if you enter all the form fields correctly? If so then something is most likely wrong with the validation code. Double check all the validation steps. Graham -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] bless function: a better aproach
Curt Zirzow wrote: * Thus wrote Francisco M. Marzoa Alonso: Giving it a round, this seems to be a better aproach than the previous one. It has the advantage of provide direct access to the original array obtained from casting without boring about ___FAKE_KEYS_. ? ... $Obj = new TestClass (); //$Clone = (array) $Obj; $Clone = obj2array ( $Obj ); I still dont see why a simple: $obj = new TestClass(); $data = serialize($obj); $Clone = unserialize($data); Cant doesn't work for you. ah so that what the OP is trying to do! -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Validation and session variables
--- Graham Cossey [EMAIL PROTECTED] wrote: I think we need to know what happens when this function returns the user to the script upon finding an error. Are all the form field values passed back? Doesn't seem that they are. I tripped an error on page1 , had an echo set for the first session variable. The page popped back with my errors, but no session variable. But! maybe that is tied into what I said towards the end of my last thread. All page1 has is: input name=ListingName type=text id=ListingName maxlength=20 / The session variable isn't posted until page2: $_SESSION['f1a'] = $_POST['ListingName']; Does it do anything at all with the session? Does it pass the SID? It's passing the SID yes. SID number remains consistent. I am not checking the /tmp file though. I'll assume at this point it's at 0kb Are you saying that page1 always fails validation even if you enter all the form fields correctly? No not at all. Validaton works fine. Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Validation and session variables
--- Graham Cossey [EMAIL PROTECTED] wrote: I think we need to know what happens when this function returns the user to the script upon finding an error. Are all the form field values passed back? Does it do anything at all with the session? Does it pass the SID? I want to append my previous message. Page 1 is not showing a SID. Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Validation and session variables
On Thursday 28 October 2004 09:24, Stuart Felenstein wrote: --- Graham Cossey [EMAIL PROTECTED] wrote: I think we need to know what happens when this function returns the user to the script upon finding an error. Are all the form field values passed back? Does it do anything at all with the session? Does it pass the SID? I want to append my previous message. Page 1 is not showing a SID. I think what you really need to do is: go back to square one, rewrite your code putting in the absolute barest minimum that will illustrate your problem. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* It is not best to swap horses while crossing the river. -- Abraham Lincoln */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Q re: php-5.0.2 ./configure --with-soap --with-openssl --with-tidy (copy)
Curt Zirzow wrote: * Thus wrote Bill McCuistion: Q re: php-5.0.2 ./configure --with-soap --with-openssl --with-tidy Hello all. Hoping for some direction with the above step. Have PHP-5.0.2 and can configure the soap and openssl options, but when I add the tidy option, the operation stops with the following message. -- checking for TIDY support... yes -- configure: error: Cannot find libtidy I have of course gotten the latest tidy source (1.1) from sourceforge, but don't understand what to do with it. The rpm doen't seel to load the libtidy as I was hoping it would. Further to my confusion, the PHP docs speak to using tidy 2.0 with PHP5, but can not locate any other refs to tidy 2.x) I've never have used the rpm for tidy, but in general it should in theory install libtidy in either /usr/lib or /usr/local/lib so you'll need to configure php like: ./configure --with-tidy=/usr or ./configure --with-tidy=/usr/local If that doesn't work, then the rpm may not have installed the libtidy. As for the tidy 2.x reference, that is referencing php's interface to tidy: tidy 1.0: for php4.x tidy 2.0: for php5.x Both tidy's use the same libtidy, it is just that 2.0 includes the new OO interface that PHP5 provides. Curt Curt, Thanks for the reply. The rpm I found only contains tidy src files. I seem to have the chicken and egg problem. How do I make a libtidy that PHP will be satisfied with? I would prefer to use the PHP5 OO interface. Following is the command sequence showing my dilema... [EMAIL PROTECTED] tidy]# pwd /usr/src/tidy [EMAIL PROTECTED] tidy]# rpm -i tidy-20030525-1.src.rpm warning: user hany does not exist - using root warning: group hany does not exist - using root warning: user hany does not exist - using root warning: group hany does not exist - using root warning: user hany does not exist - using root warning: group hany does not exist - using root [EMAIL PROTECTED] tidy]# ls bin package.xml tidy tidy-1.1 tidy-1.1.tar tidy-20030525-1.src.rpm tidy_docs.tar tidy_linux_x86.tar [EMAIL PROTECTED] tidy]# tar -xvf tidy-1.1.tar [EMAIL PROTECTED] tidy]# cd tidy-1.1 [EMAIL PROTECTED] tidy]# phipize [EMAIL PROTECTED] tidy-1.1]# ls acinclude.m4config.guess config.nice CREDITS install-sh Makefile.global php_tidy.h TODO aclocal.m4 config.h.in config.subdoit.libtidy.sh *.loT Makefile.objects README autom4te.cache config.logconfigure examples ltmain.sh missing tests build config.m4 configure.in include Makefile.fragments mkinstalldirs tidy.c [EMAIL PROTECTED] tidy-1.1]# ./configure checking build system type... i686-redhat-linux-gnu checking host system type... i686-redhat-linux-gnu checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking whether gcc and cc understand -c and -o together... yes checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking for PHP prefix... /usr/local checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20040412 checking for re2c... exit 0; checking for gawk... gawk checking for TIDY support... yes, shared configure: error: Cannot find libtidy Perhaps I've gotten something in my system (besides myself) horribly confused or am completely on the wrong path. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Regular expressions Q
Hi All I'm trying to achieve the following: In a text string there may be a number of substrings that match my criteria. I need to retrieve all of them. This is what I have so far and works perfect for the first substring but ignores the possibility of others. I need to know if there are more in the string that match and if so need to have those. ereg((([[:blank:]+]|^)[09][0-9][4789][0][0-9]{3}[abcABC]?),$zn[1],$zaakn ummers1); I thought that ereg would get all of them and store them in the array $zaaknummers1 however this is not the case PHP 4.3.4 What am I doing wrong here? THX Jack
Re: [PHP] Regular expressions Q
ereg((([[:blank:]+]|^)[09][0-9][4789][0][0-9]{3}[abcABC]?),$zn[1],$zaakn ummers1); I thought that ereg would get all of them and store them in the array $zaaknummers1 however this is not the case I just asked a question similar to this the other day. Try using; preg_match_all((([[:blank:]+]|^)[09][0-9][4789][0][0-9]{3}[abcABC]?), $zn[1], $zaaknummers1); alex hogan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Add spaces to a string
How to add a specified number of spaces to a string I use this but won't work if $spaces is less than the length of the $string $string = bla bla bla; $spaces = 5; $string = str_pad($string, $spaces, ); Thanks in advance for your help
Re: [PHP] Add spaces to a string
On Thu, 2004-10-28 at 09:32, Phpu wrote: How to add a specified number of spaces to a string I use this but won't work if $spaces is less than the length of the $string $string = bla bla bla; $spaces = 5; $string = str_pad($string, $spaces, ); Assuming you don't want padding since the above doesn't generate what you want... try the following: $string = bla bla bla; $spaces = 5; $string .= str_repeat( ' ', 5 ); Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regular expressions Q
Thx, Just joined today, should have looked thru the archives first though. Jack -Original Message- From: Alex Hogan [mailto:[EMAIL PROTECTED] Sent: Thursday, October 28, 2004 3:31 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Regular expressions Q ereg((([[:blank:]+]|^)[09][0-9][4789][0][0-9]{3}[abcABC]?),$zn[1], $zaakn ummers1); I thought that ereg would get all of them and store them in the array $zaaknummers1 however this is not the case I just asked a question similar to this the other day. Try using; preg_match_all((([[:blank:]+]|^)[09][0-9][4789][0][0-9]{3}[abcABC]?), $zn[1], $zaaknummers1); alex hogan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] access database best pratice
I have a client who wants to update their access database that sits on their XP/IIS box. I plan on using PHP/ODBC connection to do this, however I am not up-to-speed on pitfalls or best pratices concerning access and odbc over the web or if I should suggest a better course of action, since I am more familiar with point to point secure frame connections and MQ messaging for trasactional security. Theres no such thing as a problem unless the servers are on fire! - Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish.
Re: [PHP] Protecting Commercial PHP Scripts
Hi Dirk, I found this one very usefull: http://shiflett.org/php-security.pdf Nice docu *g* Does someone use this code out from the docu mentioned aboved ? It work's for me only under Explorer, Netscape switch to exit. # # Verify HTTP Header # if (isset($_SESSION['HTTP_USER_AGENT'] )) { if ($_SESSION['HTTP_USER_AGENT'] != md5($SERVER['HTTP_USER_AGENT'])) { exit; } } else { $_SESSION['HTTP_USER_AGENT'] = md5($_SERVER['HTTP_USER_AGENT']); } -- Best Regards, Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and send XML
Hi, I'm trying to pass XML file from Site A to Site B for Site B to parse. Site B is maintained by other company, so I only need to worry about sending over the XML file. I've been hinted that fsockopen() can do the job. I've done the following through PHP: $port=80; $host=134.134.134.134 $data= POST /folder1/ HTTP/1.0 Host: 134.134.134.134 User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) Content-Type: application/x-ddif Content-Length: 301 blabla version100/version securityTYPE1/security authrq tsclient20041028065058:534Pacific Daylight TimeBR/tsclient appid/appid appverappver /authrq profrq localeen_CA/locale /profrq /blabla then i wrote in PHP. fclose($f); $result=; echo $f=fsockopen($host,$port, $errno, $errstr, 30); fputs($f,$msg,$data); while (!feof($f)) $result.=fread($f,32000); fclose($f); echo $result; Since I still do not have the HOST info. on site B. I'm doing testing by setting the $host to be my own site (ie, Site A's) host ip. Right now when I execute the code, the page just keeps on running and nothing shows up.. Is this how it's suppose to behave? Thanks a lot. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Protecting Javascript via PHP
Hey, I have been searching around the web for a way to mangle my javascript code the way some people do it to HTML/PHP etc so its not so easy to read. There is no sure way to do it and if a person is REALLY determined to get to your code...he can, but I would like that person to go through some extra effort before he gets to it... the idea being to have a tag like this: script language = JavaScript 1.2 src=javascript.php?some_parameter_here if the correct $some_parameter_here (or parameters) is passed then to output the codeif it can output the code only to another php script too it would be great... I have also been reading the doc at shiflett.org as the present question of protecting PHP scripts is kind of close to this, one problemno sessions can be used at all. The above is my idea in the rough..would anyone care to extend on it? just plain comments also welcome. Thanks, Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and send XML
I'm trying to pass XML file from Site A to Site B for Site B to parse. Site B is maintained by other company, so I only need to worry about sending over the XML file. I've been hinted that fsockopen() can do the job. if you have to do this I would suggest giving pear a try, no need to reinvent the wheel. http://pear.php.net/package/HTTP_Client -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Protecting Javascript via PHP
http://scriptasylum.com/tutorials/encdec/encode-decode.html is a good article on wasy to achieve this On Thu, 28 Oct 2004 16:24:24 +0200, Ryan A [EMAIL PROTECTED] wrote: Hey, I have been searching around the web for a way to mangle my javascript code the way some people do it to HTML/PHP etc so its not so easy to read. There is no sure way to do it and if a person is REALLY determined to get to your code...he can, but I would like that person to go through some extra effort before he gets to it... the idea being to have a tag like this: script language = JavaScript 1.2 src=javascript.php?some_parameter_here if the correct $some_parameter_here (or parameters) is passed then to output the codeif it can output the code only to another php script too it would be great... I have also been reading the doc at shiflett.org as the present question of protecting PHP scripts is kind of close to this, one problemno sessions can be used at all. The above is my idea in the rough..would anyone care to extend on it? just plain comments also welcome. Thanks, Ryan -- PHP General Mailing List (http://www.php.net/ ) To unsubscribe, visit: http://www.php.net/unsub.php -- [EMAIL PROTECTED] [EMAIL PROTECTED] http://www.battez.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Protecting Commercial PHP Scripts
* Thus wrote [EMAIL PROTECTED]: Hi Dirk, I found this one very usefull: http://shiflett.org/php-security.pdf Nice docu *g* Does someone use this code out from the docu mentioned aboved ? It work's for me only under Explorer, Netscape switch to exit. # # Verify HTTP Header # if (isset($_SESSION['HTTP_USER_AGENT'] )) { if ($_SESSION['HTTP_USER_AGENT'] != md5($SERVER['HTTP_USER_AGENT'])) { exit; } } else { $_SESSION['HTTP_USER_AGENT'] = md5($_SERVER['HTTP_USER_AGENT']); } If your using the same session for IE and netscape, the behaviour you are experiencing demonstrates how this can prevent session hijacking. Netscape, using its own session should work fine. Curt -- Quoth the Raven, Nevermore. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] trying 2 pull data out table and populate a list box
I am trying to pull all data out of a table called province which has 2 fields ProvinceID and Description respectively. Now I want to populate a list with all the data in the descriptions field. Many thanx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: required help on mail function
Hello, On 10/28/2004 03:34 AM, Kunal Aggarwal wrote: I am using PHP 4.3.4 version. Please tell how to unpload a mail function. Error comes on executing mail function is mail(): SMTP server response: 550 5.7.1 Unable to relay for [EMAIL PROTECTED] in C:\Program Files\Apache Group\Apache2\htdocs\testprodigious\MAIL\mail_enquiry.php on line 30 That means you need to authenticate to send the message. The mail() function does not support SMTP authentication. You may want to try this class that comes with a wrapper function named smtp_mail() that lets you specify the user name and password for authentication: http://www.phpclasses.org/mimemessage You also need these classes for performing the actual SMTP delivery and authentication: http://www.phpclasses.org/smtpclass http://www.phpclasses.org/sasl -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and send XML
Hello, On 10/28/2004 11:01 AM, Victor C. wrote: I'm trying to pass XML file from Site A to Site B for Site B to parse. Site B is maintained by other company, so I only need to worry about sending over the XML file. I've been hinted that fsockopen() can do the job. You may want to try this HTTP client class that lets you POST arbitrary HTTP request bodies and even comes with an example of how to do that ( test_http_soap.php ): http://www.phpclasses.org/httpclient BTW, if you want to compose XML documents for sending you may also want to try this other XML writer class: http://www.phpclasses.org/xmlwriter -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] https://...
You can find the exact $_SERVER var by checking the values printed by this loop: foreach ($_SERVER as $var = $value) { echo \$_SERVER[\{$var}\] = {$value}br; } Vail, Warren wrote: Depends on the server and the release, but my apache shows If($_SERVER[HTTPS] == on) // if true is secure Lots of other information like cypher key size, etc. Look in the $_SERVER array. Keep in mind that lots of servers are setup to use the same htdocs base directory for both secure and insecure pages, what happens if someone comes to your unsecured page using https? Another example is, if you have coded full urls for images, the browser will usually complain if the page is accessed via https and the image via http. Warren Vail -Original Message- From: Greg Donald [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 27, 2004 3:01 PM To: php-general Subject: Re: [PHP] https://... On Wed, 27 Oct 2004 16:35:14 -0500, Afan Pasalic [EMAIL PROTECTED] wrote: hi, how can I check using php that I use SSL? tried with REQUEST_URI HTTP_HOST PATH_INFO but any of these does show http:// phpinfo() describes my SSL stuff pretty well if that's what you mean. And I also found: http://marc.theaimsgroup.com/?l=php-generalm=109767486431095w=2
Re: [PHP] https://...
But keep in mind that the var containing the value (I think $_SERVER[HTTPS] is the right one) is only set when https:// is used... Vail, Warren wrote: Depends on the server and the release, but my apache shows If($_SERVER[HTTPS] == on) // if true is secure Lots of other information like cypher key size, etc. Look in the $_SERVER array. Keep in mind that lots of servers are setup to use the same htdocs base directory for both secure and insecure pages, what happens if someone comes to your unsecured page using https? Another example is, if you have coded full urls for images, the browser will usually complain if the page is accessed via https and the image via http. Warren Vail -Original Message- From: Greg Donald [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 27, 2004 3:01 PM To: php-general Subject: Re: [PHP] https://... On Wed, 27 Oct 2004 16:35:14 -0500, Afan Pasalic [EMAIL PROTECTED] wrote: hi, how can I check using php that I use SSL? tried with REQUEST_URI HTTP_HOST PATH_INFO but any of these does show http:// phpinfo() describes my SSL stuff pretty well if that's what you mean. And I also found: http://marc.theaimsgroup.com/?l=php-generalm=109767486431095w=2
Re: [PHP] trying 2 pull data out table and populate a list box
you mean: $query = SELECT ProvinceID, Description FROM province ORDER BY Description ASC ; $result = @mysql_query ($query, $connection) or die (mysql_error()); while ($row = @mysql_fetch_array($result)) { $options .= option value='{$row[ProviceID]}'{$row[Description]}/option\n; } $selectBox = select name='Provinces'\n . $options . /select\n; echo $selectBox; You can also set the selected item by using: $query = SELECT ProvinceID, Description FROM province ORDER BY Description ASC ; $result = @mysql_query ($query, $connection) or die (mysql_error()); $selectedID = 1; while ($row = @mysql_fetch_array($result)) { $options .= option value='{$row[ProvinceID]}'; if ($row[ProvinceID] == $selectedID) { $options .= selected; } $options .= {$row[Description]}/option\n; } $selectBox = select name='Provinces'\n . $options . /select\n; echo $selectBox; Garth Hapgood - Strickland wrote: I am trying to pull all data out of a table called province which has 2 fields ProvinceID and Description respectively. Now I want to populate a list with all the data in the descriptions field. Many thanx
Re: [PHP] https://...
Hi Robby, Yes, I looked at SERVER_PORT/SERVER_PROTOCOL. What I got is 80 and HTTP/1.1 when I manually change http:// to https:// I'm getting 443 and HTTP/1.1 I am not so good in this: you want to say that SSL use 443 port -afan Robby Russell wrote: On Wed, 2004-10-27 at 16:35 -0500, Afan Pasalic wrote: hi, how can I check using php that I use SSL? tried with REQUEST_URI HTTP_HOST PATH_INFO but any of these does show http:// Thanks! -afan Have you looked at $_SERVER['SERVER_PORT'] and $_SERVER['SERVER_PROTOCOL'] ? -Robby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] https://...
On Thu, 28 Oct 2004 11:01:53 -0500, Afan Pasalic [EMAIL PROTECTED] wrote: I am not so good in this: you want to say that SSL use 443 port Yup. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] https://...
that's why I use it, sure. but can't find anything that helps me. Greg Donald wrote: On Wed, 27 Oct 2004 16:35:14 -0500, Afan Pasalic [EMAIL PROTECTED] wrote: hi, how can I check using php that I use SSL? tried with REQUEST_URI HTTP_HOST PATH_INFO but any of these does show http:// phpinfo() describes my SSL stuff pretty well if that's what you mean. And I also found: http://marc.theaimsgroup.com/?l=php-generalm=109767486431095w=2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fwd:
-- Forwarded message -- From: [EMAIL PROTECTED] [EMAIL PROTECTED] Date: 28 Oct 2004 16:10:47 - Subject: Re: Re: [PHP] https://... To: [EMAIL PROTECTED] Phil Ewington will be out of the office until 1st November. If your enquiry is urgent please email Ian Lowe ([EMAIL PROTECTED]). Can someone unsubscribe this guy? Thanks. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] https://...
Yes, this one is correct one! :) Thanks Warren. -afan Rens Admiraal wrote: But keep in mind that the var containing the value (I think $_SERVER[HTTPS] is the right one) is only set when https:// is used... Vail, Warren wrote: Depends on the server and the release, but my apache shows If($_SERVER[HTTPS] == on) // if true is secure Lots of other information like cypher key size, etc. Look in the $_SERVER array. Keep in mind that lots of servers are setup to use the same htdocs base directory for both secure and insecure pages, what happens if someone comes to your unsecured page using https? Another example is, if you have coded full urls for images, the browser will usually complain if the page is accessed via https and the image via http. Warren Vail -Original Message- From: Greg Donald [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 27, 2004 3:01 PM To: php-general Subject: Re: [PHP] https://... On Wed, 27 Oct 2004 16:35:14 -0500, Afan Pasalic [EMAIL PROTECTED] wrote: hi, how can I check using php that I use SSL? tried with REQUEST_URI HTTP_HOST PATH_INFO but any of these does show http:// phpinfo() describes my SSL stuff pretty well if that's what you mean. And I also found: http://marc.theaimsgroup.com/?l=php-generalm=109767486431095w=2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[Fwd: Re: [PHP] https://...]
Ok, this works just great! Thanks Warren. Also, I found after I changed manualy http:// in https:// that SCRIPT_URI will show whole URL (https://www.) and if I don't use SSL will not show anything! Thanks to all guys you wanted to help me! -afan Vail, Warren wrote: Depends on the server and the release, but my apache shows If($_SERVER[HTTPS] == on) // if true is secure Lots of other information like cypher key size, etc. Look in the $_SERVER array. Keep in mind that lots of servers are setup to use the same htdocs base directory for both secure and insecure pages, what happens if someone comes to your unsecured page using https? Another example is, if you have coded full urls for images, the browser will usually complain if the page is accessed via https and the image via http. Warren Vail -Original Message- From: Greg Donald [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 27, 2004 3:01 PM To: php-general Subject: Re: [PHP] https://... On Wed, 27 Oct 2004 16:35:14 -0500, Afan Pasalic [EMAIL PROTECTED] wrote: hi, how can I check using php that I use SSL? tried with REQUEST_URI HTTP_HOST PATH_INFO but any of these does show http:// phpinfo() describes my SSL stuff pretty well if that's what you mean. And I also found: http://marc.theaimsgroup.com/?l=php-generalm=109767486431095w=2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] About File Paths
Hi all, If a script is to be called with cron *outside* of the http directory, how should file system paths be handled? Should I use fopen('a_path/relative_to/thescript.php'); or fopen('/usr/var/www/absolute_file_path/thescript.php'); Im not only using this for fopen. So does php work relative to the script being called or not? Much thanks... -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] https://...
Well, didn't know that one. Thanks Greg, didn't know that one :) Today is successful day - learned something new :) -afan Greg Donald wrote: On Thu, 28 Oct 2004 11:01:53 -0500, Afan Pasalic [EMAIL PROTECTED] wrote: I am not so good in this: you want to say that SSL use 443 port Yup. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] About File Paths
On Thu, 28 Oct 2004 18:27:34 +0200, Nick Wilson [EMAIL PROTECTED] wrote: If a script is to be called with cron *outside* of the http directory, how should file system paths be handled? I always assume cron is dumb and provide it with full paths. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Protecting Commercial PHP Scripts
Hi Curt, if ($_SESSION['HTTP_USER_AGENT'] != md5($SERVER['HTTP_USER_AGENT'])) ^^^ $_SERVER *g* If your using the same session for IE and netscape, the behaviour you are experiencing demonstrates how this can prevent session hijacking. Netscape, using its own session should work fine. nope, it was just a missing underscore :-( -- Best Regards, Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] About File Paths
* and then Greg Donald declared On Thu, 28 Oct 2004 18:27:34 +0200, Nick Wilson [EMAIL PROTECTED] wrote: If a script is to be called with cron *outside* of the http directory, how should file system paths be handled? I always assume cron is dumb and provide it with full paths. Absolutely, but I dont mean cron, i mean the php code in the script. When referencing (including/requireing/fopen/etc) files.. -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Protecting Javascript via PHP
Hey! Thanks dude, that DOES make it harder for ther person to get to your JS codeI have seen various solutions like this like code-secure from securecents.com (although I think the article you mentioned is better) I was thinking more of a php solution, passing some variables and looking at the calling scripts etcthis way the .js file does not even get cached in the visitors/users machine... Just playing around with ideas,...this list is full of _really_ intelligent people I was hopeing someone else can build on it and maybe pool some of their ideas in on top of mine... Thanks, Ryan http://scriptasylum.com/tutorials/encdec/encode-decode.html is a good article on wasy to achieve this On Thu, 28 Oct 2004 16:24:24 +0200, Ryan A [EMAIL PROTECTED] wrote: Hey, I have been searching around the web for a way to mangle my javascript code the way some people do it to HTML/PHP etc so its not so easy to read. There is no sure way to do it and if a person is REALLY determined to get to your code...he can, but I would like that person to go through some extra effort before he gets to it... the idea being to have a tag like this: script language = JavaScript 1.2 src=javascript.php?some_parameter_here if the correct $some_parameter_here (or parameters) is passed then to output the codeif it can output the code only to another php script too it would be great... I have also been reading the doc at shiflett.org as the present question of -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Socket trouble
I'm having some trouble with my socket client. I would like it to notice when the server is no longer there, and then reconnect. I have code for the reconnect, etc., but I can't figure out how to write the socket_read code so that it notices when the server is gone and then responds. Presently, my client just hangs (CPU goes to 100%, nothing happens.) Here's my code: while(($buf = socket_read($socket,1,PHP_BINARY_READ)) !== false) { $data .= $buf; if(preg_match(/TERMINATING/,$data)) { $msg_recv = 1; break; } } The PHP docs on socket_read suggest how this might be done: Note: socket_read() may return a zero length string () indicating the end of communication (i.e. the remote end point has closed the connection). Does this end of communication include cases when the socket server dies without gracefully disconnecting? How could my code check for this zero length string? Any help is much appreciated. Thanks! ...René --- René Fournier www.renefournier.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Socket trouble
To prevent the blocking and your CPU going up to 100% usages look into: http://us2.php.net/manual/en/function.socket-select.php For length of a string: http://us2.php.net/manual/en/function.strlen.php - Original Message - From: René Fournier [EMAIL PROTECTED] Date: Thursday, October 28, 2004 1:04 pm Subject: [PHP] Socket trouble I'm having some trouble with my socket client. I would like it to notice when the server is no longer there, and then reconnect. I have code for the reconnect, etc., but I can't figure out how to write the socket_read code so that it notices when the server is gone and then responds. Presently, my client just hangs (CPU goes to 100%, nothing happens.) Here's my code: while(($buf = socket_read($socket,1,PHP_BINARY_READ)) !== false) { $data .= $buf; if(preg_match(/TERMINATING/,$data)) { $msg_recv = 1; break; } } The PHP docs on socket_read suggest how this might be done: Note: socket_read() may return a zero length string () indicating the end of communication (i.e. the remote end point has closed the connection). Does this end of communication include cases when the socket server dies without gracefully disconnecting? How could my code check for this zero length string? Any help is much appreciated. Thanks! ...René --- René Fournier www.renefournier.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] https://...
On Thu, 2004-10-28 at 11:01 -0500, Afan Pasalic wrote: Hi Robby, Yes, I looked at SERVER_PORT/SERVER_PROTOCOL. What I got is 80 and HTTP/1.1 when I manually change http:// to https:// I'm getting 443 and HTTP/1.1 I am not so good in this: you want to say that SSL use 443 port -afan There you go, the standard SSL port is 443. If you want to verify that you are on 443, then you can use SERVER_PORT -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development * --- Now supporting PHP5 and PHP4 --- / signature.asc Description: This is a digitally signed message part
[PHP] Converting a PERL Date
I have a perl date that is writing to a file. I need to display that date using PHP to a page.The date looks like this 1077051100 in the file. Can anyone help? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Converting a PERL Date
On Thu, 28 Oct 2004 13:06:57 -0400, KWRIGHT [EMAIL PROTECTED] wrote: I have a perl date that is writing to a file. I need to display that date using PHP to a page.The date looks like this 1077051100 in the file. Can anyone help? php.net/date -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I must be an XML parser idiot
On Thu, 2004-10-28 at 14:26, Jay Blanchard wrote: Good afternoon gurus and gurettes! * example code * /* functions for XML parser */ function dataHandler($parser, $data){ echo $data . br\n; } function StartTag($parser, $name, $attribute){ if(servicebrandname == $name){ echo -br\n; } } function EndTag($parser, $name){ if(servicebrandname == $name){ echo -br\n; } } /* create a parser */ if(!($covadParser = xml_parser_create())){ echo Failed to create parserbr\n; exit(); } /* set handlers for parser */ xml_set_character_data_handler($covadParser, dataHandler); xml_set_element_handler($covadParser, StartTag, EndTag); /* let's parse! */ if(($readXML = fopen(/usr/feynman/ADHOC/covad/testRecp.xml, r))){ while($lineXML = fread($readXML, 1024)){ echo $lineXML; xml_parse($covadParser, $lineXML, TRUE); } } * end code * I expect what I get back to look like TeleSurfer DSL+IP - Shared Line (Professional-Install) SOHO Internet Access 6.0/768 (Self-Install) But it is not coming back this way. Do I posess a fundamental misunderstanding of the way the xml parser is supposed to work? Could you send an XML sample please. And the output that you do get for it. Without those it's hard to say. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Calculation
That's not quite what I am talking about. I looked at that already. I can could also put the date and time that the script was ran into the MySql database by have a TIMESTAMP field in the database. I would like to compare the date and time of timestamp in the database to the current time and come up with the difference in seconds. Then I could show on the web page that the script was run x many seconds ago. From that I could do the calculations to show that it was x minutes, xhours, etc. On Oct 28, 2004, at 1:52 PM, Jay Blanchard wrote: [snip] I have a shell script that inserts the unix date and time that the script ran into a MySql database. For example Thu Oct 28 13:41:33 CDT 2004. I would like to have my web page do the math so that it displays the time since the script ran. How can I do the math so that the web page will display something like the script ran 1500 seconds ago. [/snip] http://us2.php.net/manual/en/function.strtotime.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Date Calculation
[snip] That's not quite what I am talking about. I looked at that already. I can could also put the date and time that the script was ran into the MySql database by have a TIMESTAMP field in the database. [/snip] You can use that to convert your time in the DB, get the current time when seeking as epoch time, subtract one from the otherno? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] I must be an XML parser idiot SOLVED
[snip] Good afternoon gurus and gurettes! [/snip] I was misspelling the XML tag name. *slaps forehead* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date Calculation
I have a shell script that inserts the unix date and time that the script ran into a MySql database. For example Thu Oct 28 13:41:33 CDT 2004. I would like to have my web page do the math so that it displays the time since the script ran. How can I do the math so that the web page will display something like the script ran 1500 seconds ago. Thanks, mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] About File Paths [unresolved]
* and then Nick Wilson declared ***bumpety bump*** ;-) If a script is to be called with cron *outside* of the http directory, how should file system paths be handled? Should I use fopen('a_path/relative_to/thescript.php'); or fopen('/usr/var/www/absolute_file_path/thescript.php'); Im not only using this for fopen. So does php work relative to the script being called or not? Much thanks... -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Date Calculation
[snip] I have a shell script that inserts the unix date and time that the script ran into a MySql database. For example Thu Oct 28 13:41:33 CDT 2004. I would like to have my web page do the math so that it displays the time since the script ran. How can I do the math so that the web page will display something like the script ran 1500 seconds ago. [/snip] http://us2.php.net/manual/en/function.strtotime.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Require_once(_)...when does it reset?
I am playing with PEAR_Info on my server. It was working fine, then I upgraded some classes, now it is not. I think it is because PHP is holding on to the old code from some require_once functions. I may be totally wrong but that is all I can think of what would cause this. Other classes (that I did not execute before updating) work fine. Is there a way to reset PHP if this is the case? Thanks. ++ Mike Yrabedra [EMAIL PROTECTED] Your Mac Intelligence Resource ++ W: http://www.macagent.com/ E: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] I must be an XML parser idiot
Good afternoon gurus and gurettes! * example code * /* functions for XML parser */ function dataHandler($parser, $data){ echo $data . br\n; } function StartTag($parser, $name, $attribute){ if(servicebrandname == $name){ echo -br\n; } } function EndTag($parser, $name){ if(servicebrandname == $name){ echo -br\n; } } /* create a parser */ if(!($covadParser = xml_parser_create())){ echo Failed to create parserbr\n; exit(); } /* set handlers for parser */ xml_set_character_data_handler($covadParser, dataHandler); xml_set_element_handler($covadParser, StartTag, EndTag); /* let's parse! */ if(($readXML = fopen(/usr/feynman/ADHOC/covad/testRecp.xml, r))){ while($lineXML = fread($readXML, 1024)){ echo $lineXML; xml_parse($covadParser, $lineXML, TRUE); } } * end code * I expect what I get back to look like TeleSurfer DSL+IP - Shared Line (Professional-Install) SOHO Internet Access 6.0/768 (Self-Install) But it is not coming back this way. Do I posess a fundamental misunderstanding of the way the xml parser is supposed to work? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Calculation
I guess. Are you telling me that I should take the timestamp, convert it to epoch time, the us the time function to get the current epoch time, then subtract the timestamp epoch time from the current epoch time? I think that is what you are saying. I know I can get the current epoch time in php with time(). How do I convert the timestamp in the database to epoch time, or find the epoch time in bash? If I can't do it in either, then I am subtracting apples from oranges. On Oct 28, 2004, at 2:32 PM, Jay Blanchard wrote: [snip] That's not quite what I am talking about. I looked at that already. I can could also put the date and time that the script was ran into the MySql database by have a TIMESTAMP field in the database. [/snip] You can use that to convert your time in the DB, get the current time when seeking as epoch time, subtract one from the otherno? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question on HTML_QuickForm: Validation ignored if specify form action
Hi, I just started to try HTML_QuickForm, and got a problem on setting form action in the HTML_QuickForm constructor. It looks like if I set the form action other than default, i.e., self, all the validation rule is ignored, the page goes directly to the process.php after click on submit. Could you help me to figure it out? Many thanks. Ying ?php require_once HTML/QuickForm.php; require_once 'HTML/QuickForm/Renderer/ArraySmarty.php'; require_once 'Smarty.class.php'; $form = new HTML_QuickForm('frmTest', 'post', 'process.php'); $form-addElement('text', 'txtAge', 'Age?'); $form-addElement('text', 'txtTelephone', 'Telephone number?'); $form-addElement('reset', 'btnClear', 'Clear'); $form-addElement('submit', 'btnSubmit', 'Submit'); $form-addRule('txtAge', 'Age is required', 'required'); $form-validate(); // Create the template object $tpl = new Smarty; $tpl-template_dir = '.'; $tpl-compile_dir = '/tmp'; // Create the renderer object $renderer = new HTML_QuickForm_Renderer_ArraySmarty($tpl); $renderer-setRequiredTemplate( '{if $error} font color=red{$label}/font {else} {$label} {if $required} font color=red size=1*/font {/if} {/if}' ); // build the HTML for the form $form-accept($renderer); // assign array with form data $tpl-assign('form_data', $renderer-toArray()); // parse and display the template $tpl-display('smarty2.tpl'); ?
Re: [PHP] About File Paths [unresolved]
If a script is to be called with cron *outside* of the http directory, how should file system paths be handled? Should I use fopen('a_path/relative_to/thescript.php'); or fopen('/usr/var/www/absolute_file_path/thescript.php'); Im not only using this for fopen. So does php work relative to the script being called or not? Much thanks... -- Nick W When in doubt, use absolute. -- --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Calculation
Hi, Friday, October 29, 2004, 4:51:20 AM, you wrote: MT I have a shell script that inserts the unix date and time that the MT script ran into a MySql database. For example Thu Oct 28 13:41:33 CDT MT 2004. I would like to have my web page do the math so that it displays MT the time since the script ran. How can I do the math so that the web MT page will display something like the script ran 1500 seconds ago. MT Thanks, MT mike You can do something like this (replace date with column name no quotes) $result = mysql_query(SELECT SEC_TO_TIME(UNIX_TIMESTAMP() - UNIX_TIMESTAMP('2004-10-01 13:45:00')) as diff); -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Calculation
Ok, so here is what I have. Please check to see if there is a better way. There are a lot of database calls to me. ? $database_name = CETechnology; $host = server; $login = username; $password = password; $ethernet_address = 00:01:93:8e:69:50; $db_connect = mysql_connect( $host, $login, $password ) or die (mysql_error()); $db_select = mysql_select_db($database_name) or die (mysql_error()); $query = SELECT * FROM hardware_assets WHERE ethernet_address = '$ethernet_address'; $result = mysql_query($query, $db_connect) or die (mysql_error()); while ($row = mysql_fetch_array( $result )) { $timestamp = $row[script_ran]; $timequery = SELECT SEC_TO_TIME(UNIX_TIMESTAMP() - UNIX_TIMESTAMP('$timestamp')) as diff; $timeresult = mysql_query($timequery, $db_connect) or die (mysql_error()); $time = mysql_result($timeresult, 0, 0); $secondquery = SELECT TIME_TO_SEC('$time'); $secondresult = mysql_query($secondquery, $db_connect) or die (mysql_error()); $seconds = mysql_result($secondresult, 0, 0); echo $seconds; } ? This returns the seconds since the timestamp was set for the row where the ethernet address of the computer is equal to $ethernet_address. I can then do the math so that I can display the hours or minutes. I can even have it so that when the time is too long, it displays in red, or bold, or whatever I want. On Oct 28, 2004, at 3:14 PM, Tom Rogers wrote: Hi, Friday, October 29, 2004, 4:51:20 AM, you wrote: MT I have a shell script that inserts the unix date and time that the MT script ran into a MySql database. For example Thu Oct 28 13:41:33 CDT MT 2004. I would like to have my web page do the math so that it displays MT the time since the script ran. How can I do the math so that the web MT page will display something like the script ran 1500 seconds ago. MT Thanks, MT mike You can do something like this (replace date with column name no quotes) $result = mysql_query(SELECT SEC_TO_TIME(UNIX_TIMESTAMP() - UNIX_TIMESTAMP('2004-10-01 13:45:00')) as diff); -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Require_once(_)...when does it reset?
Mike wrote: I am playing with PEAR_Info on my server. It was working fine, then I upgraded some classes, now it is not. I think it is because PHP is holding on to the old code from some require_once functions. I may be totally wrong but that is all I can think of what would cause this. Other classes (that I did not execute before updating) work fine. Is there a way to reset PHP if this is the case? What did you upgrade? Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Calculation
-- Original message from Mike Tuller [EMAIL PROTECTED]: -- Ok, so here is what I have. Please check to see if there is a better way. There are a lot of database calls to me. There are. Do it in one query. $query = SELECT * FROM hardware_assets WHERE ethernet_address = '$ethernet_address'; $result = mysql_query($query, $db_connect) or die (mysql_error()); while ($row = mysql_fetch_array( $result )) { $timestamp = $row[script_ran]; $timequery = SELECT SEC_TO_TIME(UNIX_TIMESTAMP() - UNIX_TIMESTAMP('$timestamp')) as diff; $timeresult = mysql_query($timequery, $db_connect) or die (mysql_error()); $time = mysql_result($timeresult, 0, 0); $secondquery = SELECT TIME_TO_SEC('$time'); $secondresult = mysql_query($secondquery, $db_connect) or die (mysql_error()); $seconds = mysql_result($secondresult, 0, 0); echo $seconds; } I don't know why you're doing both TIME_TO_SEC and SEC_TO_TIME, so I'm leaving them out as they are inverses. But I'm sure you can figure out what you want. $query = SELECT *, (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(script_ran)) as seconds FROM hardware_assets WHERE ethernet_address = '$ethernet_address'; This will return all the columns from the matching rows, plus an extra field called seconds that is the difference in seconds between now and wehn the script ran. Here is the list of mysql date/time functions for refernece http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html#IDX1454 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Require_once(_)...when does it reset?
Greg Beaver wrote: Mike wrote: I am playing with PEAR_Info on my server. It was working fine, then I upgraded some classes, now it is not. I think it is because PHP is holding on to the old code from some require_once functions. I may be totally wrong but that is all I can think of what would cause this. Other classes (that I did not execute before updating) work fine. Is there a way to reset PHP if this is the case? What did you upgrade? Greg the *_once cache is reset on every new request. When your page stops loading, the cache is emptied automatically. Also note that every process has its own cache, so you will never have problems with shared cache and such (unless you have a very very odd system running) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Learning PHP5
About a week ago someone was asking where are beginner can go to learn PHP5? This book was just advertised on Slashdot. Learning PHP 5 Only $20 on Amazon.com http://www.amazon.com/exec/obidos/tg/detail/-/0596005601/qid=1099000383/sr=8-1/ref=pd_csp_1/104-8763861-9120755?v=glances=booksn=507846 -- --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Review: Function that measures the width of a text string in pixels.
I have created a function that will measure the width of a text string in pixels. It works ok. If you have optimizations, please let me know. Thanks, Jacob function txt_width ($txt) { $width = 0; $txt_len = strlen($txt); for ($n = 1; $n = $txt_len; $n++) { switch (substr($txt, $n, 1)) { case 'l'; case '.'; case ' '; case '-'; case 't'; $width += 3; break; default : $width += 8; break; } } return $width; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Review: Function that measures the width of a text string in pixels.
Jacob Friis wrote: I have created a function that will measure the width of a text string in pixels. It works ok. If you have optimizations, please let me know. Thanks, Jacob function txt_width ($txt) { $width = 0; $txt_len = strlen($txt); for ($n = 1; $n = $txt_len; $n++) { switch (substr($txt, $n, 1)) { case 'l'; case '.'; case ' '; case '-'; case 't'; $width += 3; break; default : $width += 8; break; } } return $width; } the width depends on the font used (monospace or not), the kerning used, the size of whitespaces, etc. you can't say the width of X will be Y without knowing the font, font size, kerning, etc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Review: Function that measures the width of a text string in pixels.
On Fri, 2004-10-29 at 00:11 +0200, Jacob Friis wrote: I have created a function that will measure the width of a text string in pixels. It works ok. If you have optimizations, please let me know. Thanks, Jacob function txt_width ($txt) { $width = 0; $txt_len = strlen($txt); for ($n = 1; $n = $txt_len; $n++) { switch (substr($txt, $n, 1)) { case 'l'; case '.'; case ' '; case '-'; case 't'; $width += 3; break; default : $width += 8; break; } } return $width; } ..and how do you plan to account for things such as, font sizes on all platforms, font types, etc? -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development *--- Now supporting PHP5 --- / signature.asc Description: This is a digitally signed message part
Re: [PHP] Learning PHP5
On Thu, 2004-10-28 at 15:03 -0700, Matthew Sims wrote: About a week ago someone was asking where are beginner can go to learn PHP5? This book was just advertised on Slashdot. Learning PHP 5 Only $20 on Amazon.com http://www.amazon.com/exec/obidos/tg/detail/-/0596005601/qid=1099000383/sr=8-1/ref=pd_csp_1/104-8763861-9120755?v=glances=booksn=507846 I'm using it now and it's pretty good. I am almost 3/4 done the book after a week and half (including exercises). Dan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Learning PHP5
Matthew Sims wrote: About a week ago someone was asking where are beginner can go to learn PHP5? This book was just advertised on Slashdot. Learning PHP 5 Only $20 on Amazon.com http://www.amazon.com/exec/obidos/tg/detail/-/0596005601/qid=1099000383/sr=8-1/ref=pd_csp_1/104-8763861-9120755?v=glances=booksn=507846 IICR he also asked the material to be free as he currently cannot afford to buy books :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Learning PHP5
On Thu, 2004-10-28 at 15:03 -0700, Matthew Sims wrote: About a week ago someone was asking where are beginner can go to learn PHP5? This book was just advertised on Slashdot. Learning PHP 5 Only $20 on Amazon.com http://www.amazon.com/exec/obidos/tg/detail/-/0596005601/qid=1099000383/sr=8-1/ref=pd_csp_1/104-8763861-9120755?v=glances=booksn=507846 I'm using it now and it's pretty good. I am almost 3/4 done the book after a week and half (including exercises). Dan. Eh...I tired. I guess http://php.net is as free as you can get. -- --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Review: Function that measures the width of a text stri ng in pixels.
There is a function in the GD library that measures text size; http://www.php.net/manual/en/function.imagettfbbox.php But it has an advantage you don't have, once it has places exactly the font it wants, the size it wants, directly into an image, it knows that the browser won't change the image. With the font inside an image, the browser won't substitute another font, or use a different size because the one you have specified in your font statement is not available on the users machine. Perhaps there is a way for JavaScript to send you a list of available fonts on the end users machine? Course the end user could have fonts you never heard of. I think this is one of those things (like hand grenades and horse shoes) where being close counts. ;-) Warren Vail -Original Message- From: Robby Russell [mailto:[EMAIL PROTECTED] Sent: Thursday, October 28, 2004 3:27 PM To: Jacob Friis Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Review: Function that measures the width of a text string in pixels. On Fri, 2004-10-29 at 00:11 +0200, Jacob Friis wrote: I have created a function that will measure the width of a text string in pixels. It works ok. If you have optimizations, please let me know. Thanks, Jacob function txt_width ($txt) { $width = 0; $txt_len = strlen($txt); for ($n = 1; $n = $txt_len; $n++) { switch (substr($txt, $n, 1)) { case 'l'; case '.'; case ' '; case '-'; case 't'; $width += 3; break; default : $width += 8; break; } } return $width; } .and how do you plan to account for things such as, font sizes on all platforms, font types, etc? -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development *--- Now supporting PHP5 --- / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Learning PHP5
Eh...I tired. I guess http://php.net is as free as you can get. -- --Matthew Sims --http://killermookie.org Matt, Unfortunately the PHP.net are not really for beginners, you have to have some programming knowledge to get started using their tutorials...this is just my opinion. -- Michael Lauzon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Date Calculation
Hi, Friday, October 29, 2004, 7:19:09 AM, you wrote: MT Ok, so here is what I have. Please check to see if there is a better MT way. There are a lot of database calls to me. MT ? MT $database_name = CETechnology; MT $host = server; MT $login = username; MT $password = password; MT $ethernet_address = 00:01:93:8e:69:50; MT $db_connect = mysql_connect( $host, $login, $password ) or die MT (mysql_error()); MT $db_select = mysql_select_db($database_name) or die (mysql_error()); MT $query = SELECT * FROM hardware_assets WHERE ethernet_address = MT '$ethernet_address'; MT $result = mysql_query($query, $db_connect) or die (mysql_error()); MT while ($row = mysql_fetch_array( $result )) MT { MT $timestamp = $row[script_ran]; MT $timequery = SELECT SEC_TO_TIME(UNIX_TIMESTAMP() - MT UNIX_TIMESTAMP('$timestamp')) as diff; MT $timeresult = mysql_query($timequery, $db_connect) or die MT (mysql_error()); MT $time = mysql_result($timeresult, 0, 0); MT $secondquery = SELECT TIME_TO_SEC('$time'); MT $secondresult = mysql_query($secondquery, $db_connect) or die MT (mysql_error()); MT $seconds = mysql_result($secondresult, 0, 0); MT echo $seconds; MT } ? MT This returns the seconds since the timestamp was set for the row where MT the ethernet address of the computer is equal to $ethernet_address. I MT can then do the math so that I can display the hours or minutes. I can MT even have it so that when the time is too long, it displays in red, or MT bold, or whatever I want. Do it in one hit :)timediff comes out in hours:minutes:seconds $query = SELECT *, UNIX_TIMESTAMP() - UNIX_TIMESTAMP(script_ran) as seconds, SEC_TO_TIME(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(script_ran)) as timediff FROM hardware_assets WHERE ethernet_address = '$ethernet_address'; $result = mysql_query($query, $db_connect) or die (mysql_error()); while ($row = mysql_fetch_array( $result )){ $seconds = $row[seconds]; $timediff = $row[timediff]; echo $seconds = $timediff br; } -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP4 PHP4ISAPI Extensions
George Hester [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In Windows 2000 Server SP3 I tried to set up the php4isapi.dll redirector. I can get it to work as long as there are no extensions loaded. But if there are from my php.ini then I get ./extensions\php_gd2.dll not found for example. But if I run ?php phpinfo();? all the extensions I am using are found and enabled. Can anyone explain what is going on and suggest a fix? Thanks. -- George Hester __ I may have been unclear here exactly when the issue arises. If I am loading extensions in my php.ini file then this is what happens when I try try load the php4isapi.dll. I go ahead and add it as an ISAPI filter the way it supposed to be done in IIS 5. Then I stop the IISAdmin Service and restart it. Then I start the Web Puublishing Service. This is where the issue arises. If I am loading extensions in my php.ini then I will get errors, ./extensions\php_gd2.dll not found for example of course loading the php_gd2.dll extension in my php.ini. The specific dll is not the issue. It happens with any extension I have loaded in my php.ini upon starting the Web Publishing Service. Any ideas how to fix this? Thanks. -- George Hester __ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File uploads and handling
On Oct 26, 2004, at 7:06 AM, Jason Wong wrote: On Tuesday 26 October 2004 03:45, Philip Thompson wrote: I have a form to upload a file from a user's computer to the server. I want to then modify the file, and then let the user save it back. However, I am having troubles opening the file. It says it doesn't exist. Any suggestions? --- if (is_uploaded_file($_FILES['userfile']['name'])) $handle = fopen($_FILES['userfile']['name'], r); else echo $filename . was not uploaded properly; --- I know the actual filename shows up... In the above you are only referencing the *filename* and not the actual uploaded file itself. but somehow it's not uploading. Ideas? Read manual Handling file uploads to see how it all works. Yeah, that was not useful at all. That's what I originally looked at. If anyone has some code that shows how to reference the actual file, then that would be helpful. I have pulled my hair out long enough over this one. I did try this, but nothing changed (b/c it's just an array): if (is_uploaded_file(_FILES['userfile'])) $handle = fopen($_FILES['userfile'], r); Tips would be wonderful. Thanks! ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Review: Function that measures the width of a text string in pixels.
M. Sokolewicz wrote: Jacob Friis wrote: I have created a function that will measure the width of a text string in pixels. It works ok. If you have optimizations, please let me know. Thanks, Jacob function txt_width ($txt) { $width = 0; $txt_len = strlen($txt); for ($n = 1; $n = $txt_len; $n++) { switch (substr($txt, $n, 1)) { case 'l'; case '.'; case ' '; case '-'; case 't'; $width += 3; break; default : $width += 8; break; } } return $width; } the width depends on the font used (monospace or not), the kerning used, the size of whitespaces, etc. you can't say the width of X will be Y without knowing the font, font size, kerning, etc. I know, I had thought about that I could multiply the result according to what I know about the font. It works ok so far for my purpose, which is to measure the width of menu elements in dhtmlcentral.com's coolmenus. /Jacob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Protecting Javascript via PHP
Even if u make ur JS files dynamicaly made on the fly, browsers cach that dynamic JS. To be specific you'd get a file like script.php?parameter=pValue as a .php file that is cached after being rendered. So ur JS will be there stored in the cached static .php file ( a file with PHP extension including only ur rendered JS code in windows internet_temporary_folder ) ! The best way to do make ur code hard to get is obfuscating ur JS code. I think so ! Try one of these or google more than me :) keywords = obfuscating javascript -http://www.w3compiler.com/ -http://www.semdesigns.com/Products/Obfuscators/index.html?Home=SourceObfuscators On Thu, 28 Oct 2004 19:01:55 +0200, Ryan A [EMAIL PROTECTED] wrote: Hey! Thanks dude, that DOES make it harder for ther person to get to your JS codeI have seen various solutions like this like code-secure from securecents.com (although I think the article you mentioned is better) I was thinking more of a php solution, passing some variables and looking at the calling scripts etcthis way the .js file does not even get cached in the visitors/users machine... Just playing around with ideas,...this list is full of _really_ intelligent people I was hopeing someone else can build on it and maybe pool some of their ideas in on top of mine... Thanks, Ryan http://scriptasylum.com/tutorials/encdec/encode-decode.html is a good article on wasy to achieve this On Thu, 28 Oct 2004 16:24:24 +0200, Ryan A [EMAIL PROTECTED] wrote: Hey, I have been searching around the web for a way to mangle my javascript code the way some people do it to HTML/PHP etc so its not so easy to read. There is no sure way to do it and if a person is REALLY determined to get to your code...he can, but I would like that person to go through some extra effort before he gets to it... the idea being to have a tag like this: script language = JavaScript 1.2 src=javascript.php?some_parameter_here if the correct $some_parameter_here (or parameters) is passed then to output the codeif it can output the code only to another php script too it would be great... I have also been reading the doc at shiflett.org as the present question of -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- M.Saleh.E.G 97150-4779817 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File uploads and handling
On Thu, 28 Oct 2004 19:04:27 -0500, Philip Thompson [EMAIL PROTECTED] wrote: manual Handling file uploads to see how it all works. Yeah, that was not useful at all. That's how the rest of us learned. The examples on the page is pretty clear to me. That's what I originally looked at. If anyone has some code that shows how to reference the actual file, then that would be helpful. I have pulled my hair out long enough over this one. I did try this, but nothing changed (b/c it's just an array): if (is_uploaded_file(_FILES['userfile'])) $handle = fopen($_FILES['userfile'], r); $_FILES['userfile']['name'] is the file. $_FILES['userfile']['tmp_name'] is the name of the file. $_FILES['userfile'] is as you stated 'just an array'. It's all right there in the manual. http://php.net/manual/en/features.file-upload.php -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Learning PHP5
On Thu, 28 Oct 2004 19:12:12 -0400, Michael Lauzon [EMAIL PROTECTED] wrote: Unfortunately the PHP.net are not really for beginners, you have to have some programming knowledge to get started using their tutorials...this is just my opinion. Well you're certainly entitled to your opinion.. I program in multiple languages as do many people on this list. And I for one have to say that it doesn't get any more simple than PHP and the ease of learning you get from it's excellent online manual. No other programming manual even comes close. You get well documented usage examples plus hundreds if not thousands of user comments that often contain even more coding examples. Being able to teach yourself kinda goes along with being a programmer.. and PHP.net totally accelerates that function. Go out and try to learn Perl, Python, Java, or C (with no prior programming knowledge) and get back to me. It's certainly possible, but I wouldn't want to learn Perl again from scratch. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What is wrong with next code
Can one explain me why I has got a result: - Warning: mysql_query(): 4 is not a valid MySQL-Link resource in ... $result = mysql_query('SELECT 1+1', $db1); - from next example. The example does not work correctly (as I expect) in PHP 4.3.8, 4.3.9, 5.0.2 It works OK in PHP 4.3.6 or when line $db2 = 0; had been commented in all described versions of PHP. If it's a correct behaviour in new versions of PHP so how can I free/unset $db2 variable without triggering such effect? - error_reporting(E_ALL); $db1 = mysql_connect ('localhost', 'test', '1'); $db2 = mysql_connect ('localhost', 'test', '1'); mysql_close($db2); $db2 = 0; $result = mysql_query('SELECT 1+1', $db1); if ($result) { $row = mysql_fetch_row($result); echo Result: {$row[0]}\n; } - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Learning PHP5
On Thu, 2004-10-28 at 20:20 -0500, Greg Donald wrote: On Thu, 28 Oct 2004 19:12:12 -0400, Michael Lauzon [EMAIL PROTECTED] wrote: Unfortunately the PHP.net are not really for beginners, you have to have some programming knowledge to get started using their tutorials...this is just my opinion. Well you're certainly entitled to your opinion.. I program in multiple languages as do many people on this list. And I for one have to say that it doesn't get any more simple than PHP and the ease of learning you get from it's excellent online manual. No other programming manual even comes close. You get well documented usage examples plus hundreds if not thousands of user comments that often contain even more coding examples. Being able to teach yourself kinda goes along with being a programmer.. and PHP.net totally accelerates that function. Go out and try to learn Perl, Python, Java, or C (with no prior programming knowledge) and get back to me. It's certainly possible, but I wouldn't want to learn Perl again from scratch. I have to agree with this, Learning PHP 5 and the online manual are making this very easy for me, I can almost say it's as easy as HTML. But this maybe because I know perl. Dan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File uploads and handling
On Thu, 2004-10-28 at 19:04 -0500, Philip Thompson wrote: On Oct 26, 2004, at 7:06 AM, Jason Wong wrote: On Tuesday 26 October 2004 03:45, Philip Thompson wrote: I have a form to upload a file from a user's computer to the server. I want to then modify the file, and then let the user save it back. However, I am having troubles opening the file. It says it doesn't exist. Any suggestions? --- if (is_uploaded_file($_FILES['userfile']['name'])) $handle = fopen($_FILES['userfile']['name'], r); else echo $filename . was not uploaded properly; --- I know the actual filename shows up... In the above you are only referencing the *filename* and not the actual uploaded file itself. but somehow it's not uploading. Ideas? Read manual Handling file uploads to see how it all works. Yeah, that was not useful at all. That's what I originally looked at. If anyone has some code that shows how to reference the actual file, then that would be helpful. I have pulled my hair out long enough over this one. I did try this, but nothing changed (b/c it's just an array): if (is_uploaded_file(_FILES['userfile'])) $handle = fopen($_FILES['userfile'], r); Tips would be wonderful. Thanks! Here is an example: http://blog.planetargon.com/index.php?/archives/26_Uploading_images_into_PostgreSQL.html hth, Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development *--- Now supporting PHP5 --- / signature.asc Description: This is a digitally signed message part
[PHP] insert xml data into database
any ideas how to do this? i can get the php to print out all the details of the xml but not sure how to input that data into a database. - maybe using some sort of array? its an annoying postgresql database that i need to insert it into but any ideas on how to insert into any database would be helpful. thanks // this function prints out a list of properties found in the xml file function print_houses() { global $obj; echo 'table width=' . $this-TableWidth . ' border=' . $this-TableBorder . ' cellpadding=' . $this-TableCellpadding . ' cellspacing=' . $this-TableCellspacing . ' class=' . $this-TableClass . ''; while (list($key, $val) = each($obj-xml-XMLDATA-PROPERTIES-PROPERTY)) { echo tr\n; echo td class= . $this-TableRow1Class . \n; echo a href=\./property.php?id= . $val-attr['PROPERTYID'] . \ class=\ . $this-TableTxtProperties . \ . $val-SUBURB-data . , $ . $val-RENT-data . /a\n; echo /td; echo /tr\n; } // while echo '/table'; reset($obj-xml-XMLDATA-PROPERTIES-PROPERTY); } __ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is wrong with next code
Vladimir Shiray wrote: - Warning: mysql_query(): 4 is not a valid MySQL-Link resource in ... $result = mysql_query('SELECT 1+1', $db1); - [snip] $db1 = mysql_connect ('localhost', 'test', '1'); $db2 = mysql_connect ('localhost', 'test', '1'); mysql_close($db2); If you connect with the same parameters, PHP will just reuse the previous connection. So you only have one connection and closing either one will result in the connection being lost, hence the invalid link resource message. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Bug-Tracking-System in PHP ?
Hello, Curently I create my website and I need for my development project a BTS like this one from bugs.debian.org. I have only around 20 Debian Packages, so I do not need a big one of BTS. Curently I use E-Mails from my Provider like: package[EMAIL PROTECTED] with procmail and some BASH scripts :-) Does anyone know a better solution in PHP4 ? Maybe Webinterface included ? The BASH scripts are working fine, but they are too heavy Greetings Michelle -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature