Re: [PHP] read from comport: windows vs. linux
On Wednesday 06 April 2005 14:41, Kim Madsen wrote: > User and group is apache. It made _no_ difference at all, I´m still > getting permission denied, when calling fopen :-/ > > [EMAIL PROTECTED] dev]# ls -al ttyS* > crw-rw-rw- 1 apache apache 4, 64 Apr 5 16:01 ttyS0 Well if "other" has "rw" then it doesn't really matter who owns the file. What does the php error log say? Are any of the safe mode stuff enabled? Are you running SELinux? Anyway the following works for me: error_reporting(E_ALL); //error_reporting(0); ini_set('display_errors', TRUE); if (!$fp = fopen("/dev/ttyS0", 'w+b')) { echo "\nError! Could not open COMport - Got a terminal open?\n"; exit; } else { $i = 0; while ((false !== ($char = fgetc($fp))) AND $i < 10) { $i++; echo "$i::[$char]"; } echo $i; } -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] include with remoted address
Hi to all, I've wrote a program with a web-browser interface (IE) and a built-in server (INDY) which call the php-cgi.exe CGI application and redirect stdio/stdout/sterr to pass .php scripts readed from a crypted and zipped sets of files. The arguments are passed between QUERY_STRING enviroment variabile and all work very well. A this point to include a file in a my script I must use for each .PHP file: http://localhost:' . $_SERVER["SERVER_PORT"]; require_once $g_hostname . '/config_inc.php'; require_once $g_hostname . '/html_api.php'; html_begin(HTML_DOCTYPE_FRAMESET); html_head_begin(); html_head_end(); html_frameset_begin(); html_frameset_end(); html_end(); ?> There is another way (i think to php.ini) to set default include, require_once, working area to my 'http://localhost:xxx/' avoid to manually insert upon code ? thank you very much and sorry for my ignorance about php matter Silverio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] read from comport: windows vs. linux
> -Original Message- > From: Jason Wong [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 06, 2005 9:36 AM > Well if "other" has "rw" then it doesn't really matter who owns the file. My point exactly! > What does the php error log say? Samething as on the site: "Apr 6 10:16:12 lager httpd: PHP Warning: fopen(/dev/ttyS0): failed to open stream: Permission denied in /var/www/html/s.php on line 85" > Are any of the safe mode stuff enabled? Nops, disabled, cause I use exec() to set the comport speed, parity, stopbits and so... > Are you running SELinux? Jeps, that´s installed, but I have no clue, what that is and do. The server with the problem runs Feodora 3, I´m running RH9 on my own servers. -- Med venlig hilsen / best regards ComX Networks A/S Kim Madsen Systemudvikler/systemdeveloper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] select several files and download them simultaneous
Hello, is there a way to download a set of files at once, without zipping them. I want to offer my visitors to select several files for download. Now i don't know how i can handle the download at once. Any ideas or solutions? Thanks Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read from comport: windows vs. linux
Kim Madsen wrote: -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 06, 2005 9:36 AM Well if "other" has "rw" then it doesn't really matter who owns the file. My point exactly! What does the php error log say? Samething as on the site: "Apr 6 10:16:12 lager httpd: PHP Warning: fopen(/dev/ttyS0): failed to open stream: Permission denied in /var/www/html/s.php on line 85" Are any of the safe mode stuff enabled? Are you running mod_security? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] read from comport: windows vs. linux
> -Original Message- > From: Burhan Khalid [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 06, 2005 10:43 AM > Are you running mod_security? Nops: [EMAIL PROTECTED] ~]# httpd -l Compiled in modules: core.c prefork.c http_core.c And SELinux is now disabled, still no change... :-/ /Kim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] if question
Hello, I need to test if a variable value is 3 or 6 or 9 or 12 or 15 or 18 ... goes on like this. How this can be done? Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read from comport: windows vs. linux
On Wednesday 06 April 2005 16:18, Kim Madsen wrote: > > Are you running SELinux? > > Jeps, that?s installed, but I have no clue, what that is and do. The > server with the problem runs Feodora 3, I?m running RH9 on my own > servers. Check the archives, there have been a lot of people having problems with having SELinux enabled and were resolved when it was disabled. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if question
On Wednesday 06 April 2005 10:47, William Stokes wrote: > Hello, > > I need to test if a variable value is 3 or 6 or 9 or 12 or 15 or 18 ... > goes on like this. > > How this can be done? > > Thanks > -Will switch($yourvar) {case 3: somestuff; break; case 6: somestuff; break; etc default: somestuff; break; } You can find answers to these and many other questions on www.php.net Look at the documentation section Andy -- Registered Linux User Number 379093 -- Feel free to check out these few php utilities that I released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] what are {} used for in php?
I have often seen php code included inside braces. What does this mean or do? Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: [PHP] if question
On Apr 6, 2005 10:47 AM, William Stokes <[EMAIL PROTECTED]> wrote: > > Hello, > > I need to test if a variable value is 3 or 6 or 9 or 12 or 15 or 18 ... > goes > on like this. > > How this can be done? > > Thanks > -Will > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php basically divisble by 3? use the modulus operator. $reminder = $testVariable % 3; if ($reminder == 0) { return true; } HTH
[PHP] Re: SQL statement - date
Jacques wrote: > How should I formulate my sql statement to create a result set of members > who registered between now and 7 days ago? > > I have tried the following and it is obviously incorrect: > > $sqlnewmembers = "Select uid, uprofilename from tblusers where udatereg > between (date() and date() - 7)"; > > Regards > > Jacques this should work (please adjust date format to your needs): BETWEEN date('Y-m-d') AND date('Y-m-d',mktime(0, 0, 0, date("m"), date("d")-7,date("Y")))"; Regards Kyriacos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if question
William Stokes wrote: Hello, I need to test if a variable value is 3 or 6 or 9 or 12 or 15 or 18 ... goes on like this. How this can be done? if ($var % 3 == 0) { echo $var." is divisible by 3"; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] if question
> -Original Message- > From: William Stokes [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 06, 2005 10:48 AM > I need to test if a variable value is 3 or 6 or 9 or 12 or 15 or 18 ... > goes > on like this. > > How this can be done? Have a look at modulus: http://dk.php.net/manual/en/language.operators.arithmetic.php -- Med venlig hilsen / best regards ComX Networks A/S Kim Madsen Systemudvikler/systemdeveloper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] POST parsing troubles
Hi, I have the following problem: An external system passes me a post request as bellow (server names etc changed): POST /cgi-bin/sms-weather HTTP/1.1 Host: sms-app.company.com X-Recipient: 12345:0:0 X-Sender: 040123456:0:0 X-Service: weather Content-Length: 7 WEATHER == I need to get all the X headears (which I can) plus the content from this POST. My problem is that the content is not a key/value pair, and so does not apear as a _POST[] variable or as apart of any other array I can think off (_REQUEST,apache_request_headers()). Any help will be gradly apreciated. Thanks in advance, Kyriacos Sakkas -- Kyriacos Sakkas Netsmart Development Team Tel: + 357 22 452565 Fax: + 357 22 452566 kyriacos(at)netsmart.com.cy http://www.netsmart.com.cy Taking Business to a New Level! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] To session or not to session [SOLVED]
Thank you all for your input. Andy -- Registered Linux User Number 379093 -- Feel free to check out these few php utilities that I released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: if question
possible solution: http://www.php.net/function.in-array William Stokes wrote: > Hello, > > I need to test if a variable value is 3 or 6 or 9 or 12 or 15 or 18 ... goes > on like this. > > How this can be done? > > Thanks > -Will -- Kyriacos Sakkas Netsmart Development Team Tel: + 357 22 452565 Fax: + 357 22 452566 kyriacos(at)netsmart.com.cy http://www.netsmart.com.cy Taking Business to a New Level! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if question
> I need to test if a variable value is 3 or 6 or 9 or 12 or 15 or 18 ... goes if ($variable%3 == 0) #do something -- Lars B. Jensen, Internet Architect CareerCross Japan Japan's premier online career resource for english speaking professionals http://www.careercross.com
RE: [PHP] POST parsing troubles
> I need to get all the X headears (which I can) plus the > content from this POST. My problem is that the content is not > a key/value pair, and so does not apear as a _POST[] variable http://hu2.php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data Felhő -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] noob need help for sessions
I'm having problem with my session, when I login my session is registered ok but when I click on another page it's canceled again. I use that kind of link: index.php?menu=voyage&sid=$sess_id then on top of the page I use: if(session_id()){ session_id(strip_tags($_GET['sid'])); session_start(); $sess_id = session_id(); $nom_user = $_SESSION['session_nom']; $prenom_user = $_SESSION['session_prenom']; $bienvenue="Bienvenue $prenom_user $nom_user"; } http://81.57.4.105/~pat/alliance/ (user and pass = admin) can someone tell me how when I click on the top boxes link the session is not kept? here is the code: http://hashphp.org/pastebin?pid=2354 thanx in advance Pat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST parsing troubles
Hodicska Gergely wrote: >>I need to get all the X headears (which I can) plus the >>content from this POST. My problem is that the content is not >>a key/value pair, and so does not apear as a _POST[] variable > > > http://hu2.php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data > > > Felhő My problem is how to acces the content, the above setting doesnt seem to load it into any of the arrays. -- Kyriacos Sakkas Netsmart Development Team Tel: + 357 22 452565 Fax: + 357 22 452566 kyriacos(at)netsmart.com.cy http://www.netsmart.com.cy Taking Business to a New Level! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] noob need help for sessions
session_start() has to be at the top of the page... cheers
[PHP] Preventing automated account creation
Hi, I have been investigating ways of preventing automated account creation on the e-commerce system I am currently working on. Obviously I have seen the graphical solutions to this problem, a small image containing several letters and numbers which must be typed in by the user to confirm account creation. However, this (it seems to me) is a bit overkill for what is a pretty small client, I'm not entirely sure it's a good use of time to create this script solely for them, does anyone know of anything pre-packaged? Furthermore is it really worth doing this, what risks do automated account creation present to an e-commerce site? Tom Williams, Digital Data
Re: [PHP] what are {} used for in php?
Jacques wrote: I have often seen php code included inside braces. What does this mean or do? you mean inside a double quoted string? like: $var = "{$myArray[$myAssocKey]} {$myObj->property}"; ?> the braces are used to delimit the variables that are to be interpolated, this is done to make sure that PHP doesn't get confused about which part of the string is a 'var' that needs to be replaced. searching on php + 'string interpolation' should give you more info on the matter. ... also braces can be used for direct access to chars in a string e.g: $myString = "my String"; echo $myString{3}; // gimme a "S" ?> ...and if you mean braces like the following, then you need to go to the manual and read up on 'control structures': if ($x) { echo '$x casts to boolean true!'; } ?> Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Command-line php in debian/woody
I am running a Woody server. I'd like to run php scripts from the command line, but I note that the php/php4 executable is not in my PATH. I have php4, version 4.1.2-7.0.1 installed. Is the command-line option available with this version, or do I need to install another package? I understand that the command-line option was not available with earlier versions of php4 I don't want to mix my system up with Sarge - it usually screws everything up when I have tried to do that. I note that php isn't available in the backports. Is there any sort of workaround (short of upgrading the whole system to sarge, which I don't want to do)? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] swf and getimagesize problem
Dear phpers, I've got some swf file to be tested their size with php. But it worked on some of the swf files. Some don't. I wonder if someone could tell me why. Any help will be appreciated:) Thanks in advance. Sincerely, Kun -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST parsing troubles
Hodicska Gergely wrote: >>I need to get all the X headears (which I can) plus the >>content from this POST. My problem is that the content is not >>a key/value pair, and so does not apear as a _POST[] variable > > > http://hu2.php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data > > > Felhő my mistake on previus reply variable $HTTP_RAW_POST_DATA now contains the info i need. Thanks -- Kyriacos Sakkas Netsmart Development Team Tel: + 357 22 452565 Fax: + 357 22 452566 kyriacos(at)netsmart.com.cy http://www.netsmart.com.cy Taking Business to a New Level! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sprintf and arrays.
I have a snippet of code that looks something like: if (is_array($p_sub_values)) { foreach ($p_sub_values as $i => $v) { $p_sub_values_str[$i] = "'$v'"; } $s = join(',', $p_sub_values_str); $r = htmlentities(sprintf($tmp[0], $s, ENT_QUOTES); } $tmp[0] in this case contains a string like 'Fred likes %1$s on his %2$s', taking advantage of positional substitution with sprintf. The function call to this snippet can have an optional array passed. My need/desire is to substitute each element of the array into the appropriate position with sprintf. So far I've tried: $r = htmlentities(sprintf($tmp[0], $s, ENT_QUOTES); $r = htmlentities(sprintf($tmp[0], ${$s}, ENT_QUOTES); and a few other bits and pieces, all to no avail (error is about not enough arguments). Is there any way to accomplish this in PHP, or do I need to roll my own substitution code? The array can obviously be anything from a single value to 'unlimited' (though in practice will probably be less than 5). -- My mind not only wanders, it sometimes leaves completely. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] plug-in forum
Hey Davy, Thanks for replying. I checked out punbb before, a fantastic forum coz its real simple, and if you want more complex stuff it supports it via "mods"...problem is the mods can be a pain in the @ss when upgrading and I need something a little more powerful (private messageing, polls etc) so am giving FUDForum a serious look. Thanks for your suggestion though. Cheers, Ryan On 4/6/2005 8:50:12 AM, Davy Obdam ([EMAIL PROTECTED]) wrote: > Hi Ryan, > > > > You might wanna take a look at PunnBB : http://www.punbb.org/ > > > > Best regards, > > > > Davy > > > > Ryan A wrote: > > > > >Hi, > > >a client wants me to add a forum to his existing site...which is not a > > >problem, the problem is he wants it to work off his existing site > > > > > >eg: > > >once someone logs in to the main site they dont have to relogin or > create > > >new accounts in the forum section > > >a one login gets you total site access kind of deal. > > > > > >The second thing is, as clients go, these ar'nt too bright :-) a rea > >simple forum/forum admin is needed, I was looking at phpbb but after running > >a test install on my system i think it would be a little too complicated for > >them plus it has to sit into the existing design... > >recommendations please. > > > > > >Thanks, > >Ryan > > > > > > > > > > > > -- > Davy Obdam > mailto:[EMAIL PROTECTED] > web: http://www.davyobdam.com > > Turn on, log in, fight spam. > -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.3 - Release Date: 4/5/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exchanging Data among processes
Hello Richard, Shared Memory. http://php.net/shmop Not for the faint of heart. :-) Oooh... this seems sweet... :) Thanks a lot! Cya. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] plug-in forum
Hi Ryan, Yes i agree the "mods" are a problem with upgrading. Its a great forum when you dont need all the more complex stuff. Good luck with your forum intergration!:-) Cheers, Davy Ryan A wrote: Hey Davy, Thanks for replying. I checked out punbb before, a fantastic forum coz its real simple, and if you want more complex stuff it supports it via "mods"...problem is the mods can be a pain in the @ss when upgrading and I need something a little more powerful (private messageing, polls etc) so am giving FUDForum a serious look. Thanks for your suggestion though. Cheers, Ryan On 4/6/2005 8:50:12 AM, Davy Obdam ([EMAIL PROTECTED]) wrote: Hi Ryan, You might wanna take a look at PunnBB : http://www.punbb.org/ Best regards, Davy Ryan A wrote: Hi, a client wants me to add a forum to his existing site...which is not a problem, the problem is he wants it to work off his existing site eg: once someone logs in to the main site they dont have to relogin or create new accounts in the forum section a one login gets you total site access kind of deal. The second thing is, as clients go, these ar'nt too bright :-) a rea simple forum/forum admin is needed, I was looking at phpbb but after running a test install on my system i think it would be a little too complicated for them plus it has to sit into the existing design... recommendations please. Thanks, Ryan -- Davy Obdam mailto:[EMAIL PROTECTED] web: http://www.davyobdam.com Turn on, log in, fight spam. -- Davy Obdam mailto:[EMAIL PROTECTED] web: http://www.davyobdam.com "There is a wicked pretense that one has been informed. But no such thing has truly occurred! A mere slogan, an empty litany. No arguments are heard, no evidence is weighed. It isn't news at all, only a source of amusement for idlers." (Gibson-Sterling, The Difference Engine) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preventing automated account creation
[EMAIL PROTECTED] wrote: Hi, I have been investigating ways of preventing automated account creation on the e-commerce system I am currently working on. Obviously I have seen the graphical solutions to this problem, a small image containing several letters and numbers which must be typed in by the user to confirm account creation. However, this (it seems to me) is a bit overkill for what is a pretty small client, I'm not entirely sure it's a good use of time to create this script solely for them, does anyone know of anything pre-packaged? Furthermore is it really worth doing this, what risks do automated account creation present to an e-commerce site? Google CAPTCHA for those verify image scripts. I hope you are kidding about this "what risks do automated account creation present to an e-commerce site". -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Command-line php in debian/woody
Robert S wrote: I am running a Woody server. I'd like to run php scripts from the command line, but I note that the php/php4 executable is not in my PATH. Should you ask this at a debian list? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what are {} used for in php?
Jacques wrote: I have often seen php code included inside braces. What does this mean or do? Jacques A code block, rtfm :-) -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preventing automated account creation
[EMAIL PROTECTED] wrote: Hi, I have been investigating ways of preventing automated account creation on the e-commerce system I am currently working on. Obviously I have seen the graphical solutions to this problem, a small image containing several letters and numbers which must be typed in by the user to confirm account creation. However, this (it seems to me) is a bit overkill for what is a pretty small client, I'm not entirely sure it's a good use of time to create this script solely for them, does anyone know of anything pre-packaged? Furthermore is it really worth doing this, what risks do automated account creation present to an e-commerce site? Tom Williams, Digital Data Well, CAPTCHA ( http://en.wikipedia.org/wiki/Captcha) is a pretty neat solution ( http://www.pear.php.net/package/Text_CAPTCHA ). You can also generate random numbers (www.php.net/rand www.php.net/mt_rand) and combining it with this PEAR package http://www.pear.php.net/package/Numbers_Words which is also a good solution. The pass-string if I can call it so is best to be kept as a session variable, since it's stored on the server-side and the user can't view it. Storing its hash in a cookie can be also pretty fine, but storing it in a GET variable is more than stupid. Hope this helps, -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] setcookie ???
This doesn't set the cookie? Can you see why? I can't... $showbrowseteam = 'somejargon'; setcookie("showbrowseteam","$showbrowseteam",0,"/"); Thanks -will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what are {} used for in php?
http://www.wellho.net/question/H1_5.html and try google. vk. On Apr 6, 2005 2:55 PM, Jacques <[EMAIL PROTECTED]> wrote: > I have often seen php code included inside braces. What does this mean or > do? > > Jacques > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- vk. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Command-line php in debian/woody
> Should you ask this at a debian list? I tried . . .no luck. I thought that you php folks might know a bit more about specific versions. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Call a Function Held in a $_GET Var
Hi, If I have a function name held in a $_GET variable for example ...&func=print_user_list how can I call the function dynamically? ie. $_GET['func']() Thanks for your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Preventing automated account creation
> Well, CAPTCHA ( http://en.wikipedia.org/wiki/Captcha) is a > pretty neat solution ( > http://www.pear.php.net/package/Text_CAPTCHA ). You can also > generate random numbers (www.php.net/rand > www.php.net/mt_rand) and combining it with this PEAR package > http://www.pear.php.net/package/Numbers_Words which is also a > good solution. The pass-string if I can call it so is best to > be kept as a session variable, since it's stored on the > server-side and the user can't view it. Storing its hash in a > cookie can be also pretty fine, but storing it in a GET > variable is more than stupid. http://phpsec.org/articles/2005/text-captcha.html is a good primer on how to use CAPTCHA effectively HTH, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple array question, array delete
Hey, I have a $data_recs array like this: 12 445 45655 4 343 etc when the user gives me a number, i have to check if its in the array and delete that entry...how do i do that? I have looked at the manual but have gotten confused with array pop,splice,array_key_exists etc Thanks, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.3 - Release Date: 4/5/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Call a Function Held in a $_GET Var
Shaun wrote: Hi, If I have a function name held in a $_GET variable for example ...&func=print_user_list how can I call the function dynamically? ie. $_GET['func']() Thanks for your help Well, call_user_func() [ http://www.php.net/call_user_func ] will do the job. But that is really bad, because you can get hacked really easy. Here's a small example www.url.com/file.php?func=evilfunction So that is _bad_ coding and not a good practise at all, but if that is the _only_ option be more than sure that you do some checking first. An example follows : $allowed = array('first_func', 'second_func', 'third_func') { if(in_array($_GET['func'], $allowed) { /* it's okay */ call_user_func($_GET['func']); } else { die('Next time, sucker'; } } Hope this helps, -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Command-line php in debian/woody
Hi You might want to download the php source and compile the cli binary yourself (Command Line Interface) It takes only little time compared to compiling it as an apache module Once you got thing setup, you can drop the php extension and just put a shebang like this #! /usr/bin/php At the start of the file. Andy On Wednesday 06 April 2005 12:07, Robert S wrote: > I am running a Woody server. I'd like to run php scripts from the command > line, but I note that the php/php4 executable is not in my PATH. > > I have php4, version 4.1.2-7.0.1 installed. > > Is the command-line option available with this version, or do I need to > install another package? > > > I understand that the command-line option was not available with earlier > versions of php4 > > I don't want to mix my system up with Sarge - it usually screws everything > up when I > have tried to do that. I note that php isn't available in the backports. > > Is there any sort of workaround (short of upgrading the whole system to > sarge, which I don't want to do)? -- Registered Linux User Number 379093 -- Feel free to check out these few php utilities that I released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include with remoted address
[EMAIL PROTECTED] wrote: A this point to include a file in a my script I must use for each .PHP file: There is another way (i think to php.ini) to set default include, require_once, working area to my 'http://localhost:xxx/' avoid to manually insert upon code ? There is the include_dir directive in php.ini, but afaik, it requires a file path, not a URL. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple array question, array delete
Ryan A wrote: Hey, I have a $data_recs array like this: 12 445 45655 4 343 etc when the user gives me a number, i have to check if its in the array and delete that entry...how do i do that? I have looked at the manual but have gotten confused with array pop,splice,array_key_exists etc Thanks, Ryan The code follows : if (in_array($number, $data_recs)) { $key = array_search($number, $data_recs); // Get the key unset($data_recs[$key]); // Unset the variable } -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple array question, array delete
On Apr 6, 2005 3:09 PM, Ryan A <[EMAIL PROTECTED]> wrote: > > Hey, > I have a $data_recs array like this: > > 12 > 445 > 45655 > 4 > 343 > etc > > when the user gives me a number, i have to check if its in the array and > delete that entry...how do i do that? > I have looked at the manual but have gotten confused with array > pop,splice,array_key_exists etc > > Thanks, > Ryan > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.308 / Virus Database: 266.9.3 - Release Date: 4/5/2005 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php foreach ($array as $key=>$value) { if(strpos($value, $userValue) { unset($array['$key']); } } i believe... not sure if it works or not hope this helps
Re: [PHP] Simple array question, array delete
On Apr 6, 2005 3:27 PM, Ken <[EMAIL PROTECTED]> wrote: > > On Apr 6, 2005 3:09 PM, Ryan A <[EMAIL PROTECTED]> wrote: > > > Hey, > > I have a $data_recs array like this: > > > > 12 > > 445 > > 45655 > > 4 > > 343 > > etc > > > > when the user gives me a number, i have to check if its in the array and > > delete that entry...how do i do that? > > I have looked at the manual but have gotten confused with array > > pop,splice,array_key_exists etc > > > > Thanks, > > Ryan > > > > -- > > No virus found in this outgoing message. > > Checked by AVG Anti-Virus. > > Version: 7.0.308 / Virus Database: 266.9.3 - Release Date: 4/5/2005 > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > foreach ($array as $key=>$value) > { > if(strpos($value, $userValue) > { > unset($array['$key']); > } > } > > i believe... not sure if it works or not > > hope this helps > > > sorry the if bit is not strpos if ($value == $userValue) { // the unset part here }
[PHP] setcookie ???
On Apr 6, 2005 2:30 PM, William Stokes <[EMAIL PROTECTED]> wrote: > > This doesn't set the cookie? Can you see why? I can't... > > $showbrowseteam = 'somejargon'; > setcookie("showbrowseteam","$showbrowseteam",0,"/"); > > Thanks > -will > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > you've set the cookie time to 0... which is a very long time ago. setcookie("showbrowseteam",$showbroseteam, time()+time_in_seconds,"/"); hth
Re: [PHP] Command-line php in debian/woody
Robert S a écrit : I am running a Woody server. I'd like to run php scripts from the command line, but I note that the php/php4 executable is not in my PATH. just install php4-cgi package (apt-get install php4-cgi) and the PHP 4 CLI will be install : /usr/bin/php4 Next time, try to use 'apt-cache search foo' or packages.debian.org to find it yourself have tried to do that. I note that php isn't available in the backports. If you need more recent LAMP stuff on Woody (ex php5) add these lines in your /etc/apt/sources.list: deb http://packages.dotdeb.org ./ deb-src http://sources.dotdeb.org ./ This will use recent Debian packages (backported for Woody) from http://dotdeb.org/ They got a server crash without backups, but the packages are there, and it seems the server will be up again soon Is there any sort of workaround (short of upgrading the whole system to sarge, which I don't want to do)? Debian testing (currently Sarge) dont have security support. So either stick with woody (perhaps with backported packages) -- esp if you're on a production server or choose the DIY (do it yourself) way... -- ie 'manual' compilation, trouble and upgrades :p Ch. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Command-line php in debian/woody
just download the php4-cli deb package and install it, i think this should work, and correct me if it's a stupid idea. and Sarge is ok for me, i'm running a production e-mail server for last 6 months with a heavy load on it, i'm using php4-cli on it for my 'home made' exim4 administration utility, no problem yet!! vk. On Apr 6, 2005 6:40 PM, Robert S <[EMAIL PROTECTED]> wrote: > > Should you ask this at a debian list? > > I tried . . .no luck. I thought that you php folks might know a bit more > about specific versions. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- vk. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anybody getting these also?
Andy Pieters wrote: -- Forwarded Message -- Subject: Date: Wednesday 06 April 2005 07:30 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Thank you for contacting ActiveWire Inc! Nope, /dev/null gets it for me. ;) -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Simple array question, array delete
Anyway, as the replies already show, you have to have a key to identify the record to be deleted, otherwise, I don't see there can be a way. Why don't use the data as key as well? Satyam "Ryan A" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hey, > I have a $data_recs array like this: > > 12 > 445 > 45655 > 4 > 343 > etc > > when the user gives me a number, i have to check if its in the array and > delete that entry...how do i do that? > I have looked at the manual but have gotten confused with array > pop,splice,array_key_exists etc > > Thanks, > Ryan > > > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.308 / Virus Database: 266.9.3 - Release Date: 4/5/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Critical Thinking, or Several "Why" Questions
> > I do not question usefulness of include_once(). In fact, currently I'm > developing application that might use it exactly the way you described. > There are many API functions in several files, and there are cases when > I do not need all of them. That is exactly why I am concerned with it's > performance, and that is why I asked about it here. You can ask about a question. You can even try to improve the performance of a function. But at the end of the day unless you can come up with something that will do what the PHP community at large expects *and* it is faster it's not going to happen. Trust me, the core PHP dev team wants to improve performance just like you do. It's just that they also have to do silly little things like maintain BC. They'll break BC if there's a really, REALLY good reason why, but most of the time the answer is no. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-general&w=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
Re: [PHP] Re: registering session with user and password
Tomás Rodriguez Orta wrote: ... > what is the differnece between isset($_session['use']) and > session_is_registered('user') ? session_register() and session_is_registered() rely on the php.ini directive register_globals. Register_globals *can* be an ugly monster that gives crackers an easy way to mess with your server if you're not careful. I use $_SESSION because it makes my life easier. But if you want register_globals = 1 on your server, well no one is going to stop you. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-general&w=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
[PHP] secure document : solution wanted
Hi I am bulding a secure intranet.(php, mysql, apache) I am using a session and Mysql to handel the user accounts. Everythying works fine with that. The client now needs to share word/pdf document with the registered user. I created a secure directory using .htaccess for this purpose and it works as well the user are promt to enter a username password. Is there a way to bypass this login box so logged user would be able to access the file, but the directory would still be protected against non-logged user who would know the path and the name the file? I can deal with one .htacces account (username pw) since all the file can be shared with all the users. I was expecting this to work ... http://username:[EMAIL PROTECTED]/safeDir/Word.doc but it isn't. Any idea what I could do? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] secure document : solution wanted
Charles Hamel wrote: Hi I am bulding a secure intranet.(php, mysql, apache) I am using a session and Mysql to handel the user accounts. Everythying works fine with that. The client now needs to share word/pdf document with the registered user. I created a secure directory using .htaccess for this purpose and it works as well the user are promt to enter a username password. Is there a way to bypass this login box so logged user would be able to access the file, but the directory would still be protected against non-logged user who would know the path and the name the file? I can deal with one .htacces account (username pw) since all the file can be shared with all the users. I was expecting this to work ... http://username:[EMAIL PROTECTED]/safeDir/Word.doc but it isn't. Any idea what I could do? Perhaps, https? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] secure document : solution wanted
On Wednesday 06 April 2005 16:23, Charles Hamel typed: > Hi > > I am bulding a secure intranet.(php, mysql, apache) > I am using a session and Mysql to handel the user accounts. Everythying > works fine with that. > > The client now needs to share word/pdf document with the registered user. I > created a secure directory using .htaccess for this purpose and it works as > well the user are promt to enter a username password. > I was expecting this to work ... > http://username:[EMAIL PROTECTED]/safeDir/Word.doc but it isn't. IE dropped support (or severely neutered it) for username:password in URLs a while back. One way to handle this is to write a wrapper script that accepts the file name as a parameter. The script verifies that the user is allowed to access the file, and sends back the file with appropriate content type etc. Files can then be stored outside of the document root, preventing access even if you guess the file name. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] secure document : solution wanted
On Wednesday 06 April 2005 16:32, Eric Gorr typed: > Perhaps, https? HTTPS is a transport security layer, not an authentication or access control layer. -- My mind not only wanders, it sometimes leaves completely. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PDO and Oracle
I try to use PDO with Oracle and PHP 5.0.4 on windows... my php.ini includes php_pdo.dll and when I try to create an object, I got an error message "could not find driver" Any idea ? regards, FENDT Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sprintf and arrays.
For one, you are missing a right parenthesis ) in all of your examples. htmlentities( sprintf( $tmp[0], $s, ENT_QUOTES ) Second, the string you are trying to format only has one variable argument: $s. Fred likes %1$s on his %2$s You have it numbered for ordering, but you are still ordering one variable. I never used sprintf like that, so I'm not sure if that is a valid way of doing it. That may be what is giving you the too few arguments error. Typically you would do something like: Fred likes %1$s on his %2$t If you are using sprintf in a valid manner, then the problem is probably in the $s argument of the sprintf function. You are only specifying one variable to replace when you are looking to do two replacements. The contents of $s is a single string that happens to contains commas, it does not get evaluated as multiple arguments just because it contains commas. Try wrapping $s in eval(). htmlentities( sprintf( $tmp[0], eval($s) ), ENT_QUOTES); Personally, I rolled my own basic search and replace string function to support my own templating "tag" system. I still use sprinf for more "fancy" stuff, but for basic stuff, I rolled my own. A simplified version is below. It accepts an associative array and a string as parameters and returns the merged result. $text_str = "And example for {::Name::} in answer to {::Question::} on the {::ListName::}. Hope it helps {::Name::}!"; $data_Merge['Name'] = "Duncan Hill"; $data_Merge['Question'] = "sprintf and arrays"; $data_Merge['ListName'] = "PHP General"; echo mergeTplData($data_Merge, $text_str); function mergeTplData($data, $str) { $searchTags = array_keys($data); $searchTags = '{::'.implode('::},{::',$searchTags).'::}'; $searchTags = explode(',',$searchTags); $str = str_replace($searchTags,$data,$str); return $str; } On Apr 6, 2005, at 7:23 AM, Duncan Hill wrote: I have a snippet of code that looks something like: if (is_array($p_sub_values)) { foreach ($p_sub_values as $i => $v) { $p_sub_values_str[$i] = "'$v'"; } $s = join(',', $p_sub_values_str); $r = htmlentities(sprintf($tmp[0], $s, ENT_QUOTES); } $tmp[0] in this case contains a string like 'Fred likes %1$s on his %2$s', taking advantage of positional substitution with sprintf. The function call to this snippet can have an optional array passed. My need/desire is to substitute each element of the array into the appropriate position with sprintf. So far I've tried: $r = htmlentities(sprintf($tmp[0], $s, ENT_QUOTES); $r = htmlentities(sprintf($tmp[0], ${$s}, ENT_QUOTES); and a few other bits and pieces, all to no avail (error is about not enough arguments). Is there any way to accomplish this in PHP, or do I need to roll my own substitution code? The array can obviously be anything from a single value to 'unlimited' (though in practice will probably be less than 5). -- My mind not only wanders, it sometimes leaves completely. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] secure document : solution wanted
Duncan Hill wrote: On Wednesday 06 April 2005 16:32, Eric Gorr typed: Perhaps, https? HTTPS is a transport security layer, not an authentication or access control layer. I understand that. However, some pages can only be accessed if a user uses https. I though this might be the case here, but perhaps it is not. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PDO and Oracle
I try to use PDO with Oracle and PHP 5.0.4 on windows... my php.ini includes php_pdo.dll and when I try to create an object, I got an error message "could not find driver" Any idea ? regards, FENDT Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] secure document : solution wanted
"Duncan Hill" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Wednesday 06 April 2005 16:23, Charles Hamel typed: >> Hi >> >> I am bulding a secure intranet.(php, mysql, apache) >> I am using a session and Mysql to handel the user accounts. Everythying >> works fine with that. >> >> The client now needs to share word/pdf document with the registered user. >> I >> created a secure directory using .htaccess for this purpose and it works >> as >> well the user are promt to enter a username password. > >> I was expecting this to work ... >> http://username:[EMAIL PROTECTED]/safeDir/Word.doc but it isn't. > > IE dropped support (or severely neutered it) for username:password in URLs > a > while back. > > One way to handle this is to write a wrapper script that accepts the file > name > as a parameter. The script verifies that the user is allowed to access > the > file, and sends back the file with appropriate content type etc. Files > can > then be stored outside of the document root, preventing access even if you > guess the file name. Can you provide a little more infos about wrapper scripts ... first time earing about this expession. Can this script be written in php ... or it is some kind of cgi? Any exemple online of these type of script that a could study to make my own? Thanks Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PDO and Oracle
Charles FENDT wrote: > I try to use PDO with Oracle and PHP 5.0.4 on windows... > my php.ini includes php_pdo.dll > and when I try to create an object, I got an error message "could not > find driver" > > Any idea ? > > regards, > > FENDT Charles I have never used Oracle or PDO I think you need two drivers - the main PDO driver (php_pdo) plus the Oracle-specific driver (???). Not sure what the exact name is for that driver. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-general&w=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
Re: [PHP] Anybody getting these also?
John Nichel wrote: Andy Pieters wrote: -- Forwarded Message -- Subject: Date: Wednesday 06 April 2005 07:30 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Thank you for contacting ActiveWire Inc! Nope, /dev/null gets it for me. ;) John makes it all sounds so easy, I'll console myself with the fact that John 'carries' the title Ubergeek :-) (a title I can only hope to live upto :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] secure document : solution wanted
"Duncan Hill" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] IE dropped support (or severely neutered it) for username:password in URLs a while back. If anyone is interested, I found this document which appears to provide more details... http://support.microsoft.com/kb/834489 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple array question, part 2
Hey, I have a $data array like this: [0] => 158 [1] => 169926 [2] => 169931 [3] => 169932 [4] => 169933 then when i delete the first one ([0] => 158) it becomes like this: [1] => 169926 [2] => 169931 [3] => 169932 [4] => 169933 how do I get it to sort again from 0,1,2,3 etc? I tried sort(), ksort(),reset() etcbut it still shows as starting from 1 instead of resorting the keys starting from 0 what function should i lookup/use? Thanks, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.3 - Release Date: 4/5/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anybody getting these also?
Jochem Maas wrote: John makes it all sounds so easy, I'll console myself with the fact that John 'carries' the title Ubergeek :-) (a title I can only hope to live upto :-) First requirement is to still have in your possession, a computer from the Atari/Commodore/Timex days. Root on your mail server helps too. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Simple array question, part 2
[snip] I have a $data array like this: [0] => 158 [1] => 169926 [2] => 169931 [3] => 169932 [4] => 169933 then when i delete the first one ([0] => 158) it becomes like this: [1] => 169926 [2] => 169931 [3] => 169932 [4] => 169933 how do I get it to sort again from 0,1,2,3 etc? I tried sort(), ksort(),reset() etcbut it still shows as starting from 1 instead of resorting the keys starting from 0 what function should i lookup/use? [/snip] http://www.php.net/array_pop -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Anybody getting these also?
[snip] First requirement is to still have in your possession, a computer from the Atari/Commodore/Timex days. Root on your mail server helps too. [/snip] Does the Trash-80 count? I thought about giving it to an archaeology group for study, but it is holding down a stack of box lids in my garage. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple array question, part 2
Ryan A wrote: what function should i lookup/use? Thanks, Ryan This will do the job : $array = array_values($array); Hope this helps, -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple array question, part 2
Hey, I have a $data array like this: [0] => 158 [1] => 169926 [2] => 169931 [3] => 169932 [4] => 169933 then when i delete the first one ([0] => 158) it becomes like this: [1] => 169926 [2] => 169931 [3] => 169932 [4] => 169933 how do I get it to sort again from 0,1,2,3 etc? I tried sort(), ksort(),reset() etcbut it still shows as starting from 1 instead of resorting the keys starting from 0 what function should i lookup/use? If you're always taking the first element, why not use array_shift? http://us2.php.net/manual/en/function.array-shift.php array_shift() shifts the first value of the array off and returns it, shortening the array by one element and moving everything down. All numerical array keys will be modified to start counting from zero while literal keys won't be touched. If array is empty (or is not an array), NULL will be returned. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anybody getting these also?
Jay Blanchard wrote: [snip] First requirement is to still have in your possession, a computer from the Atari/Commodore/Timex days. Root on your mail server helps too. [/snip] Does the Trash-80 count? I thought about giving it to an archaeology group for study, but it is holding down a stack of box lids in my garage. Only if you had the 16k model. ;) -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] secure document : solution wanted
On Wednesday 06 April 2005 17:02, Charles Hamel wrote: > "Duncan Hill" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > One way to handle this is to write a wrapper script that accepts the file > > name > > as a parameter. The script verifies that the user is allowed to access > Can you provide a little more infos about wrapper scripts ... first time > earing about this expession. > > Can this script be written in php ... or it is some kind of cgi? Any http://lists.evolt.org/archive/Week-of-Mon-20011224/064591.html has some sample code to do with forcing IE to download a file where it can't determine the mime type properly. This forms the core of being able to feed a file to a browser when a .php file is called. The rough flow of the code would be: 1) Check that the user is authenticated. Kick them out if they aren't. 2) (Optional) Check that the user is allowed to access the file being requested. This might be a MySQL DB lookup, a secret word request, whatever. 3) Check that the file exists. Even better, rather than feed a file name, store a mapping of a unique ID to real file name in a data source of some type, and throw the ID around. You can enforce the format of the ID etc to avoid attacks against your system. 4) If all is good, use the code linked above (in some form) to feed the file to the browser. The user will get a Save dialog box in pretty much any browser. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sprintf and arrays.
On Wednesday 06 April 2005 16:40, Brent Baisley wrote: > For one, you are missing a right parenthesis ) in all of your examples. > htmlentities( sprintf( $tmp[0], $s, ENT_QUOTES ) Meh, syntax blip from the cut and paste. > Second, the string you are trying to format only has one variable > argument: $s. > Fred likes %1$s on his %2$s The source array in this case has two entries. My whole aim is to pass an array of n entries, unroll the array into a string and somehow interpolate the string into the sprintf call so that life is groovy. I realise $s looks like a single variable to PHP at that point sprintf() is called, and this is what I'm trying to work around - some way to get sprintf to realise that $s is actually two strings. Ie, I need a double level of interpolation on the $s value so that sprintf($tmp[0], $s) turns into sprintf(tmp[0], $array[0], $array[1]). I'm starting to get the feeling that this will be impossible. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Simple array question, part 2
[snip] Nope, array_pop is just deleting the last key/valuei need to reindex it without deleteing anything. [/snip] Always reply to the list ('reply all') as the individual who answered you might not be there. Always. I mean it. You shouldn't just delete an item from an array, it is improper handling Thats right, it's not array_pop(), its array_shift()...musta' had a brain fart and you didn't see the other array functions -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Anybody getting these also?
[snip] Jay Blanchard wrote: > [snip] > First requirement is to still have in your possession, a computer from > the Atari/Commodore/Timex days. Root on your mail server helps too. > [/snip] > > Does the Trash-80 count? I thought about giving it to an archaeology > group for study, but it is holding down a stack of box lids in my > garage. > > Only if you had the 16k model. ;) [/snip] Dammittohell! No ÜberGeek for me. It's just as well, I can't pronounce it or anything. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anybody getting these also?
Jay Blanchard wrote: Dammittohell! No ÜberGeek for me. It's just as well, I can't pronounce it or anything. I wouldn't lose sleep over it. I think the people here at work are actually making fun of me when they 'changed my title'. Maybe it's because at almost 40, I still collect comic books, and watch Star Trek. :o -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Anybody getting these also?
[snip] I wouldn't lose sleep over it. I think the people here at work are actually making fun of me when they 'changed my title'. Maybe it's because at almost 40, I still collect comic books, and watch Star Trek. :o [/snip] Well, I'm between 45 and 50 and still collect football cards, play disc golf, and watch sci fi all the time. So 'they' can just sit on it! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sprintf and arrays.
Making life groovy has been difficult since the 60's. You want to have sprintf look at the contents of the variable instead of the variable itself. Anytime you want to do something like this you use the eval() function to evaluate the contents of the variable. On Apr 6, 2005, at 12:46 PM, Duncan Hill wrote: On Wednesday 06 April 2005 16:40, Brent Baisley wrote: For one, you are missing a right parenthesis ) in all of your examples. htmlentities( sprintf( $tmp[0], $s, ENT_QUOTES ) Meh, syntax blip from the cut and paste. Second, the string you are trying to format only has one variable argument: $s. Fred likes %1$s on his %2$s The source array in this case has two entries. My whole aim is to pass an array of n entries, unroll the array into a string and somehow interpolate the string into the sprintf call so that life is groovy. I realise $s looks like a single variable to PHP at that point sprintf() is called, and this is what I'm trying to work around - some way to get sprintf to realise that $s is actually two strings. Ie, I need a double level of interpolation on the $s value so that sprintf($tmp[0], $s) turns into sprintf(tmp[0], $array[0], $array[1]). I'm starting to get the feeling that this will be impossible. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PDO and Oracle
Jason Barnett wrote: Charles FENDT wrote: I try to use PDO with Oracle and PHP 5.0.4 on windows... my php.ini includes php_pdo.dll and when I try to create an object, I got an error message "could not find driver" Any idea ? regards, FENDT Charles I have never used Oracle or PDO I think you need two drivers - the main PDO driver (php_pdo) plus the Oracle-specific driver (???). Not sure what the exact name is for that driver. you're correct. The drivers you'll need are: php_pdo.dll - PDO driver php_pdo_oci.dll - Oracle Driver for PDO -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need help: change a string in a file
Hi All, I need some help in searching string in a file. My requirement is to search the string,append something to the string . Write the string back to the file without changing other parts of the file. e.g Suppose I have the following string in a file Set-Cookie: T_COOKIE=127.0.0.1-saswat-9; path=/ The fixed string is "Set-Cookie: T_COOKIE="and rest of the string is variable. I would like to change the string "127.0.0.1-saswat-9" to say "127.0.0.1-saswat-9-1234" My constraint is : I don't want to read the whole file into a buffer and work on that buffer as the file can be very large , sometimes more than 10 mb. My advantage is : I know that I will get the search string in first 200 bytes of the file , so I just need to read 200 bytes,play with that and write it back (overwriting the first 200 bytes with new 200 some bytes) .. Would appreciate any help or pointers. Thanks, -Saswat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple array question, part 2
PERFECT! Thanks mate. -Ryan On 8/6/2005 6:47:22 PM, Josip Dzolonga ([EMAIL PROTECTED]) wrote: > Ryan A wrote: > > > > >what function should i lookup/use? > > > > > >Thanks, > > >Ryan > > > > > This will do the job : > > $array = array_values($array); > > > > Hope this helps, > > > > -- > > Josip Dzolonga > > http://josip.dotgeek.org > > > > jdzolonga[at]gmail.com > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.3 - Release Date: 4/5/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple array question, part 2
Just so you know what is happening, the numbers are keys (index) for each array element, not the order number. It's the same as if you had named the elements themselves. Like this: ['zero']=>158 ['one']=>169926 ['two']=>169931 ... Or [0]=>158 [12]=>169926 [5]=>169931 ... Deleting an element won't reorder the names of the elements since php wouldn't know how. On Apr 6, 2005, at 12:37 PM, Ryan A wrote: Hey, I have a $data array like this: [0] => 158 [1] => 169926 [2] => 169931 [3] => 169932 [4] => 169933 then when i delete the first one ([0] => 158) it becomes like this: [1] => 169926 [2] => 169931 [3] => 169932 [4] => 169933 how do I get it to sort again from 0,1,2,3 etc? I tried sort(), ksort(),reset() etcbut it still shows as starting from 1 instead of resorting the keys starting from 0 what function should i lookup/use? Thanks, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.3 - Release Date: 4/5/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Simple array question, part 2
Nope, array_shift()... is taking off the last one too Josip sent me the solution: $array = array_values($array); Cheers, Ryan On 4/6/2005 6:45:40 PM, Jay Blanchard ([EMAIL PROTECTED]) wrote: > [snip] > > Nope, array_pop is just deleting the last key/valuei need to reindex > > it > > without deleteing anything. > > [/snip] > > > > Always reply to the list ('reply all') as the individual who answered > > you might not be there. Always. I mean it. > > > > You > shouldn't just delete an item from an array, it is improper > handling > Thats right, it's > not array_pop(), its array_shift()... > musta' had a > brain fart and you didn't see the other array functions -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.3 - Release Date: 4/5/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need help: change a string in a file
I need some help in searching string in a file. My requirement is to search the string,append something to the string . Write the string back to the file without changing other parts of the file. e.g Suppose I have the following string in a file Set-Cookie: T_COOKIE=127.0.0.1-saswat-9; path=/ The fixed string is "Set-Cookie: T_COOKIE="and rest of the string is variable. I would like to change the string "127.0.0.1-saswat-9" to say "127.0.0.1-saswat-9-1234" My constraint is : I don't want to read the whole file into a buffer and work on that buffer as the file can be very large , sometimes more than 10 mb. My advantage is : I know that I will get the search string in first 200 bytes of the file , so I just need to read 200 bytes,play with that and write it back (overwriting the first 200 bytes with new 200 some bytes) .. Would appreciate any help or pointers. Something like this (completely un-checked)... $fd = fopen("file", "r+"); $buf = fread($fd, 200); // modify $buf... fseek($fd, 0); fwrite($fd, $buf, 200); fclose($fd); You might want to add some flock() stuff in there as well... -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] secure document : solution wanted
"Duncan Hill" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Wednesday 06 April 2005 17:02, Charles Hamel wrote: >> "Duncan Hill" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> > One way to handle this is to write a wrapper script that accepts the >> > file >> > name >> > as a parameter. The script verifies that the user is allowed to access > >> Can you provide a little more infos about wrapper scripts ... first time >> earing about this expession. >> >> Can this script be written in php ... or it is some kind of cgi? Any > > http://lists.evolt.org/archive/Week-of-Mon-20011224/064591.html has some > sample code to do with forcing IE to download a file where it can't > determine > the mime type properly. This forms the core of being able to feed a file > to > a browser when a .php file is called. > > The rough flow of the code would be: > 1) Check that the user is authenticated. Kick them out if they aren't. > 2) (Optional) Check that the user is allowed to access the file being > requested. This might be a MySQL DB lookup, a secret word request, > whatever. > 3) Check that the file exists. Even better, rather than feed a file name, > store a mapping of a unique ID to real file name in a data source of some > type, and throw the ID around. You can enforce the format of the ID etc > to > avoid attacks against your system. > 4) If all is good, use the code linked above (in some form) to feed the > file > to the browser. The user will get a Save dialog box in pretty much any > browser. I am all set guys thanks ... What would I do without the community? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OT - Re: [PHP] Anybody getting these also?
Hello John, Wednesday, April 6, 2005, 10:29:48 AM, you wrote: J> First requirement is to still have in your possession, a computer from J> the Atari/Commodore/Timex days. Root on your mail server helps too. Heheh... I've still got (and most still working): Commodore 64 Commodore 128 Atari 2600 Apple IIe TI-99 Old boxMac (the cube looking one, forget the model). Compaq Luggable (looks like a sewing machine) I used to have a TRS-80 Model I (the first computer I ever owned), but my parents threw it out before I realized I wanted to keep it. Used to have a cassette tape player hooked up to it for secondary storage before we upgraded it with a floppy drive. I've also got a 300 baud acoustically coupled modem and an 8" floppy. We're going to be moving to a bigger house sometime in August and I look forward to pulling all that stuff out of the garage and setting them up in the computer room again. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.13 Return under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Interesting, yet goofy behavior
Let's say I have a form and the action is thus; \n"; Note the 'bid' attribute. Now, I have a case statement in which stuff takes place since the form has called it because of the 'bid' attribute. Before I break from the case I do this; unset($_GET['bid']); SIDEBAR: You should all note that I ma editing someone else's code. Someone who did not bother to comment their code. [ed note: Yes, they work for the same company, but are not in the department, yet management says that I have to support their code. I asked if we could at least teach them commenting and revision control. They looked at me as if I was a space alien]. Someone who believes that all forms should use $PHP_SELF (because whatever book they have showed them this, so therefore it must be good for everything). The URL comes back and the 'bid' attribute is still there. Is this to be expected? If so, do you have any advice (other than copious amounts of alcohol) for dealing with this? Thank you, I really appreciate your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[suspicious - maybe spam] [PHP] [suspicious - maybe spam] Re: [PHP] Interesting, yet goofy behavior
But, Jay: Am I missing something here? It's obvious that the 'bid' parameter will appear in the query string... That's how the form posts it. Yes, you can unset it if you like, but the form will still add it to the URL that it posts to, unless you change the "action" attribute of the form tag. Actually I wonder how much alcohol you've had by now... :-) /Mattias Jay Blanchard wrote: Let's say I have a form and the action is thus; \n"; Note the 'bid' attribute. Now, I have a case statement in which stuff takes place since the form has called it because of the 'bid' attribute. Before I break from the case I do this; unset($_GET['bid']); SIDEBAR: You should all note that I ma editing someone else's code. Someone who did not bother to comment their code. [ed note: Yes, they work for the same company, but are not in the department, yet management says that I have to support their code. I asked if we could at least teach them commenting and revision control. They looked at me as if I was a space alien]. Someone who believes that all forms should use $PHP_SELF (because whatever book they have showed them this, so therefore it must be good for everything). The URL comes back and the 'bid' attribute is still there. Is this to be expected? If so, do you have any advice (other than copious amounts of alcohol) for dealing with this? Thank you, I really appreciate your help. -- More views at http://www.thorslund.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Interesting, yet goofy behavior
[snip] Am I missing something here? It's obvious that the 'bid' parameter will appear in the query string... That's how the form posts it. Yes, you can unset it if you like, but the form will still add it to the URL that it posts to, unless you change the "action" attribute of the form tag. Actually I wonder how much alcohol you've had by now... :-) [/snip] You may be right, I may have been looking at this for too long. And I see that yu are right about the query string too, of course. Not enough sleep and/or food on my part. I will have to find another way around the situation then. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Interesting, yet goofy behavior
Jay Blanchard wrote: [snip] Am I missing something here? It's obvious that the 'bid' parameter will appear in the query string... That's how the form posts it. Yes, you can unset it if you like, but the form will still add it to the URL that it posts to, unless you change the "action" attribute of the form tag. Actually I wonder how much alcohol you've had by now... :-) [/snip] You may be right, I may have been looking at this for too long. And I see that yu are right about the query string too, of course. Not enough sleep and/or food on my part. I will have to find another way around the situation then. Thanks! How about: If your Form tag appears after your switch/case statement, that is? But, first, do yourself and your project a favor and go grab something to eat. :-) /Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Interesting, yet goofy behavior
Jay Blanchard wrote: Let's say I have a form and the action is thus; \n"; Note the 'bid' attribute. Now, I have a case statement in which stuff takes place since the form has called it because of the 'bid' attribute. Before I break from the case I do this; unset($_GET['bid']); SIDEBAR: You should all note that I ma editing someone else's code. Someone who did not bother to comment their code. [ed note: Yes, they work for the same company, but are not in the department, yet management says that I have to support their code. I asked if we could at least teach them commenting and revision control. They looked at me as if I was a space alien]. Someone who believes that all forms should use $PHP_SELF (because whatever book they have showed them this, so therefore it must be good for everything). The URL comes back and the 'bid' attribute is still there. Is this to be expected? If so, do you have any advice (other than copious amounts of alcohol) for dealing with this? Thank you, I really appreciate your help. I may be missing something here; not understanding what you're saying (happens all the time according to my wife), but even if you unset the $_GET variables, it will still be in the URL, as that's where the form posted too. And since the code is written to post to PHP_SELF, it will keep that value for the next load of the page. You could get rid of the query string, and header() redirect to the posting page without the query. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Interesting, yet goofy behavior
Jay Blanchard wrote: Let's say I have a form and the action is thus; \n"; Note the 'bid' attribute. Now, I have a case statement in which stuff takes place since the form has called it because of the 'bid' attribute. Before I break from the case I do this; unset($_GET['bid']); SIDEBAR: You should all note that I ma editing someone else's code. Someone who did not bother to comment their code. [ed note: Yes, they work for the same company, but are not in the department, yet management says that I have to support their code. I asked if we could at least teach them commenting and revision control. They looked at me as if I was a space alien]. Someone who believes that all forms should use $PHP_SELF (because whatever book they have showed them this, so therefore it must be good for everything). The URL comes back and the 'bid' attribute is still there. Is this to be expected? If so, do you have any advice (other than copious amounts of alcohol) for dealing with this? What do you mean the URL comes back? foo.php?bid=edit Is the request. In foo.php at some point you unset $_GET['bid'], which is a silly thing to do, but whatever, and then what are you expecting to happen? -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL ternary thing
Hi I appreciate this is an SQL issue, more than a PHP issue, but since it isn't a DB specific issue, and I'm planning on using it with PHP(and I'm not subscribed to any SQL lists), I thought I'd post it here. I have a table a bit like the following: create table thing (name char(10), value boolean, name_if_true char(10), name_if_false(10)) Basicly what will be modified will be the value field. name_if_true, and name_if_false are static(and will in practice be in a different table). The table may look a bit like the following: | Accept | 0 | Yes | No | | Gender | 1 | Female | Male | State | 0 | Broken |fixed Can anyone suggest a query that will return: | Accept | No | Gender | Female | State | fixed Preferably in a db independent manner. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL ternary thing
CASE should do it... http://www.postgresql.org/docs/7.4/interactive/functions-conditional.html Say's it's SQL compliant so it should be fine for other db's as well... something like: SELECT name, CASE WHEN value=1 THEN name_if_true ELSE name_if_false END FROM thing; Might need to throw an "AS colname" in there depending on how you fetch it with PHP... On Wed, 6 Apr 2005, Rory Browne wrote: Hi I appreciate this is an SQL issue, more than a PHP issue, but since it isn't a DB specific issue, and I'm planning on using it with PHP(and I'm not subscribed to any SQL lists), I thought I'd post it here. I have a table a bit like the following: create table thing (name char(10), value boolean, name_if_true char(10), name_if_false(10)) Basicly what will be modified will be the value field. name_if_true, and name_if_false are static(and will in practice be in a different table). The table may look a bit like the following: | Accept | 0 | Yes | No | | Gender | 1 | Female | Male | State | 0 | Broken |fixed Can anyone suggest a query that will return: | Accept | No | Gender | Female | State | fixed Preferably in a db independent manner. -- 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 ternary thing
Rory Browne wrote: Hi I appreciate this is an SQL issue, more than a PHP issue, but since it isn't a DB specific issue, and I'm planning on using it with PHP(and I'm not subscribed to any SQL lists), I thought I'd post it here. I have a table a bit like the following: create table thing (name char(10), value boolean, name_if_true char(10), name_if_false(10)) Basicly what will be modified will be the value field. name_if_true, and name_if_false are static(and will in practice be in a different table). The table may look a bit like the following: | Accept | 0 | Yes | No | | Gender | 1 | Female | Male | State | 0 | Broken |fixed Can anyone suggest a query that will return: | Accept | No | Gender | Female | State | fixed Preferably in a db independent manner. Look into the CASE statement. You can use it in the SELECT part of your query. MySQL also has an IF statement, but I believe that's not supported by other DBMS's. Something like: SELECT name, CASE value WHEN 1 THEN name_if_true WHEN 0 THEN name_if_false ELSE 'unknown' END AS result FROM thing; /Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Command-line php in debian/woody
>If you need more recent LAMP stuff on Woody (ex php5) add these lines >in your /etc/apt/sources.list: >deb http://packages.dotdeb.org ./ >deb-src http://sources.dotdeb.org ./ > >This will use recent Debian packages (backported for Woody) >from http://dotdeb.org/ That looks like what I'm after >They got a server crash without backups, but the packages are there, >and it seems the server will be up again soon This does not give one great confidence!! Are they "reputable"? >Debian testing (currently Sarge) dont have security support. >So either stick with woody (perhaps with backported packages) >-- esp if you're on a production server I am >or choose the DIY (do it yourself) way... >-- ie 'manual' compilation, trouble and upgrades :p No thanks - willing to do this at home but not at my office!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] plug-in forum
Ryan A wrote: Hi, a client wants me to add a forum to his existing site...which is not a problem, the problem is he wants it to work off his existing site eg: once someone logs in to the main site they dont have to relogin or create new accounts in the forum section a one login gets you total site access kind of deal. The second thing is, as clients go, these ar'nt too bright :-) a rea simple forum/forum admin is needed, I was looking at phpbb but after running a test install on my system i think it would be a little too complicated for them plus it has to sit into the existing design... recommendations please. Thanks, Ryan Hey Ryan... I am actually coding a forum that meets all of you're requirements, however it isn't done yet and I currently have another project which takes priority. I should have an alpha out by the end of april or may at the latest. When do you need this forum? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] plug-in forum
> Hey Ryan... I am actually coding a forum that meets all of you're > > > requirements, however it isn't done yet and I currently have another > project which takes priority. I should have an alpha out by the end of > april or may at the latest. When do you need this forum? > Hey James, I've actually decided to go with FudForum as it has a lot of features and everything that this project requires...and some that it does not :-), but since its open source and free I cant really complain, once i get paid I plan to donate a few bucks to support the project. Its very generious of you to offer me your forum and if you want I can help test it for you on the site once its completed, but for now i will be installing FF because its needed in around 10 days. I know what you mean about priority projects, I have few of my own that are taking forever to complete because other "more important" stuff that comes up. Give me a shout when you are done though, I'm really curious to see it. Cheers, -Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.4 - Release Date: 4/6/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php