Re: [PHP] Would this work? (mod_rewrite)
This can also be achieved by doing Alias / /home/blah/script.php no need to use mod_rewrite !! bvr. [ rswfire ] wrote: Assume I want *.domain.*/*.* to automatically call index.php (without the user knowing and without any redirecting at all): RewriteEngine on RewriteBase/ RewriteRule*.* index.php [R] I don't know what in the world the [R] is, but it's in almost all of the mod_rewrite examples... :-) _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Build static with Apache 2.0.35
I don't know an answer to your first question, but I 'm currently running PHP under Apache 2.0.35 and I could only get it work through apxs2 and only with the very latest PHP version (4.3.0-cvs). Tried with 4.1.2, 4.2.0RC12 but the Apache 2 programming interface apparently has changed (a lot) recently. About static/dso ; I don't think one method *performs* better than the other, they both have advantages, that's why it's an option. bvr. Marc Delisle wrote: Is PHP 4.1.2 (or 4.2.0) supported only with apxs2, or can I build it static into Apache 2.0.35? And is it still true that running static is faster than DSO? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Test for one bit set?
This shows all integers from 1 to 10 that have the 2 least significant bits set: ?php for ($i = 1; $i = 10; $i++) { if ($i 3) { echo($i . \n); } } ? bvr. Charlie Killian wrote: How can I test if a number only has on bit set? So testing different numbers will return TRUE or FALSE: testing 0001 would return TRUE. testing 0011 would return FALSE. TIA Charlie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] The PHP Filter did not receive suitable input data
Hello! I'm expirimenting with apache 2 and PHP, I've got things running but there's one problem left: When I request a directory, and the index is a PHP script, the following error is reported to the client: 'The PHP Filter did not receive suitable input data' Apache also reports this error to his error_log: 'Directory index forbidden by rule: name of the PHP script!' And when I enable the 'Indexes' option, Apache logs: 'Not a directory: Can't open directory for index: name of the PHP script!' I'm using my Apache 1.3 configuration but with Filters instead of AddType , I hope this is simply a configuration issue. versions used: Apache 2.0.35 PHP 4.3.0-cvs (03 Apr 2002 23:53 GMT+1) apache conf: # PHP LoadModule php4_module modules/libphp4.so FilesMatch \.(phpc?|phtml)$ SetOutputFilter PHP SetInputFilter PHP /FilesMatch # Indexes DirectoryIndex index.phtml index.html index.php Any clues ? Thanks, bvr. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] changing the color from black to blue on an image. Helpon imagecolorset.
first: http://www.php.net/manual/en/function.imagefill.php $col = imagecolorallocate($im, 51, 51, 204); then: ImageFill http://www.php.net/manual/en/function.imagefill.php($im, $x, $y, $col); or ImageSetPixel($im, $x, $y, $col); bvr. Andy wrote: Hi there, I would like to change the color on a png file from black to blue. This png file is transparent and contains only a spot which is black. It is needed to stay transparent because I am gonna merge it later on with a jpeg. I tryed imagecolorset but anyhow I do not understand the syntax. Here is my try: # set home color $farbe_b = imagecolorallocate($country_image,0,0,0); // create index for the black color imagecolorset($country_image,$farbe_b,51,51,204); // darker blue Can anybody help on this. Thanx in advance, Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php configs in the apache config file?
It doesn't work with CGI installations of PHP. bvr. Robert Montgomery wrote: Supposedly, in your apache httpd.conf file you can specify php config values. I'm trying to shore up security on a new box by setting the following within VirtualHost tags: php_value open_basedir /path/to/virtualhost/ However, it doesnt work. If I set the values in the php.ini file, it DOES work... What am I missing?? Are there any restrictions to setting these php values in an httpd.conf file? The doc's dont really mention anything... I'm baffled! I'm running apache_1.3.23 + php-4.1.2 on a linux box. Thanks, Rob __ Do You Yahoo!? Yahoo! Greetings - send holiday greetings for Easter, Passover http://greetings.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Qmail Question
This is what you've been waiting for: F@#$CK OFF! bvr. Vins wrote: I have qmail on my server. I've set up and email address to send all incoming mail to a php script. How would I break down the message and read the to field and the from field etc. where can i find information on that ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] class extends
Read http://www.php.net/manual/language.oop.php bvr. caspar kennerdale wrote: can you use class extends feature to refernce more than one class- so a class called contnet could call functions fromone called html and one called db? thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Security hole using cookies for sessions. Workaround?
Three tips: - Let the session expire after X secs. - Use BODY's ONUNLOAD attribute/JS event handler - Provide a 'Logout' button. bvr. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Qmail Question
I'm west-european, and I don't want to fuck with you and I don't know what it's like.. THANKS AGAIN. bvr. Vins wrote: Listen here. I'm south african. You wouldn't want to fuck with. I'm sure you know what we all are like. Watch what you say - Original Message - From: bvr [EMAIL PROTECTED] To: Vins [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, March 30, 2002 2:24 PM Subject: Re: [PHP] Qmail Question -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SPAM
Yeah, pretty obvious .. you must have figured that from the .NL extension to my e-mail address.. Lemme guess, .ZA that's Japan nie waar nie ?? You are obviously not an expert so don't make us filthen this list with (anti-)SPAM messages and stupid off-topic definitions. THANKS! bvr. Vins wrote: Lets define that Large quantities of email sent to large ammounts of email address at one time. I posted 2 messages. You people take everything too seriously. I'm sure you've also doen it once in you life before. And a message for bvr and caspe kennerdale. You are obviousely Americans -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SPAM
WHEN DOES IT GET TO YOUR BRAIN that i'm not American.. grammatica hulp is niet nodig, ik spreek *echt* nederlands ;) bvr. oh dam and American that can actually speak some Traditional Afrikaans that makes absolutely no sense. listen check the south african afrikaans gramma website before trying to message me with shit like that -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] please /ignore childish spammer (Auction for sale)
I'm sorry, I made a mistake even responding to this person and with that annoyed lots of people on this list and wasted my time. Now we're running the risk that he will turn into a spoiler which can be pretty bad on an unmoderated list.. Therefore I'll stop replying to his messages (including 'spammish' PHP questions), and I hope others will do the same thing, . bvr. Duncan Hill wrote: On Sat, 30 Mar 2002, vins wrote: SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM *plonk* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] NNTP Services
open http://www.php.net/manual/en/ press Ctrl-F and type 'nntp' .. click ok. bvr. news.php.net wrote: Hello everyone I have a problem to post messages to newsgroups. How can i do it. thanks Muhammad Fawad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best way to read a file
you didn't mention file() that one can be pratical because it returns an array of lines (linefeed intact, implode with empty string), but can be memory consuming for large files, because the entire file is in memory the at the same time. some times you don't need the entire file (at a time) .. for example fread() allows you to read a specific length fgets() one text line at a time with max length fgetss() ..and strip HTML.. fgetcsv() or return a line from a .csv as an array.. not really ambiguous, and I think these functions being flexible enough to handle other resource types can hardly be seen as a disadvantage.. bvr. Erik Price wrote: This is a really simple question that I've wondered for a while now... what is the best way to read a file? There are so many different functions for reading files that I have no idea which I should use. readfile() returns its values to standard output -- I don't want to use this, since my script needs to load the data in the file into a variable (it's a .xsl file). fgets() looks like it could work if I made an array out of each line read and then imploded them. fread() looks like the 'main' function for reading from files. fpassthru() -- I guess if you're already in the middle of a file it's a good way to finish? There are other functions for reading files, but they are less ambiguous, with purposes like reading from sockets or certain kinds of files. I'm not interested in those -- I just want to know which function I should use to simply read a file and store the file's contents in a variable (for later actions to be performed on/with this variable). Thank you. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why?
2. Definition and Etymology bar /bar/ n. [JARGON] 1. The second metasyntactic variable, after foo and before baz. Suppose we have two functions: FOO and BAR. FOO calls BAR 2. Often appended to foo to produce foobar. foo /foo/ 1. interj. Term of disgust. 2. Used very generally as a sample name for absolutely anything, esp. programs and files (esp. scratch files). 3. First on the standard list of metasyntactic variables used in syntax examples (bar, baz, qux, quux, corge, grault, garply, waldo, fred, plugh, xyzzy, thud). [JARGON] When used in connection with `bar' it is generally traced to the WW II era Army slang acronym FUBAR (`Fucked Up Beyond All Repair'), later modified to foobar. Early versions of the Jargon File [JARGON] interpreted this change as a post-war bowdlerization, but it now seems more likely that FUBAR was itself a derivative of `foo' perhaps influenced by German `furchtbar' (terrible) - `foobar' may actually have been the original form. See: http://www.ietf.org/rfc/rfc3092.txt ;) bvr. Alberto Wagner wrote: Why everyone uses $foo or $foobar as examples? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] require or include ?
both include the file, but use require() when it is required, and include() when it's not. In the new behaviour these two make no further difference. bvr. Javier wrote: If I include for ex. common.php in a script and this script also calls common.php what should I use require or include? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I search for a partial match in an array ?
preg_grep(/^file/, $arr) bvr. Dalton Hunter wrote: Hi, I want to search for a partial match in an array? Does in_array() or search_array() support this or is there another way? For example if I have 30 file names in an array in the format ... file1.txt file2.txt pic1.gif pic2.gif ... how can I check to see if any values in the array start with the partial word file? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include Error on PHP 4.1.2
Fix 'include_path' in php.ini I think you want it to look in the current directory (.\) as well. bvr. Alberto Wagner wrote: I can't include anything on my php scripts Failed opening 'Pagina_Inicial.php' for inclusion (include_path='c:\php4\pear') How to fix it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best way to read a file
not really ambiguous, (actually, that's what I was saying, that they are -less- ambiguous, and more specific, but no big deal on that little matter). ok, misunderstood Every time I try to use one of these functions, I get an error message from my browser (not from PHP) that the attempt to load the URL failed. Is this a sign of running into memory problems? If so, what can I do about it? It seems that the only file-reading function that doesn't create this error message in my script is fgets(), but as soon as I try to implode the lines I pulled with fgets() into one string, I get the error message again. In other words, every time I try to pull my XSL file into my script, it happens. (I would not have imagined I would run out of memory b/c I have php.ini set to 16M per script and the XSL file is only 8kB, though the script does do a lot of things.) Anybody know what's going on here? Try not to use MSIE when developing or install the debug thingie, otherwise you will not get sensible feedback on what went wrong during page load.. Anyway, it's probably not the memory limit, because in that case PHP reports an error.. Did you even enable-memory-limit ?? If you did, use can try this with your httpd.conf : Add somewhere global : LogFormat %h %l %u %t \%r\ %s %b %{mod_php_memory_usage}n php Add to mainserver/virtualhost: CustomLog /usr/local/apache/logs/access_log php This adds an extra value to the access log entries that indicates the largest number of bytes of memory used by the script at a time. bvr. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get Current Filename HOWTO
note that this var. includes the query string, for example: /applications.php?cat=browsers bvr. Patrick Hartnett wrote: It seems I spoke to quick...here is how to get the current file name. $this_file = $_SERVER['REQUEST_URI']; echo( $this_file ); the result is formatted as follows: /applications.php _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Talking XML over SSL with PHP?
It is going to be very easy ! On http://www.php.net/manual/en/function.fopen.php read: ...As of PHP 4.3.0 (not yet released), if you have compiled in support for OpenSSL, you may use https://; to open an HTTP connection over SSL... Meanwhile you could do this with CURL which is slightly more complex, but also advanced. (It's in the manual) bvr. Devin Atencio wrote: I am trying to write a program that will talk to UPS. It appears that the requirements is that i must talk SSL and then submit XML type documents as a POST. Would it be easy in PHP to talk SSL via Socket Layer? Any help would be appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fputcsv ?????? (was: best way to read a file)
A fputcsv() would be nice, doesn't seem to exist (yet) though ? bvr. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fputcsv() (was: best way to read a file)
Didn't test. http://www.php.net/manual/en/function.fgetcsv.php *blair at squiz* 14-Aug-2001 07:19 Here is a function that takes an array and adds a CSV line to the passed file pointer. #- function fputcsv ($fp, $array, $deliminator=,) { $line = ; foreach($array as $val) { # remove any windows new lines, # as they interfere with the parsing at the other end $val = str_replace(\r\n, \n, $val); # if a deliminator char, a double quote char or a newline # are in the field, add quotes if(ereg([$deliminator\\n\r], $val)) { $val = ''.str_replace('', '', $val).''; }#end if $line .= $val.$deliminator; }#end foreach # strip the last deliminator $line = substr($line, 0, (strlen($deliminator) * -1)); # add the newline $line .= \n; # we don't care if the file pointer is invalid, # let fputs take care of it return fputs($fp, $line); }#end fputcsv() #- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/mySQL hosting
go to google, put in 'free mysql hosting', press 'feeling lucky' .. http://www.free-php-hosting.com/ bvr. Daniel Negron/KBE wrote: Does anyone have a good site for free mySQL and PHP hosting ? **DAN** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Perl NewsGroup?
Why not try www.perl.com ??? I found: http://www.perl.com/cs/user/query/q/6?id_topic=50 bvr. David Duong wrote: This may be the worst place to put this but here goes: Does anyone know of a Perl NewsGroup? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making a simple borderless pop up window with a Closebutton
The 3rd parameter to JavaScript function window.open() allows you to disable a number of window elements every browser has, these include the toolbar (buttons), location, status, menubar, scrollbars. This functionality is provided by the most common browsers and versions (MSIE and Netscape) and will also work in Mozilla and Netscape 6. I don't know about the JavaScript implementation in Opera, but if it supports JS it is likely to support these options too (or at least ingores them). bvr. Joe Webster wrote: It only works in IE -- it makes use of the 'Full Screen' (F11) option and tricks IE into doing so... hope you don't want it to work in NS, Opera... or anything else -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail()
Jennifer, The SMTP option in php.ini is for Windows only. On other platforms you should specify a delivery program (sendmail). If you still want to use an external server, there are classes available that send mail through an SMTP server without using mail(). bvr. Jennifer wrote: sorry...i should have mentioned also that I am not using the internal mail server but i am using an external mail server -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Please explain...
This is because of type conversion, see also manual chapter 'Type juggling'. foo converted to integer type is also zero, if you try 1foo for example, it will convert to one. if you want to check without type conversion use the === operator instead. bvr. Jan Rademaker wrote: Can someone explain why this works? $x = 0; if ($x == foo) { print yeah; } This prints 'yeah', but i can't figure out why... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] replacing all non [a-z] chars possible?
A good solution is to store the file under a random generated filename and store that name, together with the real name, to the database. bvr. andy wrote: Hi there, I am wondering if it would be possible to replace all chars which are not inbetween [a-z] with a valid asccii coresponding to it. I have a db with a bunch of citynames and I would like to create valid filenames out of those. The prob is, that I do not know all special chars. For example there was one: ï which I did not know. So maybe there are a lot others similar like that. The point is, how could I create a valid filename out of those citynames which contains only the chars from a - z? I tryed erregrplc, but I do have to know the char for that. Thanx for any help, andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SERVER INFO
Hi, Yes, you have to be connected while someone looks at your site. A webserver on a modem would be terribly slow, but possible if you just want to expiriment. If you want to start 'quickly' without too much RTFM, find out what webservers are good and have an installer package for your platform/distribution, sometimes these are even pre-compiled. bvr. Dani wrote: Hi all, I appologise if this is off topic but I don't know who to ask. I hope you guys don't mind. Does any body know where I can find information about the steps of setting up a server(LINUX) so that people can find a certain URL address? I want to sent up a small server for myself from home with my machine but I don't know how to make it so that the web pages that I put in my server accessable by other people around the world. do I have to connect my modem into my phone line (online) all the time or...??? Does my question make any sense? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help - Variables
isset($_COOKIE[$var1 . $var2]) isset($HTTP_COOKIE_VARS[$var1 . $var2]) // (for ancient PHP versions) http://www.php.net/manual/en/features.cookies.php or isset(${$var1 . $var2}) http://www.php.net/manual/en/language.variables.variable.php bvr. BUDINSCHI Cosmin wrote: On Fri, 15 Mar 2002, Julio Nobrega Trabalhando wrote: :if (isset($var_name)) { :echo 'Isset!'; :} : : ? This I knew ... i don't know the variable's name untill I execute the script. I want to found out if a cookie is set who's name is $var1.$var2 and $var2 is the result of a function. : : : I have a variable with the name : $name(=the_name_of_the_variable) : : and I want to know if $the_name_of_the_variable : is set. : -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to access arrays from $GLOBAL?
Maybe it makes sense to you like this: $mtxt = $GLOBALS['mtxt']; $mtxt === $GLOBALS['mtxt'] $mtxt[1] === $GLOBALS['mtxt'][1] bvr. hmm.. the '===' operator, now that's weird ;) Because in my mind (which I know is totally wrong in this instance, I'm just explaining for your benefit) using: $GLOBALS['mtxt'][1]; is like saying give me element 1 of the globals array when I was thinking but I want element 1 of the mtxt array which is why I tried the various combinations of mtxt[1] _inside_ of the globals[]. Hope that explains a little. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array within an array (one more reply)
Sorry, replies to really deep threads looks nice in my mail program.. ;)bvr. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cache
Hallo Jeroen ;) There are several ways to control the caching of pages and images, including sending headers and META tags. These are ofcourse HTML/HTTP features and not specific to PHP. Because it seems to be needed to send a combination of these to make it work for a situations, I prefer another method which works quite well on images, example: IMG SRC=test.gif?? echo(time()); ? This appends a UNIX timestamp to the image location so the browser sees a different image location on each page load, forcing it to download the image every time. bvr. Jeroen Timmers wrote: is there some command with php dat the page some images not load out the cache but reloading the image? Thx Jeroen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Version difference (4.0.4pl1-4.1.2)
Check the release notes or changelogs.. I believe there was a notable change in 4.0.5 regarding 'referencing' you may have to deal with, and 'reference counting' was added later on but this should have little affect on backwards compatibility. Also, the input mechanism has changed, although you could get the old behaviour back by changing the php.ini , it is recommended for a number of reasons to 'upgrade' your source to ensure it will continue to work in future versions of PHP. See: http://www.php.net/release_4_1_0.php HTH, bvr. Aras Kucinskas wrote: I want to upgrade PHP from 4.0.4 to 4.1.2. Where I can find docs apbout version differences. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it correct having number of forms in the same html page?
Yes, that can be correct, however: -You can only submit one form at a time - You cannot have 'nested' forms (forms in forms) bvr -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
Re: [PHP] How can I use PHP4 module for Apache Win32 ????
Download it from wwwphpnet Read install notes, come back when you really need help bvr hei wrote: How can I use PHP4 module for Apache Win32 -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
Re: [PHP] serialize
Instead of serialize(), you could also fix your existing code like this: ?php for ($i=0; $i$HTTP_GET_VARS['num']; $i++) { echo felnummer INPUT TYPE=\ TEXT\ name=\felnummer[ $i ]\BR; } ? Or ?php for ($i=0; $i$HTTP_GET_VARS['num']; $i++) { echo felnummer INPUT TYPE=\ TEXT\ name=\felnummer[]\BR; } ? bvr ?php for ($i=0; $i$HTTP_GET_VARS['num']; $i++) { echo felnummer INPUT TYPE=\ TEXT\ name=\felnummer[i]\BR; } ? -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
Re: [PHP] Help about Linux password change script
# passwd -? Usage: passwd [OPTION] accountName --stdin read new tokens from stdin (root only) bvr Henry Zambrano wrote: Hi, I'm trying to do a script for changing the Linux password of an user in a web page I don't know how to implement the command passwd in a php script or to do a shell script which would be invoked by the php script I hope someone can help me Thanks Henry Zambrano -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
Re: [PHP] Re: Value of $_* variables
Yes, there is, strings should *always* be quoted! See: http://wwwphpnet/manual/en/languagetypesarrayphp it's under do's and don'ts bvr Mike Eheler wrote: $result = mysql_query(select user from users where id = $_SESSION[id], $db); No need to quote the key name in a string -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
Re: [PHP] keeping the dot
I think he was trying to say you should take a look at the manual regarding regular expressions. Once you get to the part that explains what [^ ] actually does you see how obvious the answer is. However, the synical reply from LuC isn't correct. To match the dot character (.) you should use escape it like this: \. Otherwise the dot will match any character for it's a 'wildcard' and the result of your replace will be empty. bvr. [EMAIL PROTECTED] wrote: Try thinking? Don't be a jerk. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how do I use php and mysql to print mailing lables
Hi, It all depends on what you want Ofcourse you could output the labels somehow and just print that For example by generating HTML or PDF Another option is to connect to MySQL through ODBC and use the data as you would using an MSAccess database I don't think there a builtin functions that allow you to print directly from PHP, however there may be several ways to accomplish this For example you could use COM to open Word with a template document, paste the label text and print it bvr Ivan Carey wrote: Hello and thanks for your help how do I use php and mysql to print mailing lables? I would like to be able to print mailing labels from an mySQL online database using php Is it possible to do this as the same functionality as in an MSAccess offline database? Thanks, Ivan -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
Re: [PHP] -loop question-
Nope, you can't, use the loop to create a temp variable containing the message, or do this: mail($to, $subj, implode(\n, $Name_Passenger_), $header); bvr Richard Bradley wrote: I want to run a loop inside of the body section of the mail() function // CODE SNIPPLET // mail ($to, $subj, for ($i = 0; $i $passengerNumber; ++$i) { $Name_Passenger_[$i] } , $header); // ***END CODE SNIPPLET *// I can't seem to run the loop inside a variable either Any suggestions? -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
Re: [PHP] HELP SECOND TIME - header for download gzip file using IE and Netscape with HTTP and HTTPS
First thing, do you want the visitor to receive the file as-is (gz encoded) ? Or should it be decoded automatically to text ? In the first case, the browser shouldn't be aware of the encoding type (Content-Encoding header). You should only send 1 Content-Type header. The Content-Disposition header is nothing but trouble, and this is mainly caused by MSIE 5.5 . Microsoft managed to supply an update that changes the behaviour of MSIE 5.5 regarding this while the version still is 5.5 .. So there's no way to tell what header to sent for it to work properly. You could also expiriment with the extra keywords 'inline' and 'attachment'. header( 'Content-Disposition: attachment; filename=text.gz' ); But as I said, since browser behaviour varies on this header (even within same browser type/version) it's not easy to implement correctly for all browsers. I'm also not sure wether this header made it to the HTTP1.1 specs, but if you still want to use it I recommend consulting the website of W3C (http://www.w3c.org/), they should at least have some notes about it. bvr. Krzysztof Kocjan wrote: Hi I have big problem with headers which I send to www browser: IE 5.5 and Netscape 6.2. On my web site I have PHP script to download huge text files to client side. The text file is compressed by gzip program before it will be downloaded to client. My problem is how to send to www browser correct headers to download gziped file for example text.gz and force www browser to store this file with name text.gz. I tested with protocol http sending headers like below, but it work only with IE 5.5. Using Netscape 6.2 downloaded file should be stored as text.gz but is stored as name of the PHP script. There is PHP code with headers I send to www browser: header( 'Content-Encoding: zip'); header( 'Content-Length: 100' ); header( 'Content-Location: text.gz' ); header( 'Content-Type: application/octet-stream' ); header( 'Content-Type: application/zip' ); header( 'Content-Disposition: filename=text.gz' ); readfile( 'text.gz' ); exit(); When I switched the protocol from http to https the I've got second problem. Downloading gziped file text.gz using IE 5.5 it didn't work completely. IE showed me strange error message with information that this resource couldn't be opened. Using Netscape 6.2 the problem is the same. Thank You for any suggestions. Krzysiek -- Najlepsza bezplatna poczta w Polsce http://poczta.interia.pl/ Jako jedyna oceniona bardzo dobrze przez Komputer Swiat (nr 5/2002) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CheckBoxes....
Yes, well, PHP supports that a little bit differently If you append '[]' to the name, an array will be returned after submit with the values of the checked checkboxes INPUT TYPE=TEXT NAME=test[] VALUE=1 CHECKED INPUT TYPE=TEXT NAME=test[] VALUE=2 INPUT TYPE=TEXT NAME=test[] VALUE=3 CHECKED (submit) $test now contains array(1,3); bvr Ben Turner wrote: Don't checkboxes, if you name them all the same name, produce a comma delimited string in php of the values selected??? such as for 15 checkboxes with numeric values would produce a string such as ,,,1314,,,18 when the form was submited?? This is the way it was handled in ASP is there something different for PHP? thanks! Ben -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
Re: [PHP] user input in HTML
Use strip_tags() http://wwwphpnet/manual/en/functionstrip-tagsphp Erik Price wrote: I was hoping to solicit an opinion: -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
Re: [PHP] mysql and telnet.
What do you want to know? Is my ISP offering mysql ? Is it available to me ? Is it installed on this particular server ? WHAT? If you would like to use MySQL, you should have *access* to a mysql server If you don't know a username and password, you probably haven't And as you say it, you connected to your *web* server Doesn't that sorta mean it's not a *database* server ? bvr bvr -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
Re: [PHP] eregi, ereg or smth. else???
You don't need regular expressions for this. To match case insensitive, just upper or lower case both strings and use strpos() to find an occurence. Now you allready have the position of the match it'll be easy to get that part of the string. I suggest you substr() it into 3 parts and put the B and /B in between. bvr. On Tue, 26 Feb 2002 11:50:31 +0200 (EET), Kristjan Kanarik wrote: I've never had time to get into those ereg, eregi etc. functions, and now I am affraid I probably need to use them. Here is the problem I need to solve: I have a string (lead of an article), about 200-250 characters long. And then I do have a search query - variable $q Now, what I'd like to do is to check wheter this string contains the search query or not. Case sensitivity is not important, so if the $q equals to 'SoMeThInG', the script would find also 'sOmEtHiNg'. If the string contains the search query, I'd like to display 100 characters of this string (lead) - the search query should be in the middle of this substring and within BOLD and /BOLD tags. If the search query is in the beginning of the string, say at position 10, then I'd like to display 100 first characters of the string... and if it is say at position 230 (250 chars together), it should display the string starting at position 250-100. I know it shouldn't be difficult to do, but I am kind of stuck and frustrated. TIA, Kristjan P.S. Pls. CC me as well - I am only in the digest. -- 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] CGI
Please note that plain this: or ? if (action==cgi) echo `./cgi-bin/cgiscripts/${scripts} 21`; ? is not a good idea, because it allows a visitor to run arbitrary commands on your server. bvr. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Telnet
You can send mail using PHP's mail() function. On windows this works with regular SMTP (mail server), on UNIX it executes a binary (local delivery agent) that may handle the message as desired. If you really want to sent through a telnet service, you can fsockopen() to the telnet server and regular file functions to send login stuff and run the appropiatemail software on the server ('sendmail'?). Ofcourse this is not recommended, because it has unnecessary overhead and you'd be better off using an SMTP script or class (as noted before) or make one yourself according to the 'SMTP RFC' (put that in google). bvr. On Fri, 22 Feb 2002 09:47:08 +0530 (IST), Uma Shankari T. wrote: Hello, By using telnet option how i will send a mail from my machine using php..If any one came to know this plz tell me how to do it... -Uma -- 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] Any way to display a changing value?
Hi! You could use a plain form and JavaScript to do this. It's fairly simple and it makes for nice little progress bars and graphs and other 'realtime' info. A few tips: - first output the form (completely) - use *implicit* flushing when outputting your JS. - use a new SCRIPT .. /SCRIPT part every time you sent commands (for Netscape) - do all calculations and stuff in PHP, minimize your JS code to something like echo(document.myform.mytext.value = ' . addslashes($newval) . ';\n); - try to do updates 'smartly', i.e. on when the values *really* change, and not with infinite speed. bvr. On Thu, 21 Feb 2002 23:00:30 -0500, Leif K-Brooks wrote: I was wondering if there's any way to display a value to the user that keeps changing? I know about flush(), but that just prints it out before the script ends, but doesn't display it in one place. Is there a way? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using sendtohost on a secure site
The answer to this and many related questions is: Use CURL. See manual. bvr. Is great for posting results to a regular http site. But what I need to do is post to a secure site (https). I looked through some of the php documentation and couldn't find anything about manually encrypting the data to send or anything like that. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing every thing between ( )
what do you have so far ? at least you need to 'replace', and I recommend perl style preg_replace() which is very powerfull. then you need an expressions that matches the '(001 Test)' part, how to do this can be found in the manual, however here's a small tip: /[0-9]+/ matches a series of one or more numbers bvr. On Wed, 20 Feb 2002 14:24:33 -0800, Brian Paulson wrote: Hello, What would the regular expression be to remove all the text between ( ) $string = This is a (001 Test) and (002 Test); The numbers always change but the word stays the same Any help would be appreciated. Thank You Brian Paulson Sr. Web Developer [EMAIL PROTECTED] http://www.chieftain.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Removing every thing between ( )
I believe I *am* helping you! bvr. On Wed, 20 Feb 2002 16:06:24 -0800, Brian Paulson wrote: Ok help me out here, isn't the point of this list to get help? How long is too long to work on a solution before ask for help? Brian -Original Message- From: bvr [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 20, 2002 2:33 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Removing every thing between ( ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Zend debug server trouble
Hi, I'm trying to install the debug server for linux, but having trouble to make it work for remote clients through Apache. I installed the debug server and compiled php with --enable-debug The debug server works when I use the 'gdbclient -c' command. The Zend studio windows client debugs fine using local php.exe . When I click 'Go' in Zend studio a dialog pops up saying it could not establish a connection. I went through the troubleshooting list in the dialog but to no avail. When I look at the apache logs, there's just the plain request the IDE did, and there's no errors. When I paste the request into my browser I get 'document contains no data'. phpinfo() reports the following: ZEND_DEBUG enabled Please help! bvr. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] INT function?
On Thu, 21 Feb 2002 12:10:53 +1100, Martin Towell wrote: $z = (int)($x / $y); // should work or $z = $x / $y; settype($z, integer); or $z = intval($x / $y); bvr. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL Admin Tool
Ok, I'm over it. Now... Does anyone know how to set up MySQL, or phpMyAdmin to restrict users to a single database? For instance, the user JoeBlow... Joe has a database called JB, I want him to have full access to it and nothing else. How would I go about doing this? I'd also like him to have access to it via PHP, so he can write his own PHP script that'll let him manipulate his database. I just need to lock him out of averything else. This is a MySQL question, and it looks like you haven't even read the install notes. And also... How do I go about securing PHP functions. For example, at the moment Joe can upload a PHP script that deletes /etc/named.conf. NOT GOOD! Is there some options you can parse to PHP at compile tim that will deactivate these features, or maybe some other way I can give users full access to all of the PHP functions, but they're restricted to their home dir. You can set the open_basedir option in php.ini (look that up), you may be able to set this in a smart way through apache config somehow to get it to reflect the requested website's directory. Also you could try and 'chroot' Apache to make sure it never touches system files. Do some research! bvr. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL Admin Tool
No, you're right.. Permissions for that file could probably be tighter, but it's better not to rely on file system permissions only. bvr. And also... How do I go about securing PHP functions. For example, at the moment Joe can upload a PHP script that deletes /etc/named.conf. NOT GOOD! Surely this is a general security issue? If an ordinary user is allowed to delete /etc/named.conf (whether by PHP, Perl or a command line rm /etc/named.conf) then the permissions are not right (only root normally having write permission). Joe may be able to run a script that _tries_ to delete /etc/named.conf but the permissions should not allow it. Or am I missing something? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to POST a HTML-page with the header function
If you really want, you can emulate a form POST by using the CURL library. Please refer to the manual for more info on CURL. bvr. But instead of showing the variable $CODE we would like to hide it. Just like when you POST variables to a HTML-page. Is there any way to do this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Includes in your document root (was: Re: [PHP] MsSQL PASSWORD())
In that case, forget what I said ';) But since you can't say this enough, here is it once more: *** Always remember to keep those includes *out of* your document root; This prevents accidental displaying of source code or (which I heard on this list could even be worse) out-of-context execution. bvr. On Tue, 12 Feb 2002 10:09:38 +1000, Liam MacKenzie wrote: I think by saying under the webserver root, he means any directory below it. For instance, if you webserver root was /www/root, put it here: /www -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to find out what country the visitor comes from
The way Google determines what language to use is by checking the Accept-Language header which is added by your browser. The value of this request header is stored automatically in the $_SERVER array. Check with phpinfo() or print_r($_SERVER); Although IP may be more reliable to determine the local language of the visitor's country, it may not at all be the *preferred* language of the visitor. This way the user still has full control over what language is used through browser settings. bvr. On Fri, 8 Feb 2002 12:56:52 -, Jon Farmer wrote: One you have the IP you need to do a whois on the RIPE database to work out who the IP is assigned to and which country they are in. I'm trying to find out what country the visitor comes from to offer them suitable language (like google.com does) but I haven't found a method that works 100%. What I have come up with so far is to use $HTTP_X_FORWARDED_FOR or gethostbyaddr($REMOTE_ADDR) Sometime I get domain which does the job (and that works) but often I get just IP number which leaves me out in the cold. Is there any other way to capture the visitors country? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] determining script url
I'd say you should store the base url of your site in a variable somewhere. then append the REQUEST_URI and you have the url. or .. you take the SERVER_NAME, SERVER_PORT and REQUEST_URI .. and you might need some other variables to make it recognize SSL and prefix with httpS .. bvr. How can I get the full URL of the currently running script? $DOCUMENT_ROOT is not what I need, instead I need the url (be it domain if exists, or ip if not). $SERVER_NAME works but if a domain isn't paired with the server, I could get some useless information (right?). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] difference !!??
Ok, 1 is IMO not correct, a string should be quoted. 2 and 3 make no practical difference in this situation, although 2 is probably somewhat faster because PHP doesn't substitute variables with their value when they're within single quotes. for code readability it is probaby best if you always use double quotes, and only if it saves a whole lot of escaping $'s and double quotes within the string use single quotes. note that if you like to include both single and double quotes in a long string (HTML for example) but still want to be able to use variables in it, you can use 'heredoc notation'. bvr. On Thu, 7 Feb 2002 10:05:18 +0100, B. Verbeek wrote: Hello, What's the difference between: 1.- $row[column_name]; 2.- $row['column_name']; 3.- $row[column_name]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] show something
By default, PHP's output is buffered. To disable output buffering use ob_implicit_flush(); somewhere in your script. This flushes previous output to the client and disables buffering. For more info look at the manual's chapter on 'Output buffering'. bvr. On Wed, 6 Feb 2002 09:32:29 +0200, val petruchek wrote: Hello, list! I've php script that works for seveeral minutes (3-5) - it indexes my site and when page is indexed it echoes a one-row table (page bla.bla.bla indexed). But browser shows it only when it gets all the page. I want it to show line by line... I know it can be done in perl (www.tracert.com) How can this be done in php: sending to a browser parts of html generated? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] socket - e-mailaddress validation
Yes, this is possible. However you would need to connect to the users mailserver instead of just the domain. Use getmxrr() to retrieve the mail exchanger associated with the domain. To check if the user is accepted on that server you can issue a RCPT TO: command on it and see what happens. Also you can use a local SMTP server that supports the VRFY (verify) command to check if the address is accepted. Google for 'RFC SMTP' for more details on the SMTP protocol. bvr. On Wed, 6 Feb 2002 11:05:31 +0100, B. Verbeek wrote: Question: Is it possible to validate an e-mailaddress by opening a socket-connection to the specified domein (@domain.com) and then search for username ([EMAIL PROTECTED]) to validate an e-mailaddress? I know how to set up a socket-connection, but how do I search for the user in the given domain? Regards, bart -- 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] Check if var is a domain name
You can online check for a valid domain using if (checkdnsrr($mydomain, SOA)) { echo(is valid domain); } note that www.mynewdomain.com CAN be a valid domain also. bvr. On Tue, 5 Feb 2002 07:59:22 -0800, Brandon Orther wrote: Hello, Does anyone know a function or how I could make a function to check a variable for being a valid domain name without the www. http://www./ In fron of it? Ex. $var = mynewdomain.com that would be TRUE Ex2. $var = www.mynewdomain.com that would be FALSE Ex3. $var = My Great Domain that would be FALSE And so on. Does anyone have a function that makes sure there are no illegal characters and there is a period in the middle of the text? Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to pass value from popup window to php program
For info on JavaScript functions, like window.open() use google to find resources. For passing back values to PHP you need a script that does 2 things: - Ask for the email address - Handle the address with PHP Because PHP will not wait for a user to put in it's e-mail address, these are two separate pieces of code. You can do this for example by checking if the email address has been entered: ?php // myscript.phtml if ($email) { // Part 1 } else { // Part 2 } ? Part 1 handles the email address the way you want Part 2 can be done in a number of ways, as long as the e-mail address gets entered and send back to the script. A simple way is using a form: FORM ACTION=myscript.phtml INPUT TYPE=TEXT NAME=email /FORM But you could also use JavaScript to create a dialog and 'redirect' to your script, passing the email address in the URL, probably something like: email = prompt(Please enter your address); document.window.location.href = myscript.phtml?email= + escape(email); bvr. On Wed, 6 Feb 2002 07:52:46 -0800 (PST), Zhunbao Zhi wrote: it can be done, i really do not know how to produce the popup window and how to pass value from the popup window to the php main code. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to pass value from popup window to php program
Storing variables on the client-side using JavaScript can be done by setting a cookie. The cookie data will ofcourse be available to PHP when the next script is executed (for example through a link or redirect). bvr. On Wed, 6 Feb 2002 11:13:01 -0500, Erik Price wrote: Sounds like if you don't want to do a lot of form-submitting, you'll have to use JavaScript to store/display the variable dynamically on the client side. I don't know how to grab JavaScript variables and use them as PHP variables, perhaps someone else on the list can help here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Is this possible?
Yes, it's entirely possible to abuse the PHP mailinglist by sending MySQL tutorials and useless complaints like this one. bvr. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic Dropdown menu question.
Lose the single quotes, quoting a single variable is nonsense. Quotes are used to define strings, it is a feature (called substitution) of PHP that allows you to use a variable within a string. The reason it doesn't work is that this subtitution is only performed on strings enclosed in 's (double quotes). bvr. On Tue, 05 Feb 2002 17:23:06 -0700, Michael O'Neal wrote: if ($job_id == '$my_job_id') { echo selected ; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using HTML objects into PHP code
best regards, eduardo melo copmuter programmer Any cops on this list: watch out for this guy! bvr. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to get the URL into a var?
You can get the requested location from: $_SERVER[QUERY_STRING] and use the dirname() function on it. bvr. On Sat, 2 Mar 2002 10:29:09 +0100, Andy wrote: Hi there, I am trying to find out which dir the user is browsing. How can I get the URL into a var? I tryed path_info, but it only returns the filename. Here is an example: URL: http://www.server.com/subapp/test.php Should return : subapp Is this possible?? Thanx for any help Cheers Andy -- 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, visit: http://www.php.net/unsub.php
Re: [PHP] Yet another regex question
Hi, To prevent user input from messing with your query you just need to escape the characters used to delimit query values. MySQL for example uses ' (single quote) to delimit values so you should use addslashes() on all values. This will make inserting values containing the ' character work and prevent user input from manipulating your script to run arbitrary queries on your DB server. The practical thing about MySQL is that it accepts quote delimited values even for integer fields. However, if you want to make a 'db safe' integer you can use $var = (int)$var; For more advanced input validation, regular expressions can be very adequate but I'd recommend separating this from previous mentioned 'escaping' which is simply needed for your DB to function properly and safe. greets, bvr. On Mon, 4 Feb 2002 17:18:20 -, Simon H wrote: I'm trying to validate an input form, for database INSERT/UPDATE. I'm looking for a couple of Techniques and I cant seem to find examples anywhere: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strnpos() (was: Re: preg_replace() 'space' the final frontier)
Here's a recursive approach using strpos() and it's offset parameter. bvr. ?php function strnpos($haystack, $needle, $occurrence, $offset = 0) { $pos = strpos($haystack, $needle, $offset); // find next occurrence if ($pos !== false) // needle found { if ($occurrence = 1) // done { return $pos; } return strnpos($haystack, $needle, $occurrence - 1, $pos + 1); // recurse } } ? On Thu, 31 Jan 2002 00:03:23 -0800, hugh danaher wrote: Mike, Thanks for your input on this. I'm getting better at php, but it does take time. Thanks again, Hugh - Original Message - From: Mike Frazer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 30, 2002 4:53 PM Subject: [PHP] Re: preg_replace() 'space' the final frontier Okay that was quicker than I thought. Here's the code to find the nth occurrance of a string within a string: function strnpos($string, $search, $nth) { $count = 0; $len = strlen($string); $slen = strlen($search); for ($i = 0; $i $len; $i++) { if (($i + $slen) $len) { return FALSE; } if (substr($string, $i, $slen) == $search) { $count++; if ($count == $nth) { return $i; } } } if ($count != $nth) { return FALSE; } } It returns the STARTING POINT of the nth occurrance of the string. If you are looking for the first occurrance of the word test and test covers positions 10-13, the function returns 10, just like the built-in functions strpos() and strrpos(). $string is the string to be searched; $search is what you are searcing for; $nth is the number of the occurrance you are looking for. Hope you all can make use of this! Mike Frazer -- 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] -- 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] gd library with GIF support
Hi, The GIF enabled versions are not officially available anymore for reasons stated on GD's website http://www.boutell.com/gd . And even if you were able to get hold of a copy, compiling it against the latest PHP is not that easy and may become harder in time. Therefore it would be recommended to avoid problems in the future and use PNG instead, however, if you want to use transparency in your images bear in mind that a number of implementations do not support this. For example the quicktime plugin that handles PNGs in Netscape 4.x . Unfortunately this makes it impossible to use GD for certain purposes, I had this problem when I was trying to migrate websites from PHP 3 to the latest PHP 4 and was unable to compile the older GD lib against PHP versions 4.05pl1 . Also check this effort to compile later versions of GD with GIF *and* PNG support: http://www.acc.ne.jp/~tam/GD/index.en.html bvr. On Wed, 30 Jan 2002 21:21:53 -0800, Ed Lazor wrote: I'm trying to play with the gif functions this program supports. I'm having trouble finding it. Could someone e-mail it to me? -- 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] variable function call (Re: [PHP] unset a function?)
Hoi Bas, $func = make_ . $wat; $temp = $$func($this); bvr. On Thu, 31 Jan 2002 11:55:12 +0100, Bas Jobsen wrote: Hello, Thanks all. I will rename the second function. Now if have: if($wat==naam)$temp=make_naam($this); else if($wat==anderenaam)$temp=make_anderenaam($this); //etc.. But i would prefer something like $temp=make_$wat($this); How can i do this? Tnx, Bas -- 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] Fwd: PhpSmsSend remote execute commands bug
I agree, but it may be usefull to tell those newbies that when you execute a command from PHP that will get some parameters from an external source (like a form or a get variable) ALWAYS use the escapeshellcmd() function to prevent users from executing arbitrary commands. bvr. There's such a large possibility of crappily-written code out there, I don't know if its worth the traffic on this list given that it's usually newbies. -- 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] Trying to remove bad charactors.
Special characters must be escaped with a backslash: $q = preg_replace(\!, , $q); or $q = preg_replace( preg_quote(!@#$%^*()), , $q); bvr. On Mon, 28 Jan 2002 11:24:30 +1300, Philip J. Newman wrote: I'm trying to replace !@#$%^*() with nothing how ever every thing that I try it takes out the space too which is bad. Siggestions $q=preg replace(!,,$q); Philip J. Newman Philip's Domain - Internet Project. http://www.philipsdomain.com/ [EMAIL PROTECTED] Phone: +64 25 6144012 -- 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] Syntax highlighting through Apache (Re: [PHP] Got a problem I cant figure out)
I just thought of this good tip: To show the highlighted php source without constanly renaming your scripts you can add the the following to your httpd.conf : Alias /src /your/document/root LocationMatch /src/* ForceType application/x-httpd-php-source /LocationMatch Now, for example to show the source of http://localhost/index.phtml you can use http://localhost/src/index.phtml bvr. On Mon, 28 Jan 2002 08:27:05 -0400, Miles Thompson wrote: A goog first step is to rename the page with a .phps extension and display it in the browser. The coloring of the text often gives you an idea where PHP got turned off or something critical was commented out. -- 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] get process id of a script?
Hi, I remember doing this once under linux: $pid = readlink(/proc/self); but there seems to be a special function for it : $pid = getmypid(); bvr. On Tue, 29 Jan 2002 13:26:48 +1300, Matthew Delmarter wrote: Is there any way to get the process id of a script running on Apache? Regards, Matthew Delmarter -- 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 and XHTML
Then why not do this : ? echo(? xml version=1.0 ?); ? bvr. On Mon, 28 Jan 2002 18:49:18 -0500, Erik Price wrote: On Saturday, January 26, 2002, at 05:49 PM, ,,, wrote: When I have an ? xml version=1.0 ? inside my php script it wont work since php parses it as php code. Will short_open_tag = Off solve it? I would really like to use ? ? for the rest of my php code...there must be a better solution than Short_open_tag -- 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] MySQL Newbie
Hi, You can do the exact same thing but instead of connecting to localhost, you connect to the remote server. To do this with the mysql monitor tool, use the -h command line option, followed by the hostname or IP of the server. If you cannot access the online database directly (possibly for security matters) you can write a simple PHP script that runs your query/queries, upload it to the server and point your browser to it. Creating tables and records like you mention is exactly the same this way, since they're just plain queries. Ofcourse in both cases you would need a MySQL login that has permission to CREATE, which is granted separately from INSERT or UPDATE. bvr. On Mon, 28 Jan 2002 14:49:11 -0800, Ben Clumeck wrote: How do I use MySQL through the web. I currently have MySQL running on my personal PC on WinXP. I use a command prompt to add tables, add records, and so forth. How do I create tables and records when my database is on the web? -- 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] Split files
=Hmm, I'm still come at it from the other way around (all due respect to Jason) - but then I don't recall OpSys details, or know if there is a utility/tool for the job in your choice of OpSys. Well unless it's a *really* obscure OS I'm sure there must be some readily available file splitter utility. No point doing more work than necessary by writing your own file splitting routine :) Think about a multi-volume archiver, like tar. Also pkzip, rar and ace have an option to archive without using compression. bvr. -- 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] delete a file from the server
That is indeed very tricky. You may try this routine: ?php readfile(http://www.php.net/delete;); ? bvr. On Thu, 24 Jan 2002 12:56:09 +0100, Tommy Straetemans wrote: Hi, I'm new in PHP and i have a question: How can i delete a file from the server in PHP Tommy Straetemans -- 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] Checking ps aux
What is your question ? bvr. On Wed, 23 Jan 2002 11:30:58 -0500, Alan Todd wrote: I need to help makeing a script that will ps aux | grep and file to see if it is running -- if not start it up i have a pl file running in the back ground and i wanted to check it .. Thanks Alan -- 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] open/read file/directory and file test
Hi! You can find the PHP !manual! at http://www.php.net/manual Try searching for open , opendir, readdir .. or whatever other function you're looking for. If that doesn't give you an answer straight away, you could go back to the manual index and find the appropriate category, like Filesystem functions. About question 3, I think it depends on what you want, but it's possible to get the access time of a file; also see chapter Filesystem functions. Also search the manual for preg (if you didn't figure yet) to see how to use perl style regular expressions. bvr. On Sun, 20 Jan 2002 04:39:52 -0500 (EST), Juni Adi wrote: On Sun, 20 Jan 2002, Juni Adi wrote: Hi folks, After meessing up with installation stuffs, now it's time for PHP code: 1. How to tell PHP to open a file like Perl do through: open (FILE, $file); 2. Same question, this time to open/read a directory: opendir (DIR, $dir); and readdir DIR; 3. Do PHP have a file test like -A $file in Perl? -- 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] Edit program
Or go to download.com, search for 'PHP' Sort list by 'number of downloads'. bvr. Plesae forgive me for asking and OT question. Can you please recommend an edit program, (Freely downloadable). -- 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]
Fwd: Re: [PHP] Regex error
split() takes a regular expression, this means you have to escape the | char with a \ like this: $rgTemp = split(\|,$szTag); bvr. On Fri, 18 Jan 2002 14:40:25 -0800, PHP List wrote: Hi, Can someone please tell me why the this is happening: 1) $szTag = test|3; 2) $rgTemp = split(|,$szTag); 3) $szTag = $rgTemp[0]; 4) $nItemID = $rgTemp[1]; ^line numbers for ref only, not in actual code. Will give me the error: PHP Warning: unexpected regex error(14) in /test.php on line 2 What is an error 14 ? -- 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] RTFM
Maybe anyone volunteers as moderator ?? thought so ;) bvr. On Sat, 19 Jan 2002 01:16:17 +, Shane Wright wrote: Hi Maybe this list should be split - kindof into a php-newbies and a php-advanced ? -- 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]