[PHP] Imap functions (imap_fetchstructure)
Ok, here it goes When I began developing in PHP a call to the imap_fetchstructure function on an email with attachments created a 'parts' array that was indexed numerically. Meaning I could say: if (count($message-parts) 0) for ($x = 0; $x count($message_parts); $x++) // do some processing Then I upgraded PHP. I'm not sure which upgrade changed it's workings but it definately changed by 4.3.4. Now, from what I understand the parts array is indexed with things like 0, 0.1, 0.1.1, 0.2. Worse yet, the count($message-parts) call doesn't even seem to return accurate information. In particular it behaves as though a parts array exists on messages without attachments. Enough background, is this new code broken or is this the way it should have behaved the whole time? If it is not-broken or has not been fixed: 1. How can I get an accurate count of the parts array, determine if attachments are present, and determine what the valid array indexes are? 2. Do you know of any email classes/applications that work with these changes? TIA, Daryl Meese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] re: an if statement
[EMAIL PROTECTED] (Andy B) wrote in news:[EMAIL PROTECTED]: although that'll generally work, why not use if(empty($name) || empty($comments)) { dosomething(); } -- ---John Holmes... because for some odd reason on any of the versions of php i am writing for (4.0.6-4.1.3) it always fails Are $name and $comment being passed from a form? In which case you may need to use $_GET or $_POST -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Local sysadmin DFW needed
[EMAIL PROTECTED] (Frank Tudor) wrote in news:[EMAIL PROTECTED]: Hi folks, Sorry for the inturruption. I'm looking for a part time sysadmin in the DFW area. Just out of curiosity, where the hell is DFW? I gather it's not near Ridgehaven. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and GD
After uploading the picture, so the program should first upload the picture, then open it, cut it in like 6 pieces and save all the pieces and remove the original uploaded file. regards patrick - Edwin - [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Hi, On Thu, 25 Mar 2004 02:03:26 +0100 [EMAIL PROTECTED] (Patrik Fomin) wrote: Hi, Is there anyway to split a picture with PHP (GD) ? Im uploading lots of pictures and i want to split them in 6 pieces to make em load faster, is there anyway to do this in PHP ? You mean, split them using PHP? *Before* uploading? Then, no. (Unless of course you have PHP installed on the client then there must be a way...) -- - E - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Header Redirect POST
On 25 March 2004 20:17, Chris Thomas wrote: I am not sure if this was designed like this, or if its just something im doing wrong. Im posting some data to a processing page, where i handle it then use Header('Location: other.php') to direct me to another page. The problem that im running into is that the posted data is available in other.php. I would like to get it so that in other.php $_POST should be an empty array At a guess, you're using Apache and it's doing an internal redirect because you've used a relative pathname (so the file must be in the same document root!); in this case, Apache just does a silent internal substitution of the redirect page, and all data associated with the context will remain intact -- there is no round-trip back to your browser. If you use an absolute URL in the Location: header, Apache will return the redirect to your browser -- and because your browser now knows it's a genuine new request, the POST data is not resent. The trick is to look at the URL appearing in your browser's address bar -- if it stays as the originally requested address, Apache did an internal redirect; if it changes to the redirect address, it was an external redirect which round-tripped to your browser. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_POST not working with str_replace
On 24 March 2004 22:28, PHP Email List wrote: And ? #2 are there any settings within PHP that would limit my ability to visually display the contents of a POST variable on a .rtf document as opposed to being displayed on the browser? Yes -- take a look at the variables_order directive (http://uk.php.net/manual/en/configuration.directives.php#ini.variables-order) -- it's not immediately clear from its description that this is a relevant setting, but on the Predefined variables page (http://uk.php.net/manual/en/language.variables.predefined.php), the last sentence in the first section (just above the PHP Superglobals heading) says: If certain variables in variables_order are not set, their appropriate PHP predefined arrays are also left empty. It's clear from this that if your variables_order setting does not include P, the $_POST array will not be populated in your scripts. HTH Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] curl problem
Hi! I try to compile PHP 4.3.4 with curl support on Debian Woody 3.0. I downloaded the http://curl.haxx.se/download/curl-7.11.1.tar.bz2, and compiled it. ./configure was succesfull. But make generate an error: usr/src/install/php-4.3.4/ext/curl/curl.c: In function `curl_free_post': /usr/src/install/php-4.3.4/ext/curl/curl.c:563: warning: passing arg 1 of `curl_formfree' from incompatible pointer type /usr/src/install/php-4.3.4/ext/curl/curl.c: In function `alloc_curl_handle': /usr/src/install/php-4.3.4/ext/curl/curl.c:603: sizeof applied to an incomplete type /usr/src/install/php-4.3.4/ext/curl/curl.c: In function `zif_curl_setopt': /usr/src/install/php-4.3.4/ext/curl/curl.c:838: duplicate case value /usr/src/install/php-4.3.4/ext/curl/curl.c:695: this is the first entry for that value /usr/src/install/php-4.3.4/ext/curl/curl.c:883: warning: passing arg 1 of `curl_formadd' from incompatible pointer type /usr/src/install/php-4.3.4/ext/curl/curl.c:883: warning: passing arg 2 of `curl_formadd' from incompatible pointer type /usr/src/install/php-4.3.4/ext/curl/curl.c:891: warning: passing arg 1 of `curl_formadd' from incompatible pointer type /usr/src/install/php-4.3.4/ext/curl/curl.c:891: warning: passing arg 2 of `curl_formadd' from incompatible pointer type make: *** [ext/curl/curl.lo] Error 1 The problem is that HttpPost structure is not definied. Maybe I'm trying to use not the proper version of curl? Thx in advance, Felho -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: question about M. Lemos's HTML forms generation and validation
Manuel Lemos wrote: Hello, On 03/25/2004 10:19 PM, Dr. Zoidberg wrote: I'm creating registration service with this great form script for creating forms within Smarty. Question is how can I validate 'username' against allready registered users in MySQL so that someone cannot register him self if there is another user with that username. You can always use the ValidateServerFunction parameter to specify the name of a callback function that will make a database query to see if ise there any user name with the value passed to that function. If there is a record with that user name return 0 and the class will set the respective input field as invalid. I'm trying to create that for a few hours. Can you PLS give me an example? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Local sysadmin DFW needed
David Robley wrote: [EMAIL PROTECTED] (Frank Tudor) wrote in news:[EMAIL PROTECTED]: Hi folks, Sorry for the inturruption. I'm looking for a part time sysadmin in the DFW area. Just out of curiosity, where the hell is DFW? I gather it's not near Ridgehaven. I'm going to guess DFW is just south of BFE -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Ereg problems
-Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: Thursday, March 25, 2004 6:55 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: Ereg problems On Thu, 25 Mar 2004 18:31:02 -0500, Jeff McKeon [EMAIL PROTECTED] wrote: Having some problems with ereg() [begin code] $string=Credit adjusted: $-1.32 to $48.68 ereg(([\\$(\\$-)][0-9]+\.[0-9]+),$data[2],$found); While(list($index,$hits)=each($found)) { echo $index , $hitsbr; } [end code] you assigned $string but used $data[2]? whoops, that was a leftover from the actual app that was parsing a field pulled from a database query. Forgot to correct that when I posted. I would suggest using pcre instead of Posix: preg_match_all('($-?[0-9]+\.[0-9]+)', $string, $found); print_r($found); That produces: Array ( [0] = Array ( ) ) 0 , Array Curt. -- 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] problem with archives zip
Hello, the problem that I have is that I need to decompress archives zip under php. that for this one is used libreria that is due to install it in the servant but the problem which I have is that I cannot install in that servant. If somebody knows a way different to decompress a file please zip under php they write like doing it. Thank you very much
[PHP] saving as .XLS
Hi, I am looking for some information about the way of saving the result of my php script (html table) with .XLS (ms excel) format. Do you know where could I get info about this? Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sprintf troubles
Hey, Im trying to use sprintf to format a number and left pad it with spaces, but it doesnt want to add the spaces I can pad it with anyother char using sprintf(%'_8.2f, $val) which will left-pad the number with underscores Has anyone had any luck padding with spaces?? or is there a better way to do this?? Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] saving as .XLS
[snip] Hi, I am looking for some information about the way of saving the result of my php script (html table) with .XLS (ms excel) format. Do you know where could I get info about this? Thanks, [/snip] Take a look at the write excel class, there is a php version of it, however most of the documentation is in perl http://search.cpan.org/src/JMCNAMARA/Spreadsheet-WriteExcel-0.37/WriteEx cel/doc/WriteExcel.html HTH! -- 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] Connection with MS-SQL
Dear All, Except for --with-mssql options ( configure command ) , which any other options ( configure commands ) must be compiled with php also, then the php will be good for working with MS-SQL ? BTW, --with-mssql is better than --with-sybase ? Thank for your help ! Edward. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can't to insert data ( via variable ) into MS-SQL
Dear All, There is a sample that can't to insert any data ( via variable ) in MS-SQL : insert.php: form action=save.php method=post table border=0 align=center input type=text size=20 name=name maxlength=8 value=? echo $GBName ?br Jobinput type=text size=16 name=jobbr Subjectinput type=text size=30 name=subjectbr input type=submit value=SubMit /center /table /form save.php: a href=view.phpSearch data/a /body /html ? $date=date('Y-m-d H:i:s'); $link = mssql_pconnect(sql,sa,1234); mssql_select_db(phpbook,$link); $str = INSERT INTO staff (name,job,subject) VALUES('$name','$job','$date','$subject',); mssql_query($str,$link); ? After insert data by using save.php, I found no any data from the Database system ( MS-SQL ), but I sure the Database System is no problem ! So, how can I fix this kind of problem ( Sorry, I'm not familar with php ) ? Many thank for your help ! Edward. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] check for special characters...
How would I check if a variable has special characters in it like [EMAIL PROTECTED] etc ? and give an error if it contains one of them.
[PHP] multi-dim array from text file
Hi, I need to do some text file manipulation of a text file from an html interface. I have a file with multiple lines where each line has 2 fields each (a mac address and an associated vlan). Here's an example of rht text file: /tmp/TEST: a1b2.c3d4.e5cc VLAN3 a1b2.c3d4.e5dd VLAN4 a1b2.c3d4.e5ee IS a1b2.c3d4.e5ff VLAN6 a1b2.c3d4.e5a1 VLAN7 a1b2.c3d4.e5b2 VLAN8 a1b2.c3d4.e5c3 Printer a1b2.c3d4.e5d4 Guest a1b2.c3d4.e5e5 IS a1b2.c3d4.e5f6 VLAN6 a1b2.c3d4.e5a2 VLAN2 a1b2.c3d4.e5a3 VLAN4 Being an admin and not a developer of any kind, I'm having trouble reading in the file and being able to output specific lines and fields of a php array. This is what I have so far: HTML HEAD TITLEMAC address Listing/TITLE /HEAD BODY ?php $CnfRec=array(); $CnfRec=file(/tmp/TEST); foreach ($CnfRec as $line) { $CnfRec=explode( ,$line); echo LINE: ; print_r($line); echo CnfRec: ; print_r($CnfRec); echo P; }; ? /BODY /HTML What I want to eventually do is read in the records and fields of this file, present it as a form, allow admins to modify the second field and write that back to the text file (while backing up the original file). As a reference, I handle it in a completely different way, but this is how I'd kinds like things to look visually ( just one submit button would be preferable): == HTML HEAD TITLEMAC address listing/TITLE /HEAD BODY ?php echo table border='1' align=center\n; echo tr BGCOLOR='#99CCFF'th width=150MAC Address/thth width=150VLAN/th/tr; $res = system(/bin/sort -k 1 /tmp/TEST | /bin/awk '{ print \tr align='center'td\$1\/tdtdFORM METHOD=POST ACTION='/cgi-bin/change_mac-vlan_list.sh'SELECT NAME='VLAN' OPTION SELECTED VALUE='\$2\'\$2\/OPTION OPTION VALUE='VLAN0002'VLAN2/OPTION OPTION VALUE='VLAN0003'VLAN3/OPTION OPTION VALUE='VLAN0004'VLAN4/OPTION OPTION VALUE='IS'IS/OPTION OPTION VALUE='VLAN0006'VLAN6/OPTION OPTION VALUE='VLAN0007'VLAN7/OPTION OPTION VALUE='VLAN0008'VLAN8/OPTION OPTION VALUE='Printer_VLAN'Printers/OPTION OPTION VALUE='Guest'Guest/OPTION/SELECTINPUT TYPE='SUBMIT' VALUE='Change'/FORM/td/tr\ }' ); ? /BODY /HTML == TIA, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apache 2 w/ PHP database sessions
I recently upgraded to apache 2.0 from 1.23.x on my server. Previously, I had sessions working using the database to store session information. I recently noticed that this is no longer working as it did. The sessions are still working, however, the session information is not being transfered via the url. I have verified that everything is setup correctly. I have a development server setup with the same settings before I upgraded apache and it is working fine. The only difference is the version of Apache. Does anyone know of a fix for this? Did I set something up wrong? Below is a copy of the sessions section from my php.ini file. Thanks Chris psThe settings and instructions I used were obtained from the Web Database Applications book from O'reilly. [Session] ; Handler used to store/retrieve data. #session.save_handler = files session.save_handler = user ; Argument passed to save_handler. In the case of files, this is the path ; where data files are stored. Note: Windows users have to change this ; variable in order to use PHP's session functions. ; As of PHP 4.0.1, you can define the path as: ; session.save_path = N;/path ; where N is an integer. Instead of storing all the session files in ; /path, what this will do is use subdirectories N-levels deep, and ; store the session data in those directories. This is useful if you ; or your OS have problems with lots of files in one directory, and is ; a more efficient layout for servers that handle lots of sessions. ; NOTE 1: PHP will not create this directory structure automatically. ; You can use the script in the ext/session dir for that purpose. ; NOTE 2: See the section on garbage collection below if you choose to ; use subdirectories for session storage #session.save_path = /tmp session.save_path = mdas_users ; Whether to use cookies. #session.use_cookies = 1 session.use_cookies = 0 ; This option enables administrators to make their users invulnerable to ; attacks which involve passing session ids in URLs; defaults to 0. ; session.use_only_cookies = 1 ; Name of the session (used as cookie name). #session.name = PHPSESSID session.name = USID ; Initialize session on request startup. session.auto_start = 0 ; Lifetime in seconds of cookie or, if 0, until browser is restarted. session.cookie_lifetime = 0 ; The path for which the cookie is valid. session.cookie_path = / ; The domain for which the cookie is valid. session.cookie_domain = ; Handler used to serialize data. php is the standard serializer of PHP. session.serialize_handler = php ; Define the probability that the 'garbage collection' process is started ; on every session initialization. ; The probability is calculated by using gc_probability/gc_divisor, ; e.g. 1/100 means there is a 1% chance that the GC process starts ; on each request. session.gc_probability = 1 session.gc_divisor = 100 ; After this number of seconds, stored data will be seen as 'garbage' and ; cleaned up by the garbage collection process. session.gc_maxlifetime = 1440 ; NOTE: If you are using the subdirectory option for storing session files ; (see session.save_path above), then garbage collection does *not* ; happen automatically. You will need to do your own garbage ; collection through a shell script, cron entry, or some other method. ; For example, the following script would is the equivalent of ; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes): ;cd /path/to/sessions; find -cmin +24 | xargs rm ; PHP 4.2 and less have an undocumented feature/bug that allows you to ; to initialize a session variable in the global scope, albeit register_globals ; is disabled. PHP 4.3 and later will warn you, if this feature is used. ; You can disable the feature and the warning seperately. At this time, ; the warning is only displayed, if bug_compat_42 is enabled. session.bug_compat_42 = 1 session.bug_compat_warn = 1 ; Check HTTP Referer to invalidate externally stored URLs containing ids. ; HTTP_REFERER has to contain this substring for the session to be ; considered as valid. session.referer_check = ; How many bytes to read from the file. session.entropy_length = 0 ; Specified here to create the session id. session.entropy_file = ;session.entropy_length = 16 ;session.entropy_file = /dev/urandom ; Set to {nocache,private,public,} to determine HTTP caching aspects ; or leave this empty to avoid sending anti-caching headers. session.cache_limiter = nocache ; Document expires after n minutes. #session.cache_expire = 180 session.cache_expire = 60 ; trans sid support is disabled by default. ; Use of trans sid may risk your users security. ; Use this option with caution. ; - User may send URL contains active session ID ; to other person via. email/irc/etc. ; - URL that contains active session ID
Re: [PHP] Apache 2 w/ PHP database sessions
--- Christopher Ditty [EMAIL PROTECTED] wrote: I recently upgraded to apache 2.0 from 1.23.x on my server. 1.3.x you mean? :-) The sessions are still working, however, the session information is not being transfered via the url. [snip] session.use_trans_sid = 0 There's your answer. Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly Coming Fall 2004 HTTP Developer's Handbook - Sams http://httphandbook.org/ PHP Community Site http://phpcommunity.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] check for special characters...
Chris Mach wrote: How would I check if a variable has special characters in it like [EMAIL PROTECTED] etc ? and give an error if it contains one of them. if(preg_match('/[^a-z0-9]/i',$value)) { echo special characters present!; } -- ---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] Re: saving as .XLS
Jon wrote: Hi, I am looking for some information about the way of saving the result of my php script (html table) with .XLS (ms excel) format. Do you know where could I get info about this? Thanks, http://pear.php.net/package/Spreadsheet_Excel_Writer -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 26 Mar 2004 17:09:53 -0000 Issue 2669
php-general Digest 26 Mar 2004 17:09:53 - Issue 2669 Topics (messages 181542 through 181565): Re: Methods for creating HTML with PHP 181542 by: electroteque Imap functions (imap_fetchstructure) 181543 by: Daryl Meese Re: an if statement 181544 by: David Robley Re: Local sysadmin DFW needed 181545 by: David Robley 181551 by: Roger Spears Re: PHP and GD 181546 by: Patrik Fomin Re: Header Redirect POST 181547 by: Ford, Mike [LSS] Re: $_POST not working with str_replace 181548 by: Ford, Mike [LSS] curl problem 181549 by: Hodicska Gergely Re: question about M. Lemos's HTML forms generation and validation 181550 by: dr. zoidberg Re: Ereg problems 181552 by: Jeff McKeon PHP 4.3.5 Released 181553 by: Ilia Alshanetsky problem with archives zip 181554 by: German saving as .XLS 181555 by: jon 181557 by: Daniel Purdy 181565 by: Justin Patrin sprintf troubles 181556 by: Chris Thomas Connection with MS-SQL 181558 by: edwardspl.ita.org.mo Can't to insert data ( via variable ) into MS-SQL 181559 by: edwardspl.ita.org.mo check for special characters... 181560 by: Chris Mach 181564 by: John W. Holmes multi-dim array from text file 181561 by: Larry Pisani Apache 2 w/ PHP database sessions 181562 by: Christopher Ditty 181563 by: Chris Shiflett Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- I'm using this one with no problems, its actually quite fast http://pukomuko.esu.lt/phemplate/ there is a benchmark against smarty aswell, i was actually thinking of going the smarty path as so many php apps use it, what is the better of them , anyone using this class ? -Original Message- From: Justin French [mailto:[EMAIL PROTECTED] Sent: Friday, March 26, 2004 2:11 PM To: Resell Domain Names Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Methods for creating HTML with PHP On Friday, March 26, 2004, at 04:47 AM, Resell Domain Names wrote: Why not use Smarty or another template engine? (http://smarty.php.net/) Smarty has a lot of overhead. PHP is a perfectly good templating engine all by itself. What the OP may or may not have understood is that PHP and HTML can be mixed together: --- html body div id='content' ?=$content? /div /body /html --- As for Smarty, well, anything it can do, PHP can do better and faster, without the overhead :) --- table {section name=mysec loop=$name} {strip} tr td{$name[mysec]}/td /tr {/strip} {/section} /table --- Could just as easily be: --- table ? foreach($names as $n) { ? tr td?=$n?/td /tr ? } ? /table --- Alternating table row colours? I just slapped this together in about 1 minute -- I'm sure with a little more work (or a class), I could keep it all out of the global name space too! --- ? function alternator($val1,$val2,$name='alternator') { // initialise or increment the global counter // called ${$name}_counter if(!isset($GLOBALS[{$name}_counter])) { $GLOBALS[{$name}_counter] = 1; } else { $GLOBALS[{$name}_counter]++; } // set ${name} in the global space to either // $val1 or $val2, depending on the odd/even // state of the counter if(is_int($GLOBALS[{$name}_counter] / 2)) { $GLOBALS[$name] = $val1; } else { $GLOBALS[$name] = $val2; } } $names = array('Fred','Jane','Bob','Kate','Hank','Nicole'); ? table ? foreach($names as $n) : ? ? alternator('#ccc','#eee',bgcolor) ? tr bgcolor='?=$bgcolor?' td?=$n?/td /tr ? endforeach; ? /table And when you hit a wall in Smarty, you can't do much other than request a new feature... in PHP, just code it! You also don't have to learn YET ANOTHER syntax/language, you don't have to compile templates Smarty's forte (and it's downfall) is that it limits what you can do. On one hand, you're not letting untrusted on unskilled template designers loose with the full features of PHP, but on the other hand, when a skilled template designer with PHP experience hits a limitation as to what Smarty is capable of, they're stuck... whereas PHP-based templates are only limited by the skills of the programmer and PHP itself. If your template designer is in fact a reasonably skilled and trusted PHP programmer, then Smarty is *overkill* and *very limiting*. If your template designer only
[PHP] Access Database
Hello I need data from a Microsoft Access database; however my hosting does not allow ODBC connections with php; so I was wondering if there is a way to import the access database to Mysql by a process in the server (like for example someone uploads the database thru a form, and after the uploading process automatically migates to Mysql). would that be possible? thanks maxi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache 2 w/ PHP database sessions
Thanks Chris. I just compared the trans_sid on the dev box and it is set to 1. I'll make that change and report in. Many thanks. Owe you another beer if that was it. ;) Chris Chris Shiflett [EMAIL PROTECTED] 03/26/04 10:41AM --- Christopher Ditty [EMAIL PROTECTED] wrote: I recently upgraded to apache 2.0 from 1.23.x on my server. 1.3.x you mean? :-) The sessions are still working, however, the session information is not being transfered via the url. [snip] session.use_trans_sid = 0 There's your answer. Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly Coming Fall 2004 HTTP Developer's Handbook - Sams http://httphandbook.org/ PHP Community Site http://phpcommunity.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- 03/26/2004, 11:31:54 AM This e-mail and any attachments represent the views and opinions of only the sender and are not necessarily those of Memphis Light, Gas Water Division, and no such inference should be made. == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] script problem with authorization
I am trying to get a script to work that will protect individual files, not just a directory. The script I am using is this - ? if($auth == yes) { $file = downloads/2004_February_PB_File1.pdf; $len = filesize($file); header(Cache-Control: no-store, no-cache, must-revalidate); // HTTP/1.1 header(Cache-Control: post-check=0, pre-check=0, false); header(Pragma: no-cache); // HTTP/1.0 header(Content-type: application/pdf); header(Content-Length: $len); header(Content-Disposition: inline; filename=2004_February_PB_File1.pdf); header(Content-Transfer-Encoding: binary\n); readfile($file); } else { echo Sorry, you must be logged in to access this page. a href='index.php'lt;lt;Back/a; // this is the end of the script, next lines added for testing purposes only echo br /File size: $len; echo br /File name: $filebr /; echo File size using the filesize() function: . filesize(downloads/2004_February_PB_File1.pdf); echo br /; echo File type using the filetype() function: . filetype(downloads/2004_February_PB_File1.pdf); echo br /; echo File owner using the fileowner() function: . fileowner(downloads/2004_February_PB_File1.pdf); } ? The test lines above do show the expected results. The two echo statements that are supposed to show the variables $len and $file do not result in anything. The problem seems to be with the first line auth == 'yes'. If I change it to 'no' the script still gives the same results as when it is 'yes'. Here's what it's supposed to do - I have a directory of files that is protected by a .htaccess file. I have a password file outside the web root called passwd. The same passwd file is used for other directories for my use only and it works fine. The script is supposed to see the .htaccess file and pass the visitor through without them having to actually log in, and then the file will download automatically. My purpose - is to prevent people from manipulating the url in the location bar and download documents directory without loggin into the site. The .htaccess works by itself, but I don't want to require the users to 'log in' a second time to download a file. They have to log into the site, they should be able to download the docs freely. I hope this is clear (clear as mud probably). Anyway, I found this script on http://www.wazzup.co.nz/tutorials/protect_pdf/index.php. I sent a message to the author and haven't heard back yet, so thought I'd try here. If anyone knows of a better/easier/alternative way to protect individual files, give a logged in user free access to it, but protect it from downloads from people not logged in, I'm certainly open to any and all suggestion. The docs are price lists that we wouldn't want our competitors to get ahold of. Thanks for the help, -- Chip Wiegand Computer Services Simrad, Inc www.simradusa.com [EMAIL PROTECTED] There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corporation, 1977 (Then why do I have 8? Somebody help me!) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can't to insert data ( via variable ) into MS-SQL
Do you have register_globals on? If not ayou have to get the POST information manually. ie.. $job = $_POST['job'] Also are you sure that you are connecting to the database successfully? add: or die('could not connect') to the end of your mssql_pconnect and mssql_select_db statements. So your save.php should something like this. a href=view.phpSearch data/a /body /html ? $name = $_POST['name']; $job = $_POST['job']; $subject = $_POST['subject']; $date=date('Y-m-d H:i:s'); $link = mssql_pconnect(sql,sa,1234) or die(Could not connect to db server); mssql_select_db(phpbook,$link) or die(Could not connect to server); $str = INSERT INTO staff (name,job,subject) VALUES('$name','$job','$date','$subject',); mssql_query($str,$link); ? Chris [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dear All, There is a sample that can't to insert any data ( via variable ) in MS-SQL : insert.php: form action=save.php method=post table border=0 align=center input type=text size=20 name=name maxlength=8 value=? echo $GBName ?br Jobinput type=text size=16 name=jobbr Subjectinput type=text size=30 name=subjectbr input type=submit value=SubMit /center /table /form save.php: a href=view.phpSearch data/a /body /html ? $date=date('Y-m-d H:i:s'); $link = mssql_pconnect(sql,sa,1234); mssql_select_db(phpbook,$link); $str = INSERT INTO staff (name,job,subject) VALUES('$name','$job','$date','$subject',); mssql_query($str,$link); ? After insert data by using save.php, I found no any data from the Database system ( MS-SQL ), but I sure the Database System is no problem ! So, how can I fix this kind of problem ( Sorry, I'm not familar with php ) ? Many thank for your help ! Edward. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] write a custom file wrapper or use error_log
is it better overall to write a custom file wrapper (write my own log functions) or use the error_log/syslog that php already gives??
[PHP] Re: Can't to insert data ( via variable ) into MS-SQL
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] $str = INSERT INTO staff (name,job,subject) 1 2 3 VALUES('$name','$job','$date','$subject',); 1 2 - 3 -- Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] isset() and !=NULL
Is there an easier way to do isset($variable) AND $variable != NULL ? I use this alot in my if statements, and I was wondering if there's an easier way to do it, maybe with a single function? Oh and another question... how does if ($variable) work? When does it evaluate true? -- Marcjon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] performance with looping and count()ing
hi. ok, so i've always been under the impression that count()ing during the expression of a loop was much inefficient when compared to count()ing just before the loop expression. GOOD: ?php $the_array_cnt = count($the_array); for($i = 0; $i $the_array_cnt; $i++) { ... } ? BAD: ?php for($i = 0; $i count($the_array); $i++) { ... } ? but then i did some tests and found that only on very large arrays is there any difference between the two. count()ing outside of the loop was only marginally better. i also tried performing the same operation using foreach() and it was slightly faster than count()ing within the loop and slightly slower than count()ing outside the loop. somone pointed out in a post to a message board that php handles the result of a count() in a special way and so it therefore does not need to count the array more than once each pass through the loop? can someone confirm? thanks, chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] isset() and !=NULL
if(!empty($variable)) On Fri, 26 Mar 2004, Marcjon Louwersheimer wrote: Is there an easier way to do isset($variable) AND $variable != NULL ? I use this alot in my if statements, and I was wondering if there's an easier way to do it, maybe with a single function? Oh and another question... how does if ($variable) work? When does it evaluate true? -- Marcjon -- 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] mysql_fetch_array
I have this query to select the date from my table... SELECT DATE_FORMAT(date1, '%W %M %Y') FROM table How do I know what name mysql_fetch_array assigned to the date_format ?
Re: [PHP] mysql_fetch_array
It would be position 0 in the array, or in your query after the date format function you could put AS blah and then it would come out as blah. On Fri, 2004-03-26 at 13:50, Chris Mach wrote: I have this query to select the date from my table... SELECT DATE_FORMAT(date1, '%W %M %Y') FROM table How do I know what name mysql_fetch_array assigned to the date_format ? -- Adam Voigt [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_fetch_array
From: Adam Voigt [EMAIL PROTECTED] On Fri, 2004-03-26 at 13:50, Chris Mach wrote: I have this query to select the date from my table... SELECT DATE_FORMAT(date1, '%W %M %Y') FROM table How do I know what name mysql_fetch_array assigned to the date_format ? It would be position 0 in the array, or in your query after the date format function you could put AS blah and then it would come out as blah. Or you could use $row['DATE_FORMAT(date1, \'%W %M %Y\')'], but... umm.. yeah ;) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] isset() and !=NULL
On Fri, 2004-03-26 at 13:46, Rasmus Lerdorf wrote: if(!empty($variable)) This will return false positives for cases where the variable has not been set to null but HAS been set to the empty string or to a 0? This isn't really the same as the OP requested. However, isset() also returns false for variables assigned null values and so he is fine with just isset() and skipping the check for != NULL. Contrast the following code and output: echo ' isset: ['.isset( $foo ).']'.\n; echo '!empty: ['.(!empty( $foo )).']'.\n; -- isset: [] -- !empty: [] - $foo = null; echo ' isset: ['.isset( $foo ).']'.\n; echo '!empty: ['.(!empty( $foo )).']'.\n; -- isset: [] -- !empty: [] - $foo = 0; echo ' isset: ['.isset( $foo ).']'.\n; echo '!empty: ['.(!empty( $foo )).']'.\n; -- isset: [1] -- !empty: [] - $foo = 0.0; echo ' isset: ['.isset( $foo ).']'.\n; echo '!empty: ['.(!empty( $foo )).']'.\n; -- isset: [1] -- !empty: [] - $foo = ''; echo ' isset: ['.isset( $foo ).']'.\n; echo '!empty: ['.(!empty( $foo )).']'.\n; -- isset: [1] -- !empty: [] - $foo = 'blah'; echo ' isset: ['.isset( $foo ).']'.\n; echo '!empty: ['.(!empty( $foo )).']'.\n; -- isset: [1] -- !empty: [1] - Cheers, Rob. On Fri, 26 Mar 2004, Marcjon Louwersheimer wrote: Is there an easier way to do isset($variable) AND $variable != NULL ? I use this alot in my if statements, and I was wondering if there's an easier way to do it, maybe with a single function? Oh and another question... how does if ($variable) work? When does it evaluate true? -- Marcjon -- .. | 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] isset() and !=NULL
On Fri, 26 Mar 2004 10:40:43 -0800, Marcjon Louwersheimer [EMAIL PROTECTED] said: Is there an easier way to do isset($variable) AND $variable != NULL ? I use this alot in my if statements, and I was wondering if there's an easier way to do it, maybe with a single function? Oh and another question... how does if ($variable) work? When does it evaluate true? Check out the is_null function. Itd seems to combine the two. http://www.php.net/manual/en/function.is-null.php and http://www.php.net/manual/en/language.types.null.php#language.types.null.syntax -- David G. Risner Software Engineer California State University, Los Angeles http://www.risner.org/david/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: saving as .XLS
just save as an csv-file (comma seperated values) Jon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I am looking for some information about the way of saving the result of my php script (html table) with .XLS (ms excel) format. Do you know where could I get info about this? Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Methods for creating HTML with PHP
-Original Message- From: Jason Giangrande [mailto:[EMAIL PROTECTED] I'm looking for an easy way to write all my HTML using PHP. Jason, Sorry this is late and not even sure if you found your answer to this question that you ask, however I think in the end it's going to be up to you on how you do this as with anything, but the one thing that I do and prefer is to include() my html with include files and ontop of that I have them in functions so that like my header.php include page will allow me to change the title of the page, the page topic and some other functions specific to my website. I find this way to be very convenient also for updates, I no longer have to change all the files, I can update one template file and they are all changed whenever that particular include is used. It's nice. NOW!! With that said, The one other thing I could suggest that I didn't see anyone else mention, as you thought it was confusing to jump in and out of html/php mode. Why not use heredoc? I'm still new to php, so I'm not even sure this is exactly what you wanted, but give it a look and see if this would make your coding easier to follow? Just my 2 pennies! :) The manual doesn't have alot on this topic, heredoc is a string related feature and can be found here... http://us4.php.net/manual/en/language.types.string.php#language.types.string .syntax.heredoc If you google for heredoc or here document you'll find other pages of reference. Like this gentleman even tested the speed difference from echo/printing lines vs heredoc. Pretty interesting.. http://shat.net/php/notes/heredoc.php Again not sure if this was what you where looking for but might just help you since you don't have to use print statements and all html code can be written inside and you can use variable interpolation. Heck you could even use the include()(s) as well and place the heredoc in them for your headers/footers/navigation/etc... Good Luck, Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] write a custom file wrapper or use error_log
From: Andy B [EMAIL PROTECTED] is it better overall to write a custom file wrapper (write my own log functions) or use the error_log/syslog that php already gives?? Define better. Which one suits your needs? Obviously, if error_log does what you need it to do, then use it. Why write additional PHP code? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] simple, but missing something?
Not sure why I am not able to get this to work, but to make my stuff easier to configure for different environments I am trying to re-code some of my stuff to work with options from an array. $cfg['hostname'] = www.server.com; // Server domain or ip address $cfg['username'] = username;// Database user name $cfg['password'] = password;// Database password $cfg['bugemail'] = [EMAIL PROTECTED]; The do something like this: function database_connection() { @mysql_connect($cfg[hostname],$cfg[username],$cfg[password]); @mysql_select_database($cfg[database]); } Is there something special I have to do to get variables out of an array for use here? I have used $user = name; and called stuff like @mysql_connect($name); and it has worked before, I think I am missing something here. TIA Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php_mssql
Hello, I am attempting to connect to a mssql db so I have the php_mssql.dll in my extensions folder and have uncommented it from my php.ini file yet still get an error that it can't find the module when apache starts. Does I need to add it somewhere in my apache conf file? Thanks, Eddie WARNING: The information contained in this message and any attachments is intended only for the use of the individual or entity to which it is addressed. This message may contain information that is privileged, confidential and exempt from disclosure under applicable law. It may also contain trade secrets and other proprietary information for which you and your employer may be held liable for disclosing. You are hereby notified that any unauthorized dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify [EMAIL PROTECTED] by E-Mail and then destroy this communication in a manner appropriate for privileged information. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] simple, but missing something?
[snip] $cfg['hostname'] = www.server.com; // Server domain or ip address $cfg['username'] = username;// Database user name $cfg['password'] = password;// Database password $cfg['bugemail'] = [EMAIL PROTECTED]; The do something like this: function database_connection() { @mysql_connect($cfg[hostname],$cfg[username],$cfg[password]); @mysql_select_database($cfg[database]); } [/snip] Why are you not using the single quoted array names? i.e. @mysql_connect($cfg['hostname'],$cfg['username'],$cfg['password']); Have you echo'd each out afterwords to see if they are right? Use mysql_error() to return connection errors so that you know what they are. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple, but missing something?
Jay Blanchard wrote: [snip] $cfg['hostname'] = www.server.com; // Server domain or ip address $cfg['username'] = username;// Database user name $cfg['password'] = password;// Database password $cfg['bugemail'] = [EMAIL PROTECTED]; The do something like this: function database_connection() { @mysql_connect($cfg[hostname],$cfg[username],$cfg[password]); @mysql_select_database($cfg[database]); } [/snip] Why are you not using the single quoted array names? i.e. @mysql_connect($cfg['hostname'],$cfg['username'],$cfg['password']); Have you echo'd each out afterwords to see if they are right? Use mysql_error() to return connection errors so that you know what they are. Yeah I have tried single quoted array names, double-quoted variable names, and the output of the print_r($cfg) displays the variables are present and when I do a mysql_error() and mysql_errno() I get could not connect to database, 1046 errors. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: simple, but missing something?
$cfg['hostname'] = www.server.com; // Server domain or ip address $cfg['username'] = username;// Database user name $cfg['password'] = password;// Database password $cfg['bugemail'] = [EMAIL PROTECTED]; Then do something like this: function database_connection() { @mysql_connect($cfg[hostname],$cfg[username],$cfg[password]); @mysql_select_database($cfg[database]); } 1) You have to declare $cfg as a global variable in your data_connection() function. PHP differs from C with respect to how you access global variables from within functions. Read about global variables here http://www.php.net/manual/en/language.variables.scope.php 2) Make sure you always quote string constants, even when used as array indexes. --- Geir Pedersen http://www.activio.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: simple, but missing something?
So something like this? function database_connection() { global = $cfg['hostname'],$cfg['username'],$cfg['password']; @mysql_connect($cfg['hostname'],$cfg['username'],$cfg['password']); @mysql_select_database($cfg['database']); } Or could I do an entire array like so... function database_connection() { global = $cfg; @mysql_connect($cfg['hostname'],$cfg['username'],$cfg['password']); @mysql_select_database($cfg['database']); } ??? Stupid question I know... Geir Pedersen - Activio As wrote: $cfg['hostname'] = www.server.com; // Server domain or ip address $cfg['username'] = username;// Database user name $cfg['password'] = password;// Database password $cfg['bugemail'] = [EMAIL PROTECTED]; Then do something like this: function database_connection() { @mysql_connect($cfg[hostname],$cfg[username],$cfg[password]); @mysql_select_database($cfg[database]); } 1) You have to declare $cfg as a global variable in your data_connection() function. PHP differs from C with respect to how you access global variables from within functions. Read about global variables here http://www.php.net/manual/en/language.variables.scope.php 2) Make sure you always quote string constants, even when used as array indexes. --- Geir Pedersen http://www.activio.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: simple, but missing something?
Geir Pedersen - Activio AS mailto:[EMAIL PROTECTED] on Friday, March 26, 2004 2:05 PM said: 1) You have to declare $cfg as a global variable in your data_connection() function. PHP differs from C with respect to how you access global variables from within functions. Read about global variables here http://www.php.net/manual/en/language.variables.scope.php an alternative to that would be to use constants. define(CFG_HOSTNAME, www.server.com); define(CFG_USERNAME, username); define(CFG_PASSWORD, password); define(CFG_BUGEMAIL, [EMAIL PROTECTED]); function database_connection() { @mysql_connect(CFG_HOSTNAME, CFG_USERNAME, CFG_PASSWORD); @mysql_select_database(CFG_DATABASE); } hth, chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions and PHP
Let me rephrase it, i got a login page, once logged in you you got the session $_SESSION['in'] = true; i want to be able to count the number of people that are logged in atm, so when they logout with either logout button or close the window, i want to then decrese the number. In asp, you just used Session_Destroy() to determine if all sessions were destroyed and then APPLICATION['num'] = APPLICATION['num'] - 1 Is there anyway in php to do this? regards patrick - Original Message - From: Patrik Fomin [EMAIL PROTECTED] Newsgroups: php.general To: [EMAIL PROTECTED] Sent: Thursday, March 25, 2004 2:05 AM Subject: Sessions and PHP Hi,, is there anyway to get the number of people connected to the site? in asp you just use Application and session_terminate to accomplish this is there anyway to do this in PHP ? regards patrick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: simple, but missing something?
Jas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] So something like this? function database_connection() { global = $cfg['hostname'],$cfg['username'],$cfg['password']; global = $cfg; From that page that was linked in the previous post: ?php $a = 1; $b = 2; function Sum() { global $a, $b; $b = $a + $b; } Sum(); echo $b; ? Notice a difference between how these two examples declare globals. -- Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and GD
After uploading the picture, so the program should first upload the picture, then open it, cut it in like 6 pieces and save all the pieces and remove the original uploaded file. regards patrick - Edwin - [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Hi, On Thu, 25 Mar 2004 02:03:26 +0100 [EMAIL PROTECTED] (Patrik Fomin) wrote: Hi, Is there anyway to split a picture with PHP (GD) ? Im uploading lots of pictures and i want to split them in 6 pieces to make em load faster, is there anyway to do this in PHP ? You mean, split them using PHP? *Before* uploading? Then, no. (Unless of course you have PHP installed on the client then there must be a way...) -- - E - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions and PHP
Patrik Fomin wrote: Let me rephrase it, i got a login page, once logged in you you got the session $_SESSION['in'] = true; i want to be able to count the number of people that are logged in atm, so when they logout with either logout button or close the window, i want to then decrese the number. In asp, you just used Session_Destroy() to determine if all sessions were destroyed and then APPLICATION['num'] = APPLICATION['num'] - 1 Is there anyway in php to do this? No, as PHP does not have application variables. Keep a count in a file and increment / decrement manually. -- ---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] RE:[PHP] write a custom file wrapper or use error_log
Define better. 1. check the file size. if it is larger than a certain size then rename the current log and roll over to a new filename 2. if something fatal happens during normal program use shutdown the program/website section and display a page that says unavaliable or something of that sort... i know its probably way too much for an errorlog or log function to do by itself but just have log() call the different functions if its needed?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions and PHP
how do i determine if a session has been destroyed/created ? patrick John W. Holmes [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Patrik Fomin wrote: Let me rephrase it, i got a login page, once logged in you you got the session $_SESSION['in'] = true; i want to be able to count the number of people that are logged in atm, so when they logout with either logout button or close the window, i want to then decrese the number. In asp, you just used Session_Destroy() to determine if all sessions were destroyed and then APPLICATION['num'] = APPLICATION['num'] - 1 Is there anyway in php to do this? No, as PHP does not have application variables. Keep a count in a file and increment / decrement manually. -- ---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
Re: [PHP] Re: Can't to insert data ( via variable ) into MS-SQL
Rob Adams wrote: [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] $str = INSERT INTO staff (name,job,subject) 1 2 3 VALUES('$name','$job','$date','$subject',); 1 2 - 3 -- Rob $date=date('Y-m-d H:i:s'); Any idea for me to fix this kind of problem ? Thank a lots. Edward. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_fetch_array
Hi, Saturday, March 27, 2004, 4:50:27 AM, you wrote: CM I have this query to select the date from my table... CM SELECT DATE_FORMAT(date1, '%W %M %Y') FROM table CM How do I know what name mysql_fetch_array assigned to the date_format ? SELECT DATE_FORMAT(date1, '%W %M %Y') AS date_formatted FROM table Then access it as date_formatted -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] performance with looping and count()ing
Hi, Saturday, March 27, 2004, 4:45:38 AM, you wrote: CWP hi. CWP ok, so i've always been under the impression that count()ing during the CWP expression of a loop was much inefficient when compared to count()ing CWP just before the loop expression. CWP GOOD: CWP ?php CWP $the_array_cnt = count($the_array); CWP for($i = 0; $i $the_array_cnt; $i++) CWP { CWP ... CWP } ? CWP BAD: CWP ?php CWP for($i = 0; $i count($the_array); $i++) CWP { CWP ... CWP } ? CWP but then i did some tests and found that only on very large arrays is CWP there any difference between the two. count()ing outside of the loop was CWP only marginally better. CWP i also tried performing the same operation using foreach() and it was CWP slightly faster than count()ing within the loop and slightly slower than CWP count()ing outside the loop. CWP somone pointed out in a post to a message board that php handles the CWP result of a count() in a special way and so it therefore does not need CWP to count the array more than once each pass through the loop? can CWP someone confirm? CWP thanks, CWP chris. CWP -- CWP PHP General Mailing List (http://www.php.net/) CWP To unsubscribe, visit: http://www.php.net/unsub.php Depends on your code logic, if $the_array gets modified in the loop then you have to check it on each pass. If not, efficiency would suggest doing it before the loop. You can always do the 1 line version: for ($i=0,$j=count($the_array);$i$j;$i++){ -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] knowing which file is including
Hi, A bit of a weird problem, am just curious if this can be done... I have a file called config.inc.php which has a require_once in it for lang_a.php and lang_b.php config.inc.php is being included by a.php and b.php presently config.inc.php is doing a require_once for both lang_a and lang_b, is there any way to determine which file is calling the config.inc.php (a or b) and then set the require accordingly? I dont think so but am just wondering as PHP has a crapload of solutions that I would probably never know of. Thanks, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sprintf troubles
Hi, Saturday, March 27, 2004, 1:31:33 AM, you wrote: CT Hey, CT Im trying to use sprintf to format a number and left pad it with spaces, but CT it doesnt want to add the spaces CT I can pad it with anyother char using sprintf(%'_8.2f, $val) which will CT left-pad the number with underscores CT Has anyone had any luck padding with spaces?? CT or is there a better way to do this?? CT Chris If you are looking at it on a web page the spaces will be ignored unless you stick it in a pre/pre block or convert the spaces to nbs; -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 4.3.5 Released
PHP Development Team is proud to announce the release of PHP 4.3.5. This is primarily a bug fix release, without any new features or additions.PHP 4.3.5 is by far the most stable release of PHP to date and it is recommended that all users upgrade to this release whenever possible. The major fixes include: - Fixed INI leak between Apache virtual hosts. - Fixed crashes inside fgetcsv() and make the function binary safe. - Fixed compilation with early versions of GCC 3.0. - Fixed a bug that prevented feof() from working correctly with sockets. - Improved the matching algorithm inside the get_browser() function. - Fixed resolving of open_basedir on Win32 systems. - Fixed incorrect errors for non-existent directories when safe_mode is enabled. - Bundled OpenSSL dlls on Win32 upgraded to 0.9.7c - Updated bundled PostgreSQL library to version 7.4 in Windows distribution. - Bundled PCRE library upgraded to 4.5 - Synchronized bundled GD library with GD 2.0.17 - A number of fixes for 64bit systems. Aside from the above mentioned fixes, this release resolves over 140 various bugs and implementational problems. Enjoy, PHP Development Team. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 4.3.5 Released
On Fri, Mar 26, 2004 at 08:55:52AM -0500, Ilia Alshanetsky wrote: PHP Development Team is proud to announce the release of PHP 4.3.5. This is primarily a bug fix release, without any new features or additions.PHP 4.3.5 is by far the most stable release of PHP to date and it is recommended that all users upgrade to this release whenever possible. The major fixes include: - Fixed INI leak between Apache virtual hosts. - Fixed crashes inside fgetcsv() and make the function binary safe. - Fixed compilation with early versions of GCC 3.0. - Fixed a bug that prevented feof() from working correctly with sockets. - Improved the matching algorithm inside the get_browser() function. - Fixed resolving of open_basedir on Win32 systems. - Fixed incorrect errors for non-existent directories when safe_mode is enabled. - Bundled OpenSSL dlls on Win32 upgraded to 0.9.7c - Updated bundled PostgreSQL library to version 7.4 in Windows distribution. - Bundled PCRE library upgraded to 4.5 - Synchronized bundled GD library with GD 2.0.17 - A number of fixes for 64bit systems. Aside from the above mentioned fixes, this release resolves over 140 various bugs and implementational problems. Enjoy, PHP Development Team. Oddly enough I run into this: Script started on Fri Mar 26 11:28:18 2004 doctor.nl2k.ab.ca//usr/source/php-4.3.5$ cat config2phpdso #!/bin/sh configure --prefix=/usr/contrib --localstatedir=/var \ --infodir=/usr/share/info \ --mandir=/usr/share/man --with-low-memory --with-elf --with-x \ --with-mysql=/usr/contrib --with-zlib --enable-track-vars \ --enable-versioning --with-config-file-path=/usr/local/lib \ --with-gd --enable-ftp --with-openssl=/usr/contrib \ --with-jpeg-dir=/usr --with-pgsql=/usr/contrib/pgsql \ --with-png-dir=/usr --with-zlib-dir=/usr \ --with-xpm-dir=/usr/X11R6 \ --with-freetype-dir=/usr/X11R6 \ --without-libmbfl \ --enable-imap --with-bz2 --with-apxs2=/usr/contrib/bin/apxs doctor.nl2k.ab.ca//usr/source/php-4.3.5$ make make: make: no target to make. doctor.nl2k.ab.ca//usr/source/php-4.3.5$ config2phpdso loading cache ./config.cache checking host system type... i386-pc-bsdi4.3.1 checking for gcc... gcc checking whether the C compiler (gcc ) works... yes checking whether the C compiler (gcc ) is a cross-compiler... no checking whether we are using GNU C... yes checking whether gcc accepts -g... yes checking whether gcc and cc understand -c and -o together... yes checking how to run the C preprocessor... gcc -E checking for AIX... no checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking for re2c... exit 0; checking for ranlib... ranlib checking whether ln -s works... yes checking for mawk... no checking for gawk... gawk checking for bison... no checking for byacc... no configure: warning: You will need bison if you want to regenerate the PHP parsers. checking for flex... flex checking for yywrap in -lfl... no checking lex output file root... lex.yy checking whether yytext is a pointer... no checking for working const... yes checking flex version... 2.5.4 (ok) checking for pthreads_cflags... checking for pthreads_lib... [1mConfiguring SAPI modules[0;10m checking for AOLserver support... no checking for Apache 1.x module support via DSO through APXS... no checking for Apache 1.x module support... no checking for member fd in BUFF *... no checking for mod_charset compatibility option... no checking for Apache 2.0 filter-module support via DSO through APXS... no checking for Apache 2.0 handler-module support via DSO through APXS... yes checking for Caudium support... no checking for CLI build... yes checking for embedded SAPI library support... no checking for Zeus ISAPI support... no checking for NSAPI support... no checking for PHTTPD support... no checking for Pi3Web support... no checking for Roxen/Pike support... no checking for Servlet support... no checking for thttpd... no checking for TUX... no checking for webjames... no checking for chosen SAPI module... apache2handler [1mRunning system checks[0;10m checking for missing declarations of reentrant functions... done checking for sendmail... /usr/sbin/sendmail checking whether system uses EBCDIC... no checking for socket... yes checking for htonl... yes checking for gethostname... yes checking for gethostbyaddr... yes checking for yp_get_default_domain... yes checking for dlopen... no checking for __dlopen... no checking for dlopen in -ldl... yes checking for sin in -lm... yes checking for res_search... no checking for __res_search... yes checking for inet_aton... yes checking for dn_skipname... no checking for __dn_skipname... yes checking for ANSI C header files... yes checking for dirent.h that defines DIR... yes checking for opendir in -ldir... no checking for fclose declaration... ok checking for dirent.h... yes checking for ApplicationServices/ApplicationServices.h... no checking for sys/param.h... yes checking for sys/types.h... yes
[PHP] Re: PHP 4.3.5 Released
Hi folks, thanks for another great php-release. Are there any important changes since the last RC? TIA, thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Ereg problems
* Thus wrote Jeff McKeon ([EMAIL PROTECTED]): preg_match_all('($-?[0-9]+\.[0-9]+)', $string, $found); print_r($found); That produces: Array ( [0] = Array ( ) ) 0 , Array Sorry that should be: preg_match_all('/(\$-?[0-9]+\.[0-9]+)/', $string, $found); Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: knowing which file is including
[EMAIL PROTECTED] (Ryan A) wrote in news:[EMAIL PROTECTED]: Hi, A bit of a weird problem, am just curious if this can be done... I have a file called config.inc.php which has a require_once in it for lang_a.php and lang_b.php config.inc.php is being included by a.php and b.php presently config.inc.php is doing a require_once for both lang_a and lang_b, is there any way to determine which file is calling the config.inc.php (a or b) and then set the require accordingly? I dont think so but am just wondering as PHP has a crapload of solutions that I would probably never know of. Thanks, -Ryan Maybe you could check for the existence of a value which is set uniquely according to whether it is in lang_a or lang_b; set the value before the include then test in the included file to determine the action to be taken. There are a couple of functions, get_included_files and get_required_files which might have some use to you - if not here, for future reference. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] REsource Identifier( PHP_MYSQL)
Hey y'all, I'm having problems trying to get the MySql_Query() function to return the resource ID when using a $string as the argument to pass to it. It returns when I hard code the argument but not the string. Any ideas? here is what the function looks like: function GetVals() { $db = mysql_connect(localhost, root); $str_Query=(Select * from . $subject); mysql_select_db(books,$db); $result = mysql_query($str_Query); echo $result; } but when I use the query: $result=mysql_query(Select * from math) it works. Am I setting my string up wrong? Because it's not running into any errors when I do this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: REsource Identifier( PHP_MYSQL)
[EMAIL PROTECTED] (Gimic) wrote in news:[EMAIL PROTECTED]: Hey y'all, I'm having problems trying to get the MySql_Query() function to return the resource ID when using a $string as the argument to pass to it. It returns when I hard code the argument but not the string. Any ideas? here is what the function looks like: function GetVals() { $db = mysql_connect(localhost, root); $str_Query=(Select * from . $subject); mysql_select_db(books,$db); $result = mysql_query($str_Query); echo $result; } but when I use the query: $result=mysql_query(Select * from math) it works. Am I setting my string up wrong? Because it's not running into any errors when I do this. The string $subject is almost certainly empty, as it is not passed as an argument to the function, nor is it declared global in the function. Try a little debugging, echoing your query and the output of mysql_error. For example: function GetVals() { $db = mysql_connect(localhost, root); $str_Query=(Select * from . $subject); mysql_select_db(books,$db); $result = mysql_query($str_Query); echo Query: $str_queryBR.mysql_error(); echo $result; } Then either pass $subject as an argument to the function, or declare it global within the function. Lastly, if $string is passed from another script, make sure it is populated via the GET or POST globals. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] REsource Identifier( PHP_MYSQL)
Gimic wrote: Hey y'all, I'm having problems trying to get the MySql_Query() function to return the resource ID when using a $string as the argument to pass to it. It returns when I hard code the argument but not the string. Any ideas? here is what the function looks like: function GetVals() { $db = mysql_connect(localhost, root); $str_Query=(Select * from . $subject); mysql_select_db(books,$db); $result = mysql_query($str_Query); echo $result; } but when I use the query: $result=mysql_query(Select * from math) it works. Am I setting my string up wrong? Because it's not running into any errors when I do this. First thing, how would you know if it was returning any errors or not? Try mysql_errno() and mysql_error(). Secondly, I suspect that your string is not what you think. print_r($str_Query); and see what its giving you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple, but missing something?
Jas wrote: Not sure why I am not able to get this to work, but to make my stuff easier to configure for different environments I am trying to re-code some of my stuff to work with options from an array. $cfg['hostname'] = www.server.com; // Server domain or ip address $cfg['username'] = username;// Database user name $cfg['password'] = password;// Database password $cfg['bugemail'] = [EMAIL PROTECTED]; The do something like this: function database_connection() { @mysql_connect($cfg[hostname],$cfg[username],$cfg[password]); @mysql_select_database($cfg[database]); } I think your array isn't in scope here, that's why you can't see the array. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: REsource Identifier( PHP_MYSQL)
The entire script looks like this: ?php if ($_POST[Subject] != NULL) { echo results for . $_POST[Subject]; $subject = $_POST[Subject]; $qry = (select * from . $subject); $sqlQry = (string) $qry; GetVals(); } function GetVals() { $db = mysql_connect(localhost, root); mysql_select_db(books,$db); $result = mysql_query($sqlQry,$db); echo mysql_errno($db); echo mysql_error($db); echo $result; } ? Where the name of the table is stored in the $_POST varible. The string isn't empty, yet it is empty. It may be a bug... Or do any of you see any problem with my varible scope? because I don't. Gimic [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hey y'all, I'm having problems trying to get the MySql_Query() function to return the resource ID when using a $string as the argument to pass to it. It returns when I hard code the argument but not the string. Any ideas? here is what the function looks like: function GetVals() { $db = mysql_connect(localhost, root); $str_Query=(Select * from . $subject); mysql_select_db(books,$db); $result = mysql_query($str_Query); echo $result; } but when I use the query: $result=mysql_query(Select * from math) it works. Am I setting my string up wrong? Because it's not running into any errors when I do this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php