Re: [PHP]make error
I use php-5.4.0.tar.bz2 and MySQL-5.5.21-1.el6.src.rpm in CentOS 6.2. But I can find the MySQL headers in the MySQL source I used. Is there anything wrong with my installing MySQL? 2012/3/23 Daniel Brown danbr...@php.net 2012/3/23 黄昭源 wongzhaoy...@gmail.com: Hello, I have a problem. When I configure php with the parameter --with-mysql=/usr/local/mysql and make, some errors happen. Below is the errors: ext/mysql/php_mysql.c:995: undefined reference to `_mysqlnd_init' ext/mysql/php_mysql.c:1012: undefined reference to `mysqlnd_connect' ext/mysql/php_mysql.c:876: undefined reference to `_mysqlnd_init' ... and so on. Is there someone also come across this? Can anyone help me? Thanks! Sounds like you're missing the MySQL headers from the source library. You can either download the full source or install just the headers via your system's package manager. If you need more help, let us know what distribution you're using. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- 黄昭源(Asher Wong) *Best Wishes To You!*
Re: [PHP]make error
I use php-5.4.0.tar.bz2 and MySQL-5.5.21-1.el6.src.rpm in CentOS 6.2. But I can find the MySQL headers in the MySQL source I used. Is there anything wrong with my installing MySQL? 2012/3/23 Daniel Brown danbr...@php.net 2012/3/23 黄昭源 wongzhaoy...@gmail.com: Hello, I have a problem. When I configure php with the parameter --with-mysql=/usr/local/mysql and make, some errors happen. Below is the errors: ext/mysql/php_mysql.c:995: undefined reference to `_mysqlnd_init' ext/mysql/php_mysql.c:1012: undefined reference to `mysqlnd_connect' ext/mysql/php_mysql.c:876: undefined reference to `_mysqlnd_init' ... and so on. Is there someone also come across this? Can anyone help me? Thanks! Sounds like you're missing the MySQL headers from the source library. You can either download the full source or install just the headers via your system's package manager. If you need more help, let us know what distribution you're using. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- 黄昭源(Asher Wong) *Best Wishes To You!* -- 黄昭源(Asher Wong) *Best Wishes To You!*
Re: [PHP] Re: make error
I have installed the MySQL-devel and I can find mysql.h, but I still have the error I mentioned above. ext/mysql/php_mysql.c:995: undefined reference to `_mysqlnd_init' ext/mysql/php_mysql.c:1012: undefined reference to `mysqlnd_connect' ext/mysql/php_mysql.c:876: undefined reference to `_mysqlnd_init' ... and so on. Hi, You can just install the mysql headers via the devel package if you don't need the server: # yum install mysql-devel If you want to find where they were installed use: # find / -name mysql.h Regards Ian -- -- 黄昭源(Asher Wong) *Best Wishes To You!*
Re: [PHP] Re: make error
I trid, but it didn't work. 2012/3/24 Daniel Brown danbr...@php.net 2012/3/23 Asher Wong wongzhaoy...@gmail.com: I have installed the MySQL-devel and I can find mysql.h, but I still have the error I mentioned above. ext/mysql/php_mysql.c:995: undefined reference to `_mysqlnd_init' ext/mysql/php_mysql.c:1012: undefined reference to `mysqlnd_connect' ext/mysql/php_mysql.c:876: undefined reference to `_mysqlnd_init' You're using the native driver, so try this instead: --with-mysql=mysqlnd -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- 黄昭源(Asher Wong) *Best Wishes To You!*
Re: [PHP] Re: make error
I tried, but it didn't work. 2012/3/24 Daniel Brown danbr...@php.net 2012/3/23 Asher Wong wongzhaoy...@gmail.com: I have installed the MySQL-devel and I can find mysql.h, but I still have the error I mentioned above. ext/mysql/php_mysql.c:995: undefined reference to `_mysqlnd_init' ext/mysql/php_mysql.c:1012: undefined reference to `mysqlnd_connect' ext/mysql/php_mysql.c:876: undefined reference to `_mysqlnd_init' You're using the native driver, so try this instead: --with-mysql=mysqlnd -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- 黄昭源(Asher Wong) *Best Wishes To You!*
Re: [PHP] Re: make error
Now I use the command below to configure php: ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=mysqlnd --with-mysql=/usr/local/mysql/bin/mysql_config --with-mysqli=mysqlnd --with-pdo-mysql=myslqnd And the error happened: configure: error: Cannot find MySQL header files under /usr/local/mysql/bin/mysql_config. -- 黄昭源(Asher Wong) *Best Wishes To You!*
Re: [PHP] Re: make error
Now I use the command below to configure php: ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=mysqlnd --with-mysql=/usr/local/mysql/bin/mysql_config --with-mysqli=mysqlnd --with-pdo-mysql=myslqnd And the error happened: configure: error: Cannot find MySQL header files under /usr/local/mysql/bin/mysql_config. Note that the MySQL client library is not bundled anymore! -- 黄昭源(Asher Wong) *Best Wishes To You!*
Re: [PHP] Re: make error
I droped it but now the new error happened: checking for mysql_config... not found configure: error: Unable to find your mysql installation And I'm sorry to send more than one reply. Maybe there are something wrong with the network here. 2012/3/24 Daniel Brown danbr...@php.net 2012/3/23 Asher Wong wongzhaoy...@gmail.com: Now I use the command below to configure php: ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=mysqlnd --with-mysql=/usr/local/mysql/bin/mysql_config --with-mysqli=mysqlnd --with-pdo-mysql=myslqnd And the error happened: configure: error: Cannot find MySQL header files under /usr/local/mysql/bin/mysql_config. Note that the MySQL client library is not bundled anymore! Drop this: --with-mysql=/usr/local/mysql/bin/mysql_config and please only send one reply. I keep getting your first reply, then a second reply one or two minutes later. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- 黄昭源(Asher Wong) *Best Wishes To You!*
Re: [PHP] Re: make error
This is the result of locate mysql_config: [zhaoyuan@localhost php-5.4.0]$ locate mysql_config /home/zhaoyuan/下载/MySQL-5.5.21-1.el6.src/mysql-5.5.21/man/mysql_config.1 /home/zhaoyuan/下载/MySQL-5.5.21-1.el6.src/mysql-5.5.21/scripts/mysql_config /home/zhaoyuan/下载/MySQL-5.5.21-1.el6.src/mysql-5.5.21/scripts/ mysql_config.pl.in /home/zhaoyuan/下载/MySQL-5.5.21-1.el6.src/mysql-5.5.21/scripts/mysql_config.sh /usr/bin/mysql_config /usr/local/mysql/bin/mysql_config /usr/local/mysql/man/man1/mysql_config.1 /usr/share/man/man1/mysql_config.1.gz -- 黄昭源(Asher Wong) *Best Wishes To You!*
Re: [PHP] Google Chrome
Wow, didn't notice the GoogleUpdate.exe, thanks for the heads up on that. Agreed about programs adding items in our startup. On Thu, Sep 4, 2008 at 2:23 PM, Boyd, Todd M. [EMAIL PROTECTED] wrote: -Original Message- From: Ovidiu Rosoiu [mailto:[EMAIL PROTECTED] Sent: Thursday, September 04, 2008 12:56 PM To: Richard Heyes Cc: php-general@lists.php.net Subject: Re: [PHP] Google Chrome Richard Heyes wrote: Hi, Is it just me, or is everyones disk thrshing more since installing (if you have) Chrome? Oh, and to keep it in-line with list, isn't PHP great? :-) I uninstalled it precisely beacause of this behaviour. The disk was running crazy every time chrome was started. And I don't know how to do lsof | grep chrome on Windows to see what's going on. You can at least track memory + cpu usage through the Task Manager (Ctrl-Alt-Del + T on most distros). In the Task Manager, I also noticed that GoogleUpdate.exe is running even when Chrome.exe is not. This made me a bit curious, so I went into msconfig (the Microsoft GUI utility for modifying startup programs, services, and system INI files) and saw that GoogleUpdate.exe had been added to the list of programs to run on Windows startup. I hate, hate, HATE it when programs install resident agents that eat my memory and perform background network activity. Rrgh! Points taken away from Google for this app's EULA and its methods. Slick otherwise, though (aside from the lack of XMLDOM instantiation support for Javascript)... Todd Boyd Web Programmer -- 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] Gmail Account Invites (Want One?)
Yeah, not sure why the invite a friend option is still there On Nov 15, 2007 4:48 PM, William Betts [EMAIL PROTECTED] wrote: Great with the times. :P It's not invite anymore. On Nov 15, 2007 3:40 PM, Daniel Brown [EMAIL PROTECTED] wrote: I know a good deal of us here are already using Gmail accounts, but if you're not one of us and would like to be, let me know. I still have 95 invites left, and whomever would like one is more than welcome to it. If you're not familiar with Gmail, check out the site at http://www.gmail.com/. Great threading, something like 4BG (and counting) of space, and by far the absolute BEST SPAM filter I've ever worked with. Plus a lot more, including integration with Google Docs, et cetera. Just let me know and I'll send you an invite so you can create an account. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- 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 -- S. Wong -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Security Concerns with Uploaded Images:
On Tuesday 16 May 2006 07:45, Richard Lynch wrote: On Mon, May 15, 2006 1:58 am, Jason Wong wrote: 2) the uploaded file is a script (perl/php/python/etc) In the case of (2), if the script relies on its shebang line to execute Not necessarily -- What if I upload an image file named badscript.php and then I surf to it, after it's in your /images directory? I was assuming that any developer who allowed image files to be named *.php would be hung, drawn quartered and shot a few times for good measure :) -- 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] Security Concerns with Uploaded Images:
On Monday 15 May 2006 10:53, Richard Lynch wrote: On Sat, May 13, 2006 5:11 pm, Nick Wilson wrote: are there any security concerns with uploaded images? YES!!! Just what are the security concerns exactly? Assuming we're only focusing on attacks to the webserver[1] then I can only think of 2 (are there anymore?): 1) the uploaded file is a binary executable 2) the uploaded file is a script (perl/php/python/etc) In the case of (1), the attacker, having uploaded a malicious file would then have to find some way of getting it executed. On a un*x-like system the uploaded file would/should not have the executable bit set, so the attacker would have to find a way to set that bit AND to execute it. This would be very unlikely. In the case of (2), if the script relies on its shebang line to execute then it would have to overcome the same obstacles as (1) for it to get executed. Otherwise, eg in the case of PHP, it would have to rely on the web application to include()[2] or eval() the malicious file. Since it is supposed to be an image file then the web developer would/should not intentionally use include()/eval() on such files. However in poorly written applications where input to include()/eval() can come from the user/attacker and are not properly sanitised it is then that the attacker will have a field day. To summarise: the uploading of an executable masquerading as an image file can be protected against via coding at the application level My thought is that it wouldnt be too hard to have some kind of script masquerade as a gif file, and perhaps cause damage. More worrying and much harder to protect against are zero-day exploits against the graphics libraries themselves - libpng, libtiff, gd lib, zlib - have all had security problems in the past. Or, for that matter, load the images in through http://php.net/gd and And the potential irony is that: in order to protect against executables masquerading as image files you trigger a zero-day exploit of gd :) I would love to hear Chris Shiflett's views on this. [1] as opposed to attacks on a user's browser when later on that file is accessed or downloaded [2] this includes (pun intended) include()'s siblings - require() etc. -- 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] WINNER
On Tuesday 09 May 2006 03:10, John Nichel wrote: Ryan A wrote: Ok, the last time this happened I think it was either Jay B or John Holmes (the dude!) who claimed the prize...this time, hands off, its mine... 615,960.00. I'm rich bearch! Good ole John. I miss him. And Jason Wong. Where have all the good times gone? I don't know about John (Holmes), but I retired after winning one of these lotteries ;-) -- 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] A Problem!
Title: cids 信纸 DearAll: - 例子A(使用HTML TAG) Form Enctype="multipart/form-data" Action="" Method="POST" Input Type="hidden" Name="MAX_FILE_SIZE" Value="1000" Send this file: Input Name="userfile" Type="file" Input Type="submit" Value="Send File"/From 此种方法只是利用HTML TAG的方法,且很容易被绕过(摘自PHP5中文手册), 所以已经不再被人使用了。 - 例子B(使用_javascript_) Script language="Jscript" function chksize(strFileName){ var maxsize = 100; var objStream = new ActiveXObject("ADODB.Stream"); objStream.Type = 1; objStream.Open(); objStream.LoadFromFile(strFileName); if(Math.round(objStream.Size/1024,2)maxsize){ alert ("文件大小超过限制!"); document.form1.reset(); return false; }} /Script - 例子C(使用PHP) ?php $MaxSize = 100; $fsObj = new COM("ADODB.Stream"); $fsObj.Type = 1; $fsObj.Open(); $fsObj.LoadFromFile($UpLoadFileNam) if(($fsObj.Size/1024) $MaxSize){ echo "文件大小超过限制"; } ? - 例子B与C同基本性,因为IE或者其它浏览器在安全方面的限制(服务器平台也有限制),所以基本不太可能。 已经同国内所知的PHP高手交流过,都没有找到更好的方法来解决这个问题。所以PHP开发组是不是可以考虑加上这个功能。 能够在文件上前之前文件的类型和大小. 在此,我代表全部的PHP使用都感谢你们所作出的贡献。 thanks. Best regards. tom
Re: [PHP] PHP on Mobile Devices(Pocket PC specifically)
On Wednesday 30 November 2005 22:48, Kilbride, James wrote: Does anybody know of a way to run PHP files on a windows mobile device(Pocket PC 2003)? Optimally I'd like to run it under a web server running on the mobile device itself but barring that I'll take some form of command line I guess. Realize that the mobile device will NOT be running any active network connectivity. For all intents and purposes the individual is sitting in a wireless empty room with no land connectivity talking to the mobile device. I haven't been able to find any web servers that run on the Pocket PC that can be viewed by the mobile IE(or mobile Opera either I guess) when it doesn't have active connectivity, at which point I might as well just be using a server for all of the mobile devices rather than hiding it on the mobile device. If you're willing to ditch the windows mobile requirement (Wince/WM is crap anyway) then you could have a look at the Sharp Zaurus series. Run www.pocketworkstation.org on one of the Zaurus and you'll have access to most of Debian in the palm of your hand. I've successfully run FUDforum using Apache2/PHP4/MySQL on my Zaurus. Ruby on Rails works as well albeit a tad slow -- I need to figure out how to get fastcgi working. And unlike WM devices, you can run *real* browsers, Firefox and Mozilla are available. -- 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] owner of files created by fopen() become wrong?
Hi all, I am so sorry that I have a lot of questions... This time I got a special issue... I have set up a VirtualHost for the domain that have problem. Since I am using Apache/1.3.33 , I have set the User Group inside outside the VirtualHost ... ... /VirtualHost tags. As you know, the user group set outside VirtualHost will be the user group that the main server run with. And the one inside will be used for that domain only. The question comes, when I trying to run a script that use fopen('.xxx','w'); to create a file(or even create a dir), the file owner group is 'apache', that is the user group I run apache with, but NOT the one inside the VirtualHost!!! I have tried to restart my server and make sure the httpd.conf loaded corrrectly, but the question is still there, can anyone tell me how to solve this problem? Plesae help! Thx! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] disable safe_mode with .htaccess ?
Hello everyone, I have a special question and want to ask here, hope anyone can answer me. My server is Apache/1.3.33 with PHP/4.3.10 I have AllowOverride All in my httpd.conf and safe_mode = On in php.ini , I want to turn off safe_mode in one folder by .htaccess , is it possiable? I don't want to make changes to my httpd.conf or php.ini because that is a productive server and shouldn't restart it. Please help, thank you! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help: Get the value of pi up to 200+ digits?
Dear all, I'm trying to do like this but failed: ?php ini_set('precision',16); echo pi(); ? How can I get more digits after . ? Can anyone help? Thx! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help: Get the value of pi up to 200+ digits?
Dear all, I'm trying to do like this but failed: ?php ini_set('precision',16); echo pi(); ? How can I get more digits after . ? Can anyone help? Thx! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help: Get the value of pi up to 200+ digits?
but my server configure don't have bcmath enabled, is there any other way to do so? Torgny Bjers [EMAIL PROTECTED] wrote:[EMAIL PROTECTED] Wong HoWang wrote: Dear all, I'm trying to do like this but failed: ?php ini_set('precision',16); echo pi(); ? How can I get more digits after . ? I am fairly sure that you have to use BCMath for this: http://www.php.net/manual/en/ref.bc.php Give it a go and see what happens! :) Regards, Torgny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help: Get the value of pi up to 200+ digits?
Dear Jordan, I know what you mean. But you may try this one and you will know: ?php ini_set('precision',200); echo pi(); ? the result is the same as 16!!! So that's why I ask this question! I am not stupid like that! Please help, thx! Jordan Miller [EMAIL PROTECTED] wrote:[EMAIL PROTECTED] http://us3.php.net/manual/en/ini.core.php#ini.precision precision sets the number of significant digits, *NOT* the number of digits displayed after the decimal point. If you want to get pi out to 16 decimal places you need a precision of *17* because the beginning 3 is a significant digit. Your code does exactly this, displaying pi with 15 decimal places. Jordan On Sep 1, 2005, at 8:06 AM, Wong HoWang wrote: Dear all, I'm trying to do like this but failed: ?php ini_set('precision',16); echo pi(); ? How can I get more digits after . ? Can anyone help? Thx! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Saturdays and Sundays
the answer is simply yes! You can have a simple for looping to do so. ?php // for example, 02/2005 $year = 2005; $month = 02; for ($i = 1; $i = 31 ; $i++) { if (checkdate($month,$i,$year)) { if (date(w,mktime(0,0,0,$month,$i,$year)) == '0') // it is Sunday echo $i . '/' . $month . '/' . $year . \n; if (date(w,mktime(0,0,0,$month,$i,$year)) == '6') // it is Saturday echo $i . '/' . $month . '/' . $year . \n; } } /** Sample output: 5/2/2005 6/2/2005 12/2/2005 13/2/2005 19/2/2005 20/2/2005 26/2/2005 27/2/2005 **/ ? hope this help! Shaun [EMAIL PROTECTED] wrote:[EMAIL PROTECTED] Hi, Is it possible to get the number of saturdays and sundays for a given month / year? Thanks for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Super globals ?
Dear all, Hello, I want to know that is there any way to create a super global in PHP? Please help! Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Super globals ?
Dear all, Hello, I want to know that is there any way to create a super global in PHP? Please help! Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Super globals ?
yes, I am asking how to start my own super global... And even a PHP beginner know that $GLOBALS is a array containing all the global variables and it is used in a function or a class. So I think no one will ask a question here which the answer is simply $GLOBALS. Any finally, thanks Jasper for the answer. Jasper Bryant-Greene [EMAIL PROTECTED] wrote:[EMAIL PROTECTED] Kevin Waterson wrote: This one time, at band camp, Jasper Bryant-Greene [EMAIL PROTECTED] wrote: Because he asked for superglobals, not globals. $GLOBALS (not $_GLOBALS) meh, force of habit happens to be an example of a superglobal. and variable can be set within its scope, so why not use it? As we see in the manual at $GLOBALS _is_ a super global and available to all scopes within the script. http://www.php.net/manual/en/reserved.variables.php#reserved.variables.globals it refers to $GLOBALS as This is a 'superglobal', or automatic global, variable. gotta love the php manual Exactly Kevin. What the OP wanted was to create another superglobal, just like $GLOBALS. The contents of $GLOBALS refer to the global variables, which are *not* all superglobals. The only superglobals by default in PHP (apart from $GLOBALS) are $_SERVER, $_GET, $_POST, and so on. He asked a question, and I provided the answer. Why he wants to do it is another question, but telling him to use $GLOBALS isn't answering his question, it's answering a different question, namely how to access the global variables. Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem when encoding non-english into UTF-8
Dear all, When I try to encode non-english char. such as big5 to UTF-8 with utf8_encode(), it always generate a wrong result, which is not readable. What can I do? Please help! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] curl?
Hi, Everybody! I got this when I execute the script: Fatal error: Call to undefined function: curl_init() in msnp9.class.php on line 259 is there anyway to solve it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to start a global variable within a function?
as title, how to start a global variable within a function?
[PHP] How to start a global variable within a function?
as title, how to do that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to start a global variable within a function?
as title, how to do that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to start a global variable within a function?
but, I mean I haven't start the global variable BEFORE the function is called... Jasper Bryant-Greene [EMAIL PROTECTED] wrote:[EMAIL PROTECTED] ?php $someGlobalVariable = 'foo'; function myFunction() { global $someGlobalVariable; // do stuff with $someGlobalVariable } ? Jasper Wong HoWang wrote: as title, how to start a global variable within a function? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to start a global variable within a function?
but, I mean I haven't start the global variable BEFORE the function is called... Jasper Bryant-Greene [EMAIL PROTECTED] wrote:[EMAIL PROTECTED] ?php $someGlobalVariable = 'foo'; function myFunction() { global $someGlobalVariable; // do stuff with $someGlobalVariable } ? Jasper Wong HoWang wrote: as title, how to start a global variable within a function? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to start a global variable within a function?
That is something like: ?php fubction myfunc(){ $foo = 'bar'; // I want this $foo can access outside } myfunc(); echo $foo; ? Can I write like this? ?php function myfunc(){ $GLOBALS['foo'] = 'bar'; } myfunc(); echo $foo; ? Jasper Bryant-Greene [EMAIL PROTECTED] wrote:[EMAIL PROTECTED] ?php $someGlobalVariable = 'foo'; function myFunction() { global $someGlobalVariable; // do stuff with $someGlobalVariable } ? Jasper Wong HoWang wrote: as title, how to start a global variable within a function? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exec / shell_exec issues
On Saturday 30 July 2005 08:49, leonski wrote: sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! : No such file or directory sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 95x72! : No such file or directory beats me how it gets inside the if, if it doesn't exist! I think the error message is trying to tell you that /usr/local/bin/mogrify does not exist. -- 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] exec / shell_exec issues
On Saturday 30 July 2005 10:17, leonski wrote: Jason Wong wrote: On Saturday 30 July 2005 08:49, leonski wrote: sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! : No such file or directory sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 95x72! : No such file or directory beats me how it gets inside the if, if it doesn't exist! I think the error message is trying to tell you that /usr/local/bin/mogrify does not exist. :-( yeah it does and it works under the terminal (nicely I might add, That error certainly does not come from mogrify. Just perform these simple tests: 1) /usr/local/bin/command-that-does-not-exist 2) mogrify file-that-does-not-exist; #assume mogrify in $PATH As Robert has pointed out, it is probably telling you that the file /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! does not exist. -- 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] looking for program/script to diff directories and show dates
On Thursday 28 July 2005 01:48, Chris W. Parker wrote: I was just expirementing with the diff command and was wondering if there was anything out there that does the same thing but with a more intuitive interface? The problem I want to avoid is a basic one. Which file did I update last week that I forgot to publish to the live site? No ncurses gui, but rsync would/could/should be better than diff. Plus it'll actually do the updates for you as well if you ask nicely. NB use the --dry-run option to see what files are affected (ie those that are different and will be transferred). -- 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] preg_match - help please
On Thursday 28 July 2005 01:50, André Medeiros wrote: You can have four words to describe a first and last name... you can have other alphabets, like arabian, chinese, etc... inserting accented characters alone would make that a big, nasty regex, let alone predicting ways you can describe first/last names. I'm not saying that I have the _BEST_ sollution. All I'm saying is that there are sittuations that are out of your control, and it seems to me this might be the easiest way out, guaranteeing that there are at least two words. Most Chinese would enter their name (usually 3 words, sometimes 2. rarely 4) WITHOUT any spaces. Not sure what the OP was trying to do, but the best way to handle it (IMHO) is to give the user 2 input boxes, one for family name, the other for the rest of their name. -- 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] Only variable references should be returned by reference
On Tuesday 19 July 2005 23:17, Marc G. Fournier wrote: Just upgraded to 4.4.0 ... several legacy applications that we have installed now break with the above error message ... specifically, older installs of Horde, but I've seen reports of other apps ... Without reverting back to 4.3.11, is there a way I can temporarily fix this while working on the application issues themselves? :( Change the relevant setting in php.ini. -- 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] MySQL password file
On Monday 18 July 2005 18:53, Lawrence Kennon wrote: In my current hosting situation I don't have the ability to store my file that contains MySQL userids/passwords in a subdirectory that is not under the server root. In order to protect it from being included from a foreign host I thought up this scheme of using the php_uname function to check that it is running on the correct host. Does this look reasonably secure? I am not hosting any kind of store, or terribly sensitive data - it will only be a bulletin board. If by foreign host you mean a remote (ie over the network) host then there is nothing for you to worry about (if your webserver is configured correctly -- see below). When using include() on a remote file you are only including the output of that file AFTER it has been processed by php. Thus in the case of the example below where you're only defining a bunch of constants there is no output and thus nothing to include. define ('DB_USER', 'username'); define ('DB_PASSWORD', 'password'); define ('DB_HOST', 'localhost'); define ('DB_NAME', 'dbname'); **Beware** if you're using a non-standard filename extension for your include files, eg .inc, and have not configured your webserver to process these using php then then it *is* possible to include and use these remotely. You can easily check this by entering the URL of the include file into a browser and then view source, what you see is what will be included by a foreign host. What you should be more concerned about if you're on a shared host is that there is a good possibility that your co-hosts are able to access your files anyway. -- 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] Only variable references should be returned by reference
On Wednesday 20 July 2005 07:32, Marc G. Fournier wrote: Which is? If its: Yep. ; at function call time. This method is deprecated and is likely to be ; unsupported in future versions of PHP/Zend. The encouraged method of ; specifying which arguments should be passed by reference is in the function ; declaration. You're encouraged to try and turn this option Off and make ; sure your scripts work properly with it in order to ensure they will work ; with future versions of the language (you will receive a warning each time ; you use this feature, and the argument will be passed by value instead of by ; reference). allow_call_time_pass_reference = On The pass by reference thing works regardless of the above setting. Enabling the setting disables the warnings and vice-versa. It already is ... Are you sure that: 1) you're looking at the correct php.ini 2) the setting is not being changed elsewhere If the warning annoys you just tone down the error reporting level. Is there another one I should be looking at? :( Not that I'm aware of. -- 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] Help with preg_replace
On Tuesday 05 July 2005 02:21, Marcos Mendonça wrote: This works fine for links with id 0, 1 and 4. But i haven´t been able to figure out how to match and replace links with id 2 and 3. Works for me. Check whether $body_html really does contain what you're looking for in id 2 id 3. You may also want to consider using preg_quote() instead of str_replace(). -- 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] memcached and objects.
On Sunday 03 July 2005 13:10, Rodolfo Gonzalez Gonzalez wrote: :-S ? ... I've googled to see if there's some sample code for caching adodb recordsets, without success so far. adodb already has a caching mechanism, have you tried it? Is someone aware of some class to cache Adodb recordsets in memcached?. No idea. -- 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] postgres - mysql last_inserted_id
On Friday 01 July 2005 09:55, Richard Lynch wrote: There are innumerable on-line forums that (incorrectly) state that an OID could be returned that is not connection-specific, so two HTTP requests in parallel would criss-cross OIDs. This is patently false, and any user of PostgreSQL can demonstrate that in minutes (okay, an hour for a newbie) of coding. Someone with more time than me can go search for those above-mentioned forums and judge for themselves. However regardless of whether OIDs cross-pollination is possible or not ... OIDs *can* get re-used *IF* you end up having more than 32-bits (2 billion plus) of objects in the lifetime of your application. For normal usage, that ain't a big problem, honestly... Though I should have stated it for the record, cuz maybe the OP has a site where 2 BILLION INSERTs are gonna happen. ... 4 billion (I'm assuming the postgresql guys are smart enough to use unsigned integers) isn't really as much as it looks. Remember this is shared amongst all the tables in your database making these oids even more of a precious resource ... The solutions there are the same as for not having OID in the first place -- Have some other unique identifier you generate yourself in the INSERT, or use that *with* the OID to be 100% certain you get back the same row from your 2 billion plus data set. ... and that's exactly what sequences are for. And that's why using oids for a unique id is not a smart choice when sequences are available and were designed explicitly to provide unique ids. If there's a reliable, web-safe, connection-dependent way of getting the sequence ID used in an INSERT, it sure ain't documented, and I've never seen it discussed on the PostgreSQL list (which I dropped off awhile ago, so maybe it's something new). I have already given an example(!) Though that also limits you to 2 billion plus records per table -- The current versions of postgresql allows for 8 byte sequences which provides 1.8E19 unique ids. Now *this* will take some serious database work to cycle through all the ids. Assuming you generate a million ids per second it will take only half a million years for you to start worrying about running out of ids. But by that time I'm sure you would be more worried about the billennium bug :) If you are dealing in 2 billion object PostgreSQL databases, and you don't know all this already, you're in DEEP trouble... I think I'll be quite safe as I'm using sequences ;-) -- 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] Technology Forums
On Friday 01 July 2005 20:19, Ryan A wrote: I would rather say go screw yourself you dirty spammer than just deleting it...but thats just me. People, if you feel you *need* to respond to spam, could you please snip out the spam so that it doesn't receive more coverage than it deserves? -- 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] postgres - mysql last_inserted_id
On Friday 01 July 2005 02:55, Uroš Kristan wrote: I have an application in production, build on mysql database. I decided to migrate to postgres because of numerous reasons. Good idea :) Can you guys please guide me into the right direction? the main problem is the missing autoincrement of pgsql and getting the last record from the tabel, for linking to another tabel. How do you deal with that? The basic idea is that you use sequences which in postgresql are the equivalent of autoincrement in mysql. Something like: INSERT INTO category (category_id, category_name, category_description) VALUES (nextval('category_id_seq'), new_category_name, new_category_description); here 'category_id_seq' is the name of the sequence that produces the unique IDs for your category_id. To use your newly created category_id in another table: INSERT INTO product (product_id, product_name, product_description, category_id) VALUES (nextval('product_id_seq'), new_product_name, new_product_description, currval('category_id_seq')); nextval() and currval() are native postgresql functions which operate on sequences. Sequences are created automatically when you define a field to be of type 'serial'. If you need get the actual value of the newly created category_id for use in php then you would have to do a select query, eg: select currval('category_id_seq') as new_category_id; and do the usual pg_query() and pg_fetch_*() to process the result also, can you please recommend me some good manual, explanation or book to help me with this problem. Lookup serial types and sequences in the (postgresql) manual for the basics. Because the application uses around 250 tables in mysql and I would like to make it righ t the first time when migrating to pgsql.. I would suggest that you start off with a 'smaller' project and explore all the ways where postgresql does things differently to and/or better than mysql, then work your way up to a more complex project. This would be much better than doing a hasty migration to postgresql - which does not make the most of what postgresql has to offer - and then trying to hack the postgresql features in afterwards. -- 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] postgres - mysql last_inserted_id
On Friday 01 July 2005 04:06, Richard Lynch wrote: last record from the tabel, for linking to another tabel. You have to use http://php.net/pg_last_oid to get the PostgreSQL internal Object ID (OID) -- You can then use the ubiquitous oid column. $query = insert ...; pg_exec($connection, $query); $oid = pg_last_oid($connection); I'm pretty sure I read somewhere that the the last OID can get messed up under some circumstances and the OID that you get is not the OID that you want. Can't remember whether this was a php-postgresql thing or simply a postgresql thing. But whatever it is, you don't need OIDs to use sequences. -- 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] Re: Persistant Connections and max_connections on mysql
On Tuesday 21 June 2005 18:33, Dan Rossi wrote: We should be sweet now, still use persistant connections on a high traffice server, but reduce the timeout for the threads before they drop off, hence why they stay open for so long and then run into the max_connection issues. To be certain that you won't hit the limit configure your webserver so that the maximum number of instances (or requests it can handle) is less than the max connections settings of mysql. -- 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] Re: security question...??
On Tuesday 21 June 2005 23:05, bruce wrote: if i'm the server app, and you tell me that you're IE, v.6, i'd like the ability to somehow be able to gather information from you, such that i can then check with msoft to see if your answers match what msoft claims the answers should be. if you give wrong answers, i can then make a determination as to whether i want to talk with you, or perhaps limit the amount/type of information i allow you to access... Aside from the fact there doesn't seem to be anything in the HTTP spec which would allow this kind of querying, what's to stop someone from writing a client that will spit the same response as IE? this kind of approach goes beyond the 'user/access string' and can actually get to be rather difficult to spoof, or to break... As there are no existing mechanisms of this kind you would have to create a whole new standard. Then persuade the browser makers to adopt it. Otherwise your server will have no clients to talk to. Still, you haven't really explained why you need to only talk to real browsers (real in the sense that they're not hacked up as you put it). What's to stop a bad guy using a real browser talking to your server and getting some information and doing something bad with that information? What are you trying to prevent? -- 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] Image upload form
On Thursday 16 June 2005 00:38, Jack Jackson wrote: //try to get image size; this returns false if this is not an actual image file. $image_test = getimagesize($local_file); if ($image_test !== false) { $mime_type = $_FILES['userfile']['type']; $_FILES['userfile']['type'] contains the mime-type that is provided by the browser and will vary depending on browser and hence extremely unreliable. In fact the returned value from getimagesize() already has mime-type info, use that instead. $newfile = md5(date(l-F-j-Y i:s)).'.'.$pext; $image_file = $uploaddir . $newfile; // print_r($newfile); // print_r($image_file); if(!move_uploaded_file($newfile,$image_file)) { echo 'Could not move file to destination'; exit; } The file pointed to by $newfile doesn't exist. You need to move ... $local_file = $_FILES['userfile']['tmp_name']; ... $localfile -- 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] Of .txt to .zip
On Thursday 09 June 2005 20:04, Jay Blanchard wrote: [snip] 2005/6/8, Jay Blanchard [EMAIL PROTECTED]: [snip] I want that the file with extension .TXT that this in my server, to keep packed it with extension ZIP. Somebody knows since I can do it. [/snip] http://www.php.net/zip but it says 'Read Only Access' from the document? so,the file (.zip) can read via Zip File Functions , they dont have any method to do compress things. [/snip] You may have missed the e-mail where I said How far did you read? http://us3.php.net/manual/en/ref.zlib.php zlib does gzip (.gz) and is not the same as [pkware] zip which I believe is what the OP wants. OP, put your google googles on and look, there is (or was?) at least one solution which involved a zip handling library using pure PHP. -- 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] The goto discussion on the Internals List
On Thursday 09 June 2005 23:08, Greg Donald wrote: On 6/9/05, Jochem Maas [EMAIL PROTECTED] wrote: whats your take on ifsetor()?, personally I would like to see it. I think its a great way to teach newbies about checking vars before use (if nothing else) That and error_reporting( E_ALL ); and ini_set('display_errors', TRUE); So they don't have to figure out where the error log is (yet). -- 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] Image Verification - Problems in Safari, Mac OS X
On Thursday 19 May 2005 03:51, Rahul S. Johari wrote: A simple Image Verification script is working perfect in IE on Windows... But isnt working in Safari on Mac OS X! It displays a blank page instead of the image with the form. Here s the Script: That's because IE is severely broken? In short, you're trying to display an image, so get rid of all the HTML stuff. -- 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] counting ocuring words in a string
On Tuesday 17 May 2005 18:00, Merlin wrote: I am trying to find a way to count the number of times (if any) words are inside a string. explode() array_count_values() -- 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] Re: why are session only working with cookies?
On Tuesday 17 May 2005 21:01, Brian V Bonini wrote: Still no go... Other changes in php.ini DO take effect, just not this I'm at a loss What version of PHP are you using? In older versions (have a look at the changelog) you had to configure with --enable-trans-sid, in newer versions this is the default. Summary: you have to compile PHP with --enable-trans-sid, AND enable it in php.ini. -- 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] array, trouble updating
On Tuesday 17 May 2005 21:18, mayo wrote: I usually work with cold fusion and took on a little project to get my feet wet in php and am spinning my wheels. What I thought might be difficult was easy and what I thought would be a piece of cake has caused me much grief over the last few days. It appears that your overall problem is a misunderstanding of how arrays work in PHP and how easy it is to manipulate them. First: if (session_is_registered('ses_basket_items')){ In general, for practical purposes (if PHP is installed using the recommended default setup, ie register_globals disabled), session_is_registered() is deprecated and should not be used. Use: if (isset($_SESSION['ses_basket_items'])) { ... }; Second: if ($action == empty) { while ($ses_basket_items -1) { array_splice ($ses_basket_name, $ses_basket_items, 1); array_splice ($ses_basket_amount, $ses_basket_items, 1); array_splice ($ses_basket_price, $ses_basket_items, 1); array_splice ($ses_basket_id, $ses_basket_items, 1); $ses_basket_items--; } } You seem to be using multiple single dimension arrays to store your basket details. That is not the optimal way of doing things. You should have a *single* multi dimension array, there are many ways to do this, here's a couple: 1) $basket[1] = array('name' = 'name of product', 'id' = 'product id', 'price' = 'price of product', 'amount' = 'quantity required'); $basket[2] = array('name' = 'name of product', 'id' = 'product id', 'price' = 'price of product', 'amount' = 'quantity required'); 2) $basket['a_product_id'] = array('name' = 'name of product', 'price' = 'price of product', 'amount' = 'quantity required'); $basket['another_product_id'] = array('name' = 'name of product', 'price' = 'price of product', 'amount' = 'quantity required'); OK, so how do you operate on them? In the examples below 2 forms will be given corresponding to how you defined the arrays as per above. To remove an item: 1) unset($basket[n]); // where n is an integer 2) unset($basket['product_id']; // if product_id is an integer // then you don't need the single-quotes // note that also applies when first // define the array, ie: // $basket[product_id] = array(...); To change an attribute, eg the amount: 1) $basket[n]['amount'] = 5; 2) $basket['product_id'] = 10; To display an attribute, eg price: 1) echo $basket[n]['price']; 2) echo $basket['product_id']['price']; When playing around with arrays, print_r() is your friend, use it liberally. -- 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] Components
On Tuesday 17 May 2005 03:24, Evert | Rooftop wrote: I'm working on a component system and started with a component class. [...] I want to give PHP to have a natural application-programming feel, along with events and all (which is implemented by the PseudeModule class). And after that, start off with a web-based PHP RAD tool. (which I plan to do with either document.designMode or XUL) You might want to take a look at Prado http://www.xisc.com/ it seems to be exactly what you're trying to do and I believe it also has a RAD plugin for Dreamweaver. -- 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] Components
On Tuesday 17 May 2005 07:27, Evert | Rooftop wrote: Thank you I will look into it ;) but right now I'm also looking for the php-developers' opinions. So, what are your ideas about this? I strongly suggest that you look at the existing projects, see which one most closely matches your vision then start contributing to it. I recently had a look at the existing PHP framework projects and whilst there is no shortage of choice the one common attribute most share is the lack of adequate documentation. So rather than starting YAPF[1] go and make an existing one better! [1] Yet Another PHP Framework -- 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] cURL functions
On Friday 13 May 2005 23:19, Chris Bruce wrote: I did look at your post on PATH_INFO which did not get me any closer to the solution. At this point, I am just trying to get an image using cURL and then force it to download to the computer. Here is the link: This should work: $ch = curl_init(); // create cURL handle (ch) if (!$ch) { die(Couldn't initialize a cURL handle); } // set some cURL options $ret = curl_setopt($ch, CURLOPT_URL, http://images.apple.com/home/2005/images/ tigershippingdashboard20050429.jpg); $ret = curl_setopt($ch, CURLOPT_HEADER, 0); $ret = curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $ret = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $ret = curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); $ret = curl_setopt($ch, CURLOPT_TIMEOUT, 30); // execute $ret = curl_exec($ch); header(Content-type: image/jpg); Header('Content-Disposition: attachment; file=tigershippingdashboard20050429.jpg'); echo $ret; -- 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] cURL functions
On Saturday 14 May 2005 06:45, Chris Bruce wrote: This should work: [code snipped] Did you try this Jason? Yes, I've tried the code that I posted (using my own URL for the image), works for me. When I try it, it just downloads the getimage.php file with the binary content of the image in the file. If by 'getimage.php' you mean the above, and you're getting the contents of the above (ie the raw PHP code) AND the binary content of the image then your webserver is seriously out of whack. If you mean that the browser downloads the image binary data correctly BUT saves it in a file called 'getimage.php' then that is most likely a problem with your browser. Double check that you have Content-Disposition header correctly formatted, look at the user notes in the online manual for the header() function for loads of examples and suggestions. Also check the archives for Richard Lynch's posts where he rants (quite rightly) about IE's poor handling of forcing a download to be saved to file and ways to circumvent it. -- 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] error display problem
On Saturday 14 May 2005 09:49, hima wrote: can any one plesae help me as I am a learner. I am working on a Mac OS x machine and I want to see the errors displayed to the browser. I had changed display_errors option On in the php.ini file but still cannot see them displayed. Did you restart the webserver? Any pointers as how to display errors to browser while working on Mac machine, really appreciated. Anyway, putting the following at the beginning of your code will allow you to see all errors regardless of the server setting: error_reporting(E_ALL); ini_set('display_errors', TRUE); -- 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] Re: why are session only working with cookies?
On Saturday 14 May 2005 09:42, Brian V Bonini wrote: Yeah, I know session support is there and I DO NOT have it set to use ONLY cookies. But if I disable cookies in the browser stuff relying on sessions stops working. I'm using 5.0.3 session.use_trans_sid 0 0 Set that to 1. Sessions *are* cookies, they're cookies that have been set to expire when the browsing session finishes (ie when the browser is closed). -- 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] cURL functions
On Friday 13 May 2005 02:54, Chris Bruce wrote: $ret = curl_setopt($ch, CURLOPT_HEADER, 0); Try enabling the above or ... Does anyone know how I can take the binary result and force it to download as a JPG image? ... send an appropriate header before dumping the binary data. -- 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] Session cookies in firefox
On Wednesday 11 May 2005 13:26, Richard Lynch wrote: On Tue, May 10, 2005 7:04 pm, Kirsten said: I'm using php sessions with cookies. I realized that Firefox shared cookies between different instances (unlike IE that when someone open a new bank window a new session is created). That's because IE stupidly creates a whole new program/process on each. That behaviour is (or maybe was, don't have IE around to test) user configurable. So if the OP is relying on that feature then their website is bound to break for some users. -- 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] MySql injections (related question)
On Thursday 12 May 2005 06:30, -k. wrote: I have a related question, many of you have suggested using addslashes on your variables to prevent SQL injections, but is it safer to use mysql_real_escape_string (or mysql_escape_string)? What is the benefit / cost of using mysql_real_escape_string rather than addslashes? When using Postgres i always use pg_escape_string on anything i send the DB's way. In fact the manual says specifically to use pg_escape_string rather than addslashes (however it doesnt give that advice in mysql_real_escape_string )... Postgresql uses a single-quote to escape a single-quote. MySQL uses a backslash. Hence running addslashes() on a string destined for MySQL is usually OK whilst doing so for Postgresql is not. But now that mysql_real_escape_string() is available that is what you ought to use. -- 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] MySql injections (related question)
On Thursday 12 May 2005 09:57, Richard Lynch wrote: On Wed, May 11, 2005 5:23 pm, Jason Wong said: But now that mysql_real_escape_string() is available that is what you ought to use. But are they REALLY different. mysql_real_escape_string() is most certainly different from mysql_escape_string(), and of course addslashes(), in that it takes into account the language/character encoding. Also manual entries for addslashes() and mysql_real_escape_string() does tell you what characters are escaped. Or, put it this way: [snip] Or is mysql_real_escape_string just something I should use going forward in case it might be better someday, but it's really the same for now? I suppose that if you're not using some esoteric character encoding then the standard addslashes() would suffice. However a quick fix is simply do a search and replace then make sure you have established an mysql connection early on in your code (before mysql_real_escape_string() is called). It's all very well to repeat these pronouncements from on high that mysql_real_escape_string is better but I personally would sure appreciate somebody who's saying this to say *WHY* it is better, and in precisely what ways it is different from addslashes and/or magic quotes with or without data scrubbing. mysql_real_escape_string() calls the underlying MySQL C client library and because that library is produced by the MySQL people they are in the best position to know what exactly needs escaping. And in the event that what needs escaping gets updated then you don't need to touch your code because when the MySQL library is updated you're set. Not so if you use your own escaping function(s). Maybe I just missed that detailed analysis of the inherent superiority of mysql_real_escape_string, but it's not for a lack of looking... Well put it this way, addslashes() was not meant to make data safe for mysql, it just happened to work. Now there is a better/official/whatever alternative why not use it? -- 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] reducing array size
On Saturday 16 April 2005 23:07, pete M wrote: Is there an easy way to trim an array ? I'm using array_unshift to push elemnts onto the front of an array but I want to limit the size to 20 ?? Is there an easy way to do this without looping and unsetting the elements ?? array_slice(), array_splice() -- 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] Directory perms
On Thursday 14 April 2005 22:25, Reynier Perez Mira wrote: How I can obtain directory perms and how I know if they are RW on Win32 plattforms? I find into PHP Manual but I only obtain function fileperms wich have only for files and not for directories fileperms() works on files AND directories (and in fact the examples shows that). is_readable() and is_writeable() also works on files/dirs. -- 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] ini_set and upload_tmp_dir
On Friday 15 April 2005 02:11, Reynier Perez Mira wrote: I'm try to change de value for the PHP config var upload_tmp_dir with objetive to make an file upload an access more easy to superglobal array $_FILES['fichero']['tmp_name']. Into my php file just in the start I have this: ini_set(upload_tmp_dir,C:\\PHP5\\tmp\\); You can't do that. That has to be set in php.ini. -- 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] Apache2 html/php dir-where..?
On Tuesday 12 April 2005 16:09, Mark Sargent wrote: I've gone and uninstalled the pre-installed httpd/php via yum on Fedora3 and re-installed Apache/PHP via source. Apache is now installed at /usr/local/apache2. I want to know, where is the dir for html/php files. B4 it was /var/www/html. What is it now..? Cheers. Look in /usr/local/apache2/conf/httpd.conf for DocumentRoot. -- 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] Regular expressions
On Tuesday 12 April 2005 18:30, jem777 wrote: Php docs are quite messy about what works with what function... This is my problem; I want to strip out spaces from my tags: $word = [ / quote ]; $word = eregi_replace([[[:blank:]]*quote[[:blank:]]*], [quote], $word); $word = eregi_replace([[[:blank:]]*\/[[:blank:]]*quote[[:blank:]]*], [/quote], $word); I would expect the result to be: [/quote] but it is [ /[quote]. It seems the first replace actually do the replace, but the how does it match the slash / ??? preg_replace('|\[\s*/\s*quote\s*]|', '[/quote]', $word); You might want to spice it up with some ungreedy modifiers. -- 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] Split command problem
On Monday 11 April 2005 09:27, Russ wrote: I have been trying to get the following code working. I keep getting an error on line nine. And the error is? It looks simular to the example in the PHP online manual. If I substitute a print command for line nine I get the correct information from $_POST[username]. I must be missing or have an extra a quote but I cannot figure out where. name($fname, $lname) = split('[/\s+/]', $_POST[username]); split() probably uses POSIX regex and hence knows nothing about '\s'. Use preg_split() instead: list($fname, $lname) = preg_split('/\s+/', $_POST['username']); -- 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] COM works on NT but fails on 2003?
On Monday 11 April 2005 12:11, Theisen, Gary wrote: if ($excel !=== FALSE) { //This is the error line?!?! I even tried FALSE. if ($excel !== FALSE) { ... } -- 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] Redirection after login with security
On Monday 11 April 2005 10:48, Adam Hubscher wrote: There seems to be 2 issues here: In an attempt to provide the best way to limit the # of accounts per person, I assumed that this could be accomplished by placing a dummy value only used by the site itself that is the username/encoded password for them on the community, and test if... when searched for in the database, a result set of x is discovered, then they are unable to create another account. 1) You want to prevent people from creating multiple accounts. Basically there is really nothing concrete that you can do to prevent that short of making them pay an extortionate amount of money before they can create a new account. Problem: I would like to possibly utilize a login system (created on the remote server), that would then check their username and password against the CMS database located there, then redirect with that information (encrypted of course), to the local site where the information gets stored in a session. Then when they go to create a new account, it stores the extra verfied information into the database. However, the issue at hand here is, I'm not sure how secure it would be if I were to say, create a secure login form, verify the data... and then create another pseudo form that directs the person to the local-based site using hidden post variables (this is my original thought on the subject). 2) You want to check the credentials of a user/password against a remote database. One way to do it pretty securely without having to actually login to the remote database is to setup something like this: Remote database server, on this machine setup a simple webpage which grabs username and password from the URL. The username can be in plaintext (or if circumstances dictate and/or you're paranoid can be *encrypted*). The password is hashed (md5/sha, whatever) WITH a secret key. You can then verify whether username/password is correct and return an appropriate response. -- 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] Re: Can't Delete File Using Unlink
On Tuesday 12 April 2005 02:28, Ben Ramsey wrote: In general, permission settings under Windows suck. Hmm I thought that the ACLs on NTFS were about the only thing that is good about Windows. -- 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] Storing password in cookie
On Saturday 09 April 2005 19:29, [EMAIL PROTECTED] wrote: On 9 Apr 2005 Andy Pieters wrote: It doesn't matter how you encrypt it. DO NOT STORE PASSWORDS ON USERS COMPUTER I hope that's clear enough. A couple of people have stated this but I think it is incorrect. For one thing the users themselves are very likely to store the password there, so why shouldn't you -- with permission of course? Because you should know better than the user! Many sites will do this with a remember my password and log me in automatically feature. It doesn't necessarily mean that it will literally store your password in a cookie, it could just be storing a token. With a token, your website could impose expiry dates on them or invalidate them (and possibly issue a new one) whenever the user performs a full password login etc. Thus if a bad person gets hold of your token it'll probably mean that they'll only have access to that account for a limited period of time (depending on what security measures your website employs). However if you had stored the actual password and some bad person got hold of it then there is no reasonable way for your website to distinguish the bad person using the password to gain access from the legitimate user. -- 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] [PHP-INSTALL] Install Problems on Fedora 3
On Saturday 09 April 2005 20:17, Mark Sargent wrote: I did a source install, of which I'm a newb at, and then created a index.php file containing the following, ?php phpinfo(); ? but, that shows in the browser, Firefox, when typing localhost/index.php. I've confirmed that httpd is running, and generates pages as I got the Apache welcome page b4 creating the index.php page. I'm swaying towards that I may have compiled the source wrongly, like leaving something out. Happy to post whatever is needed to help you help me here. Cheers. You seem to have missed out some important steps ie editing httpd.conf so that it knows about PHP. RTFM for details. -- 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] [PHP-INSTALL] Install Problems on Fedora 3
On Saturday 09 April 2005 21:27, Mark Sargent wrote: I did a source install, of which I'm a newb at, and then created a index.php file containing the following, ?php phpinfo(); ? but, that shows in the browser, Firefox, when typing snip You need to tell Apache how to handle php files. sorry guys, quite new to all this. On this page, http://www.php.net/manual/en/install.unix.php it has 2 examples, 4-1 and 4-2. Little confused with what shared and static modules are and which 1 pertains to me. I was wanting to get php running to allow base to show results of snort logging in mysql. Snort/Mysql/Base etc are installed fine, just php is the last hurdle. Again, sorry. Cheers. OK you said you had already installed it, so which did you follow 4-1 or 4-2? 4-1 (shared modules) compiles PHP as an Apache module, this means that when Apache needs to process a page that contains PHP it will have to load in the PHP module (this is all done automatically), however you need to tell it what PHP files look like and what the PHP module is. This is done in steps 14 15. 4-2 (static) means that PHP will be compiled into the Apache executable however you still need to tell it what PHP files look like (step 15). -- 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] Storing password in cookie
On Saturday 09 April 2005 21:33, [EMAIL PROTECTED] wrote: On 9 Apr 2005 John Nichel wrote: While it is not absolute that you can't store passwords in a cookie, it is an absolute that you _shouldn't_ Sorry, I don't agree. There are very few absolute rules in software development. But in this case there really is no reason *why* you need to store a password (encrypted or otherwise). I might, depending on the needs, store a hash code as others have suggested Why not in *all* cases? Sometimes convenience is far more important. Often risk is. I can't see where the convenience lies. For you as a developer, you've already got the necessary code to do the token thing so there is practically no difference whether you use a token or a password. For the user, what are they going to do with an encrypted password -- are you going to tell them how to decrypt in the case that they have forgotten the password? -- 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] sessions not being stored : DAY 2
On Saturday 09 April 2005 01:02, Yuri Huitrón Alvarado wrote: I'm receiving this when trying to store a session : Warning: session_start(): open(/tmp/sess/sess_d280d6af3a2059aa58f43477d6b2c166, O_RDWR) failed: Permission denied (13) in /usr/local/apache2/htdocs/calendario/calendarix/cal_header.inc.php on line 19 * the /tmp directory is owned by root * the /tmp/sess directory is owned by the apache user and has 777 permissions * the directory in php.ini to store sessions is : /tmp/sess * there's not a php user what is the output of: ls -al /tmp/sess -- 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] Still not working: PHP4 running on server, but not on dev box (SuSE 9.2)
On Saturday 09 April 2005 01:35, Whil Hentzen wrote: Then I took an existing desktop 9.2 box, added Apache 2 and PHP 4 to it via YAST later. I can't get PHP to respond to function calls. Apache is serving up static pages fine, but it's not recognizing PHP. I'm pretty sure the people over at SuSE would be far more familiar with how *SuSE* has setup Apache + PHP, and hence would be far more likely to know what's going on. I don't know where to turn next to troubleshoot this; it seems like Apache on the dev box doesn't see PHP, but how to test? How to tell it? Go through the installation instructions in the [PHP] manual Installation on Unix systems Apache 2.0 on Unix systems. In particular verify steps 14 and 15. -- 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] PHP and Excel and COM
Hi, I am trying to control Excel with PHP via COM. I am wondering if there are some resources available with all the keywords (I didn't find anything on the net...). F.i. : I try to modify the content of a textbox in a worksheet. In VBA, I have: ActiveSheet.Shapes(Shape1).Select Selection.Characters.Text = foo If I try it on PHP, I have: $excel-Workbooks[1]-Worksheets[1]-Shapes[Shape1]-Characters-Text = foo; I get the following error: Uncaught exception 'com_exception' with message 'Unable to lookup `Characters': Unknown Apparently it does not recognize Characters. What should I use then??? Thanx for your help. Wongy _ MSN Messenger : discutez en direct avec vos amis ! http://www.msn.fr/msger/default.asp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File_get_contents()
On Thursday 07 April 2005 20:21, Jeff McKeon wrote: Now that I look at it, does anyone think this would work... file_get_contents(php//stdin/); That should be: 'php://stdin' -- 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] 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]br; } 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
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] Help! mod_php4 upgrade breaks GD!
On Saturday 02 April 2005 02:46, [EMAIL PROTECTED] wrote: No clue why it couldn't find libjpeg, but I then tried adding: --with-zlib-dir=/usr/include (AND) --with-jpeg-dir=/usr/local/include/ (the header files are there) That ought to be: --with-zlib-dir=/usr --with-jpeg-dir=/usr/local -- 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] Where is php installed on linux
On Friday 25 March 2005 19:03, Merlin wrote: I want to install Turck MMCasche. The install instructions say that the path to the php install has to be declared. Now I was searching the linux system for the php install but could not find it! It is compiled as a module and there is a file /usr/local/bin/php but no directory. The instructions read: Step 1. Compiling Turck MMCache export PHP_PREFIX=/usr $PHP_PREFIX/bin/phpize ./configure --enable-mmcache=shared --with-php-config=$PHP_PREFIX/bin/php-config make You must specify the real prefix where PHP is installed in the export command. It may be /usr /usr/local, or something else. In your case you have to set PHP_PREFIX to '/usr/local', and before you can proceed you must make sure you have the file '/usr/local/bin/phpize'. -- 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] Setting cookies for other domains
On Friday 18 March 2005 10:32, Brian Dunning wrote: I suspect it's for sub-domains of sites you administer and not completely different domains altogether. If this is true, and it's not possible for a site to set a cookie for a completely different domain, then why do browsers have security options to allow or prevent this specific action? When you display a webpage it very often pulls in a load of crap from other websites (eg banner ads). These other websites are able set their own cookies (for their particular domains). The browser prefs are for preventing these 3rd party websites from setting these 3rd party cookies. -- 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] shell script - disable log output
On Thursday 10 March 2005 06:28, Eli wrote: I don't really need it to log into a file, but I wanted to prevent it from echoing to the screen. So I guess there's no way to prevent from error_log() (using defaults) to echo to the screen (STDOUT). ini_set('display_errors', 0); // ?? -- 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] fsockopen and session_start
On Monday 07 March 2005 22:02, Pedro Garre wrote: I am using fsockopen to simulate a POST to another page (test_post.php) within the same server. It's not clear how exactly you're executing your code. I suspect that you haven't closed the session before doing your simulated POST. Your order of execution should be something like: start session assign values to session close session do the simulated POST -- 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] Passwords?
On Sunday 06 March 2005 21:03, AdamT wrote: If the password is stored in between the ? and ? tags, then it shouldn't get sent to the browser unless you specifically send it there. For *any* php code it is best to use ?php ? tags. These tags will work on *all* php enabled webservers. The short tags ? ? is an optional setting on the webserver and hence may not be enabled in which case your code *will* be displayed as-is. -- 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] Help with dates
On Sunday 06 March 2005 22:11, Kevin wrote: Right now I'm working on a script that would calculate dates from one calendar to another. The normal calendar we use and a newly invented one. In order to do that I need to find the exact days since the year 0 BC/AD. However, the functions php provides only allow up to the unix epoch. manual Calendar Functions -- 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] Can't save multiple files if I'm using values pulled from another file...
On Thursday 03 March 2005 19:53, Foofy wrote: I'm writing a script that transfers files from a list file and saves them locally. M If I use values from the list for the filenames of the saved files, it appears that none of the files are saved 'cept for the last one. If I put the values in an array directly in the script file, all is well. I have confirmed that the values are different and I've tried other methods to load the file, such as fgets. Here is a simplified version of my script that has the same problem: Thank you for helping others to help you by constructing a simplified example. ?php $linklist = file('links.txt'); file() - ... each element of the array corresponds to a line in the file, with the newline still attached ... That's most likely your problem. The last line of your file most likely does not have a trailing NL character that is why it is the only line that works. -- 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] Re: patch to php 4.3.10 to disabling URL wrappers in include like statements
On Wednesday 02 March 2005 22:03, Jason Barnett wrote: Tom Z. Meinlschmidt wrote: which disables using url wrappers in include/include_once/require/require_once statemens (switchable in http://php.net/manual/en/ini.php#ini.list allow_url_fopen = 0 I haven't had a look at the patch in question but from my understanding of the description above, after the application of the patch the filesystem functions (ie fopen and friends) should still be able to use URLs. Effectively it allows finer control over opening URLs. I would like to think that the OP wouldn't go to the trouble of creating a patch (for the latest release of PHP no less) for functionality that already exists! IIRC a request for something similar was made on the list some time ago. -- 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] Re: patch to php 4.3.10 to disabling URL wrappers in include like statements
On Thursday 03 March 2005 03:04, Richard Lynch wrote: Tom Z Meinlschmidt wrote: Tell me - how do you want to turn off remote includes and remain remote file working? Change the PHP source? That's the only viable answer I can think of; though I doubt it's one you want to hear/use. Sorry. Funnily enough I think you'll find that he did (change the source) :) allow_url_fopen turns off _both_. There's no choice what to disable Consider this: ?php eval(implode('',file(http://evilserver.example.com;))); ? So, like, what's the point to turning off only remote include and keeping remote file? I believe you're missing the point of the patch. It is to prevent people from injecting malicious remote locations in $somewhere: include($somewhere); Of course one should always validate $somwhere before using it but ... -- 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] hash issues
On Friday 25 February 2005 08:36, Erbacher Karl wrote: Thanks for your input, but I've played around with it and now it's uglier than ever. I'm very new to PHP, so I'm not sure what I'm missing here. I've done a few things to try to pinpoint the problem, but now I'm even more confused. Can you please look over what I've done and let me know if you see any mistakes or if you think there might be another problem? First, I created a test page where I hashed the values password1, password2 and password3 and echoed both the value and the hashed value back.For example: $val1 = password1; $hashVal1= bin2hex(mhash(MHASH_SHA1, $val1)); echo $val1 br $hashVal1 br; The output was fine (always consistent): password1 e38ad214943daad1d64c102faec29de4afe9da3d password2 2aa60a8ff7fcd473d321e0146afd9e26df395147 password3 1119cfd37ee247357e034a08d844eea25f6fd20f I saved the hashed values in the MySQL database so I could try to use them to log on. Then, I modified the login form and the page that processes the data to see if the problem was there. I included a message to see what values were being sent back to me. loginform.php: if (isset($message)) echo b$message/b; //create form input type='password' name='passUnhash' $fpass=bin2hex(mhash(MHASH_SHA1, $passUnhash)); You didn't read my reply to your original post on this same issue? When the form is first presented $passUnhash is empty, yet you're assigning it to $fpass. So first time round you're actually checking the hash for an empty password, second time round you're using the hash for password1 to check against username2, etc. [snip] username2, password2, e38ad214943daad1d64c102faec29de4afe9da3d (Second try) Notice that the hash looks suspiciously like 'password1'. -- 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] replace special characters
On Thursday 24 February 2005 16:14, Frank Arensmeier wrote: 1) replace .. with a string like file://server/folder 2) replace all \ characters with /. The PHP code looks something like: $path_to_file = ..\1 PDF Filer\65051.PDF; $path_to_file = '..\1 PDF Filer\65051.PDF'; Don't use double-quoted strings unless you *need* to. Ditto for the rest of your code. The big problem is the character \ which, if I got it right, in UNICODE is used for things like expressing line breaks ('\n' or something like this). \n is a newline character, however it has nothing to do with unicode, RTFM for details. The code above is resulting in the following error massage: Parse error: parse error, expecting `')'' in /xxx/xxx/xxx/TMPz06yoces6o.php on line 2. Switch to using a decent syntax highlighting editor and these types of errors will be immediately obvious. -- 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] hash issues
On Wednesday 23 February 2005 10:25, Erbacher Karl wrote: Here's my big problem... I created three seperate sample users with three different passwords (password1, password2, password3). When I go back to look at the table info in the database, it shows that all three of the passwords are exactly the same. I'm not sure why this is happening. I strongly suspect you're hashing an empty string. echo password [$password]; $pass=bin2hex(mhash(MHASH_SHA1, $password)); -- 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] Re: Minimalist permissions
On Wednesday 16 February 2005 23:30, Ugo Bellavance wrote: If the needed permissions for standard PHP files and directories are 'r' on files and 'r-x' on directories, how can I set my umask so that files and directories are always created as such? I looked up 'man umask' and it seems to treat files and directories the same way. Maybe that is impossible, but I logged in via FTP to a server of a web hosting company, and it implements just this: creates directories as rwxr-xr-x and files as rw-r--r--. chmod() after creating any directory or file. Another thing... how should I configure ownership on the files? root as owner, apache as group and no permissions for others? Depends very much on your particular setup. If you're on a dedicated server with all the virtual hosts owned by the same person then it doesn't really matter -- just have apache be the owner and the group. -- 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] Minimalist permissions
On Saturday 12 February 2005 11:28, Ugo Bellavance wrote: Please forgive me if this specific question has already been addressed, but I'm doing tests to figure out what are the minimal permissions I can give on my files and folders for a PHP application and I just can't find it (even by searching this list). Feel free to redirect me to existing documentation that I woule have missed, if needed. http://marc.theaimsgroup.com/?l=php-generalm=105793487024873w=2 -- 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