Re: [PHP] File permissions do not seem to be my friend
Brian, This is a php.ini setting, so a FS permissions problem. The sysadmin needs to disable safe mode on your behalf. David Brian Dunning wrote: > I have a script that scans an images folder and creates a thumbnail for > each and writes it to a new subfolder. Runs fine on my development box. > But I'm using a new host that I'm unfamiliar with (servage.net), and > when I run the script I get the following error. I set the permissions > on the enclosing folder to 777, and all the attempted writes are within > this folder: > > SAFE MODE restriction in effect. The script is not allowed to access > /blah/blah/blah... > > Any suggestions? Anything I can do on my end to allow this? > > --PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.2.0 WANTED: Junior PHP Developer in Bristol, UK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Print extended/parent classes
Jochem, Good point. I thought he meant object given his example. :P David Jochem Maas wrote: > David Grant wrote: >> Mathijs, >> >> Mathijs wrote: >> >>> I have the following situation : >>> >>> >> >>> class A { >>> public $var1; >>> } >>> >>> class B extends A { >>> public $var2; >>> } >>> >>> ?> >>> >>> Now I want to print this object > > ***object*** > >>> >> >>> $obj = new B; >>> print_r($obj); >>> >>> ?> >>> >>> Does anybody know how I can print class A also ? > > ***class*** > > (class and object are not interchangable concepts - yet > they are closely related :-) > > you printed $obj which is an instance of B, which happens to > be a subclass of A. if you are interested to find out which classes > an objects is defined by try something like: > > class A {} > class B extends A {} > class C extends B {} > $c = "C"; $classes = array($c); > while($c = get_parent_class($c)) > $classes[] = $c; > print_r($classes); > >> >> >> The above prints out: >> >> B Object >> ( >> [var2] => >> [var1] => >> ) >> >> Is this not what you expected? You can't print out *just* the >> properties of A. If this isn't what you want, you shouldn't be >> extending A. >> >> David > -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 WANTED: Junior PHP Developer in Bristol, UK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hide email addresses from spam bots
Gerry, If a human being can read it, so can a spambot. New techniques might be developed all the time, but you shouldn't bet against spammers bringing themselves up to date with those techniques too. If the user wishes to display their e-mail address on a web page, they should ensure they have good spam-filtering. You might consider using some sort of CAPTCHA image, but that isn't guaranteed to work flawlessly, and reading an e-mail address in a CAPTCHA image would be hard work. David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to destroy HTTP authentication (from PHP)?
Olaf, How about generating a hash-enhanced (TM) realm name, such as: Basic Realm Session Then store that timestamp-based hash in the session. When you want to user to bugger off, change the realm name. This is just a theory, and I've not tested it at all. David Olaf Greve wrote: > Hi all, > > Alright: here's a bit of a "challenge" (so as to avoid the word "issue") > ;) my colleagues have run into previously: how to kill HTTP > authentication... > > I remember that they never did figure that one out, and I too will now > have to get my hands dirty with trying to find a proper way to do so. > > Simply unsetting the PHP_AUTH_USER and PHP_AUTH_PWD variables doesn't > seem to do any magic, and using a forced 401 ('Unauthorized') HTTP > header is also highly ideal (not to say blatantly dirty)... > > S, has anyone found a proper way of achieving this (ideally from PHP)? > > Also, in case this cannot be done from PHP, does anyone know of any > Apache modules (or tricks/tweaks/settings) that will allow HTTP > authentication to be neatly destroyed? > > Thanks in advance, and cheers, > Olafo > -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 WANTED: Junior PHP Developer in Bristol, UK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Print extended/parent classes
Mathijs, Mathijs wrote: > I have the following situation : > > > class A { > public $var1; > } > > class B extends A { > public $var2; > } > > ?> > > Now I want to print this object > > $obj = new B; > print_r($obj); > > ?> > > Does anybody know how I can print class A also ? The above prints out: B Object ( [var2] => [var1] => ) Is this not what you expected? You can't print out *just* the properties of A. If this isn't what you want, you shouldn't be extending A. David -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 WANTED: Junior PHP Developer in Bristol, UK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] html forms and php
Philippe, I recommend using an ID, instead of the NAME attribute to refer to the various elements. This ought to solve your problem. David Philippe Reynolds wrote: > > Greetings all, > > Currently I have a form that has two lists that contain . > I use javacript to dynamically move options from one select list to > another. > All this works fine... > > > this is the : > > > LT680 > LT685 > LT690 > LT695 > LT700 > LT705 > > > Now I wish to "post" all the options from one list to another page. So > I select all the options in that list and hit the "submit" button. > > Obviously, a select list, will return each value with the same name to > the second web page. Therefore we can only capture the last option posted. > > To resolve this we have to create an array out of our select name: > > > I added the square brakets to the name...now when I select all the > options on the list I can read all values individually. > > Here is problem...my javascripts have stopped working, I can't move > options from one list to the next. Here is the javascript I use > currently...I would like help in modifing it so that it may work while > using the brakets on the name of the select: > > Thanks a bunch for the help!! Always appreciated > > First the two list that transmit the options back and forth: (javascript > below) > > LT680 > LT685 > LT690 > LT695 > LT700 > LT705 > > > > >onClick="Move(fleetForm.trucklist, fleetForm.reportinglist)"> >onClick="Move(fleetForm.reportinglist, fleetForm.trucklist)"> > > > > > > > here is the javascript: > function Move(fromList, toList){ >var tempArray = new Array(); >var x = 0; > >//looping through source element to find selected options >for (var i = 0; i < fromList.length; i++) { >if (fromList.options[i].selected) { >//need to move this option to the 'to' list >var selectionLen = toList.length++; >toList.options[selectionLen].text = > fromList.options[i].text; >toList.options[selectionLen].value = > fromList.options[i].value; >} > else { > //storing options that stay to recreate selected trucks > var tempValues = new Object(); > tempValues.text = fromList.options[i].text; > tempValues.value = fromList.options[i].value; > tempArray[y] = tempValues; > y++; >} > >} >//resetting length of 'from' list >fromList.length = tempArray.length; >//looping through temp array to recreate intial selection >for (var i = 0; i < tempArray.length; i++) { >fromList.options[i].text = tempArray[i].text; >fromList.options[i].value = tempArray[i].value; >fromList.options[i].selected = false; >} > } > function MoveAll(from, to){ > selectAll(from); > Move(from, to); > } > function selectAll(trucklist) { > if (!hasTruck(trucklist)) { return; } > for (var i=0; i trucklist.options[i].selected = true; > > } > -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 WANTED: Junior PHP Developer in Bristol, UK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class constructor
Georgi, Drop __construct, PHP5 will call Test() anyway. >From http://uk.php.net/manual/en/language.oop5.decon.php: "For backwards compatibility, if PHP 5 cannot find a __construct() function for a given class, it will search for the old-style constructor function, by the name of the class." David -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 WANTED: Junior PHP Developer in Bristol, UK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about C++ like macros on PHP
Andrei, http://php.net/manual/en/function.debug-backtrace.php David Andrei wrote: > > Hi list, > > For debugging purposes I want to send to a function the line and > file where it is called. The problem is that I want these parameters to > be added to function as default parameters (changing all function calls > would not be an option for me) > > function my_func( $param, $line = __LINE__, $file = __FILE__ ) > { >... > } > > won't work as it always gets the file and line where function is defined. > Also I don't want to change all function calls to put __LINE__ and > __FILE__ parameters. > I looked into assert too, but I have to change again all function calls > to be assert( "my_func(...)" ); which again will be a pain in the a... > as this function is often called in every scripts... > > Any1 has any ideea about it? > > Thnx, > Andrei > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Other than default grey button
Peter, You need to investigate CSS. David Jevos, Peter wrote: > Hi all > > I'd like to ask you one ( probably ) simple question. I'm using webmail > and I want to use other than default php grey button. > I found on the pages how to use image instead of the default button. So > I changed > > INPUT TYPE="submit" NAME="move_button" VALUE="Move" > > to > > INPUT TYPE="image'" NAME="move_button" VALUE="Move" > SRC="../images/button.jpg" width="19" height="50" > > It works but I found the other important problem. This is image. What > happend when I change the language ? Nothing cause this is permanent > image and text "Move" is replaced by image > > So what should I do to change design of the button without using image ? > > Thanks a lot for an answers > -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 WANTED: Junior PHP Developer in Bristol, UK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] doubt regarding while loop
Suresh, suresh kumar wrote: > hi, >for eg > > while(list(t1,t2,...)=mysql_fetch_row($result)): > endwhile; You could start with list($t1, $t2, ...) instead. Personally, I'd done it without assuming mysql_fetch_row is returning an array. Try: $t1 = ""; $t2 = ""; while ($row = mysql_fetch_row($result)) { list($t1, $t2) = $row; ... } echo $t1; David -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 WANTED: Junior PHP Developer in Bristol, UK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy problem with HTTP wrapper
Laurent, Laurent Vanstaen wrote: >> If so, what makes you think it's writable in the first place? > > 'Cause I work for this ISP So you don't have specs then I guess, since you're asking in a public forum! Have you considered using a HTTP PUT request (using cURL)? php.net/curl $curl = curl_init(); $file = "replacementfile.txt"; curl_setopt($curl, CURLOPT_URL, 'http://192.168.1.1/cgi-bin/newCrontab'); curl_setopt($curl, CURLOPT_PUT, true); curl_setopt($curl, CURLOPT_INFILESIZE, filesize($file)); curl_setopt($curl, CURLOPT_INFILE, fopen($file, 'r')); curl_exec($curl); Note: you might need to set the CURLOPT_USERPWD option too. This is my best guess at a solution, but obviously I've not tested it. David -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] copy problem with HTTP wrapper
Laurent, Laurent Vanstaen wrote: > >> Hello, >> >> on 01/27/2006 05:59 AM Laurent Vanstaen said the following: >> > I see your point. Here in my case the server I want to copy a file on >> > has 192.168.1.1 for IP address and thus cannot be found from outside a >> > LAN, so the security problem is not that much important. But I agree >> > with you and see what you mean. >> >> You may want to try sending files via form upload. Then on the >> destination end the you could have a PHP script that would take care of >> authentication and receiving and storing the uploaded files. > > The destination server doesn't have PHP When you say "Livebox", are you in fact referring to the router given out by your ISP? If so, what makes you think it's writable in the first place? David -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Does file_exists() 'honour' open_basedir?
Perhaps you saw it here: http://php.net/file_exists Search the page for "ceo at l-i-e dot com" or "open_basedir". David DRYALLS wrote: > Let me try and answer my own question. I've *heard* that since PHP v4.3.2 > file_exists() returne an open_basedir warning, but earlier PHP versions did > not. Is this true? > > ""DRYALLS"" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> I have 2 different PHP installs, each are slightly different versions, and >> each have different open_basedir restictions. >> >> I have a PHP script that fails on ONE of the installs but NOT the other. >> >> The line that fails is $foo = file_exists("/proc/loadavg"); >> >> What I don't understand is why one script fails, yet the other does not >> because NEITHER have /proc in the open_basedir path. >> >> What could be different about the PHP configs that makes one report a PHP >> warning, yet the other does not? > -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Does file_exists() 'honour' open_basedir?
Hi, Perhaps you refer to this (fixed in 4.3.3): http://bugs.php.net/bug.php?id=24313 David DRYALLS wrote: > Let me try and answer my own question. I've *heard* that since PHP v4.3.2 > file_exists() returne an open_basedir warning, but earlier PHP versions did > not. Is this true? > > ""DRYALLS"" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> I have 2 different PHP installs, each are slightly different versions, and >> each have different open_basedir restictions. >> >> I have a PHP script that fails on ONE of the installs but NOT the other. >> >> The line that fails is $foo = file_exists("/proc/loadavg"); >> >> What I don't understand is why one script fails, yet the other does not >> because NEITHER have /proc in the open_basedir path. >> >> What could be different about the PHP configs that makes one report a PHP >> warning, yet the other does not? > -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML Question?
William, William Stokes wrote: > How to print tables to a page so that they are placed side by side > horizontally as long as there is screen width left and then continue to > second row below? Like in many image galleries where thumpnails are dumped > to screen and the lines of thumpnails scale dynamically according to screen > widht. > > I need to dump my thumpnails to screen and add some image info below every > thumpnail and I want to take advantage of the whole screen widht. http://www.alistapart.com/articles/practicalcss/ David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recursive array_push?
Kim, After some contemplation (and slightly less crack): $array); } print_r($array); ?> Array ( [layer1] => Array ( [layer2] => Array ( [layer3] => Array ( [layer4] => FOO ) ) ) ) David David Grant wrote: > Kim, > > May the hack-o-rama commence: > > $str = "[layer1][layer2][layer3][layer4]"; > $parts = explode("][", substr($str, 1, -1)); > $text = ""; > foreach ($parts as $part) { > $text .= 'a:1:{s:' . strlen($part) . ':"' . $part . '";'; > } > $text .= 'b:1;' . str_repeat('}', count($parts)); > print_r(unserialize($text)); > ?> > > It works, but I'm not proud. :P > > David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recursive array_push?
Kim, May the hack-o-rama commence: It works, but I'm not proud. :P David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] forwarding from virtual email account to real email account
Binay, I guess you could set up PHP to listen on port 25 and rewrite the headers of mail messages containing aliases, but that seems like a lot of work for what could easily be handled by a (much quicker) MTA. David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function preg_match()
Denyl, You need to call the person responsible for maintaining your box. Denyl Meneses Guillén wrote: > sorry , what is PCRE ? Regular Expression Functions (Perl-Compatible) > I looking my configuration with phpinfo() and not exist PCRE or similar . That's because someone disabled it in the ./configure step (--disable-all). Try using the following in the ./configure step: --with-pcre-regex=DIR (where DIR is where PCRE's include and library files are located) David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to check if an object exists
Derrick, Derrick Shoemake wrote: > It appears that the error I was getting wasn't really related to my > problem. I'm getting a error in httpd-error.log > > httpd in free(): error: junk pointer, too high to make sense > [Tue Jan 24 17:11:32 2006] [notice] child pid 22665 exit signal Abort > trap (6) > > Is there any way to track down where the code is failing? It's not > creating any dump file that I can see. I don't mind digging into this to > either report a bug to php.net, apache.org or even just fix the code > myself and submit a patch to someone, but I'm a little new to the php > and apache working together. This might be related to PHP, but I would start out by asking around the Apache community. David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to check if an object exists
Derrick, Derrick Shoemake wrote: > Does anyone know if this is the proper way to check for an Objects > existence and where I can find more information on doing so? php.net/is_object php.net/instance_of David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] query problem.
Angelo, Angelo Zanetti wrote: > Why does the < > cause that not to be displayed? or is it retrieving it > correctly but not showing it because of the < > (which might be > conflicting with HTML tags? Look at the source! David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Custom Usort Function
Matt, Personally, I'd do a logic case for each combination, e.g. if (ctype_alpha($x[0])) { if (ctype_alpha($y[0])) { //strcmp } elseif (ctype_digit([$y[0])) { //-1 } else { // 1; } } elseif (ctype_digit([$x[0])) { if (ctype_alpha($y[0])) { // 1; } elseif (ctype_digit([$y[0])) { // > } else { // 1; } } else { if (ctype_alpha($y[0])) { // -1; } elseif (ctype_digit([$y[0])) { // -1 } else { // strcmp } } It's not the prettiest, but it will work. David Matt Palermo wrote: > Any ideas on how to accomplish this? > > > ""Matt Palermo"" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> I'm try to sort a list of items using a usort function. Basically, I want >> it to sort in this order: >> >> Numbers (0-9) >> Letters (Aa-Zz) >> Other (anything else) >> >> To explain a little further, I want anything that starts with a number to >> show up first in the sorted list, then anything that starts with a letter, >> and finally anything that starts with some other character. My usort >> function I'm using now gives me results close to this, but it sorts it as >> follows (which is wrong for what I need): >> >> Numbers (0-9) >> Other (anything else) >> Letters (Aa-Zz) >> >> They are all sorted properly alphabetically, but not in the group order >> that I need them in. Here is the usort function I'm using right now: >> >> >> function myUsort($x, $y) >> { >> if(strtolower($x) == strtolower($y)) return 0; >> if(strtolower($x) < strtolower($y)) return -1; >> return 1; >> } function myUsort($x, $y) { if (ctype_digit($x[0])) { } elseif (ctype_alpha($x[0]} } >> As I stated above, this provides me with the proper alphabetical results, >> but I need it tweaked. Basically this function will give a sorted list >> like this: >> >> 007 >> 90210 >> __underscore >> abra-cadabra >> Zebra >> >> But I need the function to provide a sorted list like this: >> >> 007 >> 90210 >> abra-cadabra >> Zebra >> __underscore >> >> >> Anyone know what I need to do to get these results? Please let me know. >> >> Thanks, >> >> Matt Palermo >> http://sweetphp.com > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Book Sample Code Help
Poppy, Poppy Alexandra wrote: > Parse error: parse error in book-1.php on line 90 Please provide lines 89-91 of book-1.php only please. David -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookie reposted
Tedd, The cookie is being set on the www.xn--ovg.com domain. The cookie is being read on xn--ovg.com domain. This is perceived to be a security risk, so the cookie isn't sent. David tedd wrote: > Hi: > > After I successfully writing a cookie, I'm having a problems reading the > cookie repeatedly. > > The first time into my "read the cookie" page, the cookie is read. > However, the second time, it's not. > > If I quit my browser and then reenter the "read the cookie" page, the > cookie is there and read again. But leaving the page and returning > produces no cookie. The cookie remains, but the page doesn't read it. > > I have set up an example at: > > http://xn--ovg.com > > Do 1, Set Cookie -- it will create a cookie and report it. Then go to > "main" > Do 2, Get Cookie -- it will report no cookie found. > > [A] Quit your browser. > > Return to: > > http://xn--ovg.com/cookie/getcookie.php > > It WILL report your cookie. > > Leave the page and return back from anywhere, and your cookie will not > be reported as there. However, if you go to [A] and repeat, you'll find > your cookie remains. > > Surely someone must know what's happening here. > > Does anyone have any ideas? > > It would be nice to have a persistent cookie. Do I also have to use a > session to make this happen? > > tedd -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adventures in Cookies
Please ignore the previous e-mail: I slipped on the keyboard. :) -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adventures in Cookies
Barry wrote: > Austin Denyer wrote: >> On Mon, 23 Jan 2006 16:37:12 + >> David Grant <[EMAIL PROTECTED]> wrote: >> >>> tedd wrote: >>> >>>> Hi all: >>>> >>>> While I'm sure this is obvious for most, but I just discovered this. >>>> >>>> Using one browser (browser A) I can access one of my pages and >>>> create a cookie with a user input value. >>>> >>>> Then using a different browser (browser B), I can access the same >>>> page and create another cookie with another user value. >>>> >>>> Now, it would seem to me that I shouldn't have two cookies with the >>>> same name both having different contents, but that's exactly what >>>> I've found -- for browser A will produce one value and browser B >>>> will produce another value. >>> >>> Can you provide some examples for what you mean? >> >> >> I think he's referring to the fact that you can have one cookie in, >> say, Mozilla and another one in, say, Konqueror (or Internet Exploiter >> if you do Windoze). >> >> Regards, >> Ozz. IE: > No i think he is more referring to that some "different" values are stored. > > But unless we dont get an example, it's useless to discuss that further :P > > Barry > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adventures in Cookies
Austin, Austin Denyer wrote: > On Mon, 23 Jan 2006 16:37:12 + > David Grant <[EMAIL PROTECTED]> wrote: >> tedd wrote: >>> ... >> Can you provide some examples for what you mean? > > I think he's referring to the fact that you can have one cookie in, > say, Mozilla and another one in, say, Konqueror (or Internet Exploiter > if you do Windoze). Rightio. David -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adventures in Cookies
Tedd, tedd wrote: > Hi all: > > While I'm sure this is obvious for most, but I just discovered this. > > Using one browser (browser A) I can access one of my pages and create a > cookie with a user input value. > > Then using a different browser (browser B), I can access the same page > and create another cookie with another user value. > > Now, it would seem to me that I shouldn't have two cookies with the same > name both having different contents, but that's exactly what I've found > -- for browser A will produce one value and browser B will produce > another value. Can you provide some examples for what you mean? David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP SSH2
Vedanta, I recommend contacting the author of the package, or posting to pecl-dev. David Vedanta Barooah wrote: > On 1/23/06, Vedanta Barooah <[EMAIL PROTECTED]> wrote: >> hello all, >> this is in regard to PECL ssh2 ( http://pecl.php.net/package/ssh2 ) : how >> to i print the output of the command executed using ssh2_exec? >> thanks, >> vedanta >> > > > > -- > *~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~* > Vedanta Barooah > YM! - vedanta2006 > Skype - vedanta2006 > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php4 with mysql flag
Markus, Markus Braun wrote: > libapache2-mod-php4 is already the newest version. > mysql-server is already the newest version. > mysql-client is already the newest version. That should be all you need then. Have you restarted apache yet? David -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php4 with mysql flag
Markus, Markus Braun wrote: > I have installed it with apt-get install php4 php4-mysql I think you'll need libapache-mod-php4 too (p.d.o is down at the moment, so can't be sure), as well as the mysql-server and mysql-client packages. David -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem encountered with stristr-based function
George, George Pitcher wrote: > For info, I am trying to highlight search terms in results. If you're searching and replacing within HTML, you ought to be aware of issues if someone's search term happens to be an HTML tag or attribute. For example, Alice might search for "href" and get the following: href="URL">Text back, which is clearly fubar, which highlights the necessity for some handy regex skills. Following a quick google, I found this page: http://aidanlister.com/repos/?file=function.str_highlight.php David -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New identification after an error...
David David BERCOT wrote: > I've tried : > $_SERVER["PHP_AUTH_USER"] = NULL; > without succes... http://www.php.net/unset e.g. unset($_SERVER['PHP_AUTH_USER']); It might, however, be better practice to used an authorisation state variable, or something similar, i.e. if (! $auth) { // HTTP Headers } David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date("H", $datevalue) always adds an hour?
Murray, I can't think what else it might be. Sorry! David -- David Grant http://www.grant.org.uk/ http://pear.php.net/package/File_Ogg0.2.1 http://pear.php.net/package/File_XSPF 0.1.0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date("H", $datevalue) always adds an hour?
Murray, As far as I know, Queensland is in EST (Eastern Standard Time), so that is the correct value. Are you using the same machine or is it remote? David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date("H", $datevalue) always adds an hour?
Murray, What do you get if you print date("T")? David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php script running as a cgi
Hi, zedleon wrote: > I am running a php script as a cgi so to be able to run under my user name. > The script seems to be working except for one major problem. > the cgi script is not finding the variables passed by the html form... How are you attempting to access them? David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how 2 stroe images in Mysql Database using PHP
Suresh, suresh kumar wrote: > i dont know how 2 store images in gif/jpeg format > in Mysql Database.i also want 2 know PHP Code 2 > store images in Mysql Database .reply me soon its very > urgent . Storing the image in the database will result in a fairly large performance hit, but if you want to do that, it's your lookout. A quick search turned this up: http://www.zend.com/zend/trick/tricks-sept-2001.php David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Lions and tigers and slashes, oh my!
Jay, Jay Blanchard wrote: > [snip] > hope the kick didn't break anything. :-) > [/snip] > > Nah, just having a senior moment. Since it is a query string issue I > converted the database (even though it is strictly a web database in this > case) to 'Oil & Gas'. The query string sees the ampersand and doesn't show > anything past that in the condirion. URL encoding the category ought to convert the text to Oil%20%26%20Gas, which ought to work without any problems. Have you tried this? David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Lions and tigers and slashes, oh my!
Jay, Jay Blanchard wrote: > I am having a problem with a an ampersand sign. I have a list of things on a > page, in which one category is 'Oil & Gas'. I store it in the database as > 'Oil & Gas'. When the category is clicked the query string shows just an > ampersand, i.e. > "Filter=Process&FilterKey=Oil%20&%20Gas&Order=Application&Direction=ASC&comm > ents=" and therefore just shows as an '&' and the query only sees 'Oil'. > > I guess that I am too tired to deal with this or the answer would come to > mind immediately. Can someone drop kick me in the right direction? Thanks! Probably not the answer you're looking for, and somewhat site-stepping the issue, but can't you use the category key instead of its title? David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 4.4.2 released!
Derick, Derick Rethans wrote: > The PHP Development Team would like to announce the immediate release of > PHP 4.4.2. This is a maintenance release that addresses a number of > minor security problems and fixes a few regressions that shown up in PHP > 4.4.1. All users of PHP 4 are recommended to upgrade to PHP 4.4.2. Any indication as to when the Windows binaries will become available? David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP for Mac
Richard, Caveat: I'm not a OS X user, so this information may not help you. Richard Correia wrote: > I want to install PHP5 on Mac powerbook G4. Can someone please let me know > where I can find it and it's related module? The installation instructions for OS X on PHP.net[1] points to this[2] resource for installing a portfile. It appears to come with GD compiled in already, but you'll have to look a bit further for Ming. > I am mainly looking for GD and mingswf module on Mac. 1. http://www.php.net/manual/en/install.macosx.php 2. http://php5.darwinports.com/ David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] transferring db info
Ross, Ross wrote: > Can you just export the mysql? Will the pdfs be exported as binary data? > Will I have to re-upload them? (there are hundereds). Try using "mysqldump" to pull the data into a flat file full of SQL statements. You can then use the "mysql" command to reinsert the data. David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image size?
Will, William Stokes wrote: > Can I get pixel sizes from a uploaded web applicable image with PHP? I mean > width and height as pixels. If so How? http://www.php.net/getimagesize David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a way to display data from database for Select Options in a form?
Jochem, Jochem Maas wrote: > David Grant wrote: > 1. your looping a result set which involves a db connection - lots > of pontential things that could go wrong... Absolutely, and lots of lessons to learn too. > 2. its not a centralized 'solution' - code reuse is a good thing. However, what use is code reuse when you're using it only once. If you need to perform the same function again, then refactor the existing code. > 3. we should encourage people to aim a little higher? I imagine my first PHP script with a database connection probably looked much like Adrian's solution, and writing lots and lots of PHP has taught be some best practices that I now stick to. However, being told that I need to write reusable functions for iterating a resultset would've had me running off to another scripting language in a heartbeat. Tell people to aim higher, sure, but let them make their own mind up, make their own mistakes and learn from them. :) >> >> Even the longest journeys start with small steps, and asking someone new >> to PHP to separate various tiers might put them off. > > which I could spin as a positive thing - raising the lowest commom > denominator > so to speak. besides Sue was the one that came with the many-in-one > question > (i.e. how to a dynamically generate a select box AND how do I grab data > from > a DB). I'm sure you're not being elitist, but where do you place the bar? Should PHP be made a language that only the experienced can get into? That sounds like a policy that would only harm the PHP community. David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] replacing .shtml #exec cgi with php calls
Dr. The Doctor wrote: > and wish to replace it with a php call. php.net/exec > Similarly we want to hide a js script. You want to disable direct requests to the javascript file? I can't think of a way that couldn't be trivially circumvented. You're probably better off obfuscating the code. David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a way to display data from database for Select Options in a form?
Jochem, Jochem Maas wrote: > teaching noobs to output html while (oun intended) looping thru a > result set is counter-productive. discuss. I disagree, however, I do believe attention should be drawn to reasons why doing so might be considered bad practice. Even the longest journeys start with small steps, and asking someone new to PHP to separate various tiers might put them off. David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a way to display data from database for Select Options in a form?
Sue, Sue wrote: > We have a form that contains a Select option for a listing of available > dates for the user to choose from. Right now we have to manually change the > dates within the form's Selection list as new dates become available to > choose from. We currently store these available dates in our database, and > am wondering if we can somehow extract these dates from the table to display > in our form? This would eliminate alot of maintenance needed to this form. > If anyone has any ideas as to reference material etc. that I may look which > would give me an idea how to do this using PHP, I'd appreciate it! I'd recommend reading the PHP manual at: http://www.php.net/docs.php There you will find chapters on using various database functions, such as: MySQL http://www.php.net/manual/en/ref.mysql.php PostgreSQL http://www.php.net/manual/en/ref.pgsql.php Microsoft SQL Server http://www.php.net/manual/en/ref.mssql.php Oracle http://www.php.net/manual/en/ref.oracle.php David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php + mysql - timstamp - calculate hours remaining
Gregory, David Grant wrote: > Gregory Machin wrote: >> I have a table with a timestamp column and would like to use his to >> calculate the age of the record . how would i go about this... >> I would also like to exicute a mysql stament that pasess the tables and >> removes fields older than say 72 hours. how would i go about this . ? > > A timestamp is the time in seconds (since Jan 1 1970), so you can > ascertain the age in seconds by subtracting the stored timestamp from > the current timestamp. > > You can find the current timestamp in MySQL using the > CURRENT_TIMESTAMP() function. > > Once you have the age of the record, finding 72 hours is fairly trivial > - 72 hours is 259200 seconds (72hrs * 60mins * 60secs). > > Therefore your query will be: > > DELETE FROM WHERE CURRENT_TIMESTAMP() - > 259200 Following Albert's reply, the query ought to read: DELETE FROM WHERE CURRENT_TIMESTAMP() - UNIX_TIMESTAMP( > 259200 David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php + mysql - timstamp - calculate hours remaining
Gregory, Gregory Machin wrote: > I have a table with a timestamp column and would like to use his to > calculate the age of the record . how would i go about this... > I would also like to exicute a mysql stament that pasess the tables and > removes fields older than say 72 hours. how would i go about this . ? A timestamp is the time in seconds (since Jan 1 1970), so you can ascertain the age in seconds by subtracting the stored timestamp from the current timestamp. You can find the current timestamp in MySQL using the CURRENT_TIMESTAMP() function. Once you have the age of the record, finding 72 hours is fairly trivial - 72 hours is 259200 seconds (72hrs * 60mins * 60secs). Therefore your query will be: DELETE FROM WHERE CURRENT_TIMESTAMP() - > 259200 David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Executing a string
Philip Hallstrom wrote: > http://us2.php.net/eval Pay close attention to the oft-used quote from Rasmus Lerdorf: "If eval() is the answer, you're almost certainly asking the wrong question" David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The meaning of and "@"
Todd, The @ operator suppresses error messages. http://www.php.net/manual/en/language.operators.errorcontrol.php David Todd Cary wrote: > I have not been able to find in the Online Manual the use of the "@" > symbol as in > > while ([EMAIL PROTECTED]($sqlID, MYSQL_BOTH)){ > > Is that a "pointer"...address of...? > > Todd > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include() problem
Nuno, Have you considered $_SERVER['DOCUMENT_ROOT']? David Nuno Trancoso wrote: > This may sound dumb, but i have been up all night going through > php/apache docs, and still have not found an answer.. > > Throughout a site i need to include files that are scattered in subdirs, > sometimes up in the dir tree, sometimes down. Bad design i know but i > have to live w/ it... > > Problem is in the way Apache/PHP see stuff. If i include /somefile.htm > in html, it means somefile.htm wich is at site root dir. In PHP it looks > like it means somefile.htm at SERVER root dir. > > I can use getcwd() and go around truncating/adding to the string until i > get a path to use with set_include_path() to add the site root dir to > the include path, but it just seems wrong to waste cycles doing it... > > So, question is, is there a more direct/elegant way to add the site root > (or any other dir for that matter) to the include path? > > TIA > Nuno Trancoso > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php5 SOAP WSDL parsing
Simon, It would appear you've not included the full message. Please look at the source of the message in your web browser. The space between unexpected and "in complexType" probably contains an XML tag. David Simon Detheridge wrote: > I'm trying to get PHP5 to talk to a web service that I am developing. > > I have created a wsdl for the service > (http://www.symgate.com/symgate/symgate.wsdl) and am trying to get PHP > to parse it. (The wsdl validates in a number of tools I've pointed at > it, including mindreef soapscope and the wsdl analyser on xmethods.net) > > When I try and get PHP5 to read the file, I get an error that it not > very helpful. My code says: > > try > { > $client = new SoapClient ( > "http://www.symgate.com/symgate/symgate.wsdl"; ) ; > } catch ( SoapFault $fault ) { > echo $fault ; > exit ; > } > > The output says: > > SoapFault exception: [WSDL] SOAP-ERROR: Parsing Schema: unexpected in > complexType in /var/www/localhost/htdocs/soap1.php:5 Stack trace: #0 > /var/www/localhost/htdocs/soap1.php(5): > SoapClient->__construct('http://www.symg...') #1 {main} > > This is obviously truncated. I've tried looking at the apache2 error_log > but I can't see any further detail. > > I'd really like to know what PHP's problem is with my wsdl. How can I > see the full output of this error? > > Thanks, > Simon > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with fsockopen and SSL
Hi Barry, I'm not terrible au fait with the workings of SSL, but it strikes me as potentially problematic that you are communicating in plain text over an encrypted protocol. Might that be the problem? David Barry wrote: > Hi everyone! > > I want to connect to an SSL server but i can't get the content :( > > Here is the code i use: > $xml = 'Hello!'; > > function PostToHost($host, $path, $referer, $data_to_send) { > $fp = fsockopen($host, 443); > printf("Open!\n"); > fputs($fp, "POST $path HTTP/1.1\r\n\r\n"); > fputs($fp, "Host:$host\r\n"); > fputs($fp, "Referer: $referer\r\n"); > fputs($fp, "Content-type: text/xml\r\n"); > fputs($fp, "Content-length: ". strlen($data_to_send) ."\r\n"); > fputs($fp, "Connection: close\r\n"); > //fputs($fp, $data_to_send); > printf("Sent!\n"); > while(!feof($fp)) { > $res .= fgets($fp, 128); > } > printf("Done!\n"); > fclose($fp); > > return $res; > } > > $data = $xml; > > printf("Go!\n"); > $x = PostToHost( > "ssl://easy-demo.tcinternet.de", > "/hosting/servlet/Dispatcher", > $GLOBALS["HTTP_REFERER"], > $data > ); > echo $x; > > And this is what i get: > Go! Open! Sent! Done! HTTP/1.1 400 Bad Request Date: Mon, 09 Jan 2006 > 10:28:48 GMT Server: Apache/2.0.53 (Unix) mod_ssl/2.0.53 OpenSSL/0.9.7e > DAV/2 mod_jk/1.2.1 Content-Length: 363 Connection: close Content-Type: > text/html; charset=iso-8859-1 > Bad Request > > Your browser sent a request that this server could not understand. > Apache/2.0.53 (Unix) mod_ssl/2.0.53 OpenSSL/0.9.7e DAV/2 mod_jk/1.2.1 > Server at easy-demo.tcinternet.de Port 443 > > What did the Webserver not understood? > > Btw. i can't use cURL because the server has an old version of PHP (><)" > > Would be glad if you can help or even have a code how to connect to a > SSL webserver via fsockopen that works. > > Btw the PHP version on server is: PHP Version 4.2.2 > > Thanks for any help! > > Greets Barry > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Graphically displayed number to confirm user is a human
Dave M G wrote: > First, is there a term for these kinds of images, or that kind of > verification system? What would be the best search terms to look for > source scripts? CAPTCHA > Second, can anyone recommend a resource for that kind of PHP script. If > I really worked at it, I could probably write the script to generate a > small PNG image with a random number in it. But I haven't the faintest > clue how to distort it so it's only legible to humans, nor how to > correlate the image with a number that a user inputs into a form field. http://pear.php.net/package/Text_CAPTCHA Cheers, David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP is OK in IE but not in Netscape
Nanu, Nanu Kalmanovitz wrote: > Ok, I will forget Netscape, what other popular browsers beside M$-IE > works with M$-Windows? I wouldn't "forget" Netscape, because people still use it. Just make sure your code validates to W3C standards and so long as it isn't too cutting edge, must browsers should display it fine. To answer your question, Opera is probably the third most popular browser on Windows. Cheers, David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP is OK in IE but not in Netscape
Nanu, Nanu Kalmanovitz wrote: > The http://www.kalmanovitz.co.il/hello.php file appears OK in M$-IE but > not in Netscape 7.0. Looks fine to me. What is the contents of hello.php? Cheers, David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem: pgsql (unicode) => php5 => HTML (iso-8859-1)
Michelle, Michelle Konzack wrote: > Please can anyone tell me the right (???) Tag to get Motilla > right to UNICODE? Try: Cheers, David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can someone explain this query to me
Ross, Ross wrote: > $query = "delete from meetings where id IN (".implode(",", $ids).")"; > > Just the end bit, ids is an array of values (1,2,3,4,5) what does the IN > do?? It's the equivalent of WHERE id = 1 OR id = 2 OR id = 3 OR id = 4 OR id = 5. Cheers, David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ? Split string into smaller chunks
Labunski wrote: > I need to split a long string into smaler chunks (an array), as a separator > using every third \n (and not just every \n). > I could use 'explode', but then it would produce too many chunks. php.net/preg_split Cheers, David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/MySQL noob rides again.. into trouble
Paul, Paul Jinks wrote: > David Grant wrote: >> $SQLQuery = "SELECT * FROM project WHERE projTitle = '" . >> $HTTP_GET_VARS['projTitle'] . "'"; > > Yep, that fixed it. Thanks. I had a feeling there was a mix up with the > "s and 's. What's with the . s? The . is a concatenation operator, i.e. it joins two strings together. >> Not sure why you've got the or die() there. > > I had the idea that you could put an or die() after any command and it > would tell you that it had screwed up at that point. Bad idea? Bit hard to maintain I should think. It's unlikely you're going to screw up a string concatenation and it still be able to call the die(). Cheers, David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/MySQL noob rides again.. into trouble
Paul Jinks wrote: > $SQLQuery = "SELECT * FROM project WHERE > projTitle = ".$HTTP_GET_VARS['projTitle'] > or die("SQLQuery 1 failed"); $SQLQuery = "SELECT * FROM project WHERE projTitle = '" . $HTTP_GET_VARS['projTitle'] . "'"; Not sure why you've got the or die() there. Cheers, David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 4 Digit ID with Leading Zeros
Rahul, Rahul S. Johari wrote: > The 4 Digit ID (beginning from 0001) will be used in two places: > (a) It will be the ID for the record in the mySQL table, instead of the > usual ID that we create in mySQL. It will be a Primary Key, Not Null, > Auto_Increment Adding ZEROFILL to that definition might be what you're after. Cheers, David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach $_FILES
Shaun, That is the documented behaviour for form fields in PHP. See "Dots in incoming variable names" on the following page: http://php.net/variables.external Cheers, David Grant Shaun wrote: > Hi, > > I have a form on my site with many file fields for users to upload files. I > am trying to verify that for each file uploaded it corresponds with the name > of the file field i.e. > > >File_1.CSV: > > > >File_2.CSV: > > > > However if I loop through the $_FILES array like this: > > foreach( $_FILES as $key => $value ){ >echo '$key = '.$key.''; >echo '$value = '.$value.''; > } > > $key = File_1_CSV > $value['name'] = File_1.CSV > $key = File_2_CSV > $value['name'] = File_2.CSV > > The . is replaced with an underscore in the $key value. I could get around > this with a substr() but it seems a little inelegant, can anyone tell me why > this is happening please? > > Thanks for your advice. > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem: Distortion while saving text file.
Could it be the other way around, i.e. Windows is stripping slashes, and Linux is not? How does $contents come to exist in the script? Check for any difference in your ini files for magic_quotes_runtime. Cheers, David Grant Janne Miettunen wrote: > What could be wrong when this is transformed: > "" > to this form: > "" > > The line is saved to text file with this function: > > function savesite($site, $lang, $contents){ > > if (check_session()){ > $file=fopen('content/' . $site . '_' . $lang . '.txt', "w"); > > fwrite($file, $contents); > > fclose($file); > } > > I run it through nl2br() before saving and this only happens on Linux > server, on Windows server it works fine, no \ before ". > > Tested with: > On Windows: Apache2, PHP5 > Linux: Debian distro, Apache2, PHP4, also tried with PHP5 > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 1 ip address go here all others go here
Erm, REMOTE_ADDR, not REMOTE_HOST. Sorry! David Grant wrote: > Quick and (very) nasty: > > $parts = split(".", $_SERVER['REMOTE_HOST']); > if ($_SERVER['REMOTE_HOST'] == '127.0.0.1' || ($parts[0] == '192' && > $parts[1] == '168')) { > // Local > } else { > // Remote > } > > > Dave Carrera wrote: >> i know about >> >> $_SERVER['REMOTE_HOST'] >> >> but i think i should of said how do i compare any address starting with >> 192.168. >> >> sorry if my first question was to vague >> >> >> David Grant wrote: >> >>> Try $_SERVER['REMOTE_HOST'] instead of REFERER. >>> >>> Dave Carrera wrote: >>> >>> >>>> Jay Blanchard wrote: >>>> >>>> >>>>> [snip] >>>>> Is there a way of sending users with a local ip address say 127.0.0.1 >>>>> and 192.168.xxx.xxx to goto one page and all other visitors to goto >>>>> another? >>>>> [/snip] >>>>> >>>>> >>>>> Yes, there is. >>>>> >>>>> >>>>> $_SERVER['REFERER'] will give you the referer mosy of the time. More >>>>> info >>>>> from TFM can be found here; >>>>> >>>>> http://us3.php.net/reserved.variables >>>>> >>>>> Header can then be used to redirect >>>>> >>>>> header("Location: http://www.example.com/";); /* Redirect browser */. >>>>> More >>>>> info from TFM can be found here; >>>>> >>>>> http://us3.php.net/header >>>>> >>>>> >>>>> >>>>> >>>> snip from TFM >>>> >>>> 'HTTP_REFERER' >>>> >>>> The address of the page (if any) which referred the user agent to >>>> the current page. This is set by the user agent. Not all user agents >>>> will set this, and some provide the ability to modify HTTP_REFERER >>>> as a feature. In short, it cannot really be trusted. >>>> >>>> notice the last 7 words >>>> >>>> >>> >>> >>> > > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 1 ip address go here all others go here
Quick and (very) nasty: $parts = split(".", $_SERVER['REMOTE_HOST']); if ($_SERVER['REMOTE_HOST'] == '127.0.0.1' || ($parts[0] == '192' && $parts[1] == '168')) { // Local } else { // Remote } Dave Carrera wrote: > i know about > > $_SERVER['REMOTE_HOST'] > > but i think i should of said how do i compare any address starting with > 192.168. > > sorry if my first question was to vague > > > David Grant wrote: > >> Try $_SERVER['REMOTE_HOST'] instead of REFERER. >> >> Dave Carrera wrote: >> >> >>> Jay Blanchard wrote: >>> >>> >>>> [snip] >>>> Is there a way of sending users with a local ip address say 127.0.0.1 >>>> and 192.168.xxx.xxx to goto one page and all other visitors to goto >>>> another? >>>> [/snip] >>>> >>>> >>>> Yes, there is. >>>> >>>> >>>> $_SERVER['REFERER'] will give you the referer mosy of the time. More >>>> info >>>> from TFM can be found here; >>>> >>>> http://us3.php.net/reserved.variables >>>> >>>> Header can then be used to redirect >>>> >>>> header("Location: http://www.example.com/";); /* Redirect browser */. >>>> More >>>> info from TFM can be found here; >>>> >>>> http://us3.php.net/header >>>> >>>> >>>> >>>> >>> snip from TFM >>> >>> 'HTTP_REFERER' >>> >>> The address of the page (if any) which referred the user agent to >>> the current page. This is set by the user agent. Not all user agents >>> will set this, and some provide the ability to modify HTTP_REFERER >>> as a feature. In short, it cannot really be trusted. >>> >>> notice the last 7 words >>> >>> >> >> >> >> > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 1 ip address go here all others go here
Try $_SERVER['REMOTE_HOST'] instead of REFERER. Dave Carrera wrote: > Jay Blanchard wrote: > >> [snip] >> Is there a way of sending users with a local ip address say 127.0.0.1 >> and 192.168.xxx.xxx to goto one page and all other visitors to goto >> another? >> [/snip] >> >> >> Yes, there is. >> >> >> $_SERVER['REFERER'] will give you the referer mosy of the time. More info >> from TFM can be found here; >> >> http://us3.php.net/reserved.variables >> >> Header can then be used to redirect >> >> header("Location: http://www.example.com/";); /* Redirect browser */. More >> info from TFM can be found here; >> >> http://us3.php.net/header >> >> >> > snip from TFM > > 'HTTP_REFERER' > >The address of the page (if any) which referred the user agent to >the current page. This is set by the user agent. Not all user agents >will set this, and some provide the ability to modify HTTP_REFERER >as a feature. In short, it cannot really be trusted. > > notice the last 7 words > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Non-trivial task of converting text to HTML
Hi Roman, Check out this: http://www.michelf.com/projects/php-markdown/ Would this help you? Cheers, David Roman Ivanov wrote: > Task: > Create a script that converts text into HTML with paragraphs. > > Problem: > Input text could use the book notation, as well as the web notation, > plus it can contain HTML. > > == > This is a title > >This is a Book paragraph. >This is another book paragraph. > This is yet another book paragraph, but it's not indented with spaces, > because user wrote it in OpenOffice. > == > > == > This is a web paragraph. > > This is another web paragraph. > >This is yet another web paragraph, which is indented with spaces for > some unknown reason. > == > > Output text should be correctly formatted without using lots of br's and > 's. Doing so manually is not a problem, I would just use for > web paragraphs, and for book paragraphs. However, > formatting such text with a scrip is very difficult. Does anyone knows a > good exaple of such script? > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR Validate email question
Validate::email appears to check for a MX or A record. I'm a bit rusty on my RFCs, but isn't is possible the mail host could be specified using a CNAME? Cheers, David Eric Butera wrote: > Hello, > > I'm using the PEAR Validate::email method to validate email addresses on our > contact forms since the spam bots have gotten so bad. I am using the > "check_domain" flag which calls the php function "checkdnsrr." This form > processor is used on several sites now and all is going well except one > problem. It seems this "checkdnsrr" function randomly returns false on > valid email addresses. I built a little debug feature into the processor to > let me know when the script fails and any error messages it has generated > along the way to try and stay ahead of the spammers. > > I've been getting randomly occurring failure notices. Most of the time it > works, sometimes it doesn't. Every failure is a valid DNS and email > address. If I try running the email address against Validate::email later > it works. I was hoping somebody can shine some light on why checkdnsrr > would work sometimes and why it wouldn't work others. Any help or advice > would be greatly appreciated. > > Thanks in advance! > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Call to undefined function mysql_real_escape_string()]
Hi John, John Nichel wrote: > Paul Hickey wrote: >> I don't understand why I'm getting "undefined function" errors. >> PHP.ini has no reference to mysqli. I don't know if changing this would >> enable the functions specific to PHP > 4.x. > > In your configuration line (how php was configured then compiled), you > have... > > --with-mysqli=/usr/local/mysql/bin/mysql_config > > That is why you are getting undefined function errors. Your version of > php is using mysqli, not mysql. You have two options: a) Recompile php > or b) Change all mysql_* functions to their counterparts in mysqli_* Hmm, that's how I *should* have put it. :) Cheers, David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Call to undefined function mysql_real_escape_string()]
Is there no way to specify the database functions in Joomla? You're getting undefined function because you haven't compiled it with mysql, but mysqli instead, which means the functions you need are prefixed with mysqli instead of mysql. Paul Hickey wrote: > I have PHP compiled with mysqli. > > The standard answer from the Joomla forums is that I need to have > "mysql" vice "mysqli". I was looking for a more global solution than > having to modify the code for every component, module, mambot I want to > use. > > I don't understand why I'm getting "undefined function" errors. > > PHP.ini has no reference to mysqli. I don't know if changing this would > enable the functions specific to PHP > 4.x. > > Paul Hickey > Christian Patriot > Palm Bay Fl > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Call to undefined function mysql_real_escape_string()]
Try using mysqli, instead of mysql. Have you tried Joomla! support channels? Paul Hickey wrote: > Can someone help me overcome this recurring problem? I am using the > Joomla content management system and I keep coming across the following > errors. > > Fatal error: Call to undefined function mysql_real_escape_string() > in /usr/local/apache2/htdocs/common.php on line 24 > > Fatal error: Call to undefined function mysql_real_escape_string() > in /usr/local/apache2/htdocs/class.inputfilter.php on line 344 > > I notice in my Dynamic Extensions section of php.ini there are no > extensions called for; if that helps. Joomla works fine, but when adding > components or modules the problems start. One component author made a > test for the mysql_real_escape_string and I think avoided using it then > the component worked. I think that's probably not the best solution. > > Fedora Core 3 > > Apache 2.0.55 > > PHP 5.0.5 (compiled with mysqli vice mysql) > './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--enable-ftp' > '--enable-inline-optimization' '--enable-magic-quotes' '--enable- > mbstring' '--enable-track-vars' '--enable-trans-sid' '--enable- > wddx=shared' '--enable-xml' '--with-dom' '--with-gd' '--with-gettext' > '--with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-regex=system' > '--with-xml' '--with-zlib-dir=/usr/lib' > > MySQL 4.1.15 > > > TIA, > > > Paul Hickey > Christian Patriot > Palm Bay Fl > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Eval To String
Shaun Shaun wrote: > Is it possible to return the result of eval function to a string rather than > outputting directly to the browser? ob_start(); eval('$eval = "evil";'); $output = ob_get_clean(); Cheers, David Grant -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone getting bounces from
Jay Blanchard wrote: > [EMAIL PROTECTED] ? > > I am getting failure notices out the wazoo for some very old messages to the > general list. > Just got seven in a row, looks like the MTA is trying for three weeks and then giving up. The messages appear to be for: [EMAIL PROTECTED] Can this address be unsubscribed? Cheers, David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forum
Larry E. Ullman wrote: >>>> Does anyone of you know of a good forum that is easy to customize and >>>> supports sticky notes, user registration, bb code and stuff like that? http://fudforum.org/features.php I've heard lots about it, but never used it. Cheers, David Grant -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unnecessary if statement? Programming technique
Hi, I imagine this kind of thing is not especially taxing on the processor, especially if the condition is a fairly simple comparison. That said, I have very little understanding aside from my own limited experience of what runs slowly! If you're worried about code maintenance, then move the code out to a function and pass the parts that vary as parameters. Cheers, David Grant Steve McGill wrote: > Hi, > David is right about the unwanted side-effect. Thanks for the idea though. > Unfortunately the 'greater problem' is not so great, I've just been doing > this for a while now and find myself programming loops like these so often > and I've never got round to testing if a simple IF statement is a major > drain on the CPU. Somehow I doubt it. > I got this reply from someone direct to my mail address, which seems to sum > it up: > > -- > In truth you are not evaluating the whole if block just the condition > and since its such a simple condition I can't see how it would be at > all taxing on the server. In your specific case I can't think of a > better way to do it either. > -- > > I'll try and think of a better example: > > $bool = true; // this is set dynamically and not known in advance > while(true) { > if($bool) { // this condition tested in every single loop > // do first code > } else { > // do second code > } > } > ?> > > and I am wondering if the compiler is smart enough to turn this into: > > $bool = true; // this is set dynamically and not known in advance > if($bool) { // this condition only tested once > while(true) { > // do first code > } > } else { > while(true) { > // do second code > } > } > ?> > > I realise this might be hard to follow without giving specific examples and > code. > > In this case, the coding style of the 2nd example seems far better, but > sometimes the 2 blocks of code are practically identical and it's a > programmer's nightmare to have the blocks of code in 2 places and to > remember to keep them both updated. > > I'm also assuming that using function calls is also much slower than > evaluating a very simple IF statement. > > Thanks for your interest. > > Best wishes, > Steve > > "David Grant" <[EMAIL PROTECTED]> schreef in bericht > news:[EMAIL PROTECTED] >> Jared Williams wrote: >>> Why not >>> >>> for ($i = 0; $i < 100/100; ++$i) >> This involves dividing 100 by 100 for each iteration of the loop. >> It would be better to test against 1. >> >> There is also the unwanted side-effect of executing the code on each >> hundredth iteration, which is unwanted (as far as I understand the >> problem). :) >> >> It would be interesting if Steve could divulge the greater problem that >> he is seeking a solution to. >> >> Cheers, >> >> David >> -- >> David Grant >> http://www.grant.org.uk/ > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
According to http://kate.kde.org/info.php, kate and kwrite (and Quanta) all use katepart (a rewrite of kwrite). Stephen Leaf wrote: > As far as I can tell kate has a kwrite embedded :) I'm sure that's not the > case but it seems like it. everything kwrite can do so can kate. only it has > more options that I'd never used. > > And yes Code folding is nice don't use it much tho. > > On Tuesday 06 December 2005 09:48, David Grant wrote: >> Stephen Leaf wrote: >>> KWrite part of KDE. Notepad with Syntax Highlighting and AutoIndention. >>> And because it's part of KDE all the kioslaves come with. Which means >>> editing sites over ftp, ftps, ssh and many others is possible. >>> Like the Vim guy said. DEs? who needs them :) >> Mmmm, reminds me of Kate! When I use KDE, I used Kate for all non-PHP >> coding tasks, because it has great highlighting, and code folding too. :) >> >> Cheers, >> >> David Grant > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
Stephen Leaf wrote: > KWrite part of KDE. Notepad with Syntax Highlighting and AutoIndention. > And because it's part of KDE all the kioslaves come with. Which means editing > sites over ftp, ftps, ssh and many others is possible. > Like the Vim guy said. DEs? who needs them :) Mmmm, reminds me of Kate! When I use KDE, I used Kate for all non-PHP coding tasks, because it has great highlighting, and code folding too. :) Cheers, David Grant -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unnecessary if statement? Programming technique
Jared Williams wrote: > Why not > > for ($i = 0; $i < 100/100; ++$i) This involves dividing 100 by 100 for each iteration of the loop. It would be better to test against 1. There is also the unwanted side-effect of executing the code on each hundredth iteration, which is unwanted (as far as I understand the problem). :) It would be interesting if Steve could divulge the greater problem that he is seeking a solution to. Cheers, David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
Hi Jeff, Jeff McKeon wrote: > What is it you like about Zend Studio? * Code completion * Syntax highlighting for PHP, HTML and CSS * Manual pages * Debugging * Code examination * PHPDoc * CVS & SVN support Cheers, David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
Jeff, Jeff McKeon wrote: > Forever now I've been using Frontpage for all my web work including php. > I'm sure there's better software out there that is more suited to > writing and editing PHP pages. What do you all use? I use Zend Studio 5, but there are plenty of other (cheaper) options. Take a look at the following link for a list of editors with reviews. http://www.php-editors.com/review/ Cheers, David Grant -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with preg_replace only part of the string
Replace the middle (.*) with ([^<]*). This tells the regex engine to ignore new opening tags. Cheers, David Georgi Ivanov wrote: > Hi, > I want to replace the content of html links : name="bla">REPLACETHIS. > > $html=preg_replace("/()(.*)<\/a>/isU",$link,$html,1); > This generally works but removes , tags too. > How to make it work without removing anything else than (.*) in the middle of > .* > > Thanks in advance. > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] weird error, cookies??
Hi Angelo, This simply means that the redirection keeps going, like so: foo.php bar.php Check the logic in your application that decides if the user gets redirected and make sure you're not making any incorrect assumptions. Cheers, David Grant Angelo Zanetti wrote: > Hi guys. > > Been working on my site and then been trying to navigate through it, the > once page redirects to another. > > then all of a sudden I get this weird popup (in mozilla) "Redirection > limit for this URL exceeded. Unable to load requested page" > > Also IE seems to timeout. > > The page redirects from http to https. > > anyone come across this or know what the problem is? > > Thanks in advance. > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] when to enter submitted in mysql?
Personally, I'd keep it all in the session and write at the end, but this approach has at least two drawbacks: 1. The user cannot complete the process at a later point. 2. You cannot conduct analysis of part-completed data. Cheers, David Grant [EMAIL PROTECTED] wrote: > Hi to all! > I have form made on 4 pages (by groups of questions). Right now my code > works this way: once somebody submit the first page of the form his/her > submitted info is entered in database with status=temp. I store the ID > (insert_id()) in session and then every time visitor submit the next > page I do update of the current record using ID. > But, I heard once that "the best" solution is store all entered info in > session (array) and insert all info at once. > Or, instead in sessions, move submitted info with serialized array. > > Opinions? > > Thanks for help. > > -afan > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exclude part of text
Please try: preg_match('/^[^\>]*\>(.*)\*.*$/', $line, $matches); 021 wrote: > the log file is from a radio playlist: > > TIME > ARTIST - TITLE *SONG_CATEGORY > > for example > > 17:12:26 > THE CURE - ALT.END *NEW > > the values before > and after * are changing, hope there's a simple > solution for this > > thanx > -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exclude part of text
Hi, 021 wrote: > $lines = file('sometext.txt'); > for ($i = 0, $j = count($lines); $i <=1; $i++) { > print $lines[$j - $i]; > } > ?> For a start, try this instead: $lines = file('sometext.ext'); $last = end($lines); Secondly, do you have an example of the real log file? Cheers, David Grant -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_slipt
There is an error in this code. It should in fact read: $a = split("\r\n", chunk_split('1234567890', 2), 5); OR $a = split("\n", chunk_split('1234567890', 2, "\n"), 5); David Grant wrote: > Hi Dan, > > Try: > > $a = split("\n", chunk_split('1234567890', 2), 5); > > php.net/chunk_split > php.net/split > > Cheers, > > David Grant > > Sichta Daniel wrote: >> Hi all !!! >> >> I have string like this "1234567890" >> >> I need to split this into array like this >> a[0] = "12" >> a[1] = "34" >> a[2] = "56" >> a[3] = "78" >> a[4] = "90" >> >> I know that for this is preg_split, but I don't know the string patern >> for split. >> Thank you in advance !! >> >> >> Dan >> >> >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_slipt
Hi Dan, Try: $a = split("\n", chunk_split('1234567890', 2), 5); php.net/chunk_split php.net/split Cheers, David Grant Sichta Daniel wrote: > Hi all !!! > > I have string like this "1234567890" > > I need to split this into array like this > a[0] = "12" > a[1] = "34" > a[2] = "56" > a[3] = "78" > a[4] = "90" > > I know that for this is preg_split, but I don't know the string patern > for split. > Thank you in advance !! > > > Dan > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PhpMailer vs Pear:Mail
*cough* http://pear.php.net/package/Mail *cough* Mark Steudel wrote: > Would you mind elaborating on why? > > -Original Message- > From: Richard Heyes [mailto:[EMAIL PROTECTED] > Sent: Monday, November 28, 2005 12:53 AM > To: Cabbar Duzayak > Cc: php-general@lists.php.net > Subject: Re: [PHP] PhpMailer vs Pear:Mail > > Cabbar Duzayak wrote: >> Could you please tell which one you recommend in terms of >> stability/speed and share your experience in terms of these 2? > > Ooo, that would have to be PEAR::Mail... > > -- > Richard Heyes > http://www.phpguru.org/ > > -- > 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] SQL Password() function
Ahmed Saad wrote: > On 11/26/05, Yaswanth Narvaneni <[EMAIL PROTECTED]> wrote: >> I 'dont' want to use something like select * from table where >> table.passwd=password($passwd); > > (IIRC. they broke backward compatibility in > version 5).. 4.1 :( Cheers, David Grant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is
Tells the parser that the XML it is parsing is version 1. Jochem Maas wrote: > Wolf wrote: >> I have some scripts that I downloaded and am trying to make compliant >> with my server. They have > they are and how to fix them at this point. >> >> Stupid question, I know, but... > > not stupid, although a 'google' might have helped, regardless you have > already had the answer. > > I find it funny that you say 'fix them' - one of the things [some of] > the core > developers are looking to get rid of is this shorthand syntax > (according to posts on internals@lists.php.net) ... something > to do with XML compatibility ... for now its valid php syntax though :-). > >> >> Thanks, >> Robert >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is
Robert, I have some scripts that I downloaded and am trying to make compliant > with my server. They have they are and how to fix them at this point. > > Stupid question, I know, but... > > Thanks, > Robert > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regexp trouble
Andy, Try preg_match instead of ereg. Cheers, David Grant Andy Pieters wrote: > Hi list > > I still fail to understand why regular expressions are causing me such a hard > time. > > I used and tested my regexp in kregexpeditor (comes with Quanta [kdewebdev]) > but when I put it in the php script it fails. > > ereg('^([\w]{3,3})[\s]([\d]{2,2})[\s]([\d]{2,2})[:]([\d]{2,2})[:]([\d]{2,2})' > > Does not match my query string. > > Which is > > Nov 22 06:51:36 > > Any ideas why? I mean Line start, followed by 3 word chars, followed by a > space, followed by 2 digits, followed by a space, followed by two digits, > folowed by a colon followed by 2 digits and followed by a colon, should match > that date? > > With kind regards > > > Andy > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] understanding session vars ?
Gregory Gregory Machin wrote: > My test code is for test.php which is intended to call it's self, and > starts with sesstion_start(). > buy does not disply x after link2 is clicked on, but only y.. > > what am I missing ? "x" wouldn't display because it depends on $_GET['item'] being set, which isn't. Try var_dump($_SESSION) instead of the conditional echoing of the variables. Cheers, David Grant > Thanks > > On 11/24/05, *David Grant* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Gregory, > > Values in the $_SESSION superglobal will persist over pages so long as > session_start() is called on each page. > > Cheers, > > David Grant > > Gregory Machin wrote: > > I have a test script.. > > What i'm trying to achieve is once the user has clicked on link1 the > > value of item must equal x and if the user clicks on link2 the > value of > > items must stay equal to x while setting action equal to y .. > > > > > session_start(); > > echo 'Welcome to testpg'; > > $_SESSION['time']= time(); > > > > > > if (isset($_GET['item'])){ > >$_SESSION['item'] = $_GET['item']; > > echo $_SESSION['item']; > > } > > > > if (isset($_GET['action'])){ > >$_SESSION['action'] = $_GET['action']; > >echo $_SESSION['action']; > > } > > > > > > ?> > > link1 > > link2 > > > > thanks > > > > On 11/24/05, * David Grant* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > > mailto:[EMAIL PROTECTED]>>> wrote: > > > > Gregory, > > > > Are you always setting $_SESSION['menu'] to the contents of > > $_GET['menu']? If so, the second link will set > $_SESSION['menu'] to > > null. You need to check the contents of $_GET['menu'] first > before > > setting, i.e. > > > > if (isset($_GET['menu'])) > > $_SESSION['menu'] = $_GET['menu']; > > > > Cheers, > > > > David Grant > > > > Gregory Machin wrote: > > > Hi > > > I'm a bit stuck on session var, and thier implamentation, or my > > perseption > > > thier of. > > > I have a page and need certian vars to be persistat each > time the > > page is > > > called. > > > This is done to detmin the content of the page through logic > that > > calls > > > different includes. > > > > > > But I cant get the vars to be persistant. > > > note the page call it's self. > > > > > > ./index.php > > > > > session_start(); > > > $_SESSION['menu'] > > > > > > ?> > > > option 1 // this > works > > > differnt action // > > this brakes > > > it . when the user links here the 'menu' var is cleared > > > > > echo $_SESSION['menu']; > > > > > > ?> > > > > > > I would like the menu var (and others) to be persistant until it > > is reset or > > > updated. how do I acheave this . > > > > > > Thanks > > > > > > > > > > > > > > > > > > > > > -- > > > Gregory Machin > > > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> > > > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > mailto:[EMAIL PROTECTED]>> > > > www.linuxpro.co.za <http://www.linuxpro.co.za> > <http://www.linuxpro.co.za> > > > www.exponent.co.za <http://www.exponent.co.za> > <http://www.exponent.co.za> > > > Web Hosting Solutions > > > Scalable Linux Solutions > > > www.iberry.i
Re: [PHP] understanding session vars ?
Gregory, Values in the $_SESSION superglobal will persist over pages so long as session_start() is called on each page. Cheers, David Grant Gregory Machin wrote: > I have a test script.. > What i'm trying to achieve is once the user has clicked on link1 the > value of item must equal x and if the user clicks on link2 the value of > items must stay equal to x while setting action equal to y .. > > session_start(); > echo 'Welcome to testpg'; > $_SESSION['time']= time(); > > > if (isset($_GET['item'])){ >$_SESSION['item'] = $_GET['item']; > echo $_SESSION['item']; >} > > if (isset($_GET['action'])){ >$_SESSION['action'] = $_GET['action']; >echo $_SESSION['action']; > } > > > ?> > link1 > link2 > > thanks > > On 11/24/05, * David Grant* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Gregory, > > Are you always setting $_SESSION['menu'] to the contents of > $_GET['menu']? If so, the second link will set $_SESSION['menu'] to > null. You need to check the contents of $_GET['menu'] first before > setting, i.e. > > if (isset($_GET['menu'])) > $_SESSION['menu'] = $_GET['menu']; > > Cheers, > > David Grant > > Gregory Machin wrote: > > Hi > > I'm a bit stuck on session var, and thier implamentation, or my > perseption > > thier of. > > I have a page and need certian vars to be persistat each time the > page is > > called. > > This is done to detmin the content of the page through logic that > calls > > different includes. > > > > But I cant get the vars to be persistant. > > note the page call it's self. > > > > ./index.php > > > session_start(); > > $_SESSION['menu'] > > > > ?> > > option 1 // this works > > differnt action // > this brakes > > it . when the user links here the 'menu' var is cleared > > > echo $_SESSION['menu']; > > > > ?> > > > > I would like the menu var (and others) to be persistant until it > is reset or > > updated. how do I acheave this . > > > > Thanks > > > > > > > > > > > > > > -- > > Gregory Machin > > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > > www.linuxpro.co.za <http://www.linuxpro.co.za> > > www.exponent.co.za <http://www.exponent.co.za> > > Web Hosting Solutions > > Scalable Linux Solutions > > www.iberry.info <http://www.iberry.info> (support and admin) > > > > +27 72 524 8096 > > > > > -- > Gregory Machin > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > www.linuxpro.co.za <http://www.linuxpro.co.za> > www.exponent.co.za <http://www.exponent.co.za> > Web Hosting Solutions > Scalable Linux Solutions > www.iberry.info <http://www.iberry.info> (support and admin) > > +27 72 524 8096 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] readfile and get_file_contents don't work
Hi Richard, Please ensure that the "allow_url_fopen" directive is set to "On" in your php.ini file. Cheers, David Grant Richard K. Miller wrote: > I compiled PHP from source on Fedora Core 4, but I must have left > something out because readfile and get_file_contents aren't working. If > I try to connect to a "http://"; address I get the error "failed to open > stream: HTTP request failed". Any ideas why? > > Richard > > --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] understanding session vars ?
Gregory, Are you always setting $_SESSION['menu'] to the contents of $_GET['menu']? If so, the second link will set $_SESSION['menu'] to null. You need to check the contents of $_GET['menu'] first before setting, i.e. if (isset($_GET['menu'])) $_SESSION['menu'] = $_GET['menu']; Cheers, David Grant Gregory Machin wrote: > Hi > I'm a bit stuck on session var, and thier implamentation, or my perseption > thier of. > I have a page and need certian vars to be persistat each time the page is > called. > This is done to detmin the content of the page through logic that calls > different includes. > > But I cant get the vars to be persistant. > note the page call it's self. > > ./index.php > session_start(); > $_SESSION['menu'] > > ?> > option 1 // this works > differnt action // this brakes > it . when the user links here the 'menu' var is cleared > echo $_SESSION['menu']; > > ?> > > I would like the menu var (and others) to be persistant until it is reset or > updated. how do I acheave this . > > Thanks > > > > > > > -- > Gregory Machin > [EMAIL PROTECTED] > [EMAIL PROTECTED] > www.linuxpro.co.za > www.exponent.co.za > Web Hosting Solutions > Scalable Linux Solutions > www.iberry.info (support and admin) > > +27 72 524 8096 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php