[PHP] FW: No Subject

2013-03-16 Thread Ryan S
http://www.coachholidays.co.uk/ramlm/hfoqauyyvomdvio.kaxkucbebccxpzq



Re: [PHP] Need Part-time Coder

2011-12-27 Thread Ryan Cunningham
How can I get in touch thats the best code I have seen for a long time LMOA

On Tue, Dec 27, 2011 at 6:03 PM, Paul Halliday paul.halli...@gmail.comwrote:

 On Tue, Dec 27, 2011 at 6:55 PM, Fatih P. fatihpirist...@gmail.com
 wrote:
  On Wed, Dec 28, 2011 at 12:54 AM, Ashley Sheridan
  a...@ashleysheridan.co.ukwrote:
 
  On Tue, 2011-12-27 at 17:29 -0500, John R. Cornell II wrote:
 
   Email PHP sample for consideration
 
 
  ?php
  echo hello world;
  ?
 
  Reply to list with a few more details for a more detailed reply ;)
 
 
  ?php echo  ;) ; ?

 ?php
 $a = array('he', 'llo', ' ', 'w', 'orld', '!');
 for($i = 0, $ln = sizeof($a); $i  $ln; ++$i) { echo $a[$i]; }
 ?

 --
 Paul Halliday
 http://www.squertproject.org/

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 

Regards
*Ryan Cunningham*
Owner
Construct Media Web Development / SEO / SMMhttp://www.constructmedia-usa.com
Office: 352 671 7868 Cell: 352 857 2040

Twitter http://www.twitter.com/constructmedia |
Facebookhttp://www.facebook.com/RyanCunninghamUSA| Google
Profile https://plus.google.com/116504326755759708880 | Linked
inhttp://www.linkedin.com/in/constructmedia| Client
Support Desk http://constructmedia-usa.com/ostic/
http://www.facebook.com/RyanCunninghamUSA

Don't think you are. Know you are!.




The information contained in this message may be privileged, confidential,
and protected from disclosure. If the reader of this message is not the
intended recipient, or any employee or agent responsible for delivering
this message to the intended recipient, you are hereby notified that any
dissemination, distribution, or copying of this communication is strictly
prohibited. If you have received this communication in error, please notify
us immediately by replying to the message and deleting it from your
computer. Thank you. Construct Media. CMI © 2006-2011

Please note all photo images should be sent in the largest highest quality
format you have available, you also verify in sending the images they are
free from copyright and usage terms and that you are the owner of such art
work and are legally allowed to use this material. You agree that in
supplying the artwork to Construct Media you shall not hold CMI responsible
for any copyright infringement and or violation that may result from the
finished article or any part there of. You also agree to allow Construct
Media to use the images, and or manipulate them for artistic use in your
work. You also agree that your work may be used in the capacity of previous
work, Portfolio, or web examples to showcase our clients, in return for
this usage all links to your URL will always remain in tact and you shall
benefit from the free advertising.Construct Media. © CMI 2006-2011


Re: [PHP] is there a static constructor?

2011-03-30 Thread Ryan
There is such thing, but its not called static constructor, its called 
singleton pattern

class SingletonA
{
  public static instance;
  public SingletonA(){}
  public static function getInstancce()
  {
if(self::instance != null)
{
  return self::instanc;
}
return new SingletonA();
  }
}

On 3/31/2011 12:56 AM, D. Dante Lorenso wrote:

All,

I want to build a config file class that gets called statically.  Is 
there such a thing as a static constructor?  Example:


class Daz_Config {
  public static function load() {
...
  }
  public static function get($key) {
self :: load();
...
  }
}

Daz_Config :: get('myvalue');

I want to call the load function when the class is used for the first 
time.  If no code ever calls Daz_Config :: get(...) then I never 
want to invoke load() but if it does get called, I only want to call 
load() once before the class is used further.


Anyone know how to do this with calling load() at the top of all the 
other functions and writing a load() function that exits early if 
already loaded?


-- Dante




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] gzdeflate and file_get_contents memory leak?

2011-01-09 Thread Ryan Reading
I have a download script that streams the contents of multiple files
into a zip archive before passing it on the to browser to be
downloaded.  The script uses file_get_contents() and gzdeflate() to
loop over multiple files to create the archive.  Everything works
fine, except I have noticed that for a large number of files, this
script will exceed the php memory limit.  I have used
memory_get_peak_usage() to narrow down the source of the high memory
usage and found it to be the two above methods.  The methods are used
in a loop and the variable containing the file data is unset() and not
referenced in between calls.  The script peak memory usage for the
script should be a function of the single largest file that is
included in the archive, but it seems to be the aggregate of all
files.

Here is the pseudo-code for this loop:

header( /* specify header to indicate download */ );
foreach( $files as $file )
{
  echo zip_local_header_for($file);
  $data = file_get_contents( $file )
  $zdata = gzdeflate( $data );
  unset($data);
  unset($zdata);
}
echo zip_central_dir_for($files);

If I remove either the gzdeflate and replace the file_get_contents()
with a fread() based method, the script no longer experiences memory
problems.

Is this behavior as designed for these two functions (because PHP
scripts are usually short lived)?  Is there a way to get them to
release memory?  Is there something I'm missing?   Thanks.

-- Ryan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[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 24, 2010 at 11:16 PM, Andres Gonzalez
 and...@packetstorm.com wrote:
 I have a large C source file that is generated by a separate
 source-generating program. When the generated src file is compiled, it
 produces tons of warnings. I want to edit the generated src file and delete
 the offending lines.

 What is the easiest way using a PHP script to read in a file, search for a
 particular signature, and delete a couple of lines? Seems like this would be
 very easy in PHP.

 file_get_contents() to get the file into a $string.

 preg_match_all(,,$matches) to get to what you need,

 str_replace() to replace $matches with your chosen replacements

 and there you are :)

 file_put_contents() to save the results..


 Thanks,

 -Andres

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





 --
 -
 Greetings from Rene7705,

 My free open source webcomponents:
  http://code.google.com/u/rene7705/
  http://mediabeez.ws/downloads (and demos)

 http://www.facebook.com/rene7705
 -

 --
 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] 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 Caesaribus tamquam 25-04-2010 liberis am regendi
patrimonii swore permitted21-05-2010;
$dateReg = '/[\D]\d{2}[.-]\d{2}[.-](\d{2}|\d{4})[\D]/';
preg_match_all($dateReg, ' '. $subject . ' ', $match);
array_walk($match[0], 'myGetDate');
var_dump($match[0], 1);
function myGetDate($str)
{
$str = substr($str, 1, strlen($str) - 2);
}

On Fri, May 21, 2010 at 3:12 PM, Mickael MONSIEUR
mickael.monsi...@gmail.com wrote:
 Le 21/05/10 21:00, Ashley Sheridan a écrit :

 On Fri, 2010-05-21 at 20:51 +0200, Mickael MONSIEUR wrote:

 hello
 I want to find a date in a text how to? format: XX-XX-

 Example:

 Ideo urbs Venerabile superb post 12-02-2010 efferatarum latasque leges
 gentium cervicis oppressed and fundamenta libertatis retinacula
 sempiterne Frugi velut parens and prudent and dives Caesaribus tamquam
 25-04-2010 liberis am regendi patrimonii swore permitted.

 Return:

 12-12-2010
 25-04-2010

 Thank you for your help.
 Mickael.


 What sort of format is that date, English or American?

 For example: dd-mm- or mm-dd-?

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk


 Hi,

 The principle is to detect the possible dates in French texts.

 The formats can be varied ...

 examples
 02.12.1991, 02/12/1991, 12-02-1991, ... or 2 digit (max 1 char ./-) 2 digit
 (max 1 char ./- ) 4 OR 2 digit (1991 Or 91) :-)

 Br,



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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 guarantees about delivering a complete message in one read, or
 that two writes won't be read together. It only guarantees that all
 octets will eventually be delivered in the same order they were sent, or
 you will get an error.

thanks 4 pointing out the difference between tcp and udp, I had learnt a lot ^^

The other problem has to do with thinking an fread() will always give
you everything you sent in an fwrite()
Interestingly, I use 'telnet 127.0.0.1 1037' for testing later(on
windows) and everything works, the php server got the input from
telnet client, so I assume there is something wrong in the php client,
the fwrite statement...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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 ryansu...@gmail.com wrote:
 this is a class for corntab job, and the validation is very simple,
 just check if the status of user is active when cron job runs, if not,
 throws an exception, other developers won't want to overwrite this
 validation.
 which method of user class will be called is configurable via website
 backed page(we write the name of methods directly in to  schedule
 table).
 Using private methods will solve the problem but since we write public
 methods for all the other cron classes, I just want to keep the style
 to make less confusion.

 On Tue, Apr 13, 2010 at 12:11 PM, Nathan Rixham nrix...@gmail.com 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 method call so that they don't have to write more code and they
 won't miss this validate?

 This may call for a back to roots approach, what exactly are you trying
 to accomplish, as in: what is the validation doing?

 perhaps if we see the full picture, we can recommend another perhaps
 more suited approach to the full thing, feel free to post the full code
 if you want / can, the more info the better!

 Regards,

 Nathan


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



 Would this be better ...

 abstract class baseValidate() {
  final public function __construct($params) {
  // Determine if user is active.
  // If OK, then call abstract function postConstruct($params)
  }

  abstract function postConstruct($params);
 }


 You can't override the constructor, so the validation will always be
 called. The developer's can implement their own postConstruct as if
 they where extending __construct.



 --
 -
 Richard Quadling
 Standing on the shoulders of some very clever giants!
 EE : http://www.experts-exchange.com/M_248814.html
 EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 ZOPA : http://uk.zopa.com/member/RQuadling


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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, 2010 at 4:09 PM, Micky Hulse mickyhulse.li...@gmail.com wrote:
 Hi,

 Code:

 =

 ob_start();
 switch ($this-command)
 {
       case 'include':
               @include($x);
               break;
       default:
               @readfile($x);
 }
 $data = ob_get_contents();
 ob_end_clean();

 =

 The above code snippet is used in a class which would allow developers
 (of a specific CMS) to include files without having to put php include
 tags on the template view.

 The include path will be using the server root path, and the include
 files will probably be stored above the web root.

 My question:

 What would be the best way to clean and secure the include string?

 Maybe something along these lines (untested):

 $invalidChars=array(.,\\,\,;); // things to remove.
 $include_file = strtok($include_file,'?'); // No need for query string.
 $include_file=str_replace($invalidChars,,$include_file);

 What about checking to make sure the include path is root relative,
 vs. http://...?

 What do ya'll think? Any suggestions?

 Many thanks in advance!

 Cheers,
 Micky

 --
 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] 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, 2010 at 5:15 PM, Don Wieland d...@dwdataconcepts.comwrote:

 On Apr 16, 2010, at 1:26 PM, Bastien Koert wrote:

  Run a cronjob at midnight and send the email. Track who it got sent
 to, so you don't duplicate it. Easy peasy!


 This is fine if the email is to be sent at midnight.

 I am looking for more refinement.

 For example:

 A user signs up for an event - 4/16/2010 @ 10:45am

 There is an option:

 Send me a reminder email X minutes/hours/days/weeks/months/years prior to
 the Event.

 so:

 30 minute(s) = email sent at 4/16/2010 @ 10:15am
 2 hour(s) = email sent at 4/16/2010 @ 8:45am
 3 day(s) = email sent at 4/13/2010 @ 10:45am
 1 week(s) = email sent at 4/9/2010 @ 10:45am
 1 month(s) = email sent at 3/16/2010 @ 10:45am
 1 year(s) = email sent at 4/16/2009 @ 10:45am

 This is really what I need...


 Don Wieland
 D W   D a t a   C o n c e p t s
 ~
 d...@dwdataconcepts.com
 Direct Line - (949) 305-2771

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 What about making ics files available for download?  Users could easily
 import the event into the calendar of choice, and they could also (using the
 calendar software they're already familiar with) set the alarm.  For
 instance, I can set the calendar on my cell to ring my phone to alert me to
 events (my preference over email reminders for important events because I
 sometimes get flooded with email.)

 Your scripts could generate the files containing event info and then
 automatically start the download.

 This allows the users to determine the mode of alarm that works best for
 them in their native calendar app, and you're still greatly facilitating the
 process by providing all of the info so they merely have to drag and drop
 for many apps.

 I realize you asked specifically for a server-side email alarm solution (I
 apologize for the tangent if your needs preclude this type of approach), but
 I thought I'd toss out the idea as this approach has proved more effective
 and efficient for websites I maintain.

 Adam

 --
 Nephtali:  PHP web framework that functions beautifully
 http://nephtaliproject.com


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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 = array(12, 34, 56, 78, 90);

      $array2 = array(12, 23, 56, 78, 89);



      $result = array_diff($array1, $array2);



      print_r($result);





 This returns:



      Array

      (

          [1] = 34

          [4] = 90

      )





 However what I really want is a two-way comparison.  I want elements that
 don't exist in either to be returned:



 34 and 90 because they don't exist in $array2, AND 23 and 89 because they
 don't exist in $array1.  So, is that a two step process of first doing an
 array_diff($array1, $array2) then reverse it by doing array_diff($array2,
 $array1) and merge/unique the results?  Any caveats with that?



      $array1 = array(12, 34, 56, 78, 90);

      $array2 = array(12, 23, 56, 78, 89);



      $diff1 = array_diff($array1, $array2);

      $diff2 = array_diff($array2, $array1);



      $result = array_unique(array_merge($diff1, $diff2));



      print_r($result);





 -- A



 I don't see any problems with doing it that way. This will only work as
 you intended if both arrays have the same number of elements I believe,
 otherwise you might end up with a situation where your final array has
 duplicates of the same number:

 $array1 = $array(1, 2, 3, 4, 5, 6);
 $array2 = $aray(1, 3, 2, 5);

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[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 function _update($args)
{
//
}
}

$user = new User();
$user-update() // will call _validate before _update automatically

BUT, if I want to make this update a public function, how can I call
the validate without call it inside update function explicitly?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: how to overload accessible methods

2010-04-13 Thread Ryan Sun
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 method call so 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)
     {
         //validate user
         $this-_validate();

         $this-_{$name}($args);
     }
     private function _validate()
     {
         //
     }
     private function _update($args)
     {
         //
     }
 }

 $user = new User();
 $user-update() // will call _validate before _update automatically

 BUT, if I want to make this update a public function, how can I call
 the validate without call it inside update function explicitly?


 why would you want to, is there a technical reason for wanting magic
 functionality instead of normal functionality (+ wouldn't it make the
 code much easier to maintain and debug if developers can see what is
 called where, instead of just magic).

 to answer though, you're best bet is probably to make an abstract class
 with magic functionality and then extend with an implementing public class.

 abstract class MagicUser
 {
    public function __call($name, $args)
    {
        //validate user
        $this-_validate();
        $this-_{$name}($args);
    }

    private function _validate()
    {
        //
    }
    private function _update($args)
    {
        //
    }
 }

 class User extends MagicUser
 {
    public function update($args)
    {
        parent::update($args);
    }
 }



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: how to overload accessible methods

2010-04-13 Thread Ryan Sun
this is a class for corntab job, and the validation is very simple,
just check if the status of user is active when cron job runs, if not,
throws an exception, other developers won't want to overwrite this
validation.
which method of user class will be called is configurable via website
backed page(we write the name of methods directly in to  schedule
table).
Using private methods will solve the problem but since we write public
methods for all the other cron classes, I just want to keep the style
to make less confusion.

On Tue, Apr 13, 2010 at 12:11 PM, Nathan Rixham nrix...@gmail.com 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 method call so that they don't have to write more code and they
 won't miss this validate?

 This may call for a back to roots approach, what exactly are you trying
 to accomplish, as in: what is the validation doing?

 perhaps if we see the full picture, we can recommend another perhaps
 more suited approach to the full thing, feel free to post the full code
 if you want / can, the more info the better!

 Regards,

 Nathan


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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 tedd.sperl...@gmail.com wrote:
 At 5:35 PM -0400 4/7/10, Andrew Ballard wrote:

 On Wed, Apr 7, 2010 at 5:02 PM, Paul M Foster pa...@quillandmouse.com
 wrote:
 Array indexes have to be unique regardless of whether they are numeric
 or strings.

 Ahhh, so you start to see the problem, eh?

 Let's look at the problem again (a vote collection problem):

 Array 1
 (
    [1] = 75
    [2] = 31
    [3] = 31
    [4] = 31
    [5] = 40
 )

 Array 1 is an array that contains the count of votes ($votes[] ) for the
 index. IOW, index 1 received 75 votes.

 Array 2
 (
    [1] = Personal Email
    [2] = Personal Phone
    [3] = Web site
    [4] = Text Message
    [5] = USPS mail
 )

 Array 2 is an array that contains the names for the items ($items[] ) voted
 upon. As such, index 1 (Personal Email) received 75 votes.

 Now, I have this data in two different arrays and I wanted to combine the
 data into one array and then preform a descend sort.

 This is the way I solved it:

 $final = array();

 for($i =1; $i =5; $i++)
   {
   $final[$i][] = $votes[$i];
   $final[$i][] = $items[$i];
   }

 echo(pre);
 echo('br');
 print_r($final);
 echo('br');

 array_multisort($final, SORT_DESC);

 echo('br');
 print_r($final);
 echo('br');
 echo(/pre);

 I was hoping that someone might present something clever.

 Cheers,

 tedd


 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] 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 connection is working. The username
 and password are the administrator's. What else could prevent the insert
 statements from executing?

 Thank you.


 Martine

 --
 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] 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 (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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 
resource, I think GC of php is not so reliable... or maybe I don't know 
how to use it.


On 3/16/2010 7:13 PM, Richard S. Crawford wrote:

I have a script that connects to an external database to process about 4,000
records. Each record needs to be operated on pretty heavily, and the script
overall takes about half an hour to execute. We've hit a wall where the
script's memory usage exceeds the amount allocated to PHP. I've increased
the allotted memory to 32MB, but that's not ideal for our purposes.

So my thought is, would it be more efficient, memory-wise, to read the
database entries into an array and process the array records, rather than
maintain the database connection for the entire run of the script. This is
not an issue I've come across before, so any thoughts would be much
appreciated.

Thanks in advance.

   



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[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] xoops

2010-03-04 Thread Ryan Cunningham
Hi all

I am fairly new to the forum but I have a question that maybe I could get
some input on, I have a client that is looking to run a new informational
site. The basis of which allows visitors to post up their events or
functions for free, the site will be geographically based by area, ie one
for New York one for New Jersy etc.

End user posts their article for their restaurant or gig bake sale etc, they
can post pics and video as well as text all for free. site needs to include
advertising areas for the income revenue stream portion of the site so would
need rotating banner ads and headers etc.

My client has been advised to use Xoops, I have not used xoops before, I am
familiar with CMS from using Magento but obviously this is more leaning
toward e commerce than informational. The site needs to be self managing as
far as content, just with a moderator approving the postings. any feedback
or maybe suggestions as to any other OS or PHP driven I could look at using
or implementing for this site would be greatly appreciated. I need something
stable and also expandable as there are many major corporate sponsors in the
wings for this project, ie ATT, Dell etc etc

-- 
-- 
Regards

Ryan Cunningham
1 352 624 3262
constructme...@gmail.com
www.constructmedia.com

The information contained in this message may be privileged, confidential,
and protected from disclosure. If the reader of this message is not the
intended recipient, or any employee or agent responsible for delivering this
message to the intended recipient, you are hereby notified that any
dissemination, distribution, or copying of this communication is strictly
prohibited. If you have received this communication in error, please notify
us immediately by replying to the message and deleting it from your
computer. Thank you. Construct Media. CMI 2008

Please note all photo images should be sent in the largest highest quality
format you have available, you also verify in sending the images they are
free from copyright and usage terms and that you are the owner of such art
work and are legally allowed to use this material. You agree that in
supplying the artwork to Construct Media you shall not hold CMI responsible
for any copyright infringement and or violation that may result from the
finished article or any part there of. You also agree to allow Construct
Media to use the images, and or manipulate them for artistic use in your
work. You also agree that your work may be used in the capacity of previous
work, Portfolio, or web examples to showcase our clients, in return for this
usage all links to your URL will always remain in tact and you shall benefit
from the free advertising.Construct Media. © CMI 2006-2010


[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, visit: http://www.php.net/unsub.php



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 building a site for a client that has a need to allow their users to
 upload large files (up to 100mb or more) and store them on the server.  I've
 never had a need to work with PHP's FTP functions until now and, before I go
 reading the manual to learn how, I wanted to see if this something that I
 can handle with just PHP, or if I'm going to need to adopt a third party
 Ajax app or something like that?  Any thoughts or even a point in the right
 direction would be greatly appreciated.  Thanks,



 Ben



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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
 'HTTP_REFERER'
The address of the page (if any) which referred the user agent to
the current page. This is set by the user agent. Not all user agents
will set this, and some provide the ability to modify HTTP_REFERER as
a feature. In short, it cannot really be trusted. 


On Fri, Feb 12, 2010 at 4:26 PM, Robert Cummings rob...@interjinn.com wrote:
 Ashley Sheridan wrote:

 On Fri, 2010-02-12 at 16:12 -0500, Robert Cummings wrote:

 John Allsopp wrote:

 Hi everyone

 There may be blinding bits of total ignorance in this so don't ignore
 the obvious.

 This is a security question, but a sentence of background: I'm writing
 software for a mapping/location website and I want to be able to provide
 something others can plug into their website that would display their map.

 So I'm providing a URL like
 http://www.mydomain.com?h=300w=250username=namepassword=password

 The idea is they can define their own height and width and it plugs in
 as an iframe.

 That takes the username and password and throws it over web services to
 get back the data from which we can create the map.

 My question (and it might be the wrong question) is how can I not give
 away the password to all and sundry yet still provide a self-contained URL?

 MD5() (or SHA()) hash the information and supply that along with the
 settings. Then you know it was generated by your site. So you can do the
 following:

 ?php

 $height = 300;
 $width = 250;
 $username = 'username';
 $key = md5( SECRET_SALT-$heigh-$width-$username );

 $url =
 http://www.mydomain.com?h=$heightw=$widthusername=$usernamekey=$key;;

 ?

 Then when you get this URL via the iframe, you re-compute the expected
 key and then compare it against the given key. Since only you know the
 SECRET_SALT value then nobody should be able to forge the key.

 Cheers,
 Rob.
 --
 http://www.interjinn.com
 Application and Templating Framework for PHP



 What about requiring them to sign in the first time to use your service,
 and then give them a unique id which i tied to their details. You could
 then get them to pass across this id in the url. You could link their
 account maybe to some sorts of limits with regards to what they can
 access maybe?

 Presumably they ARE logged in when you create this URL for them... otherwise
 someone else could generate it :)

 Cheers,
 Rob.
 --
 http://www.interjinn.com
 Application and Templating Framework for PHP

 --
 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] 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']

 then your clients will not have to put their username/password in clear 
 texthttp://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
  'HTTP_REFERER'
 The address of the page (if any) which referred the user agent to
 the current page. This is set by the user agent. Not all user agents
 will set this, and some provide the ability to modify HTTP_REFERER as
 a feature. In short, it cannot really be trusted. 


 On Fri, Feb 12, 2010 at 4:26 PM, Robert Cummings rob...@interjinn.com wrote:
  Ashley Sheridan wrote:
 
  On Fri, 2010-02-12 at 16:12 -0500, Robert Cummings wrote:
 
  John Allsopp wrote:
 
  Hi everyone
 
  There may be blinding bits of total ignorance in this so don't ignore
  the obvious.
 
  This is a security question, but a sentence of background: I'm writing
  software for a mapping/location website and I want to be able to provide
  something others can plug into their website that would display their 
  map.
 
  So I'm providing a URL like
  http://www.mydomain.com?h=300w=250username=namepassword=password
 
  The idea is they can define their own height and width and it plugs in
  as an iframe.
 
  That takes the username and password and throws it over web services to
  get back the data from which we can create the map.
 
  My question (and it might be the wrong question) is how can I not give
  away the password to all and sundry yet still provide a self-contained 
  URL?
 
  MD5() (or SHA()) hash the information and supply that along with the
  settings. Then you know it was generated by your site. So you can do the
  following:
 
  ?php
 
  $height = 300;
  $width = 250;
  $username = 'username';
  $key = md5( SECRET_SALT-$heigh-$width-$username );
 
  $url =
  http://www.mydomain.com?h=$heightw=$widthusername=$usernamekey=$key;;
 
  ?
 
  Then when you get this URL via the iframe, you re-compute the expected
  key and then compare it against the given key. Since only you know the
  SECRET_SALT value then nobody should be able to forge the key.
 
  Cheers,
  Rob.
  --
  http://www.interjinn.com
  Application and Templating Framework for PHP
 
 
 
  What about requiring them to sign in the first time to use your service,
  and then give them a unique id which i tied to their details. You could
  then get them to pass across this id in the url. You could link their
  account maybe to some sorts of limits with regards to what they can
  access maybe?
 
  Presumably they ARE logged in when you create this URL for them... otherwise
  someone else could generate it :)
 
  Cheers,
  Rob.
  --
  http://www.interjinn.com
  Application and Templating Framework for PHP
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 



 I think Google does both the referrer check coupled with an id passed in
 the URL. At least, this is what it did the last time I embedded one of their
 maps.


   Thanks,
 Ash
 http://www.ashleysheridan.co.uk





[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) {
 throw new Exception();
}
if($zip)
{
    $zip-addFromString('xxx.xx', $fileString);
}
$zip-close();
$fileString = file_get_contents($filename);
unlink($filename);

$this-getResponse()-setHeader('Content-Type', 'application/zip');
$this-getResponse()-setHeader('Content-Disposition','attachment;filename=xxx.zip');
$this-getResponse()-setBody($fileString);
-
it works, but I think creating the file in memory is a better
approach, so I changed the 2nd lineI(using php 5.2.0) to
$filename = 'php://temp/xxx.zip';
then the php just won't archive the file and the file downloaded is
just a plain text file.

so
question 1, how to create zip Archive file in memory on the fly and
download it (I don't have to save it on disk)?
question 2, if there is no way to create in memory, is it safe to just
unlink() the file?

thanks in advance.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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:
 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) {
  throw new Exception();
 }
 if($zip)
 {
     $zip-addFromString('xxx.xx', $fileString);
 }
 $zip-close();
 $fileString = file_get_contents($filename);
 unlink($filename);

 $this-getResponse()-setHeader('Content-Type', 'application/zip');
 $this-getResponse()-setHeader('Content-Disposition','attachment;filename=xxx.zip');
 $this-getResponse()-setBody($fileString);
 -
 it works, but I think creating the file in memory is a better
 approach, so I changed the 2nd lineI(using php 5.2.0) to
 $filename = 'php://temp/xxx.zip';
 then the php just won't archive the file and the file downloaded is
 just a plain text file.

 so
 question 1, how to create zip Archive file in memory on the fly and
 download it (I don't have to save it on disk)?
 question 2, if there is no way to create in memory, is it safe to just
 unlink() the file?

 thanks in advance.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



 According to http://docs.php.net/manual/en/wrappers.php.php, it looks
 like you should be using ...

 $filename = 'php://temp';

 That's it.

 The actual file name is not your job.



 --
 -
 Richard Quadling
 Standing on the shoulders of some very clever giants!
 EE : http://www.experts-exchange.com/M_248814.html
 EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 ZOPA : http://uk.zopa.com/member/RQuadling


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Help with regex (search/replace) please

2010-02-06 Thread Ryan S
Hey guys,

As many of you might know, i totally suck at regex..so would really appreciate 
some help here.

Basically i have a html page with a lot of textboxes,radios,checkboxes etc 
i need your help in the form of a regex so that when i give it the name and 
value it gives me the entire code of that checkbox.
for example here are 2 checkboxes:

input type=checkbox name=something value=1 /

input type=checkbox name=something2 value=2 id=something 
onClick=javascript_code_etc() onSomething=lots of js cod here() /



so if i want the second checkbox code i was thinking of something like this:

$the_name=something2;
$the_value=2;
$fetched=getCheckboxFromHTML($the_name,$the_value);

and then if successful the variable $fetched would contain
input type=checkbox name=something2 value=2 id=something 
onClick=javascript_code_etc() onSomething=lots of js cod here() /

the idea is that i would use the contents of $fetch to add some code before the 
end just before  the greater than symbol, and do a str_replace().

What do you think? Critique of my logic above too is welcome!

Thanks!
Ryan


  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Help with regex (search/replace) please

2010-02-06 Thread Ryan S
Hey guys,

As many of you might know, i totally suck at regex..so would really appreciate 
some help here.

Basically i have a html page with a lot of textboxes,radios,checkboxes etc 
i need your help in the form of a regex so that when i give it the name and 
value it gives me the entire code of that checkbox.
for example here are 2 checkboxes:

input type=checkbox name=something value=1 /

input
type=checkbox name=something2 value=2 id=something
onClick=javascript_code_etc() onSomething=lots of js cod here()
/



so if i want the second checkbox code i was thinking of something like this:

$the_name=something2;
$the_value=2;
$fetched=getCheckboxFromHTML($the_name,$the_value);

and then if successful the variable $fetched would contain
input
type=checkbox name=something2 value=2 id=something
onClick=javascript_code_etc() onSomething=lots of js cod here()
/

the idea is that i would use the contents of $fetch to add
some code before the end just before  the greater than symbol, and do a
str_replace().

What do you think? Critique of my logic above too is welcome!

Thanks!
Ryan



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Help with regex (search/replace) please

2010-02-06 Thread Ryan S
Hey Ash,Bastien!
clip

Rather than a regex, you're probably better off using something like 
DomDocument, where you can iterate over all of the input elements in the 
document, and check the attributes of each one to check if they match your 
criteria.
/clip

@Ash, You're kinda reading my mind... i did do this in domDocument but it didnt 
work out so well... so now am trying to do this in a diff way.
Is it ok if i send you the code via an attachment? it is REA messy code 
right now though.

@Bastien, you're talking client side... i need to do this server side as then i 
am writing the results to a file which is going to be used as a template in 
other scripts.

Thanks!
Ryan


  

Re: [PHP] DOM TextArea (and dom chart please)

2010-02-03 Thread Ryan S



 I think what you are looking for is $input2-textContent in PHP.

Hey Andrew (and everyone else was was kind enough to write back) !

Found the solution, this is what i am using (and it works!), and i hope it 
helps anyone else who finds themselves in the spot i found myself

$inputs2 = $dom-getElementsByTagName('textarea'); // Find textareas  
foreach ($inputs2 as $input2) { 
if(!$input2-nodeValue || $input2-nodeValue==) { 
$input2-nodeValue=it works!; 
} 
} 


Cheers guys!
/R



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Thinking of moving to .NET because of standalone... any suggestions?

2010-02-03 Thread Ryan S
Hey Guys,

Coming from a C and Java background I just loved PHP and have been programming 
with it for years thanks in a large part to the kind people on this list... 
present and past (Immediately the name John Holmes comes to mind.. i hope the 
dude is well)
but now I have have to leave PHP or split time between php and .NET for just 
one reason:

.NET offers a way to run programs using the Windows GUI / stand alone executable

There always was talk on the list about running php code as standalone, but 
since I had a long absence from the list sorry if I missed any new updates... 
but I'm hoping someone can offer a way to run php standalone executable.

Before posting I always google, and the main results I have gotten so far is:
priado blender
and PHP-GTK

but no way to kind of drag and drop what you need like visual studio (i dont 
know how to use it yet, but been reading) or some other visual development tool 
like visual basic.

I need to make a few standalones programs that will run (mostly) on Windows... 
is there any other way that I have not found that i can use PHP instead of 
learning something new like .NET?

I have resisted going the microsoft way for years.. looks like my luck has 
run out...

Thanks,
Ryan



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Thinking of moving to .NET because of standalone... any suggestions?

2010-02-03 Thread Ryan S
Thanks for the reply Michael, Robert and Jochem,

makes sense, a native windows app is going to look more in place than any of 
the demos and graphics i have seen of GTK.

Was also looking at GTK-Builder, unfortunately you really have to hunt for each 
scrap of new info - which is why I'm guessing open source falls back a bit 
compared to M$'s offerings.

MS shoehorning something into dotnet sounds interesting, will ask my pal google 
what he can bring up ;)
I did read about FLEX but i have pretty much complete php scripts that i want 
to use in a desktop environment, FLEX wouldnt do for my (present) needs.

Will look up WxWidgets and HipHop (somehow i get the feeling i'm gonna be 
drowned in millions of results that have rap lyrics instead of programming 
information - should be a test of my patience :-)))

Anyone have anything more to add/advise, please do so.

Cheers guys!



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Thinking of moving to .NET because of standalone... any suggestions?

2010-02-03 Thread Ryan S
Thanks for the links and advise guys!

Of all I found this most interesting as it would run native:


check out http://www.php-compiler.net/doku.php

unfortunately I think this project is dead or at best stagnant because the 
server is slower than a 99 year old on weed and forums link dead. Documentation 
is badly limited as well.

 But if someone was used this or is using this, would love to hear from you.

Till then am back to checking out the other recommendations and googling.
Keep any other advise/links coming ;) they are most appreciated.

Cheers!
R



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] DOM TextArea (and dom chart please)

2010-02-02 Thread Ryan S
Hey!
i'm just starting with PHP's DOM-XML and need a little help please.


Basically, first i am trying to see if a input like a textbox has a 'VALUE=' 
associated with it, if yes, i leave it be, if no, i add a default value.

This *is working* as can be seen by the attached code below.

But a bit confused as to how to do the same for a textarea as textarea's do not 
have a 'VALUE=' attribute.

Heres my code:


$website_data = file_get_contents('dom_test.html');//load the website data,

$dom = new DomDocument; //make a new DOM container in PHP
$dom-loadHTML($website_data);  //load all the fetched data into the DOM 
container

$inputs = $dom-getElementsByTagName('input'); // Find Sections 

foreach ($inputs as $input) { //***  this block has the guts of the 
functionality ***
if(!$input-getAttribute(value) || $input-getAttribute(value)==) 
{
$input-setAttribute(value, RRR);
}
}



// * now we come to the textarea bit that is not working *

$inputs2 = $dom-getElementsByTagName('textarea'); // Find textareas 

foreach ($inputs2 as $input2) {
if(!$input2-firstChild.nodeValue==) {
$input2-firstChild.nodeValue==it works!;
}
}



echo $dom-saveHTML();
?

+++

// I have even tried this instead of the above:

foreach ($inputs2 as $input2) {
if(!$input2-getAttribute(defaultValue)==) {
$input2-setAttribute(defaultValue,it works!);
}
}

but no joy.

I'm betting its pretty simple but i dont have a DOM chart for php, the only 
ones i have been able to find via google are for javascript like this one: 
http://www.hscripts.com/tutorials/javascript/dom/textarea-events.php


and that chart does not help much.  Does anyone have a PHP DOM chart or a 
resource that i can use to get started using this?

Thanks in advance!
Ryan



 --
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] DOM TextArea (and dom chart please)

2010-02-02 Thread Ryan S



// I have even tried this instead of the above:

foreach ($inputs2 as $input2) {
if(!$input2-getAttribute(defaultValue)==) {
$input2-setAttribute(defaultValue,it works!);
}
}

but no joy.

I'm betting its pretty simple but i dont have a DOM chart for php, the only 
ones i have been able to find via google are for javascript like this one: 
http://www.hscripts.com/tutorials/javascript/dom/textarea-events.php


and that chart does not help much.  Does anyone have a PHP DOM chart or a 
resource that i can use to get started using this?


When I get stuck on things like this, I find print_r() invaluable as it can 
basically dump out the objects entire contents, so I can see what values it has 
set.


Hey Ash,
Thanks for replyng.

Where exactly do i use the print_r? and on which variable?
Because i have tried it in different places but still no luck..


  

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 (magento
had published a book for designer), or you can leave this job to your
developer...

On Tue, Feb 2, 2010 at 6:04 PM, Skip Evans s...@bigskypenguin.com wrote:

 Hey all,

 So I'm more comfortable all the time with using Magento, more I read, and
 Ryan said, Its great, I have been using it for over 2 years very flexible
 platform very easy to manipulate, and the end user admin is second to none
 mate. ... Mate?...

 Are there Aussies on this list? ;)

 Anyway, what about skinning this animal. If I install it will our designer
 be able to put the site's custom look and feel into it?

 Ryan, what do you think?

 Skip


 Nathan Nobbe wrote:

 On Mon, Feb 1, 2010 at 3:22 PM, Skip Evans s...@bigskypenguin.com
 wrote:

  I'm not totally opposed to using Magento, though I can see my comments,
 especially if it's what the client wants.

 I have been looking over the site and it does have a lot of features so I
 can see it saving some serious time, especially given the extras he
 wants.

 So Nathan, having used it, do you have any tips for a Magento newbie when
 it comes to integrating it with a custom site?


 I havent used it yet, but we are considering using it as a second-gen
 platform at my new place of biz.  initial glimpses are promising, but it
 appears to be a somewhat complex offering compared to say wordpress w/ an
 e-commerce plugin.

 i imagine there may be other tradeoffs as well, like a number of general
 purpose plugins and probly more look  feel options in wordpress than
 magento.


  I haven't found any integration documentation for programmers yet.


 google for magento extension and it looks like you may have to hit the
 appropriate mailing list for more details.

 fwiw, afaik, x-cart is one of those older e-commerce platforms circa
 os-commerce / zencart days.  the code is ass, but frankly that damn thing
 has installations up all over the net (or did once upon a time, lol).

 -nathan


 --
 
 Skip Evans
 PenguinSites.com, LLC
 503 S Baldwin St, #1
 Madison WI 53703
 608.250.2720
 http://penguinsites.com
 
 Those of you who believe in
 telekinesis, raise my hand.
  -- Kurt Vonnegut

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] exception throw from __autoload could not be catched on php 5.3.1

2010-01-28 Thread Ryan
于 2010-1-29 13:19, Ashley Sheridan 写道:
 On Fri, 2010-01-29 at 13:02 +0800, Eric Lee wrote:

   
 Hi php-dev pros,

 I got an issue about catching exception throw from __autoload on php 5.3.1.

 The manual state that exception throw from __autoload could be catched with
 try.. catch statement same as the normal flow.

 But I'can archive that even I have copied the same sample code from the
 manual.

 Here are the code segment.

 [[[
 function __autoload($name) {
 echo Want to load $name.\n;
 throw new Exception(Unable to load $name.);
 }

 try {
 $obj = new NonLoadableClass();
 } catch (Exception $e) {
 echo $e-getMessage(), \n;
 }

 ]]]

 Are there anyone experienced this or not ?

 Thanks in advance !

 Regards,
 Eric,
 

 Sorry, ignore that, I see you're running 5.3.1, which should be fine for
 running the example. I do notice that you've got [[[ and ]]] in-place of
 ?php and ?, was that intentional?

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk



   
Do you have any other autoload implamentaions? try testing that code
segment in a single php file and dump phpinfo() to make sure you are on
php 5.3.1

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Question on XML/XSL/PHP/MySQL

2010-01-27 Thread Ryan Park
Hypothetically say that I have MySQL with petabytes of data. I want to 
use XSL as my template language. But in order to use XSL, I need to make 
XML filled with petabytes of data. This does not sound elaborate way to 
use XSL/XML; I would rather use PHP/MySQL/Smarty. Is there a way around 
this so that I can use XSL instead of Smarty?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Question on XML/XSL/PHP/MySQL

2010-01-27 Thread Ryan Park
My only reason doing this because I could use XSL as my templating 
engine; achieve the separation of content, design, and code. But in 
order to use XSL I need to use XML. XML needs to big if I want to use 
the data from the huge MySQL database.


On 1/27/2010 3:32 AM, Ashley Sheridan wrote:

On Wed, 2010-01-27 at 03:31 -0800, Ryan Park wrote:

Hypothetically say that I have MySQL with petabytes of data. I want to
use XSL as my template language. But in order to use XSL, I need to make
XML filled with petabytes of data. This does not sound elaborate way to
use XSL/XML; I would rather use PHP/MySQL/Smarty. Is there a way around
this so that I can use XSL instead of Smarty?

 


I'm not really sure what you want to achieve here, as all of those 
languages do quite different things! And I wouldn't ever recommend 
having a single XML file with petabytes of data, that's just asking 
for trouble!


Thanks,
Ash
http://www.ashleysheridan.co.uk




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();
$form = $A-getFormGeneration()-newForm();

On Wed, Jan 27, 2010 at 7:52 AM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 Hi All,

 I know that a class can only inherit from one other single class in PHP,
 but how would I go about simulating a multiple class inheritance? For
 example, if I had several small classes that dealt with things like form
 generation, navbar generation, etc, how could I create a class in which
 these all existed?

 Or am I thinking about this the wrong way? Should I have keep the
 smaller classes, and have one larger object containing instances of each
 as and how are necessary?

 I've used classes before, but I'm fairly new to class inheritance, and
 more particularly, the complex inheritance like I describe here.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk





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 content as .html page

 html
 head
 ...  stuff
 /head
 body
 ...  stuff
 ...  stuff with database query results...
 ...  stuff
 /body
 /html

 Q: Is there a function that might help with saving the whole content as
 .html page?



 Thanks,
 deal...@gmail.com
 [db-10]



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




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 colomn
 of an MYSQL database, set to autoinc reaches the int limit. Will it return
 and begin choosing the ID's that have been deleted, or... what?
 Thanks!


 Ask Slashdot... I believe they hit the limit one day (several actually) for
 comments :)

 Cheers,
 Rob.
 --
 http://www.interjinn.com
 Application and Templating Framework for PHP


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Foreign Characters Break in MySQL

2010-01-22 Thread Ryan Park

Thank you all for the helpful comments.
I've finally solved the problem through sql command set name.

On 1/22/2010 1:53 AM, Michael A. Peters wrote:

Ashley Sheridan wrote:




You're also forgetting one of the most important elements of this. If
you're displaying the characters on a web page, chances are that you
need to add a corresponding meta tag to inform the browser that the
content is utf-8

meta http-equiv=content-type content=text/html; charset=UTF-8/

Otherwise the browser will attempt to guess from the first few
characters of output, and because of the large headers in some websites,
will guess completely wrong.


Just to add - I had to deal with this, I think I got it right now but 
I'm not positive.


My /etc/my.cnf file has the following:

default-character-set=utf8

That way I don't have to remember to specify the charset when I create 
a new table.


If you don't have control over that file (IE shared host) when you 
create your database tables, I believe you need to do


SET character_set_client = utf8;

before your create table commands.

You should also send the charset in a header, IE

header('Content-type: text/html; charset=utf-8');

but for html you also need to have the meta tag as mentioned because 
if the page is saved to disk, there's no other way for a browser to 
know the charset (and if it isn't there, w3c validator complains).


proper xhtml doesn't need the meta tag because it has the charset in the
?xml version=1.0 encoding=UTF-8?
that opens a proper xhtml document.

If the charset isn't set, then any information sent via post will 
probably be sent using whatever charset the operating system uses by 
default, so setting the charset to utf-8 is important for pages that 
are forms as well as pages that display data.


I'm by no means an expert, that's just what I had to do to get
Aneides iëcanus
to properly display.

I already was doing the utf-8 for the web pages, but MySQL defaults to 
a different character set - I consider it a CentOS bug, they should 
have shipped with my.cnf set to utf-8 IMHO because just about 
everything else in the OS is utf-8 by default, but I pulled my hair 
out for half an hour trying to figure out why it wasn't working when 
the reason was the default charset of the MySQL client used to 
initially create the database table.





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Foreign Characters Break in MySQL

2010-01-21 Thread Ryan Park

Hello I'm currently trying to use PHP to insert foreign characters into one of 
the mysql database tables.mysql_query() worked seamlessly, but when I check the 
inserted data on phpMyAdmin it shows the foreign characters in broken letters, 
like this ì‹œíŒ - jibberish...The foreign characters show fine when I'm typing 
it out on my editor to code PHP, but it gets broken into unrecognizable symbols 
when put into mysql database columns.
I tried to create the same thing this time through phpMyAdmin console and it 
worked great, the foreign characters showed correctly as they should.The column 
that I'm trying to put the foreign characters into is set as utf8_general_ci.I 
wish to use PHP to insert the data into the database because I'll be inserting 
massive amounts of them at once, so I just can't continue with this problem at 
hand.
I'll greatly appreciate any help, thank you.
  
_
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
http://clk.atdmt.com/GBL/go/196390709/direct/01/

Re: [PHP] Foreign Characters Break in MySQL

2010-01-21 Thread Ryan Park

Forgot to reply all.

You can see that it's in the middle of the sql statement.
It looks fine here but some how it breaks during the query.

?php
mysql_connect(localhost, adminID, password) or die(mysql_error());
echo Connected to MySQLbr /;

mysql_select_db(databasename) or die(mysql_error());
echo Connected to Databasebr /;

$sql = INSERT INTO xe_modules (module_srl, module, module_category_srl, 
layout_srl, menu_srl, site_srl, mid, skin, browser_title, description, 
is_default, content, open_rss, header_text, footer_text, regdate) VALUES 
('135', 'bodex', '0', '53', '0', '0', 'free', 'xe_default', '자유게시판 
', '', 'N', '', 'Y', '', '', UNIX_TIMESTAMP());;


mysql_query($sql) or die(mysql_error());

mysql_close();
?

On 1/21/2010 5:19 PM, Jim Lucas wrote:

Ryan Park wrote:
   

Hello I'm currently trying to use PHP to insert foreign characters into one of the 
mysql database tables.mysql_query() worked seamlessly, but when I check the 
inserted data on phpMyAdmin it shows the foreign characters in broken letters, 
like this ì‹œíŒ- jibberish...The foreign characters show fine when I'm typing 
it out on my editor to code PHP, but it gets broken into unrecognizable symbols 
when put into mysql database columns.
I tried to create the same thing this time through phpMyAdmin console and it 
worked great, the foreign characters showed correctly as they should.The column 
that I'm trying to put the foreign characters into is set as utf8_general_ci.I 
wish to use PHP to insert the data into the database because I'll be inserting 
massive amounts of them at once, so I just can't continue with this problem at 
hand.
I'll greatly appreciate any help, thank you.
_
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
http://clk.atdmt.com/GBL/go/196390709/direct/01/
 

How about showing a little of the insert code.  ie: how you are gathering the
data, how you are preping the data, and the actual insert statement.

   


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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 but in future we can build rates for each province / state
 for each country which an admin would have to complete for each product
 (time consuming) but for now the solution will work.

 Thanks for the responses and thoughts, they are much appreciated.

 I see the UPS class is also quite interesting but its only if you using
 them
 :)

 Cheers
 Angelo


 -Original Message-
 From: Jochem Maas [mailto:joc...@iamjochem.com]
 Sent: 19 January 2010 04:53 AM
 To: Angelo Zanetti
 Cc: 'php-general'
 Subject: Re: [PHP] integrating shipping with shopping cart site - OT

 Op 1/18/10 10:47 AM, Angelo Zanetti schreef:
  Hi all,
 
  We are about to start a new project. Custom written shopping cart - quite
  simple actually. However we have a concern when it comes to calculating
 the
  shipping cost for an order.
 
  For each product we can determine the base cost based on weight,
 therefore
  we can determine the total weight of an order.
 
  However we are struggling to determine how to calculate the shipping
 based
  on where the delivery is going.
 
  In terms of DB and PHP would the best way to calculate it be done by
 having
  a list of countries to ship to and a rate for each? Then you can apply
 the
  rate to the current order (calculate according to the order weight).
 
  Problems arise when shipping to different parts of a country EG:
 
  New York vs California (quite far apart). Perhaps we should have a list
 of
  cities but that could be massive?
 
  I know there is a PHP class / system that integrates with UPS but I don't
  think the client is going to use UPS.
 
  Perhaps you can tell me how you have handled this issue in the past.
 
  Apologies if it is slightly off topic but it does still relate to PHP
  indirectly.

 I'd start with defining shippingcost 'sets', each defining a number of
 costs by weight bands, some 'table defs':

 set:
 -
 id  name

 set_bands:
 --
 set_id  upper_weightcost


 then it would be a case of linking (many-to-many relation) 'regions' to
 sets,
 if you approach this with a tree of regions you can effectively set values
 at
 a continent, country, state/province level ... as such you would only need
 to
 relate a 'shippingcostset' to a state if the shippingcosts are different to
 the given country's shippingcosts.

 world
  - north america
   - california
  - south america
  - europe
   - france
   - UK

 then your left with the problem of determining the smallest defined region
 a
 given
 address physically falls into .. using geo-spatial magic in the DB would be
 one
 way to do it.

 this is a hard problem (unless, maybe, the client is willing to sacrifice
 precision
 and instead using highly averaged shipping cost definitions to cover the
 real differences
 in costs - i.e. a fixed fee for all of europe, whereby such fee is just
 above the
 average real cost the client pays for shipping).

 my guess would be that building such a thing is hard, and would take lots
 of
 time ... best bet is to hook into the webservice of whatever shipping
 company the
 client intends to use ... even if you have to build your end of the
 webservice from
 scratch it will be many factors less hard that building a user-manageable,
 shipping cost
 algorythm.

 - sorry it's all a bit vague, I'm very tired :) my eyes are starting to
 bleed.


 
  Thanks in advance.
  Angelo
 
 
  http://www.wapit.co.za
  http://www.elemental.co.za
 
 
 


 --
 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] 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 PHP server side code written and working within
 CodeIgniter.  Now, my project
 has changed and (for reasons unimportant to this discussion) we are now NOT
 going to
 use apache and CodeIgniter, but instead, we are going to have to use an
 http server that does
 not support PHP internally.  But I want to reuse my original PHP code. So I
 am thinking that I
 can execute the PHP code via a command line interface using the PHP cli
 interface instead of
 the PHP cgi interface. But, I will have to initiate this serversid call via
 javascript code running
 on the client.

 I know...kind of convoluted. But how would one do this if necessary?

 -Andres

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




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 using mysql)

On Tue, Jan 12, 2010 at 4:52 PM, deal...@gmail.com deal...@gmail.comwrote:

 I did a query... then I display records like:

 table
  ?php do { ?
tr
  td?php echo $row_cur['tid']; ?/td
  tdnbsp;/td
/tr
?php } while ($row_cur = mysql_fetch_assoc($cur)); ?
 /table


 Q: but how I i just display a particular record with out the do / while
 loop?

 like just the 2nd record only:

 i tried
 ?php echo $row_cur['tid',2]; ?
 but this makes an error

 or $row_cur('tid',2) --- hmmm what's the syntax?



 Thanks,
 deal...@gmail.com
 [db-10]


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




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 = $.number_format($old_price, 2, ., ,);

 and this returns $0.109 when I am looking for $0.11.


 I tried:

 $newprice = $.round(number_format($old_price, 2, ., ,),2);
 But no luck.

 Any help is appreciated.

 Thanks,

  --Rick



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




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, Anthony Papillion papill...@gmail.comwrote:

 I'm developing a basic webservice to compliment a mobile application I'm
 developing or iPhone. While I know how to encode simple variables and
 arrays, I'm not sure how to do what I'm needing to do. Basically, I want to
 encode a status message to return to the mobile client. Something like

 status good_request

 Right now, I'm thinking I should put this in an array and encode/return
 that. But is that the right way of thinking? Is there a more correct or
 better way to do this?

 Thanks!
 Anthony

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




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 guidelines for code formatting and
 documentation to individuals and teams contributing to Zend
 Framework.

 So as far as anything other than code being contributed to Zend
 Framework, its just a suggestion.  For your programming team, you're
 the boss, you make the decision.  The only benefit I see is preventing
 the white space mistake (as your co-worker's quote mentioned), but I
 agree with you on that point.  Just don't put any white space
 there... moron... :-)  Its an inconsequential option, pull rank, get
 back to work.

 On Fri, Jan 8, 2010 at 1:24 PM, Daevid Vincent dae...@daevid.com wrote:
  I'm having a debate with a co-worker about adding the final ? on a PHP
  page...
 
  To be honest, I am the lead, and I could pull rank and be done with the
  discussion, however I don't like to be that way. I would rather do the
  right thing. If my way of thinking is old-school (I've been coding since
  PHP/FI), and what he says is the newfangled proper PHP/Zend way, then I'd
  rather adopt that, despite how icky it makes me feel to leave an unclosed
  ?php just dangling and alone, all sad-like. In my mind, nobody gets
 left
  behind! :)
 
  Is there ANY side-effects to leaving the end ? off? Is it any more work
  for the compiler? And yes I know computers are hella-fast and all that,
 but
  I come from the gaming industry where squeeking out an extra FPS matters,
  and shaving off 0.01s per row of data in a table matters if you have more
  than 100 rows. A 1 second wait IS noticeable and a 10 second is even
 moreso
  -- just try to talk for 10 seconds straight without a pause. Or sit there
  and stare at a screen for 10 seconds!
 
  If the main argument is that it's to prevent white-space after the code,
  then most modern editors that I'm aware of will automatically trim
  white-space (or have a setting to do so). Plus this is ONLY a factor when
  you're trying to output a header and things like that. In 90% of your
 code,
  you don't deal with that. It's also obvious enough when you have an extra
  character/space because PHP pukes on the screen and TELLS you something
  about blah blah sent before header output or something to that effect.
 
  What do you guys all do?
 
  I also created a poll here http://www.rapidpoll.net/arc1opy
 
  -Original Message-
  From: Co-worker
  To: Daevid Vincent
 
  Actually, Zend states that you should omit the final ? on include pages.
  There is no harm in the action, and it prevents you from accidentally
  adding white space after the tag which will break the code.
 
 
 http://framework.zend.com/manual/en/coding-standard.php-file-formatting.htm
  l
 
 
  -Original Message-
  From: Daevid Vincent
  To: Co-worker
 
  Please DO include the final ? I noticed on several of your files that
 you
  have purposely omitted it. Yes, I know the files work without them, but
 it
  makes things easier to see the pairings for matching ?php . Plus it
 keeps
  things consistent and I'm not a big fan of special cases as this is,
  especially if it's a bad habit to get into since in all other cases it's
  required except this one lazy one. If you are concerned about white
 space
  sending in a header or something, well then just make sure there isn't
 any.
  I've had no problems and it makes you a more careful coder.
 
  Thanks,
 
  Daevid.
 
 
  --
  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] 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 5.3, and I have no idea when
  they'll be updated.  The json_last_error function is in 5.3.  What can I
  do to provide a temporary json_last_error function until my servers get
  updated to 5.3?  Is there source available for json_last_error somewhere?
 
  Thanks,
 
  Kirby
 

 I don't believe you will be able to provide this functionality without
 recreating the json_decode() function also.

 json_last_error() looks like it retrieves information that is from the last
 attempt to run json_decode() on a given string.  My guess is that
 json_decode()
 set an internal variable that json_last_error() picks up and returns.

 Without having json_decode() say what the problem was/is then you can never
 recreate the json_last_error() function.

 Jim Lucas

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.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 files with collections of slides and create the
 presentation themselves.

 Skip


 Ashley Sheridan wrote:


 I don't think that's possible. You could look at the Microsoft XML formats
 to see if you can take that apart, but it would be tricky. It might be far
 easier to do it with the Open Office presentation format, but again, I don't
 know of any libraries that are capable of doing this.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk



 --
 
 Skip Evans
 PenguinSites.com, LLC
 503 S Baldwin St, #1
 Madison WI 53703
 608.250.2720
 http://penguinsites.com
 
 Those of you who believe in
 telekinesis, raise my hand.
  -- Kurt Vonnegut

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




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 when it is
 clicked to prevent double clicks submitting  a form for CC processing.

 I put the following code into the submit button and it works fine on
 FireFox, but... hold your breath... not on IE.

 The button gets disabled but the form just sits there, not submitting. At
 first I just had

 onclick=this.disabled=true;

 and that worked in FF also, but not in IE. Then I added the

 document.ticket_form.submit();

 But even that doesn't work with IE.

 Below is the whole snippet for the button.

 input type=submit name=submit value=Purchase Ticket(s)
 id=submit_tickets onclick=this.disabled=true;
 document.ticket_form.submit();

 Any suggestions would be greatly appreciated.

 Thanks,
 Skip

 --
 
 Skip Evans
 PenguinSites.com, LLC
 503 S Baldwin St, #1
 Madison WI 53703
 608.250.2720
 http://penguinsites.com
 
 Those of you who believe in
 telekinesis, raise my hand.
  -- Kurt Vonnegut




 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




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 any outputed private keys with. 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#.
I believe you can ask user their password on previous page and utilize the
'pass' option and it won't ask for a password again

HTH


On Wed, Nov 25, 2009 at 2:53 AM, Tanveer Chowdhury 
tanveer.chowdh...@gmail.com wrote:

 Hi all,

 I have an apache server and for that I created CA as the signing authority
 using openssl.

 Now I created a  php page which will generate client certificates with key
 and will sign by CA. Now the output is in .pem .
 Now how to convert it in .p12 for exporting it in client browser..

 Again, If using exec gives another problem which is it asks for export
 password so how to give this via php.

 Thanks in advance.
 Below is the code:

  ?
 Header(Content-Type: text/plain);
 $CA_CERT = /usr/local/openssl/misc/demoCA/cacert.pem;
 $CA_KEY  = /usr/local/openssl/misc/demoCA/private/cakey.pem;
 $req_key = openssl_pkey_new();
 if(openssl_pkey_export ($req_key, $out_key)) {
$dn = array(
countryName= AU,
stateOrProvinceName= AR,
organizationName   = Widget Ltd,
organizationalUnitName = Test,
commonName = John Smith
);
$req_csr  = openssl_csr_new ($dn, $req_key);
$req_cert = openssl_csr_sign($req_csr, file://$CA_CERT,
 file://$CA_KEY, 365);
if(openssl_x509_export ($req_cert, $out_cert)) {
echo $out_key\n;
echo $out_cert\n;
$myFile2 = /tmp/testFile.pem;
   // $myFile1 = /tmp/testKey.pem;

 $fh2 = fopen($myFile2, 'w') or die(can't open file);
 fwrite($fh2, $out_key);
 $fh1 = fopen($myFile2, 'a') or die(can't open file);
 fwrite($fh1, $out_cert);
 fclose($fh1);
 fclose($fh2);

 $command = `openssl pkcs12 -export test -in /tmp/testFile.pem -out
 client-cert.p12`;
 exec( $command );

}
 elseecho Failed Cert\n;
}
 else
echo FailedKey\n;
 ?



Re: [PHP] string concatenation with fgets

2009-11-24 Thread ryan

Is this what you want

$file = fopen(test.txt, r);
while (!feof($file)) {
   $line = trim(fgets($file));
   print $line.sometext\n;
   }
fclose($file);

outputs
asometext
bsometext
csometext

Ref to http://us3.php.net/manual/en/function.fgets.php. Reading ends 
when /length/ - 1 bytes have been read, on a newline (which is included 
in the return value), or on EOF (whichever comes first). If no length is 
specified, it will keep reading from the stream until it reaches the end 
of the line. 



aurfal...@gmail.com wrote:

Hi all,

I'm trying to append some text to what I read from a file.

My code;

$file = fopen(foo.txt, r);
while (!feof($file)) {
$line = fgets($file);
print $line.sometext;
}
fclose($file);

foo,txt;
a
b
c
d
e
f
g

And when I run the script, it looks like;
a
sometextb
sometextc
sometextd
...


Any ideas?

Thanks in advance,
- aurf




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] downloading winword mp3 files the fancy way through a browser

2009-08-26 Thread Ryan Cavicchioni
On Wed, Aug 26, 2009 at 03:38:27PM +0200, Grega Leskov??ek wrote:
 I tried to download the file from another server the fancy way in PHP, but
 it just display blank screen. Can You please look at my code:
 
 $filepath = http://aa.yolasite.com/resources/happytears.doc;;

Try using a local filepath instead of a URL.

Example: $filepath = /path/to/file/;

Regards,
Ryan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] downloading winword mp3 files the fancy way through a browser

2009-08-26 Thread Ryan Cavicchioni
On Wed, Aug 26, 2009 at 03:38:27PM +0200, Grega Leskov??ek wrote:
 I tried to download the file from another server the fancy way in PHP, but
 it just display blank screen. Can You please look at my code:

If it helps, here is some code that I dug up from an old project:

?php

$filepath = /var/www/test.doc;
$filename = basename($filepath);
$filesize = filesize($filepath);

if ( file_exists($filepath) )
{
header(Cache-Control: no-store, must-revalidate);
header(Expires: Mon, 26 Jul 1997 05:00:00 GMT);
header(Content-Transfer-Encoding: binary);
header(Content-Type: application/force-download);
header(Content-Type: application/octet-stream);
header(Content-Type: application/download);
header(Content-disposition: attachment; filename= . $filename);
header(Content-length:  . $filesize);
$fh = fopen($filepath, rb) or exit(Could not open file.);
while (!feof($fh))
{
print(fgets($fh,4096));
}
fclose($fh);
} else {
echo The file does not exist.;
}

?

I would also verify that the web server has permissions to the files
that php is trying to open. Internet Explorer 8 seems to have a
problem with the filename parameter in the Content-disposition header
being enclosed in quotes. It would just dump the binary data in the
page when I was testing this.

Regards,
Ryan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP pages won't open correctly on my server.

2009-08-24 Thread Ryan Cavicchioni
On Mon, Aug 24, 2009 at 01:30:00PM -0500, RRT wrote:
 PHP pages won't open at all on my server.  HTML pages open fine, but when 
 going to the PHP pages that are on my server, the browser tries to download 
 the page like a file instead of presenting it by the browser.  What can I do 
 to make the PHP processor to be handled properly?  Do I need to recompile it 
 again, and if so, what switches should I use?
 
 I am running Apache version 2.2.11.  I'm on Fedora 2.6.11-1.1369_FC4 on that 
 particular server.  I'm running PHP 5.2.9 which I downloaded directly from 
 the php web site, then untarred, ran make, and make install commands as 
 described in the php INSTALL file that was included with the distribution..

Hello,

If PHP is installed properly, look at step 14 (loading the module in
apache) and step 15 (Tell Apache to parse certain extensions as PHP)
in the PHP installation documentation.

http://www.php.net/manual/en/install.unix.apache2.php

Regards,

  -- Ryan Cavicchioni

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] php move_uploaded_file() filesize problem

2009-08-24 Thread Ryan Cavicchioni
On Mon, Aug 24, 2009 at 09:54:03PM +0200, Thomas Gabrielsen wrote:
 Hi

 I have a problem with uploading files that are bigger than the Master 
 Value allow me to, which is 32 MB. I've set the max_upload_filesize and  
 max_post_size in a .htaccess file and the phpinfo() reports the new local 
 value (128 MB) according to the .htaccess, but the script fails silently  
 with no errors every time I try to upload a file greater than 32 MB. Have 
 any of you had the same problem?

Hello,

What is 'memory_limit' set at 

Regards,
  --Ryan Cavicchioni

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php move_uploaded_file() filesize problem

2009-08-24 Thread Ryan Cavicchioni
On Mon, Aug 24, 2009 at 09:54:03PM +0200, Thomas Gabrielsen wrote:
 Hi

 I have a problem with uploading files that are bigger than the Master 
 Value allow me to, which is 32 MB. I've set the max_upload_filesize and  
 max_post_size in a .htaccess file and the phpinfo() reports the new local 
 value (128 MB) according to the .htaccess, but the script fails silently  
 with no errors every time I try to upload a file greater than 32 MB. Have 
 any of you had the same problem?

I stumbled across this blog post:
http://www.gen-x-design.com/archives/uploading-large-files-with-php/

He suggests also looking at the script timeout and the
'max_input_time' ini setting.

Regards,
  --Ryan Cavicchioni

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] RecursiveDirectoryIterator and foreach

2009-02-23 Thread Ryan Panning
I have discovered that when I foreach over a RecursiveDirectoryIterator 
(see example below) the $item actually turns into a SplFileInfo object. 
I would expect it to be a RecursiveDirectoryIterator. How do I do a 
hasChildren() on SplFileInfo?


However, if I change it to a non-recursive, DirectoryIterator, $item is 
what I would expect, DirectoryIterator. I've tested this with 5.2.8 and 
5.3b1. I'm guessing this is an issue with my setup as I'm sure I've 
gotten this to work before...



$dir = new RecursiveDirectoryIterator('/path/to/dir');
foreach ($dir as $item) {
print get_class($item) . \r\n;
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: RecursiveDirectoryIterator and foreach

2009-02-23 Thread Ryan Panning

Ryan Panning wrote:
I have discovered that when I foreach over a RecursiveDirectoryIterator 
(see example below) the $item actually turns into a SplFileInfo object. 
I would expect it to be a RecursiveDirectoryIterator. How do I do a 
hasChildren() on SplFileInfo?


However, if I change it to a non-recursive, DirectoryIterator, $item is 
what I would expect, DirectoryIterator. I've tested this with 5.2.8 and 
5.3b1. I'm guessing this is an issue with my setup as I'm sure I've 
gotten this to work before...



$dir = new RecursiveDirectoryIterator('/path/to/dir');
foreach ($dir as $item) {
print get_class($item) . \r\n;
}


Alright, I've found a related PHP bug report. 
http://bugs.php.net/bug.php?id=44018


It seems that the default behavior is to return a SplFileInfo object. 
However, if 0 is passed as a flag then a RecursiveDirectoryIterator 
should be returned. However, I cannot seem to get that to work with 
5.2.8. Testing previous versions, this option no longer works as of 
5.2.6, but did in 5.2.5.


This seems like a bug to me, however that bug was marked as Wont Fix. 
The default behavior should be RecursiveDirectoryIterator as there is a 
flag for CURRENT_AS_FILEINFO. Any thoughts on that?


@ Marcus, what was the reasoning not to fix this? And why did it break 
in 5.2.6?


In relation, I've found a workaround, use while(). That way I'm always 
working off of the $dir. I'd rather use foreach though..



$dir = new RecursiveDirectoryIterator('/path/to/dir');
while ($dir-valid()) {
print get_class($dir) . \r\n;
$dir-next();
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] RecursiveDirectoryIterator and foreach

2009-02-23 Thread Ryan Panning

Nathan Nobbe wrote:

if youre trying to do recursive iteration whereby you 'flatten' the tree
structure, drop the RecursiveDirectoryIterator into a
RecursiveIteratorIterator (its for iterating over RecursiveIterators), then
you dont have to bother w/ calling hasChildren() at all.  you probly also
want to look at the constructor args, since by default, it only returns leaf
nodes.

$dir = new RecursiveDirectoryIterator('/path/to/dir');

$itt = new RecursiveIteratorIterator($dir,
RecursiveIteratorIterator::CHILD_FIRST);


foreach ($itt as $item) {
   print get_class($item) . \r\n;
}



-nathan



Hi, thanks for the idea. In my case I do not want to flatten the tree. 
When there is a sub-directory I make a repeat call to the 
function/method, there-by calling it for each directory. I'd give you 
more details but I don't think it'd help with this specific issue.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] RecursiveDirectoryIterator and foreach

2009-02-23 Thread Ryan Panning

Philip Graham wrote:

Here's a RecursiveDirectoryIterator class I've written and find quite useful:

?php
/**
 * This class encapsulates an iterator that iterates over all the files in a
 * directory recursively.  Only files that don't begin with a '.' are included
 * in this iteration.  This class essentially wraps an SPL DirectoryIterator
 * object and returns each file in the iteration as an SplFileInfo.
 *
 * @author a href=mailto:phi...@lightbox.org;Philip Graham/a
 */
class Util_RecursiveFileIterator implements Iterator {
CONST SHOW_DOT_FILES = true;

private $_basePath;
private $_curDirIter;
private $_dirStack;
private $_showDots;

/**
 * Constructor.  By default the iteration will skip any files that begin
 * with a '.' character but this can be changed by passing the class
 * constant SHOW_DOT_FILES as the second parameter.
 *
 * @param string $basePath - The base path of the directory to iterate 
over

 * @param boolean $showDots - Whether or not to include files that begin
 * with a '.' character in the iteration.
 */
public function __construct($basePath, $showDots = false) {
// PREPARE ... THE ... HUMANOID
if(!is_dir($basePath)) {
$basePath = dirname($basePath);
}
if(!$basePath) {
$basePath = '.';
}
// If the given path is relative this function will transform it
// into an equivalent path.  This call assumes that the relative path
// is relative to the file that created this iterator.
$this-_basePath = Util_File::getAbsolutePath($basePath, 2);

$this-_showDots = $showDots;

}

/**
 * Returns the current value of the iteration
 *
 * @return FileInfoInfo
 */
public function current() {
return $this-_curDirIter-current();
}

/**
 * Returns the index of the current entry.
 *
 * @return string
 */
public function key() {
$curPath = $this-_curDirIter-getPathname();
$relativeToBase = substr($curPath, strlen($this-_basePath));
return $relativeToBase;
}

/**
 * Moves the directory iterator to the next element of the iteration.
 */
public function next() {
$this-_curDirIter-next();
$good = false;
while(!$good) {
if(!$this-_curDirIter-valid()) {
if(count($this-_dirStack) == 0) {
$good = true;
} else {
$this-_curDirIter = array_pop($this-_dirStack);
}
} else if($this-_curDirIter-isDot()) {
if(!$this-_showDots) {
$this-_curDirIter-next();
} else {
$good = true;
}
} else if(!$this-_showDots 
  substr($this-_curDirIter-getFileName(), 0, 1) == '.') {
$this-_curDirIter-next();
} else if($this-_curDirIter-isDir()) {
// Create a new iterator for the sub-dir
$newIter = new DirectoryIterator(
$this-_curDirIter-getPathname());

// Make sure the current iterator is ready to go when it
// gets popped off the stack
$this-_curDirIter-next();

// Push it... push it real good
array_push($this-_dirStack, $this-_curDirIter);

// Set the new iterator
$this-_curDirIter = $newIter;
} else {
$good = true;
}
}
}

/**
 * Resets the iterator to first file in the object's base path.
 */
public function rewind() {
$this-_curDirIter = new DirectoryIterator($this-_basePath);
$this-_dirStack = array();
if(!$this-_showDots  $this-_curDirIter-isDot()) {
$this-next();
}
}

/**
 * Returns a boolean indicating wether or not there are anymore elements 
left

 * in the iteration.
 */
public function valid() {
return $this-_curDirIter-valid();
}
}

Usage:

$dirIter = new Util_RecursiveFileIterator('/path/to/directory');
foreach($dirIter AS $fileName = $fileInfo) {
  // $fileName is the basename of the file and $fileInfo is a SplFileInfo
  // for the file
}

Hope this helps!


Hi, although I don't think this will work in my situation, there is an 
interesting piece of code that you have.


array_push($this-_dirStack, $this-_curDirIter);

Are you able to inject the iterator with more items? I would like to 
do this with the RecursiveDirectoryIterator where-by I inject fake 
files into the iterator. Is this what you're doing here?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Kinda 0.T... php site and maintenance

2009-01-28 Thread Ryan S
@Bastien, Stuart:

Thanks for your input guys, was very useful and appreciate it.

cheers!
R


  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Kinda 0.T... php site and maintenance

2009-01-26 Thread Ryan S
Hey,

Got a question for you guys who make a lot of personal sites.

I got a US client who wants me to make a personal site, 4-7 sections (eg: 
about me, photos, whats new etc)
and have to put a yearly maintenance $$ amount...

I thought i'll make most of the stuff using php rather than plain html so the 
client can update different sections without me (eg: whats new, add pics)

What do you guys charge for something like this (dont count hosting and domain 
fees)

Thanks!
R



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Kinda 0.T... php site and maintenance

2009-01-26 Thread Ryan S
Hey,
Thanks everyone for replying, I really appreciate your input.

One thing you forgot to mention, how much would it be for maintenance per 
year?
Feel free to add anything you think you might have forgotten in your first 
emails to me.


@ Nitsan, I did some personally sites like that for 2 banks here in Israel.

Israel!! Stay safe bro and god bless, you have some real crazies surrounding 
your country.


@Michael Kubler, 
Not a problem, I like long replies.. by their very nature most of them are more 
detailed ;)

Cheers!
R


--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



- Original Message 
From: Nitsan Bin-Nun nitsa...@gmail.com
To: Ryan S gen...@yahoo.com
Cc: php php php-general@lists.php.net
Sent: Monday, January 26, 2009 6:39:19 PM
Subject: Re: [PHP] Kinda 0.T... php site and maintenance

I have just quitted from my partial time job at the company.
I did some personally sites like that for 2 banks here in Israel.

When I do something like that I usually basing the whole thing on the known
blogging platform WordPress, it has a massive power inside of it, the
templating system is very easy and gives you the ability to dress it up
without any extra knowledge except common sense and a bit of php knowledge,
It supports creating galleries (using plugins, etc) and gives you the
functionally you usually need when you write a personall website - free
access to creating static pages, using wordpress integrated WYSIWYG editor,
creating updates using the blog posts, etc.

I found it very useful so far (I used this platform in 15 websites~) and I
think you will find it more than great for your client's job.

HTH,
Nitsan

On Mon, Jan 26, 2009 at 7:09 PM, Ryan S gen...@yahoo.com wrote:

 Hey,

 Got a question for you guys who make a lot of personal sites.

 I got a US client who wants me to make a personal site, 4-7 sections (eg:
 about me, photos, whats new etc)
 and have to put a yearly maintenance $$ amount...

 I thought i'll make most of the stuff using php rather than plain html so
 the client can update different sections without me (eg: whats new, add
 pics)

 What do you guys charge for something like this (dont count hosting and
 domain fees)

 Thanks!
 R





 --
 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] system() Question

2008-12-28 Thread Ryan O'Sullivan
Hello all,

I am using system to convert some files using a binary in linux.  My code 
looks like this:
 $response = system('gpsbabel -p  -r -t -i gpx -f test.gpx -o kml -F 
test2.kml', $retval);
 echo pResponse: , $response, /ppReturn Value: , $retval;

The $retval is returning code 127 - Any ideas on why this?

Thanks! 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Request to bash/jump/screw my code

2008-12-08 Thread Ryan S
Hello everyone,

Recently I worked on a rather decent sized project and it just went live 
yesterday.

We cannot really afford a security specialist so would appreciate it if you 
could hit our site with whatever you want to (just dont take us offline with 
something like a DDOS please) and tell us if you find any problems.

As we cannot afford to pay you for this service all we an say is thank you if 
you decide to give this a go with a few seconds or a few minutes of your time.
It should be fun though as its a jokes section and even has funny 
images/cartoons and funny vids.

The site is at http://ezee.se/funnies/index.php

Any advise is also most welcome.

Thanks in advance!
Ryan


 --
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Request to bash/jump/screw my code

2008-12-08 Thread Ryan S
Snippy 
 Any advise is also most welcome.

'Advise' is a verb.

'Advice' is a noun.

No charge.

/Snippy

LOL! Thanks!
Got caught by the grammar and typo police but no ticket!
Must be my lucky day!

Cheers!
R



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Replacing with f*ck and f*cking

2008-10-27 Thread Ryan S
Thanks for all your input guys!

 Scunthorpe

LOL!
Never heard of the place but ...f**k i think i am a geek for finding it funny!
Reminds me of quite  few people tho...

Cheers!
R

2008/10/26 Colin Guthrie [EMAIL PROTECTED]:
 Ashley Sheridan wrote:

 What you really need to watch out for is words which you're going to
 censor which might be part of other names. Sex is an obvious one, as it
 appeared in the borough name of my old address: Middlesex.

 I can't believe you didn't use the infamous Scunthorpe as your example :p

 Col

There was a post on Coding Horror not long ago that brought this one up:
http://google.com/search?q=consbreastution

http://www.codinghorror.com/blog/archives/001176.html

-- 
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

ä-ö-ü-ß-Ä-Ö-Ü





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Replacing with f*ck and f*cking

2008-10-25 Thread Ryan S
Hey!
I'm just trying to replace some of the more bad words with their slightly 
censored counterparts like so

$bad_words = array(/*Well you know the words so am not going to write them 
here*/);
$bad_words_replacements = array(f*ck, f*cking);
$comment = str_replace($bad_words,$bad_words_replacements,  $comment);

My question is this, for just two words its fine to use the above, but a pal 
tells me that if using a lot of words (eg: 15) and the $comment is big then it 
can take quite some time and be a bit of a processing strain as well because 
php first checks the first word from the good list against all the 15 words in 
the bad list against the comment then moves to the second word etc.

Is this really bad processing wise and would you recommend any other way of 
doing this?
The other question i have is, wont f*ck catch f*cking as well? so should i 
delete the longer f*cking?

I'm not really trying to stop people swearing... just trying to make it not 
jump out so much, this was the poster is happy coz i have not censored him to 
bits and the reader should be a bit happy coz its a bit decent.

Thanks!
R


  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] index search

2008-10-24 Thread Ryan S

clip
Are you sure LIKE isn't working? I would think LIKE a% would work. For 
0-9, I would think you can use = 9 or you can use BETWEEN 0 and 9.
/clip

Silly me, the reason it was not working was I am so used to %something% and 
used that instead of 
something%

Anyway, it was a not a useless post for me because the 0-9 part was not solved 
in my head but a lot of interesting replies as to how to do it.

Thanks everyone!

/Ryan



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] index search

2008-10-23 Thread Ryan S
Hey all,
Was wondering how this is done, have a bunch of links like so:
0-9 : a : b : c - till Z

these will be linked to the program (so far have done this) but when the user 
clicks any of those links I want to query the DB for just the first alphabet 
from the field title, using LIKE is not working for me because its catching 
alphabets from the middle of the word as well.

Also how to do 0-9? do i have to have 10 if() conditions for that?

Ideas and suggestions welcome.

Thanks!
Ryan

 --
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysql search

2008-10-22 Thread Ryan S


 
clipp
 Am hoping someone out there can recommend a better script or maybe share some 
 of your own code?
 
 Any help would be appreciated.

Do it right... read up on MySQL's fulltext matching.

Cheers,
Rob.
/clipp

Did some searching based on your tip, got what i was looking for, just didnt 
know where to start.. and now feeling like the man who was taught how to fish :D

Thanks!
R



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Mysql search

2008-10-21 Thread Ryan S
Hey all,
I have two columns in my DB 
title varchar(254)
 and 
jtext text

which I would like to search, as the user might enter two or more words I am 
opting not to use LIKE %search_term% so started searching google, I came across 
this very promising class:
http://code.activestate.com/recipes/125901/

but when i tried to run it I am just getting a blank page, no errors or 
anything.

Am hoping someone out there can recommend a better script or maybe share some 
of your own code?

Any help would be appreciated.

Thanks,
Ryan

 --
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Convert video to FLV like youtube

2008-10-18 Thread Ryan S
Hey!

Been googleing for a way to convert video to flv just like youtube and came 
accross the flv SDK kit, unfortunately it seems to only support C++, Delphi and 
C#

 
Have any of you guys come accross a php script that does this? any links, 
pointers and code would be appreciated.

TIA,
R

--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Brain dead... write image to file

2008-10-15 Thread Ryan S
AGH!
Just got up, feel like I have a hangover which is not really fair because I 
didnt drink so dont deserve one.
It really is screwed up, you pull an all nighter and when you get up you look 
at the code you produced and it just isnt your best work... and the question 
pops up, why bother?

Sorry, a bit of a rant in the middle of my coffee ;)

just wanted to thank all of you who replied, I really appreciate it... was way 
out in the zonked zone when I wrote and asked for help and the fact that some 
of you actually read that long ass bit of code AND responded shows that 
there IS hope for humanity, coz there are a lot of good folk still out there. 
Ok, a bit dramatic... but still not thinking too straight, gotta refill my cup!

Thanks and tcare ppl!
/Ryan

 --
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



- Original Message 
From: Maciek Sokolewicz [EMAIL PROTECTED]
To: Ryan S [EMAIL PROTECTED]
Cc: php php php-general@lists.php.net
Sent: Wednesday, October 15, 2008 12:25:29 PM
Subject: Re: Brain dead... write image to file

Ryan S wrote:
 Hey all,
 
 am feeling a bit brain dead, pulled an all nighter and would appreciate some 
 help as have already wasted over 2hrs on this :(
 just not thinking straight.
 I got this script off the net, cant even remember where :( its basically to 
 resize an uploaded image (i have a script that does exactly this that i 
 created ages ago... but cant find it and if i remember corrrectly that only 
 resizes jpgs, this one does gifs and pngs as well)
 
 the way the original guy wrote it is that it writes the uploaded image to the 
 DB, i'm just trying for it to create a resized image *instead of writing to 
 the db*.
 
 The code is below, needless to say, my little block of code to write an the 
 image to file is not working... would appreciate some help.
 
 ?php 
 //$conn = mysql_connect(localhost, username, password) or 
 die(mysql_error()); 
 //mysql_select_db('test', $conn) or die(mysql_error()); 
 
 
 if($_FILES['userfile']['tmp_name']){ 
 resize(); 
 //$q = INSERT INTO test VALUES ('', '.$blob_arr['image'].', 
 '.$blob_arr['thumb'].', '.$blob_arr['type'].'); 
 //$aa = mysql_query($q,$conn) or die(mysql_error());  
 
 /## Start my code try
 $uploaddir = 'C:\\wamp\\www\\ezee\\funny\\';
 $filename = $uploaddir.'test.jpg';
 $somecontent = $blob_arr['thumb'];
 
 if (is_writable($filename)) {
 if (!$handle = fopen($filename, 'w')) {
  echo Cannot open file ($filename);
  exit;
 }
if (fwrite($handle, $somecontent) === FALSE) {
 echo Cannot write to file ($filename);
 exit;
 }
 
 fclose($handle);
 
 } else {echo The file $filename is not writable;}
 
 
 
 header( Content-type: .$blob_arr['type'].); 
 }
 /## End my code try
 
 
 
 function resize(){ 
 global $blob_arr; 
 $temp_name =$_FILES['userfile']['tmp_name']; 
 $userfile_name =$_FILES['userfile']['name']; 
 $userfile_size =$_FILES['userfile']['size']; 
 $userfile_type =$_FILES['userfile']['type']; 
 
 $thumb_width=90; 
 $thumb_height=90; 
 $image_width=200; 
 $image_height=200; 
 
 if (!($userfile_type ==image/pjpeg OR $userfile_type ==image/jpeg OR 
 $userfile_type==image/gif OR $userfile_type==image/png OR 
 $userfile_type==image/x-png)){ 
 die (You can upload just images in .jpg .jpeg .gif and .png 
 format!br / ); 
 } 
 $data = fread(fopen($temp_name, rb), filesize($temp_name)); 
 $src_image = imagecreatefromstring($data); 
 $width = imagesx($src_image); 
 $height = imagesy($src_image); 
 if ($thumb_width  ($width  $height)) { 
$thumb_width = ($thumb_height / $height) * $width; 
 } else { 
$thumb_height = ($thumb_width / $width) * $height; 
 } 
 if ($image_width  ($width  $height)) { 
$image_width = ($image_height / $height) * $width; 
 } else { 
$image_height = ($image_width / $width) * $height; 
 } 
 $dest_img = imagecreatetruecolor($thumb_width, $thumb_height); 
 $i_dest_img = imagecreatetruecolor($image_width, $image_height);  
 imagecopyresized($dest_img, $src_image,0, 0, 0, 0,$thumb_width, 
 $thumb_height,$width, $height); 
 imagecopyresized($i_dest_img, $src_image,0, 0, 0, 0,$image_width, 
 $image_height,$width, $height); 
 ob_start(); 
 if($userfile_type == image/jpeg OR $userfile_type == image/pjpeg){ 
 imagejpeg($dest_img); 
 } 
 if($userfile_type == image/gif){ 
imagegif($dest_img); 
 } 
 if($userfile_type == image/png OR $userfile_type == image/x-png){ 
 imagepng($dest_img); 
 } 
 $binaryThumbnail = ob_get_contents(); 
 ob_end_clean(); 
 ob_start(); 
 if($userfile_type == image/jpeg OR $userfile_type == image/pjpeg){ 
 imagejpeg($i_dest_img

[PHP] Brain dead... write image to file

2008-10-15 Thread Ryan S
Hey all,

am feeling a bit brain dead, pulled an all nighter and would appreciate some 
help as have already wasted over 2hrs on this :(
just not thinking straight.
I got this script off the net, cant even remember where :( its basically to 
resize an uploaded image (i have a script that does exactly this that i created 
ages ago... but cant find it and if i remember corrrectly that only resizes 
jpgs, this one does gifs and pngs as well)

the way the original guy wrote it is that it writes the uploaded image to the 
DB, i'm just trying for it to create a resized image *instead of writing to the 
db*.

The code is below, needless to say, my little block of code to write an the 
image to file is not working... would appreciate some help.

?php 
//$conn = mysql_connect(localhost, username, password) or 
die(mysql_error()); 
//mysql_select_db('test', $conn) or die(mysql_error()); 


if($_FILES['userfile']['tmp_name']){ 
resize(); 
//$q = INSERT INTO test VALUES ('', '.$blob_arr['image'].', 
'.$blob_arr['thumb'].', '.$blob_arr['type'].'); 
//$aa = mysql_query($q,$conn) or die(mysql_error());  

/## Start my code try
$uploaddir = 'C:\\wamp\\www\\ezee\\funny\\';
$filename = $uploaddir.'test.jpg';
$somecontent = $blob_arr['thumb'];

if (is_writable($filename)) {
if (!$handle = fopen($filename, 'w')) {
 echo Cannot open file ($filename);
 exit;
}
   if (fwrite($handle, $somecontent) === FALSE) {
echo Cannot write to file ($filename);
exit;
}

fclose($handle);

} else {echo The file $filename is not writable;}



header( Content-type: .$blob_arr['type'].); 
}
/## End my code try



function resize(){ 
global $blob_arr; 
$temp_name =$_FILES['userfile']['tmp_name']; 
$userfile_name =$_FILES['userfile']['name']; 
$userfile_size =$_FILES['userfile']['size']; 
$userfile_type =$_FILES['userfile']['type']; 

$thumb_width=90; 
$thumb_height=90; 
$image_width=200; 
$image_height=200; 

if (!($userfile_type ==image/pjpeg OR $userfile_type ==image/jpeg OR 
$userfile_type==image/gif OR $userfile_type==image/png OR 
$userfile_type==image/x-png)){ 
die (You can upload just images in .jpg .jpeg .gif and .png format!br 
/ ); 
} 
$data = fread(fopen($temp_name, rb), filesize($temp_name)); 
$src_image = imagecreatefromstring($data); 
$width = imagesx($src_image); 
$height = imagesy($src_image); 
if ($thumb_width  ($width  $height)) { 
   $thumb_width = ($thumb_height / $height) * $width; 
} else { 
   $thumb_height = ($thumb_width / $width) * $height; 
} 
if ($image_width  ($width  $height)) { 
   $image_width = ($image_height / $height) * $width; 
} else { 
   $image_height = ($image_width / $width) * $height; 
} 
$dest_img = imagecreatetruecolor($thumb_width, $thumb_height); 
$i_dest_img = imagecreatetruecolor($image_width, $image_height);   
imagecopyresized($dest_img, $src_image,0, 0, 0, 0,$thumb_width, 
$thumb_height,$width, $height); 
imagecopyresized($i_dest_img, $src_image,0, 0, 0, 0,$image_width, 
$image_height,$width, $height); 
ob_start(); 
if($userfile_type == image/jpeg OR $userfile_type == image/pjpeg){ 
imagejpeg($dest_img); 
} 
if($userfile_type == image/gif){ 
   imagegif($dest_img); 
} 
if($userfile_type == image/png OR $userfile_type == image/x-png){ 
imagepng($dest_img); 
} 
$binaryThumbnail = ob_get_contents(); 
ob_end_clean(); 
ob_start(); 
if($userfile_type == image/jpeg OR $userfile_type == image/pjpeg){ 
imagejpeg($i_dest_img); 
} 
if($userfile_type == image/gif){ 
imagegif($i_dest_img); 
} 
if($userfile_type == image/png OR $userfile_type == image/x-png){ 
imagepng($i_dest_img); 
} 
$binaryImage = ob_get_contents(); 
ob_end_clean(); 
if(!get_magic_quotes_gpc()){ 
$binaryThumbnail=addslashes($binaryThumbnail); 
$binaryImage=addslashes($binaryImage); 
} 
$blob_arr['image']=$binaryImage; 
$blob_arr['thumb']=$binaryThumbnail; 
$blob_arr['type']=$userfile_type; 
} 
if($_POST['submit']){ 



//$Rs = mysql_query(SELECT * FROM funny_test WHERE id = 
'.mysql_insert_id().') or die(mysql_error()); 
//$row_Rs = mysql_fetch_assoc($Rs); 
//header( Content-type: .$row_Rs['typ'].); 
//echo $row_Rs['thb']; 










}else{ 
? 
form name=form1 method=post  enctype=multipart/form-data action=?php 
echo $PHP_SELF; ? 
  input id=userfile  name=userfile type=file / 
  input type=submit name=submit value=Submit / 
/form 
?php 
} 
? 



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] searching by tags....

2008-10-14 Thread Ryan S
Hey,

this the first time I am actually working with tags but it seems quite 
popular and am adding it on a clients requests.

By tags I mean something like wordpress' implementation of it, for example when 
an author writes an article on babies the tags might be
baby,babies, new borns, cribs, nappies

or a picture of a baby can have the tags 

baby,babies, new born, cute kid, nappies

the tags are comma separated above of course.

The way i am doing it right now is i have sa an article or a pic saved in 
the db as 
article_or_pic_address text
the_tags varchar(240)

My question is, when someone clicks on any one of the tags, do i do a  LIKE 
%search_term% search or...???

quite a few sites seem to have a very neat way of implementing this with (url 
rewriting?) something like http://sitename/blog/tags/tag-comes-here/

Any help in the form of advise, code or links would be appreciated.

TIA.

Cheers!
Ryan
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Little regex help please...

2008-10-13 Thread Ryan S
Hello!

Here's a regex that I got off the web that I am trying to modify for my needs, 
I suck at regex so desperately need some help.

Basically, am trying to get a remote webpage and get the value between the 
title tags, note that it should get the values regardless if title is upper 
or lower case (case insensitive)

?php
$data = file_get_contents(http://www.youtube.com/watch?v=oQ2dKXGAjNg;);
preg_match('/#title([^]*)/title#/iU',$data,$match);
$title=$match[1]; 
echo $title;
?

This is the error that i am getting when running the above:

Warning: preg_match() [function.preg-match]: Unknown modifier 't' in 
C:\wamp\www\ezee\tests\get
_remote_title.php on line 3

TIA,
Ryan




 --
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Little regex help please...

2008-10-13 Thread Ryan S
Hey Todd, Eric,

Thanks for replying.

 I don't believe you need both the / and the # for delimiters in your
 RegEx. Try using just # (since / is actually going to be in the text
 you're searching for) like this:

 ?php
  $data =
 file_get_contents(http://www.youtube.com/watch?v=oQ2dKXGAjNg;);
  preg_match('#title([^]*)/title#iU', $data, $match);
  $title = $match[1];
  echo $title;
 ?



 You can also escape the / like \/.


Ok, I changed it to:
?php
$data = file_get_contents(http://www.youtube.com/watch?v=oQ2dKXGAjNg;);
preg_match('/#title([^]*)\/title#iU',$data,$match);
$title=$match[1]; 
echo $title;
?
And this is the error i am getting:

Warning:  preg_match() [function.preg-match]: No ending delimiter '/' found in 
C:\wamp\www\ezee\tests\get_remote_title.php on line 3



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Little regex help please...

2008-10-13 Thread Ryan S
Thanks guys, I appreciate the help.

Cheers!
R



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Using Static Class Variables to Access Globally

2008-09-23 Thread Ryan Panning
The typical way to access a variable or instance from inside a 
function/method is to either declare it a global variable or pass it as 
a argument. Is there any reason why someone shouldn't use static class 
variables to do this? Ex:


?php
class Foo {
public static $bar_instance;
}

class Bar {
public function do_something() {}
}

Foo::$bar_instance = new Bar;

function foo_bar() {
Foo::$bar_instance-do_something();
}

foo_bar();
?

Crude example but imagine this on a larger scale. I'm thinking there may 
be some kind of php optimization that this would hamper or something to 
that effect.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Using Static Class Variables to Access Globally

2008-09-23 Thread Ryan Panning

Nathan Nobbe wrote:

in many cases, people like to drive client code through methods, which,
given the current set of language features in php, could be reason to favor
a singleton w/ __get()  __set() methods defined.  you still have the same
'global' scope, except that the data doesnt have to be public.  (im not
saying its bad to use public vars, im merely presenting an alternative
perspective).

supposedly php has in the rfc about static classes to add __setStatic() 
__getStatic(), but support isnt there yet, and im starting to doubt it will
be available for 5.3 =/

-nathan



Interesting point about the singleton option. I'll have to think about 
that one.


I can assure you that __set/getStatic() will not make it in 5.3. I've 
already contacted the author of that RFC, they confirmed it won't make 
it. :( I'm just glad late static binding made it.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] RE: Sale 79% OFF !!!

2008-08-24 Thread Ryan S
klip
I hate to admit to this, but some 15 years ago I was consulting for a 
company doing oil exploration in Nigeria and I received a very 
elaborate and believable Nigerian scam. It was complete with signed 
and official documents from both the Nigerian Government and the Bank 
of Nigeria.

I passed the proposal through two attorneys and the decision was to 
participate. Of course nothing happened and we did not lose anything. 
But the first Nigerian scams were very believable.
/klip

Heck! Always wanted to meet someone who feel for the Nigerian scams, would 
never have thought you would be the one Tedd!
Can you give me mroe details of the scam? Is it like the ones we get via email 
everyday or different?

Cheers!
Ryan



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Scripts for removing Reg entries

2008-08-07 Thread Perkins, Ryan
I was looking thru some of the scripts that were mentioned and I am
wondering if there is a way to write on that will delete registry entries? I
am trying to uninstall Office 97 on XP machines and there are a lot of
pieces left after the uninstall has run. I would need to look and see if the
entry exists and if it does delete it. Also, is there a way to script
removing items that have been pinned to the start menu?

Ryan Perkins
Dept. of Employee Trust Funds
Operations/ Help Desk
608.266.2080

This email message and any attachments may contain information that is
confidential, privileged, proprietary, or otherwise protected by law.  This
information is intended solely for the named addressee (or a person
responsible for delivering it to the addressee).  If you have received this
message in error, please notify the sender immediately and delete it from
your computer.  Unauthorized disclosure, copying, printing, or distribution
of this message is prohibited.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Freelance PHP development in India

2008-07-16 Thread Ryan S
No apologies necessary, good luck!

 Cheers!
R




- Original Message 
From: Denis L. Menezes [EMAIL PROTECTED]
To: Ryan S [EMAIL PROTECTED]; Wolf [EMAIL PROTECTED]
Cc: PHP General php-general@lists.php.net
Sent: Monday, July 14, 2008 3:31:43 PM
Subject: Re: [PHP] Freelance PHP development in India

Dear Ryan, Wolf.

Apologies for asking from India only. No offence meant.

It is because I am from India and I can personally meet and discuss with the 
programmers. Cost is also an issue. Mine is a startup and the finances are 
low. :-(

Apologies.
Denis


- Original Message - 
From: Ryan S [EMAIL PROTECTED]
To: Wolf [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: PHP General php-general@lists.php.net
Sent: Monday, July 14, 2008 8:34 PM
Subject: Re: [PHP] Freelance PHP development in India






 snip
 Dear friends.

 I am looking for freelance web developers in India.

 Can contact me?


 Why just in India?  There are a number of us available via the world.

 Wolf
 /snip

 I'm guessing because he wants a REAL cheap solution...
 what you (probably) charge for 5-7hrs work would probably be the same that 
 someone in india charges for a day or two or the whole project.

 HTH

 Cheers!
 R





 -- 
 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Freelance PHP development in India

2008-07-14 Thread Ryan S




snip
 Dear friends.
 
 I am looking for freelance web developers in India.
 
 Can contact me?
 

Why just in India?  There are a number of us available via the world.

Wolf
/snip

I'm guessing because he wants a REAL cheap solution... 
what you (probably) charge for 5-7hrs work would probably be the same that 
someone in india charges for a day or two or the whole project.

HTH

Cheers!
R



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Most popular per month

2008-07-13 Thread Ryan S
Thanks Brady, Wolf, Bernhard!

Will write back if i hit a wall but I think your explanations and links should 
take me all the way.

Cheers!
Ryan


  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Most popular per month

2008-07-12 Thread Ryan S
Hey!
Thanks for replying!



snip
..
.
$perc50=(img50 int)/$total;

You can do it per day, per month, per year, per 28 days, per PMS cycle, 
per anything you want provided you have the data to do it.
/snip

:) this is the part where i am a bit confused actually, can you give me one or 
two examples and i'll work from there?


snip
Google had an pie chart thingie, check the archives of this list.
/snip

Thanks! Will do!

Cheers!
Ryan


  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Most popular per month

2008-07-11 Thread Ryan S
Hey!

The client has a set of 50 images that keep rotating everyday and when a user 
clicks one of those images he is taken to that images site, in the background 
(database) i maintain a counter _for the day_ and then display the top ten 
images everyday in this format: 1-10

before the next days counter starts this data is stored in a table which has a 
simple structure like this
img_id1 int,img_id2 int  (etc till img_id10) 


Now the client wants a little extra functionality, and with me sucking at maths 
I need some help please, basically he now wants to have a chart with all the 50 
images there and showing _via percentages_ instead of the present 1-10 display 
which ones are the most popular till date.

example:
1. image name: (percentage here)
2. image name: (percentage here)
3. image name: (percentage here)
etc
any ideas on where i can start/ code tips/ urls etc would be most appreciated.
Also, if i am not mistaken there was some charting software to display this 
kind of data in pie and line charts... anybody know what i am talking about? 
because i cant find such a link in my bookmarks.

Thanks in advance,
Ryan



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Static Member Overloading

2008-07-03 Thread Ryan Panning
Does anyone know if static member overloading was added in PHP 5.3? I 
noticed that static method overloading was (__callStatic). Thought I'd 
ask here before attempting to ask in the internals. Ex:


__setStatic()
__getStatic()
__isset()
__unset()

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] O-T What are we going to do about the O-T thread that asks the question: What we are going to do about those OT's?

2008-06-24 Thread Ryan S
Sorry, had to ask :o)



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Monitor a WP website

2008-06-24 Thread Ryan S
Hey,
Is there a way to check if a new post has been submitted on your favourite 
wordpress site?

Heres what i am trying to do:
do a fopen http://ezee.se/articles-blog/  via CRON every x minutes
if a new post has been submitted, i mail someone...

but am not just looking to do this for this one site... am thinking other WP 
sites too, but am hoping if i can get this to work on this one site.. the 
others should be pretty much the same.

Any suggestions on how to check for new posts? keep in mind most wp sites use 
some kind of url-rewriting so the formats a bit different (there are around 7 
formats if i am not mistaken)

Thanks!
R


 --
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Monitor a WP website

2008-06-24 Thread Ryan S
Hey Eric, Stut,

Maybe you should start by trying to utilize the RSS feed.

Went to that option at first too... but have  a quick look around, there are 
many sites that for some reason dont have this feature turned on, and for 
them... the only option i think is to read the page... unless I am missing 
something?


Cheers!
R

 Is there a way to check if a new post has been submitted on your favourite 
 wordpress site?

 Heres what i am trying to do:
 do a fopen http://ezee.se/articles-blog/  via CRON every x minutes
 if a new post has been submitted, i mail someone...


but am not just looking to do this for this one site... am thinking
other WP sites too, but am hoping if i can get this to work on this one
site.. the others should be pretty much the same.

 Any
suggestions on how to check for new posts? keep in mind most wp sites
use some kind of url-rewriting so the formats a bit different (there
are around 7 formats if i am not mistaken)


  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Monitor a WP website

2008-06-24 Thread Ryan S
clippity

 So, you want something to tell you if something new has been added to
 a remote site, right?
 
 There used to be free services that did that -- I used to monitor
 competitors's web sites using such service. But, I think they
 eventually stopped the free service. Here's one site that charges:
 
 http://www.webmetrics.com/websitemonitoring.html
 
 Now, if you want to do this on your own, then it should be simple
 enough to use get_file_contents and put the file through a md5()
 function (or use md5_file) and store the result in a dB.
 
 Then cron a check every so often to see if the hash has changed. If
 it has, then email you notice, rehash the site and store it in the dB.
 
 Or, am I completely off-base in understanding what you wanted (as
 I've been told lately)?


tedd,
(damnit, Outlook capitalized that for me, and I had to change it
back...)

I believe he is talking about providing such a service. Of course, I've
heard of companies that outsource their entire livelihoods and charge
their own customers out the nose for proxy.

I'm not sure if he's trying to simply determine if a change has been
made or if he is trying to notify people of the particular item that has
been posted.

Clarifications, Ryan?

/clippity


Hey,
This is strange, I didnt get Tedds message but only got to read it through 
yours.

Sorry for the mixup, yes, was thinking of making something like this and offer 
it for free, its a bit of both: what you and Tedd said.

I want to check if a new post has been published AND get the text+url of the 
post to send out to people along with the link to it.

To make matters worse, i think i am a bit confused about the feeds 
themselves... i used to work with RSS feeds from Yahoo! and others (example: 
http://www.php.net/news.rss) but they used to come via XML... but now i see a 
lot of sites using something different via feedburner (example 
http://feeds.feedburner.com/eZeeDotse) or wordpress' default feed (example: 
http://www.ballz.info/feed/) 

um... help?

:)

Cheers!
R



  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



  1   2   3   4   5   6   7   8   9   10   >