RE: [PHP] Can a PHP script process a file on a remote computer?
you probably won't be able to edit PHP.ini with shared-hosting. The other solutions, one I can think of it now - you can use PHP to upload files from remote computer to the server at certain time, and set schedule with cron to run your PHP scripts on your server. Good luck -Original Message- From: Jon Westcot [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 24, 2007 3:18 PM To: PHP General Subject: Re: [PHP] Can a PHP script process a file on a remote computer? Thanks, Wolf. I'm going to have to do a lot of long processes -- uploads, queries, and the like -- and I appreciate knowing that I can adjust that. Now if I can just find the PHP.INI file (Stupid GoDaddy-shared-domains; can't find anything on 'em.) Jon - Original Message - From: Wolf [EMAIL PROTECTED] To: Jon Westcot [EMAIL PROTECTED] Cc: PHP General php-general@lists.php.net Sent: Wednesday, October 24, 2007 1:16 PM Subject: Re: [PHP] Can a PHP script process a file on a remote computer? Go into your php.ini file and increase the script timeout length, which should allow the upload to finish. Jon Westcot [EMAIL PROTECTED] wrote: Hi all: I'm working on a project that requires frequent updating of a large amount of data to a MySQL database. Currently, I'm trying to transfer a CSV file to the server, have it process the file, and then delete it once the processing is complete. Rather than waste the up-front time of having to upload the file (which is currently timing out without fully uploading the file and I have no idea how to resolve this!), is it possible to have the server open the specified file remotely and read it using the fgetcsv() function? If so, how? Any help you can give me will be GREATLY appreciated! Thanks, Jon -- 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] MySQL and SESSIONs
Stut What's good for multiple webservers? thanks -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Friday, October 05, 2007 4:31 PM To: Stefano Esposito Cc: php-general@lists.php.net Subject: Re: [PHP] MySQL and SESSIONs Stefano Esposito wrote: is it somehow possible to store the connection reference obtained from mysql_connect() (note the absence of the i) in a $_SESSION element? No. Why would you want to? You'd end up holding on to a database connection even when nothing is using it. If you want to optimise things look at http://php.net/mysql_pconnect but bear in mind that this starts to suck if you scale up to multiple web servers. -Stut -- http://stut.net/ -- 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
[PHP] PHP WAP Resources?
hi can you guys please suggest some good resources for PHP and WAP? either urls or websites would be great tia, Lance
RE: [PHP] PHP WAP Resources?
and books too :) -Original Message- From: Vo, Lance [mailto:[EMAIL PROTECTED] Sent: Thursday, September 13, 2007 11:07 AM To: php-general@lists.php.net Subject: [PHP] PHP WAP Resources? hi can you guys please suggest some good resources for PHP and WAP? either urls or websites would be great tia, Lance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Pirate PHP books online?
Wow, this topic has been going on forever. Probably the longest I've seen. -Original Message- From: Instruct ICC [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 18, 2007 1:51 PM To: php-general@lists.php.net Subject: Re: [PHP] Re: Pirate PHP books online? From: Tijnema [EMAIL PROTECTED] I didn't read the full thread (because it is 80 emails...) But really, it isn't special that these books are found on the net, and you really can't stop them, nor can the author of the book. With a quick search, I found these books related to PHP(all free to download): Beginning Ajax with PHP: From Novice to Professional ... need one? Tijnema Yes, I need one. Kindly send me the full free download link to the one above. All I see are free excerpts. _ http://imagine-windowslive.com/hotmail/?locale=en-usocid=TXT_TAGHM_migration_HM_mini_2G_0507 -- 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] simplexml_load_string();
Try to do a search in PEAR.PHP.NET I remember I've seen something like this for php4, but not sure where. Lance -Original Message- From: Ross [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 18, 2007 8:41 AM To: php-general@lists.php.net Subject: [PHP] simplexml_load_string(); $data = simplexml_load_string(file_get_contents($url)); Is there a php4 version of this or does this only work in 5? How can I get around it? R. -- 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] Is There a Function to yada .... /yada to [yada] ..... [/yada]?
str-replace? http://us.php.net/manual/en/function.str-replace.php -Original Message- From: Stephen [mailto:[EMAIL PROTECTED] Sent: Thursday, June 21, 2007 1:17 PM To: php-general@lists.php.net Subject: [PHP] Is There a Function to yada /yada to [yada] . [/yada]? I can't find one. Thanks Stephen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] calculate xml size
does php has any function that calculate a xml element in bytes or anything: example: tests test1ABC/test1 test2DEF/test2 /tests If I want to calculate element test1, it should return 18 bytes. thanks Lance
[PHP] Magic Quotes or Curley Quotes or Something
I recently upgraded my server. It is running Ubuntu Linux with PHP and MySQL. My site allows people to post content to their own web oages through a web interface. Many of my customers compose their content on a word processer and then cust and paste it to the web interface for insertion to the database and later retrevial and display on a web page. The problem I am having is that content which includes quotes is is not being seen correctly. Rather than inserting a slashed quote (/), it inserts a bunch of strange formatted gunk. A sample of the problem anc be seen at www.dallypost.com/ranch/page5688.php Thanks -- Lance Earl, President DallyPost, Inc. - Equine Marketing/Training/Shows Rockland, Idaho 208-548-2721 or 208-604-2721 [EMAIL PROTECTED] http://www.dallypost.com http://www.dallypost.com/ranch Horse Marketing - Clinics - Shows -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Magic Quotes or Curley Quotes or Something
Hi Marco, Thanks for the help, you gave me a place to start. Before doing what would amount to a lot of coding to correct this problem throughout my site I wanted to see if it could be corrected on the server side. I found the following section in the php.ini file: ; As of 4.0b4, PHP always outputs a character encoding by default in ; the Content-type: header. To disable sending of the charset, simply ; set it to be empty. ; ; PHP's built-in default is text/html default_mimetype = text/html default_charset = utf-8 ;default_charset = iso-8859-1 In the default file the iso-8859-1 line was commented out so I uncommented it to see it that would help. It changed the unreadable goop to another type of unreadable goop but the problem remained. I then recommented the iso-8859-1 line and added the utf-8 line. This changed the output back to what I had before. My thinking is that since my code worked under the older version of php, it should also work under the newer version if I can configure it correctly. Thanks, Lance Hello Lance-- On 8/5/05 2:18 PM, Lance Earl [EMAIL PROTECTED] wrote: I recently upgraded my server. It is running Ubuntu Linux with PHP and MySQL. My site allows people to post content to their own web oages through a web interface. Many of my customers compose their content on a word processer and then cust and paste it to the web interface for insertion to the database and later retrevial and display on a web page. The problem I am having is that content which includes quotes is is not being seen correctly. Rather than inserting a slashed quote (/), it inserts a bunch of strange formatted gunk. A sample of the problem anc be seen at www.dallypost.com/ranch/page5688.php You have an encoding problem--the content is being uploaded to your site using a different encoding mechanism (most likely utf-8) than the one you use to display it. I'm not much of an expert in this area, but a couple of suggestions: 1. You're already outputting UTF-8 code from the looks of it, so a simple Header (Content-type: text/html; charset=utf-8); Or even adding this to your HTML code in the HEAD: META HTTP-EQUIV=content-type CONTENT=text/html; charset=utf-8 Should do it. Remember to also use htmlentities ($data, null, utf-8); to properly encode the entities in your content. 2. Convert the text over from UTF-8 to ISO-8859-1. I think you can use utf8_decode, or you may have to go with the mbstring extension (not too sure here, I'd just go ahead and convert everything over to UTF-8). I'm sure some other people who have more experience with this stuff can give you even more pointers, but this should get you started. Cheers, Marco -- BeebleX - The PHP Search Engine http://beeblex.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Lance Earl, President DallyPost, Inc. - Equine Marketing/Training/Shows Rockland, Idaho 208-548-2721 or 208-604-2721 [EMAIL PROTECTED] http://www.dallypost.com http://www.dallypost.com/ranch Horse Marketing - Clinics - Shows -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Persistent PHP web application?
I wrote a PHP extension a while ago that implements executor persistence for scalar variables and constants. I never looked much into persisting objects, arrays or resources but it would be a useful addition to the extension if someone wants to contribute. I haven't updated the Web site with the latest version that compiles under 4.3.x, but if you're interested I can send you the files that changed in the meantime. It has been immensely useful for my projects. http://pwee.sourceforge.net Lance -Original Message- From: Josh Whiting [mailto:[EMAIL PROTECTED] Sent: Monday, January 03, 2005 11:28 AM To: php-general@lists.php.net Subject: [PHP] Persistent PHP web application? Dear list, My web application (an online classifieds server) requires a set of fairly large global arrays which contain vital information that most all the page scripts rely upon for information such as the category list, which fields belong to each category, and so on. Additionally, there are a large number of function definitions (more than 13,000 lines of code in all just for these global definitions). These global arrays and functions never change between requests. However, the PHP engine destroys and recreates them every time. After having spent some serious time doing benchmarking (using Apache Bench), I have found that this code takes at least 7ms to parse per request on my dual Xeon 2.4ghz server (Zend Accelerator in use*). This seriously cuts into my server's peak capacity, reducing it by more than half. My question is: is there a way to define a global set of variables and functions ONCE per Apache process, allowing each incoming hit to run a handler function that runs within a persistent namespace? OR, is it possible to create some form of shared variable and function namespace that each script can tap? AFAIK, mod_python, mod_perl, Java, etc. all allow you to create a persistent, long-running application with hooks/handlers for individual Apache requests. I'm surprised I haven't found a similar solution for PHP. In fact, according to my work in the past few days, if an application has a large set of global functions and variable definitions, mod_python FAR exceeds the performance of mod_php, even though Python code runs significantly slower than PHP code (because in mod_python you can put all these definitions in a module that is loaded only once per Apache process). The most promising prospect I've come across is FastCGI, which for Perl and other languages, allows you to run a while loop that sits and receives incoming requests (e.g. while(FCGI::accept() = 0) {..}). However, the PHP/FastCGI modality seems to basically compare to mod_php: every request still creates and destroys the entire application (although the PHP interpreter itself does persist). Essentially I want to go beyond a persistent PHP *interpreter* (mod_php, PHP/FastCGI) and create a persistent PHP *application*... any suggestions? Thanks in advance for any help! Regards, J. Whiting * - Please note that I am using the Zend Accelerator (on Redhat Enterprise with Apache 1.3) to cache the intermediate compiled PHP code. My benchmarks (7ms+) are after the dramatic speedup provided by the accelerator. I wouldn't even bother benchmarking this without the compiler cache, but it is clear that a compiler cache does not prevent PHP from still having to run the (ableit precompiled) array and function definition code itself. -- 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] Global persistent variables
If you have the ability to compile extensions into PHP and you're not running under Windows you may find useful an extension I wrote that is one solution to this problem (and more). http://pwee.sourceforge.net/ Note that I haven't yet compiled it under anything later than PHP 4.2.1. Lance -Original Message- From: Jean-Yves Jourdain [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 10, 2004 11:37 AM To: [EMAIL PROTECTED] Subject: [PHP] Global persistent variables Hi, Is there a way to have global persistent variable with PHP? I would like to reproduce the use of the ASP Application(name)= value possibility. The variable name will be available to every users... Thank-you in advance, Kind regards. Jean-Yves -- 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] Keep PHP variable values between script calls - XML RPC
If you only need to persist a handful of request-agnostic variables you may be able to make use of an extension I wrote. Note that it doesn't work under Windows and I haven't tested it under PHP 4.3.x. http://pwee.sourceforge.net/ Lance -Original Message- From: Santiago Peirano [mailto:[EMAIL PROTECTED] Sent: Thursday, May 27, 2004 11:17 AM To: [EMAIL PROTECTED] Subject: [PHP] Keep PHP variable values between script calls - XML RPC Ok, here we go. I would like to implement an XML-RPC server (a script of course) that keeps the value of certain variables between the different invocations of the script. I think that it should be possible, but I don't know where to start (none of the search in internet gave me a starting point). Thanks in advance Santiago -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] An extension to CREATE zips??
Did you try this class? http://www.phpconcept.net/pclzip/index.en.php Is there function library capable of creating zip files and adding files to a zip archive under the windows/apache platform? After some extensive browsing I can only turn up read-only access functions. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] extracting text from text file to be used in PHP
Hello all, One of the sites I host is a radio station. Their computer has been setup to automagically upload the current song and the next song to their web site via FTP. Unfortunately, the format it comes in is pretty awful. (See below). tag The CURRENT CutID is: 70428 The Type is: MUS The ArtistName is: Nena The SongTitle is: 99 Luft Balloons (German) The Duration is: 00:03:48 /tag What I would like to know how to do is extract the relevant info (everything after the : for instance) and manipulate it, possibly as a variable so that $ArtistName=Nena for instance. I've looked through the php.net manual for fgets and such, but no luck. Thanks in advance, Lance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] caching variables and preloading functions
If you are not running PHP under a Windows platform and can compile extensions into PHP the most efficient way to solve problem #2 may be with a PHP extension I developed. It handles constants and provides a type of persistent variable too. It has been immensely useful for my projects. http://pwee.sourceforge.net/ Lance -Original Message- From: ssamuel [mailto:[EMAIL PROTECTED] Sent: Sunday, May 25, 2003 7:05 PM To: [EMAIL PROTECTED] Subject: [PHP] caching variables and preloading functions Hi, I am looking for a way to do the following with PHP on Apache. 1) I have a list of functions that I would like loaded into memory when the Apache server starts so that other .PHPs can call these functions at any time. Somewhat of a way to expand the API set for PHP. i.e., Say I have a file named init.php which has many functions defined. When the Apache server loads, I want this file to be sourced so that these functions are visible to all other phps. 2) I have several variables, that I want to be cached at server init time. These variables are global variables and live until the server is restarted and can be accessed by any .phps. Are there any ways to do these? thanks, sunil. -- 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] Persistent values between executions
The most efficient way to solve your problem is with a PHP extension I developed. It handles constants and provides a type of persistent variable too. It has been immensely useful for my projects. http://pwee.sourceforge.net/ Lance -Original Message- From: Mike Mannakee [mailto:[EMAIL PROTECTED] Sent: Monday, March 10, 2003 11:30 AM To: [EMAIL PROTECTED] Subject: [PHP] Persistent values between executions I have some sets of values that I have stored in several tables in a mySQL database. These don't often change, but are referenced on every single page view. While each call is quick, as a gross the load on the server is too high. I would like to know if there is a way to have these sets of values remain persistent in the server's memory between calls from browsers, like environment variables, to reduce the back and forth calls to mySQL. As the data from the calls are almost always the same, it would seem easier this way. Any thoughts? Comments? RTFM suggestions? Mike -- 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
[PHP] ob_start -- output buffer problem
Hi all, to quote from http://www.php.net/manual/en/function.ob-start.php void ob_start ( [string output_callback]) An optional output_callback function may be specified. This function takes a string as a parameter and should return a string. The function will be called when ob_end_flush() is called, or when the output buffer is flushed to the browser at the end of the request. My callback function does not get called unless I manually call ob_end_flush(). I'm not interested in calling ob_end_flush() at all, I want my callback function to be called when the output buffer is flushed to the browser at the end of the request so the question is why isn't this happening? here's my example: ?php $x = new test(); echo hey; // IF next line is uncommented so it manually flushes // then the finish method WILL get called. But I need // get around calling anything at the *end* of a script. //ob_end_flush(); class test { var $msg_file = cooked_html/error_log2; function test() { ob_start(array($this, finish)); $this-msg(got to initialize); } function finish($page) { $this-msg(GOT TO FINISH!!!); return $page; } function msg ($msg) { $msg = \n . exec(date) . ::: . $msg; $fp = fopen($this-msg_file, a) or die (cannot open .$this-msg_file); fputs ($fp, $msg, strlen($msg)) or die (cannot write to .$this-msg_file); fclose($fp); } } ? But if ob_end_flush() IS called then the error log WILL have the GOT TO FINISH message. Any ideas on why the output is not being flushed automatically? thanks Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] page cannot be displayed after a post of form with over 80 post elements
hi guys, i am facing the above problem. i couldn't explain whats causing this behavior. however, those data does get posted to the server. only thing is that the result page is not showing up but the above error page. i have tested with 60+ post elements, but no error of such occur. any idea what could be the cause? platform: win2k, sp3 iis5 php on cgi i have been wondering if it is iis5 that is giving the problem. thanks, lance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fixed - Re: page cannot be displayed after a post of form with over80 post elements
managed to found out the cause. it was the cookies. it got overloaded with data and exceed the 4k limit. the cookies was storing preferences for too many users thus it break the limit. B.C. Lance wrote: hi guys, i am facing the above problem. i couldn't explain whats causing this behavior. however, those data does get posted to the server. only thing is that the result page is not showing up but the above error page. i have tested with 60+ post elements, but no error of such occur. any idea what could be the cause? platform: win2k, sp3 iis5 php on cgi i have been wondering if it is iis5 that is giving the problem. thanks, lance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Copy Paste URL was [Re: [PHP] Would appreciate thoughts on sessionmanagement ]
one reason that i could think of for not including session id into URL and using cookies would be copy paste. users could just copy and paste the url and send it to his/her friends. and it could be a considerably number of people. imagine couple of people clicking on the link. that session will be shared among that no. of active people at that particular time. in short, session hijacking will occur. Ernest E Vogelsinger wrote: At 22:41 10.11.2002, Charles Wiltgen said: [snip] I'm about to implement session management, and I'm considering rolling my own instead of using PHP's. Hmm - NIH syndrome? (not invented here) Specifically, I'm considering using hidden fields for persistent object properties because (1) I don't want cookies to be an issue, (2) I prefer not to have session IDs appear in a URL, and (3) I prefer not to use require a database just to store persistent properties. [snip] As Justin already pointed out you make yourself stick to forms, not allowing any normal page be session-dependent - but that's only one of the drawbacks. The issue that would disturb me the most is data security - if you use the client browser to store object persistent data this opens up a whole world of possibilities to hack your data... Of course you could always check if the hidden fields are still ok, using some md5 or whetever, but why the hassle? If you don't want cookies (I too don't use them for a session and have disabled session cookies in our php.ini), PHP will transparently merge the session identifier into its output (as long as you don't use ob_gzhandler, that is). But why don't you like the session ID magled into links? prefer not to use a database - that's not the case with standard php sessions, they get written to a file somewhere. Just make sure that this somewhere is a) read/writable by apache b) not read/writable by anyone else and you are (relatively) secure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Best way to set global params for entire site??
If you are not running PHP under a Windows platform the most efficient way to solve your problem is with a PHP extension I developed. It handles constants and provides a type of persistent variable too. It has been immensely useful for my projects. http://pwee.sourceforge.net/ Lance -Original Message- From: Monty [mailto:monty3;hotmail.com] Sent: Tuesday, October 22, 2002 3:27 PM To: [EMAIL PROTECTED] Subject: [PHP] Best way to set global params for entire site?? I'm building a site with PHP and most scripts need access to certain site-wide global parameters, such as paths and default settings, etc. What's the best way to load this information so that it's globally available to all scripts? I have a func.php file that is included in all scripts - do I just load them every time for each script in there? Or is there a more efficient way of doing this with environment variables or some other way? Thanks!! -- 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] Getting fully qualified host name
If you happen to be running *nix (which it sounds like you are) and want to compile the Pwee extension into PHP you can have access to constants like SERVER_HOSTNAME. http://pwee.sourceforge.net Lance -Original Message- From: Spongle [mailto:[EMAIL PROTECTED]] Sent: Monday, October 07, 2002 4:20 AM To: [EMAIL PROTECTED] Subject: [PHP] Getting fully qualified host name I need to get the fully qualified host name of the local machine, like server.somewhere.com. Sounds simple, right? Seems not. I'm running a CLI script in PHP 4.3-cvs (on OpenBSD) so I have no HTTP or other global vars to look at, and it doesn't seem to be lying about in my environment (not that I want to rely on that anyway). The posix_uname command doesn't include the domain on non-GNU OSs. I can get the hostname, but not the domain. Can I get it through some other PHP command? I'd really prefer not to resort to platform-specifics like rummaging in /etc and parsing config files or doing something silly like a reverse DNS lookup... On some OS, this will give me the hostname: $hostname = `/bin/hostname`; However, it doesn't give me the domain, and it's highly platform specific (i.e. it won't work on Win). This seems like a pretty fundamental function that should be a built-in, but it doesn't seem to be possible to do this in a platform-independent way. Have I missed some php_fqdn() function? Any better ideas? -- 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] Static constants? Server persistent?
I wrote the PWEE PHP extension to solve this exact problem. http://pwee.sourceforge.net It's great for constants but it's true power comes from executor persistent variables. I haven't updated the web site but it does work with PHP 4.2.3. Lance -Original Message- From: Jean-Christian Imbeault [mailto:[EMAIL PROTECTED]] Sent: Sunday, September 29, 2002 6:59 AM To: [EMAIL PROTECTED] Subject: [PHP] Static constants? Server persistent? This is a bit hard for me to explain but is there any way to have PHP store a persistent server-side constant. Something that will stay in RAM and is not dependent on client connection. For example I have this code in consts.inc file: define (HOME_PAGE, http://myip.com/index.html); But if I want access to the constant I need to include the file in every script that needs it. I am hoping there is some way to say to the PHP engine, this is a static constant that will never change, keep it RAM, and share it between invocations/children. Is this feasible? Is it is I could then cache whole blocks of static HTML and that would speed up my scripts quite a bit ... AND my my life as a programmer easier since I wouldn't have to always have an include(conts.inc) statement at the top of each of my scripts ... Jc -- 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
[PHP] Re: Editor
http://www.phpedit.net Bryan McLemore wrote: Hi guys, just wondering if anyone could recomend a good editor that is based on windows. Thanks, Bryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: All Queries TRUE even when they should be FALSE
you should use mysql_num_rows() to check for records returned instead of using mysql_query(). this is because if $query is a valid $sql statement, mysql_query() will always return a resource link. which evaluates to true. so this will work for you: if (mysql_num_rows($result)) echo record found; else echo record not found; --lance Monty wrote: Even though I have no record in my MySQL DB with that has 005 in the ID field, the following statement always reverts to Record Found, or True, no matter what ID I use. What's wrong? I'm using PHP 4.2.2. Has something changed that makes this work differently? Thanks. $query = SELECT id FROM member WHERE id = 005; $connect = mysql_pconnect(localhost, dbname, password); $result = mysql_query( $query, $connect ); // Query DB. if ( !empty($result) ) { echo RECORD FOUND; } else { echo RECORD NOT FOUND; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: checkbox question
if you can't use [] for the checkbox, the only way out is to have unique name for each checkbox. otherwise, php will always be returning the value of the last checked checkbox if all checkboxes share the same name without the []. --lance Alex Shi wrote: How to ontain data from a group of checkbox using same name? For example, in a form there're 6 checkboxes and all named as Interesting_Area. I know if put a pairs of square brackets at the end of the name then in php all the values of them can be ontained. However, for some reason I cannot use square brackets. Please help me out if anyone know how to do the trick. THanks! Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: tricky preg_replace and how to escape the \{occurencenumber}
probably this will be faster? $fn = str_replace(.gif, 1.gif, $fn); Lallous wrote: ? $fn = 'test.gif'; echo preg_replace('/(.+?)(\..+?)/', '\1a\2', $fn); ? This script will output 'testa.gif' now how can i make it produce 'test1.gif' ? if i replace the: '\1a\2' with '\11\2' it will understand to replace with occurence number 11 ! How can i escape the 2nd '1' so it is considered as a string an not another number. Elias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: tricky preg_replace and how to escape the \{occurencenumber}
hm... this should work, notice the double quotes echo preg_replace('/(.+?)(\..+?)/e', '\1.1.\2', $fn); Lallous wrote: Oh well, I could have solved it w/ too many other methods, but how can I escape the \{occurence} as in my case? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: problem with array and session
try this instead: session_start(); . . . if (mysql_num_rows($_query)) { $_rec = mysql_fetch_array($_query); if (!isset($_SESSION[bkmks]) || !in_array($_rec, $_SESSION[bkmks]) { $_SESSION[bkmks][] = $_rec; } else { echo Already exist.; } } to test: echo pre; print_r($_SESSION[bkmks]); echo /pre; p.s. assuming you are using php 4.1 or above Ricky wrote: Hello everybody I'd like to make a page in which the results shown can be bookmarked by clicking a button aside each of them. Actually first it should check if the session is open already ... Then if that item(that comes from a query to a MySQL table) has been registered already, finally it registers all the variables in a multidimensional array. this is the code: session_start(); if(!session_is_registered(bkmks)) {session_register(bkmks)||die(WE GOT PROBLEMS MAN); $bkmks = array(array(tab=$tab, id=$id, url=$url, nome=$nome, ind=$ind, com=$com, pv=$pv, tel=$tel, chi=$chi)); print htmlbody Your choice has been stored/body/html; } else { foreach($bkmks as $v) { if(($v[tab]==$tab)($v[id]==$id)){ print htmlbody You have already chosen this item/body/html;exit; } } $bkmks[][tab]=$tab; $bkmks[][id]=$id; $bkmks[][url]=$url; $bkmks[][nome]=$nome; $bkmks[][ind]=$ind; $bkmks[][com]=$com; $bkmks[][pv]=$pv; $bkmks[][tel]=$tel; $bkmks[][chi]=$chi; print htmlbodyYour choice has been stored/body/html; } It doesn't work! I can't figure out why. It starts storing fine and then it seems messing up with values so it recognises as already stored only the variables of my first choice (the value stored at bkmks[0])... I tried to print values stored in the array: the output is a mess I don't know why! Thanks a lot ! Bye. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help
to do a comparison between two values / variables, you have to use == instead of = = is an assignment while == is a comparison operator if($row['gid'] == 0) { $rat = 110; } elseif($row['gid'] == 1) { $rat = 9.5; } else { $rat = 6.6; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: passing an array in a link
you could try this: transmitting end: ?php foreach ($keylist as $key = $value) { $searchArg .= keylist[]=.htmlentities($value).; } ? a href=myphp.php??php echo $searchArg?array from search argument/a receiving end: foreach($_GET[keylist] as $key = $value) { echo {$value}br; } David T-G wrote: Hi, all -- I collect field keys in an array that looks like $keylist = array('comment','job','spaced out key name','foo',...) ; and would like to pass the array to myself in a call like print a href=\/myscript.php?keylist=$keylist\link/a ; but when it's actually run it of course says ...keylist=Array... which is quite bad. I'd use a simple scalar $keylist = comment job spaced out key name foo ... ; but, of course, those darned fields which have spaces embedded in the names will really mess that up. How can I pass myself an array -- and recognize it on the receiving end? TIA HAND :-D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing an array in a link
from my experience, you don't really have to worry much on the space issue. is the delimiter to determine that the string terminates and a new argument begins next. and very often, the browser will do an auto conversion from space to %20 when you click on the link. David T-G wrote: snip so that takes care of walking the array but now I need to protect myself from the spaces. I've looked at htmlentities() but it doesn't seem to convert spaces... /snip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Good Damn
you might wanna use this instead: $result = mysql; if (mysql_num_rows($result) { while } else { echo 'no articles'; } $result will always hold an int value if the query does not contain any error. so doing a num_rows on it will be more accurate in telling you if records are been retrieved. Sascha Braun wrote: $Query = SELECT * FROM basket_db WHERE session_id = '$PHPSESSID'; $Result = mysql_query($Query, $connect); if ($Result) { while ($arrResult = mysql_fetch_array($Result, MYSQL_ASSOC)) { echo 'tr bgcolor=#fffdd7 class=text01'; echo 'td'.$arrResult['image_id'].'/td'; echo 'td'.$arrResult['name'].'/td'; echo 'tda class=text01 href='.$PHP_SELF.'?action=deleteid='.$arrResult['id'].'delete/a/td'; echo 'td Hier Preis'.$arrResult[''].'/td'; echo 'td hier gesamt'.$arrResult[''].'/td'; echo '/tr'; } } else { echo 'tr bgcolor=#fffdd7 class=text01'; echo 'td colspan=5There are no Artikles in Cart./td'; echo '/tr'; } This script is not doing what I want it too! Ich want to see : There are no Artikles in Cart when there are no Artikels in Cart But it good damn doesn't work! Please tell me why -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Cookie array
to store: setcookie (TestCookie[0], zero, time() + 3600); setcookie (TestCookie[1], one, time() + 3600); setcookie (TestCookie[2], two, time() + 3600); or setcookie (TestCookie[one], 1, time() + 3600); setcookie (TestCookie[two], 2, time() + 3600); setcookie (TestCookie[three], 3, time() + 3600); to retrieve: foreach($_COOKIE[TestCookie] as $key = $value) { echo {$value}br; } or echo $_COOKIE[TestCookie][one]; echo $_COOKIE[TestCookie][1]; Jan - Cwizo wrote: Hi ! How can I stoor array in to a cookie ? Do I just define an array and stoore it in a cookie ? How do I access the data in the array then ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Random mirrors and download quota
how about using the counter to store an id of the mirrors instead of randomly picking one? this will provide you a sequential traverse through all mirror sites. if there are 10 sites, the counter will always be from 0 - 9. this way each mirror site will have equal share on hits. so if the counter == 2, your script will know that the next hit will be to mirror site 2. $_nextSite = (isset($_nextSite))?++$_nextSite % 10:0; the above code will always ensure the counter counts from: 0 - 9 - 0 - ... this way, you can store all counters (into database?) on the main site for all mirrors. Andrew Conner [EMAIL PROTECTED] escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, I have a script (at bottom) that, upon loading, will randomly select a mirror or primary server (on average, the primary servers will be selected twice as much). It all works good, but now, I have to add a quota manager that will, for both mirrors, limit the times the file can be downloaded to 1200 times (there is only one file being downloaded). I have thought about storing a text file for each of the two mirrors that shows the current count of downloads, and it will be checked if the mirror is randomly selected and if it is above 1200, will randomly select another server, and if it isn't, will just add one to it and update the file. How would I go about this, or is there a better way to do this? Thanks in advance. Andrew Conner The script (I know it doesn't use the best design, but it works, any better ways of doing this?): ? // This array holds the servers, and has a double entry for the primary servers $adArr = array(http://www.someprimaryserver.com/file.exe;, http://www.someprimaryserver.com/file.exe;, http://www.someprimaryserver2.com/file.exe;, http://www.someprimaryserver2.com/file.exe;, http://www.someprimaryserver3.com/file.exe;, http://www.someprimaryserver3.com/file.exe;, http://www.someprimaryserver4.com/file.exe;, http://www.someprimaryserver4.com/file.exe;, http://www.somemirror.com/file.exe;, http://www.somemirror2.com/file.exe;); // This randomly gets a server... srand((double)microtime()*100); $wOne = rand(0, 9); $choice = $adArr[$wOne]; // This fwds the user to the server picked. // Somewhere in here needs to be the mirror stuff... header(Location: $choice); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] imagecopyresized() problems
I am trying to create a piece of code that will create and display thumbnail image. When trying to send the image to a browser, I see binary data rather then an image. You can see the problem at www.dallypost.com/a/test.php The troubled cose for this page follows: ?PHP //a master image may be any image of any size //If the master image exists, the thumb will be created and output to the browser //requires path from the file system home directory as $master_image_path //requires the name of the master image as $master image //test variables -- will eventually be defined by the calling module $master_image_path = /home/html/74ranch/uploads/; $master_image = chex34.jpg; if(!isset($thumb_width)) { $thumb_width = 80; }//end if //make sure that the master file exists $master_image_all = $master_image_path; $master_image_all .= $master_image; //remove this section after coding is complete $master_image_all_link = /74ranch/uploads/; $master_image_all_link .= $master_image; print(img src = $master_image_all_link); if(file_exists($master_image_all)) { $size = getimagesize($master_image_all); $width = $size[0]; $height = $size[1]; //calculate thumb height $factor = $width / $thumb_width; $thumb_height = $height * $factor; $thumb_height = $thumb_height * .1; $thumb_height = round($thumb_height); print(P Origional: height: $height width: $widthBRTarget: height:$thumb_height width: $thumb_widthP); //build the thumbnail $src_img = imagecreatefromjpeg($master_image_all); $dst_img = imagecreate($thumb_width,$thumb_height); //$dst_img = imagecreatetruecolor($thumb_width,$thumb_height);//requires gd 2.0 or higher print(PVariables that will be inserted into the imagecopyresized function); print(BRwidth: $width); print(brheight $height); print(brthumb_width $thumb_width); print(brthumb_height $thumb_height); print(PDisplay the new thumb imageP); imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, $thumb_width, $thumb_height, $width, $height); //imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $thumb_width, $thumb_height, $width, $height);//requires gd 2.0 or higher //imagejpeg($dst_img, path and file name, 75);//saves the image to a file imagejpeg($dst_img, '', 50);//sends the image to thebrowser imagedestroy($src_img); imagedestroy($dst_img); }//end if ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: FW: [PHP] session problem
you might wanna check if register global is turned on or off. Naintara Jain wrote: One thing I forgot to mention is that the same code works perfectly on the web server (running on Apache and a Unix flavor). -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] t]On Behalf Of Naintara Jain Sent: Saturday, July 06, 2002 6:09 PM To: Php-General@Lists. Php. Net Subject: [PHP] session problem I am storing some values in session variables. The behavior of the session is pretty unpredictable. On the first page I begin with: session_name(aname) session_start() session_register(var1,var2) In another page I check for existing value of session variable var2. In the next page I have the following code: session_name(aname) session_start() if(($var2)== || !isset($var2)) invalid But the strange thing is that the session value is not accessible in the other page. I have tried passing the session id though session_id() in the URL. Session handling has been giving me some trouble (windows 2000, IIS) The strange thing is that it works some times. Can anyone give any pointers? -- 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 vs. HTTP ? - the weakest link
sorry to barge in. but the weakest link ain't in ssl. doesn't really matter how secure vs insecure it is. you can come up with the most secure technology in the whole world that no one can break into. the weakest link lies on the user/customer themselves. you just need a trojan horse in their computer and there goes the neighbourhood. they can by all means send their credit card information over to amazon.com. but this piece of information will still be open to the person who plant the horse in the machine. so i suppose the debate over here should really be: is ecommerce safe? and not: http vs https just my 2 cents b.c. lance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thanks
not from meta refresh. but javascript could do that. set a timeout that will fire the submit event after 2 seconds. that will work. b.c. lance Alberto Serra wrote: ðÒÉ×ÅÔ! Probably a stupid question. Is there anyway to force POSTing a form from the refresh META? META HTTP-EQUIV=Refresh CONTENT=2;URL=someURL/somescript.php IMHO that is NOT possible, but maybe I am wrong. ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thanks
you might wanna fire that javascript using onload from the body tag. that kinda assure the page is loaded successfully before the event takes off. Alberto Serra wrote: I already have that and it works fine. The problem is when jscript is not working (or missing). I was trying to build up some panic tree in case jscript fails. ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thanks
hm... how about sticking couple of iframes that will load the piece of javascript and have each of the javascript in the iframe firing at different time? i suppose at least 1 copy of javascript will be there to do the intended work. Alberto Serra wrote: It is there already. My problem is to do it something that will save my *ss in case jscript is *NOT* there. So it must be a no thrills HTML solution that will run anyway, no matter how poor in resources the browser is. ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thanks - Actually POSTING without javascript
yes. now its clearer. hm... but i can't think of submitted the information if javascript is off on the client browser. unless you stick in a button telling the user to hit it if the page do not bring him to another after a specific timing. a button probably don't look presentable. use an image as the input type. that will probably brighten up the page. in short, what i mean is let the user do the submit if javascript fails. an image of brintney spear and a text on it telling the user to click on sounds appealing to you? ;) b.c. lance Alberto Serra wrote: ðÒÉ×ÅÔ! *The problem was here*. What if this second step fails? easy, I just leave the META as is and stock previous data on a session during the first execution of index.php At this point index.php knows all it needs to fill in cionfiguration data and it just includes the real home page. From now on we will be able to tailor channelling (that is, cookies or not, jscript or not) without reasonable doubts. Yes, the user *may* change it's configuration during the session, but this is very low percentage of cases and we can live with it. Well, that's the most general part of it. But at least it's clearer. ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Mailing all the elements of a form
you could loop through $_POST (assuming you are using a post action) to extract the value out. e.g. $arr = array_keys($_POST); for ($i = 0; $i count($arr); $i++) { $msg.= {$arr[$i]}: {$_POST[$arr[$i]]}\r\n; } echo $msg; b.c. lance Jeremy Bowen wrote: Hey, I have looked in PHP manual but I cannot seem to find what I am looking for. I have a very large form that I need to be able to mail. I just don't want to have to code all of the field into my mail() function. Thanks, Jeremy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] does a form submit from a http page to a https ensure secure data?
hi, the above question has been puzzling me for a while. the situation is this. http://domainname.com/register.php display a user registration form having [form action=https://domainname.com/register.php; method=post] will the data from that page be encrypted when it is sent via https specified in the [form] action? note: the registration form is served from http. could someone enlighten me on this? regards, b.c. lance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] does a form submit from a http page to a https ensure securedata?
thanks for the insights. :) basically the 2 files are from 2 different domains saving to the same database server. the 2 sites share the same userbase. and when the registration form is submitted to the 2nd site, upon successful registration, it will redirect back to the 1st site and display a success page. otherwise it will redirect back to the 1st site and prompting them an error. you probably wonder why the complexity of the above scenario. basically the 2nd site has a ssl cert while the 1st site doesn't. so as a cost saving measure, the 1st site will be using the 2nd site's ssl cert to complete the user registration process. hope the above make sense to you. lance Michael Sweeney wrote: Your form action parameter has an absolute url specifying an https protocol. When the browser submits the form, it uses the url you specify which is https. So the request is going to be encrypted. You might consider serving the form page from https as well to kind of tighten things up a little, but the data will be posted under https which is an encrypted connection. Your main problem is going to be the fact that the http and https services are accessing two different file system spaces (or they should be unless you've got your server badly misconfigured) so the http://...register.php is going to be a different file from the https://...register.php. You might want to reconsider your design. ..mike.. On Tue, 2002-07-02 at 04:21, B.C. Lance wrote: hi, the above question has been puzzling me for a while. the situation is this. http://domainname.com/register.php display a user registration form having [form action=https://domainname.com/register.php; method=post] will the data from that page be encrypted when it is sent via https specified in the [form] action? note: the registration form is served from http. could someone enlighten me on this? regards, b.c. lance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cc / Bcc don't work on win2k but on linux???
cool! 4.3.0dev work like a charm! but is it safe for deployment server? --lance Christoph Grottolo wrote: You should download php4.3.0 dev. The mail enhancements have not been merged into the 4.2 branch. Sorry for not having been exact in my last posting. Christoph Lance wrote: i downloaded php4.2.2dev and tried my codes on it. still giving me the same problem. Try a recent dev-snapshot from snaps.php.net/win32. The mail function has been reworked. Christoph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cc / Bcc don't work on win2k but on linux???
ok. thanks for the info. guess i have to wait till it hit stable version before deploying it on live server. for now, it's byebye to CC/BCC/Attachments. thanks again. lance Christoph Grottolo wrote: Lance wrote: cool! 4.3.0dev work like a charm! but is it safe for deployment server? No. It's a dev version which has not been going through qa. (We're using it on an intranet and didn't have any probs until now.) Christoph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cc / Bcc don't work on win2k but on linux???
hi, i am facing the above issue. i set the headers up for the mail(). tried submitting the email. it worked great on linux server. but when i try to run it on a win2k. i just get: Warning: Server Error in blahblah.php on line blahblah my piece of code: $headers = MIME-Version: 1.0\r\n; $headers .= Content-type: text/html; charset=iso-8859-1\r\n; $headers .= From: [EMAIL PROTECTED]\r\n; $headers .= Cc: [EMAIL PROTECTED]\r\n; $to = [EMAIL PROTECTED]; $subject = my subject; $message = my message; mail($to, $subject, $message, $headers); any idea whats wrong with the above code? the log file shows: #Fields: time c-ip cs-method cs-uri-stem sc-status 12:23:30 127.0.0.1 HELO - 250 12:23:30 127.0.0.1 MAIL - 250 12:23:30 127.0.0.1 RCPT - 250 12:23:30 127.0.0.1 RCPT - 501 12:23:30 127.0.0.1 QUIT - 0 it appears that 501 = Not Implemented on IIS5. but i am not sure on that. thanks regards, lance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cc / Bcc don't work on win2k but on linux???
i tried that. using different email addresses. all of them are valid. still getting the same error. however, when i change the Cc to cc, no error was thrown. but only the To: will receive the email. the Cc: never get the mail. any other thoughts on that? Stuart Dallas wrote: That 501 is an SMTP error code, not an IIS error. A 501 error in SMTP means Syntax error in parameters or arguments. Looking at your code, the only thing I can think is that it's complaining because both addresses are the same. Try changing the CC address to something different from the primary recipient. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cc / Bcc don't work on win2k but on linux???
yes, and it did show me whats wrong. but i have no idea why is that the case... 127.0.0.1 SMTPSVC1 RCPT - +TO:[EMAIL PROTECTED] 250 127.0.0.1 SMTPSVC1 RCPT - +TO:Cc:[EMAIL PROTECTED] 501 i don't understand why the Cc is been treated as a recipient in TO: Stuart Dallas wrote: On Friday, June 21, 2002, 4:01:44 PM, Lance wrote: i tried that. using different email addresses. all of them are valid. still getting the same error. however, when i change the Cc to cc, no error was thrown. but only the To: will receive the email. the Cc: never get the mail. any other thoughts on that? Can you get a transcript of the SMTP session, specifically the line PHP sends to the SMTP server when it gets the 501 reply? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cc / Bcc don't work on win2k but on linux???
hm... but isn't it weird to include the cc: recipient within to: and then specifying them under cc: again? cos wouldn't it be more straight forward just to simply include all the recipient in cc: to to: and omit the cc: list. and specifying the recipient that is suppose to be in Bcc: under To:, i believe its already telling everybody who will be receiving that email. there is no more reason to stick their email in Bcc: list. am i right to say that? Lowell Allen wrote: You need to include cc: and Bcc: addresses in the first parameter and repeat in the headers, for example: mail('[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]', 'subject', 'message', To: Receiver [EMAIL PROTECTED]\n . From: Sender [EMAIL PROTECTED]\n . cc: Courtesy [EMAIL PROTECTED]\n . Bcc: Blind [EMAIL PROTECTED]\n); Cc does not work, but cc or CC does, and on Windows servers the Bcc: header is not removed when sending, so recipients can see Bcc: receivers by examining the headers. This is from Kevin Yank's Advanced email in PHP on WebmasterBase.com. -- Lowell Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cc / Bcc don't work on win2k but on linux???
yes, the + is a whitespace. hm... a bug, you could be right on that. i dont have a copy of php4.2.1 on linux to test and see if it is just windows2k that is giving the problem, or php4.2.1 is the main culprit. but i did get the same piece of code to run on php4.0.6 on linux. it runs smoothing in there. btw, i forgot to mention that i am running php4.2.1 on win2k sp2 server. Stuart Dallas wrote: As far as the SMTP envelope is concerned, the To:, Cc: and Bcc: recipients are equal. It looks like a bug in PHP to me, but I don't have time to delve into the code to confirm it. It should be stripping the Cc: and the space (which shows in your log as a +) from the Cc: line. The SMTP server is complaining because the address contains invalid characters. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cc / Bcc don't work on win2k but on linux???
i downloaded php4.2.2dev and tried my codes on it. still giving me the same problem. Cc: is not been parsed correctly. so i changed to cc: and CC: no errors thrown out this time. however, only the recipient specified in To: managed to receive the email. the one specified under CC: never gets it. i looked at the smtp log file and i can only find the To: been executed. no CC: was shown on the log file. seems that php never send the CC: list to the smtp server. Christoph Grottolo wrote: Try a recent dev-snapshot from snaps.php.net/win32. The mail function has been reworked. Christoph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular expression newbie question, convert this: [::word1\ word2 \ word3::] to : .word1 word2 word3.
hi dan, its because the html text is from user input. and i dont wanna spend too much time educating them on coding with php. sometime its a pain trying to get them to understand the codes. so i just wanna give them some simple commands in php whereby they can happily insert date formats on a page. something like what phpBB did on the [url] thingie. lance Analysis Solutions wrote: Hi Lance: On Sun, Jun 16, 2002 at 01:31:45AM +0800, Lance wrote: i was developing an application that will read in the content of a html file. and within this html file contains php variables which will be replaced using the eval() function with its required value. and within this html, i want to be able to run php functions. ... snip ... eval(\$rs = \span class=\normal\.date(m d y).$phpVar/span\;); Why not merge your PHP and HTML straight up like this? span class=normal?php echo date('m d y') . $phpVar; ?/span Then, just have the whole HTML file parsed as PHP. --Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular expression newbie question, convert this: [::word1\ word2 \ word3::] to : .word1 word2 word3.
hi, thanks for the code. i tried. it only worked if the string is simply the one i wanna convert. but that particular string is in the middle of a long text, and there are multiple occurance, it won't. however, i did manage to come up with this code that worked. but i believe it can be improved on. it will identify all occurance of the specified pattern and do the necessary replacement throughout the whole string. preg_match_all(|\[::(.*)::\]|U, $longTxt, $matchedResult); for ($idx = 0; $idx count($matchedResult[1]); $idx++) { $extract = stripslashes($matchedResult[1][$idx]); $longTxt = str_replace([::{$matchedResult[1][$idx]}::], \.$extract.\, $longTxt); } lance Analysis Solutions wrote: Lance: On Fri, Jun 14, 2002 at 11:41:34PM +0800, Lance wrote: [::word1 \ word2 \ word3::] to: .word1 word2 word3. While I don't know if this is really what you need, it does do exactly what you want to do in your example: $Replace['\\'] = ''; $Replace['::'] = '.'; $Replace['['] = ''; $Replace[']'] = ''; $UserInput = '[::word1 \ word2 \ word3::]'; echo strtr($UserInput, $Replace); --Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular expression newbie question, convert this: [::word1\ word2 \ word3::] to : .word1 word2 word3.
hi, i was developing an application that will read in the content of a html file. and within this html file contains php variables which will be replaced using the eval() function with its required value. and within this html, i want to be able to run php functions. however, due to the fact that characters need to be escaped so that eval() can process it, i have to make use of addslashes() to escape all that are embedded in the html file. with the escaped, eval() will be able to work and evaluate the php variable and instead of: eval(\$rs = \span class=normal$phpVar/span\;); (won't work) it will now be: eval(\$rs = \span class=\normal\$phpVar/span\;); (work) and to call a date() function on the above text, this format will work: eval(\$rs = \span class=\normal\.date(m d y).$phpVar/span\;); since the text that is passed into eval() came from a html/php/inc (whatever you name it) file, there is no way you will know that a particular text is in fact a php function. so i thought of prefixing and suffixing php function with [::date(m d y)::] and it will be helpful in the sense that the application will know that oh, this is a php function, i need to . . it so that eval will not throw me an error. with that, now the html file's content will be something like: span class=normal[::date(m d y,$phpVar)::]/span after using addslashes(), it will be: span class=\normal\[::date(\m d y\,$phpVar)::]/span for the above text, in order for eval() to parse correctly, it has to be in this format: eval(\$rs = \span class=\normal\.date(m d y,$phpVar)./span\;) and there is always a chance that the html text could contain more than 1 block of [:: phpfunction ::] thats why i came up with that piece of code to convert the text to a string that eval will be able to understand. and at the end of it, i will be echoing $rs to display the final result. you probably will wonder why dont i use include() and require()? that way, php will be handling all the above without requiring additional work. however, due to the way the result has to be handled, i couldn't use include nor require. lance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Regular expression newbie question, convert this: [::word1 \ word2\ word3::] to : .word1 word2 word3.
hi, i have been banging my head against the wall for hours trying to figure the expression out to perform the following: covert this: [::word1 \ word2 \ word3::] to: .word1 word2 word3. i would definitely appreciate any help given on this. thanks beforehand. lance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Generate every possible combination
Here's the function I use: // array array_permute(array [, string]) // // Returns an array containing the permutations of the values in an array. // // Example: // $a = array(1, 2, 3); // $p = array_permute($a) // // Result: // p[0] = '1,2,3' // p[1] = '1,3,2' // p[2] = '2,1,3' // p[3] = '2,3,1' // p[4] = '3,2,1' // p[5] = '3,1,2' // function array_permute($a, $glue = ',') { $retval = array(); array_permute_internal($a, $glue, $retval, 0, count($a)); return $retval; } // Private function used by array_permute. function array_permute_internal($a, $glue, $retval, $depth, $ubound) { if ($ubound 0) { for ($i=0; $i $ubound; $i++) { $c = $a[$depth+$i]; $a[$depth+$i] = $a[$depth]; $a[$depth] = $c; array_permute_internal($a, $glue, $retval, $depth+1, $ubound-1); $c = $a[$depth+$i]; $a[$depth+$i] = $a[$depth]; $a[$depth] = $c; } } else { $retval[] = implode($glue, $a); } } -Original Message- From: Evan Nemerson [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 16, 2002 12:17 AM To: [EMAIL PROTECTED] Subject: [PHP] Generate every possible combination I need to generate every possible combination of the the values in an array. For example, if... $array = Array(A, B, C); I want to be able to do something like print_r(magic_function($array)); which would output Array ( [0] = ABC [1] = ACB [2] = BAC [3] = BCA [4] = CAB [5] = CBA ) I really have no idea where to begin. The best lead I can think of is that there are going to be n! elements in the output array, where n is the size of the input array. Any help would be greatly appreciated. Evan -- Think not those faithful who praise all thy words and actions, but those who kindly reprove thy faults. Socrates -- 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] Creating a global variable for all PHP pages?
Take a look at this PHP extension and see if it will help solve your problem. It doesn't work on Windows yet though... http://pwee.sourceforge.net Lance -Original Message- From: Warrick Wilson [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 2:49 PM To: [EMAIL PROTECTED] Subject: [PHP] Creating a global variable for all PHP pages? I want to define a variable that I can reference on ALL of my PHP pages. Ideally, I'd like to do it in php.ini or some similar place so that I can modify it as I place code on different systems, but not need to make changes in lots of different places. I looked at the Configuration section of the manual, did web searches, tried getenv() and using the OS environment (we're mixed Windows and UNIX boxes, using Apache and mysql and PHP 4.1.1), and had zero luck. I was hoping that getenv() or _ENV[] would have worked. I tried creating something in php.ini by simply adding a line, with no luck. Is there some way of doing this? Warrick -- 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] Creating a global variable for all PHP pages?
The short answer - efficiency. The FAQ has a more elaborate explanation. -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 12:14 AM To: 'Lance Lovette'; Warrick Wilson; [EMAIL PROTECTED] Subject: RE: [PHP] Creating a global variable for all PHP pages? what about a common include file? -Original Message- From: Lance Lovette [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 4:00 PM To: Warrick Wilson; [EMAIL PROTECTED] Subject: RE: [PHP] Creating a global variable for all PHP pages? Take a look at this PHP extension and see if it will help solve your problem. It doesn't work on Windows yet though... http://pwee.sourceforge.net Lance -Original Message- From: Warrick Wilson [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 2:49 PM To: [EMAIL PROTECTED] Subject: [PHP] Creating a global variable for all PHP pages? I want to define a variable that I can reference on ALL of my PHP pages. Ideally, I'd like to do it in php.ini or some similar place so that I can modify it as I place code on different systems, but not need to make changes in lots of different places. I looked at the Configuration section of the manual, did web searches, tried getenv() and using the OS environment (we're mixed Windows and UNIX boxes, using Apache and mysql and PHP 4.1.1), and had zero luck. I was hoping that getenv() or _ENV[] would have worked. I tried creating something in php.ini by simply adding a line, with no luck. Is there some way of doing this? Warrick -- 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 -- 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] time in annother zone
just use GMT it is much simpler just kidding ?PHP $test = getenv(DATE_LOCAL); print($test); ? - Original Message - From: Justin French [EMAIL PROTECTED] To: php [EMAIL PROTECTED] Sent: Monday, September 10, 2001 2:07 AM Subject: [PHP] time in annother zone Greetings, I've been to the online manual relating to both date() and time(), and i've read all the user-added notes, and i'm actually MORE confused now than I was before I started!! My ISP is based in Ontario, Canada. Myself, and 90% of my users are based in Australia (Sydney/Melbourne time). I'm trying to show what time a post was added to a message board. It's easy enough using date(), but it shows the server's local time (of course), not the current time in Australia. Now, I could easily find out how many seconds behind the ISP is, and minus it from the unix timestamp, but I'm thinking there has to be an easier way :) eg: ? $secondsDifference = a really big number; date(your format string,time() - $secondsDifference); ? it could be setlocale(), or something else, i'm just not sure what to make of it all. Many thanks in advance, Justin French -- 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 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] Rounding a number up
http://www.php.net/manual/en/function.ceil.php - Original Message - From: Brandon Orther [EMAIL PROTECTED] To: PHP User Group [EMAIL PROTECTED] Sent: Monday, September 10, 2001 2:19 PM Subject: [PHP] Rounding a number up Is there a way to round a number to the next whole number? Example: Before: 1.86758 After: 2 Thank you, -- 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] php help probably basic (used stripslashes but probably not the right way to do it)
I am having the following problem. I have a database that is setup as follows CREATE TABLE test ( id tinyint(4) NOT NULL auto_increment, text text NOT NULL , PRIMARY KEY (id) ) TYPE=MyISAM; I have a page after a form that confirms all data to be entered the html is as follows text=\test \'ve\ id=1 form action=./commitcard.php input type=hidden name=text value=\test I\'ve\ input type=hidden name=id value=1 input type=submit name=submit value=Commit to database! /form however in the next page I am doing a print of the insert statement for testing and all I get is the following insert into test (id,text) values ('1','\') I have tried the following $test = stripslashes($test); but it just gets worse any ideas would be helpful I am using php 4.0.6, apache 1.3.20, mysql 3.23.42, and Linux kernel 2.4.3 Lance Rochelle [EMAIL PROTECTED] http://ulands.idlegames.com (607) 775-2681 --- Being a Systems Administrator is like hitting yourself in the bead with a brick. After a while you don't feel the pain. -- 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] fsockopen doesn't time out for 10 minutes
I am calling fsockopen with a timeout parameter of 60 seconds. Despite the timeout value however fsockopen on some servers doesn't return for 10 to 13 minutes. The error given is usually Connection timed out and sometimes No route to host. Is this much of a delay to be expected? Is there any way to have the script just give up on fsockopen after 60 seconds? The server OS is RedHat 6.2. Thanks! Lance -- 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] Cannot determine HOSTNAME in 4.0.6?
Something was changed between 4.0.5 and 4.0.6 and now there is no way to determine the host name of the local host from a PHP script when executed in Apache. The output of phpinfo shows that the HOSTNAME environment variable that existed in 4.0.5 is not available in 4.0.6. This affects the return value of getenv and the contents of HTTP_ENV_VARS. Is this a bug or a feature? Here are the variables listed in the Environment section of Additional Modules as output from phpinfo on two of my servers, one with 4.0.5 and one with 4.0.6. 4.0.5 - LESSOPEN USERNAME ENV HISTSIZE HOSTNAME LOGNAME MAIL TERM HOSTTYPE PATH HOME INPUTRC SHELL USER LANG OSTYPE SHLVL LS_COLORS _ 4.0.6 - INIT_VERSION previous TERM HOSTTYPE PATH CONSOLE HOME PREVLEVEL RUNLEVEL SHELL runlevel AUTOBOOT BOOT_IMAGE OSTYPE SHLVL _
[PHP] IP of server?
I want to base the database a PHP script uses on the IP address of the server running the script. What is the fastest way to get the IP address of the server from a script? I could use environment variables but they are unreliable (when run from cron for example, the environment doesn't have all the variables you would expect). I wrote the following function based on a Perl firewall script that uses ifconfig, but it has too much overhead to call every time I connect to the database. All I really want to do is add a conf variable to php.ini that gets read at startup and is cached from then on. Any ideas? Thanks! Lance // string gethostaddress([string]) // // Returns the IP address of a network interface for the local host. // Returns false on error or if the address cannot be determined. // // Note: This function shells the ifconfig command so call sparingly. // function gethostaddress($interface = "eth0") { $inetaddr = false; // assume failure $ifconfig = `/sbin/ifconfig $interface`; if (ereg("inet addr:([.0-9]+)", $ifconfig, $ifconfigparts)) $inetaddr = $ifconfigparts[1]; return ($inetaddr) ? $inetaddr : false; } -- 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] IP of server?
Thanks, but most variables such as SERVER_ADDR and SERVER_NAME are not set when you run a PHP script from the command line (or from cron). Write a script that calls phpinfo() and then use 'php -f' to run it and you'll see how little environment information you get. Lance -Original Message- From: wx [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 28, 2001 5:09 PM To: Lance Lovette Subject: Re: [PHP] IP of server? Why just not use the built in variables: $SERVER_ADDR $SERVER_NAME not that tough, :) - Rob - Original Message - From: "Lance Lovette" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 28, 2001 11:27 AM Subject: [PHP] IP of server? I want to base the database a PHP script uses on the IP address of the server running the script. What is the fastest way to get the IP address of the server from a script? I could use environment variables but they are unreliable (when run from cron for example, the environment doesn't have all the variables you would expect). I wrote the following function based on a Perl firewall script that uses ifconfig, but it has too much overhead to call every time I connect to the database. All I really want to do is add a conf variable to php.ini that gets read at startup and is cached from then on. Any ideas? Thanks! Lance // string gethostaddress([string]) // // Returns the IP address of a network interface for the local host. // Returns false on error or if the address cannot be determined. // // Note: This function shells the ifconfig command so call sparingly. // function gethostaddress($interface = "eth0") { $inetaddr = false; // assume failure $ifconfig = `/sbin/ifconfig $interface`; if (ereg("inet addr:([.0-9]+)", $ifconfig, $ifconfigparts)) $inetaddr = $ifconfigparts[1]; return ($inetaddr) ? $inetaddr : false; } -- 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 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] PHP dll on NT - more reliable with Apache than IIS?
did you copy this file "php4ts.dll" into your winnt/system32 folder? i believe you need that in order for the isapi to work --lance - Original Message - From: "Greig, Euan" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 07, 2001 5:44 PM Subject: [PHP] PHP dll on NT - more reliable with Apache than IIS? I have been having problems using the PHP 4 ISAPI module with IIS 4 on NT4 (The most common problem is HTTP 500 internal server error which disappears if page is refreshed). This is apparently not too surprising given the current status of the ISAPI module. So I have switched to using CGI, which seems absolutely fine, but is noticeably slower. I was wondering if it is worth trying the Apache module. Will it be more reliable? And are there any notable gotchas to watch out for in installing this combination? Euan Greig Technical Consultant BRANN DATA [EMAIL PROTECTED] 01285 645997 ** Any opinions expressed in this email are those of the individual and not necessarily the Company. This email and any files transmitted with it, including replies and forwarded copies (which may contain alterations) subsequently transmitted from the Company, are confidential and solely for the use of the intended recipient. If you are not the intended recipient or the person responsible for delivering to the intended recipient, be advised that you have received this email in error and that any use is strictly prohibited. ** -- 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 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]