[PHP] a question about user and permission on linux

2010-10-31 Thread Ryan Sun
which user it is executed as when request a php script on browser?(suppose we are on a shared LAMP hosting) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] editing a file

2010-05-24 Thread Ryan Sun
yea, file_get_contents and file_put_contents are the easiest, but play with caution when dealing with large files, 'cause it loads the whole file into memory, fopen() fread() fwrite() can be used for large files. On Mon, May 24, 2010 at 5:56 PM, Rene Veerman rene7...@gmail.com wrote: On Mon, May

Re: [PHP] localize string (date)

2010-05-21 Thread Ryan Sun
Its either ur title is misleading or I'm misunderstanding is this what u want? $subject = 21-05-2010 Ideo urbs Venerabile superb post 12-02-2010 efferatarum latasque 12-02-10 leges gentium cervicis oppressed and fundamenta libertatis retinacula sempiterne Frugi velut parens and prudent and dives

Re: [PHP] How to get input from socket client

2010-05-20 Thread Ryan Sun
Thanks for your reply First, I don't think feof() will do what you think it does. I wouldn't expect it to show up until after the other end has actually closed the connection. I found unread_bytes in stream_get_meta_data should be more reliable TCP is a stream protocol, there are no

Re: [PHP] Re: how to overload accessible methods

2010-04-16 Thread Ryan Sun
thanks for all your reply, since all these classes have main entry in cron.php, I have moved validation there. Richard, your solution seems interesting, maybe I can use it later :) On Thu, Apr 15, 2010 at 4:46 AM, Richard Quadling rquadl...@googlemail.com wrote: On 13 April 2010 17:25, Ryan Sun

Re: [PHP] Include security?

2010-04-16 Thread Ryan Sun
if allow_url_include is turned off, you don't have to worry much about http, if '.' is a invalide char, you can't include *.php... the include path probably should be the inc(whatever the name) folder(not accessible from web) instead of the web root and '..' should be disallowed On Fri, Apr 16,

Re: [PHP] PHP and schedules tasks/events

2010-04-16 Thread Ryan Sun
you can setup a schedule table in db and have a cron php script check the db every time and send email if the current time is around the scheduled_at time and close the schedule after you send the email On Fri, Apr 16, 2010 at 5:35 PM, Adam Richardson simples...@gmail.com wrote: On Fri, Apr 16,

Re: [PHP] Array differences

2010-04-14 Thread Ryan Sun
Maybe this one works? array_diff(array_unique($array1 + $array2), array_intersect($array1, $array2)) On Wed, Apr 14, 2010 at 4:39 AM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Tue, 2010-04-13 at 23:01 -0600, Ashley M. Kirchner wrote: I have the following scenario:      $array1 =

[PHP] how to overload accessible methods

2010-04-13 Thread Ryan Sun
As we all know, __call() can overload non-accessible methods, eg. Class User { public function __call($name, $args) { //validate user $this-_validate(); $this-_{$name}($args); } private function _validate() { // } private

[PHP] Re: how to overload accessible methods

2010-04-13 Thread Ryan Sun
that they don't have to write more code and they won't miss this validate? On Tue, Apr 13, 2010 at 11:46 AM, Nathan Rixham nrix...@gmail.com wrote: Ryan Sun wrote: As we all know, __call() can overload non-accessible methods, eg. Class User {     public function __call($name, $args

[PHP] Re: how to overload accessible methods

2010-04-13 Thread Ryan Sun
wrote: Ryan Sun wrote: I'm writing an abstract parent class which only contain a validate method, other developers will extend this class and add many new public methods, every new methods will need to perform a validate first.  Won't it be good if validate get called automatically before every

Re: [PHP] Sort two coupled arrays {my solution]

2010-04-07 Thread Ryan Sun
rsort(array_combine(array2, array1)); you should expect array( 'Personal Email' = 75, 'USPS mail' = 40, 'Personal Phone' = 31, 'Web site' = 31, 'Text Message' = 31 ) logically, the items are your key but not the count of votes On Wed, Apr 7, 2010 at 6:29 PM, tedd

Re: [PHP] PHP MySQL Insert Statements

2010-03-16 Thread Ryan Sun
Always make sure your dynamic sql string in php code are as expected var_dump($sql) before query On Thu, Mar 11, 2010 at 10:13 PM, Martine Osias webi...@gmail.com wrote: Hi, My insert statements on this web page don't execute. The select statements do work. This tells me that the database

Re: [PHP] best way to set up an include path for a multi-level project?

2010-03-16 Thread Ryan Sun
On Tue, Mar 16, 2010 at 1:57 PM, Robert P. J. Day rpj...@crashcourse.ca wrote: and all PHP scripts would start off with something like: set_include_path(get_include_path() . PATH_SEPARATOR . getenv('PROJ_DIR')); just utilize include_path directive in php.ini -- PHP General Mailing List

Re: [PHP] Database vs. Array

2010-03-16 Thread Ryan Sun
Maybe you want to optimize your script first, and I don't think read entire data set into array would save you much time. Don't create new variables when its unnecessary, cache data when its necessary, try memcached, and I think heavy php cli scripts are always likely to resume a lot of

[PHP] long polling solution for LAMP with limited privilege

2010-03-15 Thread Ryan Sun
I wonder if you guys have a long-polling(http://meteorserver.org/interaction-modes/) solution for a shared hosting(eg. hostmonster) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] how to download files require login

2010-03-01 Thread Ryan Sun
For URLs like 'http://download.fotolia.com/DownloadContent/1/h7G0bWGsGof8VvSqw32xFZ0KvD5eqbvN', it requires user login to download. Then how do I download it remotely via php server if I have the username and password in hand? -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

Re: [PHP] Help preserving sentence structure

2010-02-26 Thread Ryan Sun
http://us.php.net/manual/en/function.htmlentities.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] FTP Site

2010-02-16 Thread Ryan Sun
I think you will need the help from a client side app, like java applet or flash, php can transfer file from your web server to your ftp server but people will have difficulty uploading file via bare browser On Tue, Feb 16, 2010 at 3:12 PM, Ben Miller biprel...@gmail.com wrote: Hi, I'm

Re: [PHP] How to secure this

2010-02-12 Thread Ryan Sun
authenticate by remote domain name or remote ip $_SERVER['HTTP_REFERER'] then your clients will not have to put their username/password in clear text http://www.mydomain.com?h=300w=250 and you will just check if you have their domain on your list I'm not sure if there is better one but

Re: [PHP] How to secure this

2010-02-12 Thread Ryan Sun
In that case, referer is for authentication, and id is for authorization, I think On Fri, Feb 12, 2010 at 6:23 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Fri, 2010-02-12 at 18:25 -0500, Ryan Sun wrote: authenticate by remote domain name or remote ip $_SERVER['HTTP_REFERER

[PHP] create archive file in memory with zipArchive class

2010-02-09 Thread Ryan Sun
I want to generate credential zip file for user on the fly with zipArchive and render it for download, so I created following code - $zip = new ZipArchive(); $filename = '/tmp/xxx.zip'; if ($zip-open($filename, ZIPARCHIVE::CREATE)!==TRUE) {   

Re: [PHP] create archive file in memory with zipArchive class

2010-02-09 Thread Ryan Sun
thanks, Richard, maybe you are right, the actual file name is not my job I changed it to 'php://temp' but its still the same, nothing has been changed... On Tue, Feb 9, 2010 at 11:13 AM, Richard Quadling rquadl...@googlemail.com wrote: On 9 February 2010 15:42, Ryan Sun ryansu...@gmail.com wrote

Re: [PHP] Magento shopping cart

2010-02-02 Thread Ryan Sun
Your designer will definitely be able to skin it, it has multi template and skin system, is easy to customize css, images, and html code for each block However, for changing the layout (position of each block), it will require your designer have a little knowledge on Mage's xml layout system

Re: [PHP] Multiple Class Inheritance

2010-01-27 Thread Ryan Sun
1, you can implement multiple interfaces 2, you may want to return object instead of extending classes, eg. class Small_Class_Abstract { public function getFormGeneration() { return new Form_Generation(); } } class Small_Class_A extends Small_Class_Abstract { } $A = new Small_Class_A();

Re: [PHP] Creating an Entire .html page with PHP

2010-01-26 Thread Ryan Sun
Isn't there a framework doing that? On Mon, Jan 25, 2010 at 8:00 PM, deal...@gmail.com deal...@gmail.comwrote: Hi Folks, I would like to create an entire .html page gathered from database content mixed with html etc. and be able to save the page... like: --- save all this pre made

Re: [PHP] MySQL ID -- what happens when you run out of range?

2010-01-25 Thread Ryan Sun
For such a large data set, they would split into several sub tables, otherwise the performance will be horrible On Mon, Jan 25, 2010 at 3:39 PM, Robert Cummings rob...@interjinn.comwrote: Parham Doustdar wrote: Hello there, A friend called me today and was wondering what happens if the ID

Re: [PHP] integrating shipping with shopping cart site - OT

2010-01-20 Thread Ryan Sun
Just use the shipping rate web service of your client's shipping carrier why border building a custom shipping rate calculator On Wed, Jan 20, 2010 at 10:24 AM, Angelo Zanetti ang...@zlogic.co.zawrote: Thanks guys, yes in general we will go with a lookup for each country, it wont be accurate

Re: [PHP] PHP and javascript

2010-01-15 Thread Ryan Sun
I don't think you can call php cli from client javascript unless you have a wrapper http interface On Fri, Jan 15, 2010 at 2:07 PM, Andres Gonzalez and...@packetstorm.comwrote: How do I call PHP code that will run server side, from javascript code that is running client side? I have a lot of

Re: [PHP] Display just 1 record in a query

2010-01-12 Thread Ryan Sun
though you can fetch twice to get the 2nd row $row_cur = mysql_fetch_assoc($cur); //skip 1st row $row_cur = mysql_fetch_assoc($cur); echo $row_cur['tid']; you should really modify your sql statement, like 'select xxx from xx order by xx limit 1, 1' (limit 1,1 retrieve your 2nd row if you are

Re: [PHP] Formatting Decimals

2010-01-11 Thread Ryan Sun
$newprice = sprintf($%.2f, 15.109); On Sun, Jan 10, 2010 at 8:36 PM, Rick Dwyer rpdw...@earthlink.net wrote: Hello List. Probably an easy question, but I am not able to format a number to round up from 3 numbers after the decimal to just 2. My code looks like this: $newprice =

Re: [PHP] Question about using JSON_ENCODE()

2010-01-08 Thread Ryan Sun
Yup, you put result in an array $result = array('status' = 'good'); and return encoded string return Json_Encode($result); your client will get a string '{status: good}' and you use your client tech(eg. javascrpt) to decode this string and finall get an object On Fri, Jan 8, 2010 at 3:43 PM,

Re: [PHP] POLL: To add the final ? or not...

2010-01-08 Thread Ryan Sun
if you use the newest PDT, you will find that a new php file has no final ? I vote for your co-worker [?] On Fri, Jan 8, 2010 at 3:49 PM, LinuxManMikeC linuxmanmi...@gmail.comwrote: http://framework.zend.com/manual/en/coding-standard.html#coding-standard.overview.scope This document provides

Re: [PHP] json_last_error

2009-12-04 Thread Ryan Sun
json_decode (PHP 5 = 5.2.0, PECL json = 1.2.0) so json_decode will be avaliable for php 5.2.0+ php is open source, I believe you can get an idea from their C source On Fri, Dec 4, 2009 at 2:16 PM, Jim Lucas li...@cmsws.com wrote: Kirby Bakken wrote: None of the servers I run on have PHP

Re: [PHP] Powerpoint from PHP?

2009-12-02 Thread Ryan Sun
php on windows server may have the capability... On Wed, Dec 2, 2009 at 11:30 AM, Skip Evans s...@bigskypenguin.com wrote: Yeah, from Googling around I'm getting the impression there is not a PHP library capable of doing this. I guess the next best thing we can do is just let them download

Re: [PHP] Disabling button onclick in IE

2009-12-01 Thread Ryan Sun
Andrew is right, another solution is to move your code from onclick to onsubmit event, form name=ticket_form onsubmit=this.submit.disabled=true; On Tue, Dec 1, 2009 at 4:06 PM, Skip Evans s...@bigskypenguin.com wrote: Hey all, You probably remember me asking about disabling a submit button

Re: [PHP] Create client certificate with openssl

2009-11-25 Thread Ryan Sun
check these options *-pass arg, -passin arg* the PKCS#12 file (i.e. input file) password source. For more information about the format of *arg* see the *PASS PHRASE ARGUMENTS* section in * openssl*(1) http://www.openssl.org/docs/apps/openssl.html#. *-passout arg* pass phrase source to encrypt