[PHP] Sessions on clustered machines

2002-06-05 Thread Cameron Just

Hi,

Just wondering if sessions can be shared on clustered webservers?

ie one location for session.save_path which is shared amongst many machines.

Thanks



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




[PHP] Regular Expression Challenge

2002-03-24 Thread Cameron Just

Hi,

I am trying to pull out the following information via a regular expression.

The string I am searching on is 'wed-thurs 9:35, 14:56, 18:35'

and I want it to retreive
wed
thurs
9:35
14:56
18:35

The regular expression I am using is
([a-z]+)-([a-z]+) +([0-9]{1,2}:?[0-9]{0,2})[, ]*

It seems to be grabbing the
wed
thurs
9:35
but I can't seem to retrieve the rest of the times.

Anyone have any ideas?

BTW
There can be any number of 'times' in the string and also the 'times' can
be with or without the colon and the minutes, hence the '}:?[0-9]{0,2}'
part of the regexp.





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




Re: [PHP] Regular Expression Challenge

2002-03-25 Thread Cameron Just


No luck on any of those suggestions people but thanks anyway :(

I had a feeling it was a bit too complex for a regexp.


> Oh, I didnt read the bit at the bottom about the times appearing any
> number of times.  Off the top of my head I think this should work...
>
> PREG:
>
> "/'([a-z]+)-([a-z]+)\s(?:([0-9]+(?::[0-9]+|))(?:,\s)?)*'/"
>
> --
> Matt
>
> - Original Message -
> From: "Cameron Just" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, March 25, 2002 6:15 AM
> Subject: [PHP] Regular Expression Challenge
>
>
>> Hi,
>>
>> I am trying to pull out the following information via a regular
> expression.
>>
>> The string I am searching on is 'wed-thurs 9:35, 14:56, 18:35'
>>
>> and I want it to retreive
>> wed
>> thurs
>> 9:35
>> 14:56
>> 18:35
>>
>> The regular expression I am using is
>> ([a-z]+)-([a-z]+) +([0-9]{1,2}:?[0-9]{0,2})[, ]*
>>
>> It seems to be grabbing the
>> wed
>> thurs
>> 9:35
>> but I can't seem to retrieve the rest of the times.
>>
>> Anyone have any ideas?
>>
>> BTW
>> There can be any number of 'times' in the string and also the 'times'
>> can be with or without the colon and the minutes, hence the
>> '}:?[0-9]{0,2}' part of the regexp.
>>
>>
>>
>>
>>
>> --
>> 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] Regular Expression Challenge

2002-03-25 Thread Cameron Just

Brilliant. (Sort of)

Thats the answer I needed thankyou.
I was not sure as to whether regexp could do recursive matching and now I
know.

Thankyou for your help.

> You won't be able to do that with a regexp alone.  Recursively matching
> isn't possible.  You'll need a little help from some additional code.
>
> $string = "wed-thurs 9:35, 14:56, 18:35";  // YOUR STRING
>$regexp = "^([a-z]+)-([a-z]+)[\ ]+(.*)$";
>   // GETS (day)-(day) (any/all times)
>$find = ereg( $regexp, $string, $matches );
>$times = explode( ",", $matches[3] );  // BREAK APART (.*)
>print( $matches[1] . "\n" . $matches[2] . "\n" );
>while( list( $key, $val ) = each( $times ) ){
>print( trim( ${val} ) . "\n" );
>}
> ?>
>
> That seems to do the trick.  Hopefully that gets ya closer to where you
> want to go.  If you really needed to regexp match on the times, you can
> do that within the while loop.
>
>   g.luck,
>~Chris /"\
>   \ / Microsoft Security
>   Specialist:
>        X  The moron in Oxymoron.
>   / \ http://www.thebackrow.net
>
> On Mon, 25 Mar 2002, Cameron Just wrote:
>
>> Hi,
>>
>> I am trying to pull out the following information via a regular
>> expression.
>>
>> The string I am searching on is 'wed-thurs 9:35, 14:56, 18:35'
>>
>> and I want it to retreive
>> wed
>> thurs
>> 9:35
>> 14:56
>> 18:35
>>
>> The regular expression I am using is
>> ([a-z]+)-([a-z]+) +([0-9]{1,2}:?[0-9]{0,2})[, ]*
>>
>> It seems to be grabbing the
>> wed
>> thurs
>> 9:35
>> but I can't seem to retrieve the rest of the times.
>>
>> Anyone have any ideas?
>>
>> BTW
>> There can be any number of 'times' in the string and also the 'times'
>> can be with or without the colon and the minutes, hence the
>> '}:?[0-9]{0,2}' part of the regexp.




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




[PHP] Re: Database connection problem

2002-03-25 Thread Cameron Just

Hi,

Genenally you can use 'localhost' as the hostname username 'root' and the
password is blank.
I beleive this is a default user when mysql is installed.

The details about how to connect are in the database 'mysql' and the
table 'user'. You should probably add a new user specifically for your php
scripts to this table.

NOTE: If you do add a new user you will need to restart mysql before it can
be accessed via the new user.

Hope that helps.

> Hi, can anyone help me with this problem.
> I'm trying to connect to a MySQL database on my computer, I don't have
> a hostname for it, so I just insert the IP, something like this.
>
> ...
> mysql_cos?
> Thanks.
> -Chris




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




[PHP] Classes within classes (Should I do this?)

2001-12-04 Thread Cameron Just

Hi,

Is this a bad thing to do have a class stored within another class?

I would also like to store an array of another class within a class. 

It seems to work apart from the fact that I can't reference an array of 
class directly.
ie
$test_array[0]->get();
This gives an error.


Example code.
-
testing = $temp;
  }
  function get_test(){
return $this->testing;
  }
}

class top_level {
  var $testing = 0;
  var $sub_class = "";
  function set($temp){
$this->testing = $test;
  }
  function get(){
return $this->testing;
  }
}

  $test = new sub_level;
  $top = new top_level;
  $top2 = new top_level;

  $top->sub_class = $test;

  $top2->sub_class = $test;

  $top->sub_class->set_test(50);
  $top2->sub_class->set_test(1000);
  $test_array[0] = $top;
  $test_array[1] = $top2;

  echo get_class($test_array[0])."";
  echo get_class($test_array[1])."";
  echo get_class($test_array[2])."";

  $temp = $test_array[1];
  echo get_class($temp->sub_class)."";
  echo "Booo - ".$temp->sub_class->get_test();

?>
-


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Anyone have the wording for a license for clients?

2001-03-22 Thread Cameron Just

Hi,

I have been developing PHP for a few years now as an employeee of other companies.
I have now started working from home doing contracts for various businesses.

Does anyone know of where I can find the wording of a software license I can give to 
my clients when I hand over the code.
It should cover the following points.

1. I am offering them unlimited licensed use of the code I have produced.
2. They cannot on sell my code.
3. I retain copyright for my code. (This might come as a default)
4. 40% - 60% of my code is generic functions that I use in all my websites and I 
retain the ability to use this code again in developing work for other businesses.
5. They are free to modify and adjust my code as much as they want.

Does anyone know where I can find some sort of legal document I can give to these 
clients as a license for the software I produce for them.

Is there any important points I have missed?
I know the law is very different from country to country but I'm sure much of this 
would be the same.




Cameron Just ([EMAIL PROTECTED])

Phoenix Digital Development



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Including files within a class definition

2004-07-04 Thread Cameron Just
Hi,

I have a program which generates classes based on table structures within
a database. However there are a few times where I need to put custom
methods within these generated classes.

I want to be able to do this but php gives an error for the following include

class generatedClass {
  var $this = 0;

  function here($strVar){

   echo 'this';
  }

  include (extended_methods_stuff.php);

}

I know that I can probably extend this class to add the extra
functionality however the other generated classes rely on the name of this
class so I cannot just extend this class and it's name cannot change.

Is there any way to have an include prior to the class being parsed?

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



[PHP] SFTP connections via PHP

2007-09-25 Thread Cameron Just

Hi All,

Just wondering if anyone has had any success getting a connection
working with PHP via SFTP.

I am running
Win 2003 Server
PHP Version 5.1.6
Win32 OpenSSL v0.9.8e Light is installed
PECL module for SSH2 is installed

The following code
-
   // create connetion to remote server
   if (!$sftpConnection = ssh2_connect(DNCR_SERVERNAME, 22)) {
   echo 'ERROR: Server connection failed.' . "\n";
   exit;
   }

   // check fingerprint of remote server matches what we expect
   $dncrFingerprint = ssh2_fingerprint($sftpConnection,
SSH2_FINGERPRINT_MD5 | SSH2_FINGERPRINT_HEX);
   if ($dncrFingerprint != DNCR_FINGERPRINT && FALSE) {
   echo 'ERROR: Hostkey mismatch.' . "\n";
   exit;
   }

   // ensure that authentication methods allowed
   $sshAcceptedAuthenticationMethods =
ssh2_auth_none($sftpConnection,DNCR_USERNAME);
   echo "\n" . 'Accepted authentication methods:' . "\n";
   for ($i = 0; $i < count($sshAcceptedAuthenticationMethods); $i++)
echo $sshAcceptedAuthenticationMethods[$i] . "\n";
   echo "\n";

   $sshNegotiatedMethods = ssh2_methods_negotiated($sftpConnection);
   echo 'Encryption keys were negotiated using: {' .
$sshNegotiatedMethods['kex'] . '}' . "\n";
   echo 'Server identified using an {' .
$sshNegotiatedMethods['hostkey'] . '} with ';
   echo 'fingerprint: ' . ssh2_fingerprint($sftpConnection) . "\n";

   echo 'Client to Server packets will use methods:' . "\n";
   echo 'Crypt: {' . $sshNegotiatedMethods['client_to_server']['crypt']
. '}' . "\n";
   echo 'Comp: {' . $sshNegotiatedMethods['client_to_server']['comp'] .
'}' . "\n";
   echo 'MAC: {' . $sshNegotiatedMethods['client_to_server']['mac'] .
'}' . "\n";

   echo 'Server to Client packets will use methods:' . "\n";
   echo 'Crypt: {' . $sshNegotiatedMethods['server_to_client']['crypt']
. '}' . "\n";
   echo 'Comp: {' . $sshNegotiatedMethods['server_to_client']['comp'] .
'}' . "\n";
   echo 'MAC: {' . $sshNegotiatedMethods['server_to_client']['mac'] .
'}' . "\n";


   if (!ssh2_auth_password($sftpConnection, DNCR_USERNAME ,
DNCR_PASSWORD)) {
   echo 'ERROR: Cannot authenticate to remote server.' . "\n";
   exit;
   }
-

produces the following result
-

Accepted authentication methods:
publickey
keyboard-interactive

Encryption keys were negotiated using: {diffie-hellman-group14-sha1}
Server identified using an {ssh-dss} with fingerprint: 
F4EE0910B0C6BA932908320145F87790

Client to Server packets will use methods:
Crypt: {aes256-cbc}
Comp: {none}
MAC: {hmac-sha1}
Server to Client packets will use methods:
Crypt: {aes256-cbc}
Comp: {none}
MAC: {hmac-sha1}

*Warning*:  ssh2_auth_password() [function.ssh2-auth-password 
]: Authentication 
failed for myusername using password in 
*c:\Inetpub\wwwroot\VESD\phoenix\composer-stage1-wash-file-submission.php* 
on line *67*


ERROR: Cannot authenticate to remote server.

-

I can connect to this remote server via SFTP using Filezilla so there is
no firewall issues.

I also did a bit of reading on the accepted authentication method of
keyboard-interactive and it states that password should be allowed to be
sent
http://www.ssh.com/support/documentation/online/ssh/winhelp/32/overview.html

Any help would be greatly appreciated.

Thankyou

PS: I am sorry for the double post but noone has responded to this email 
on the windows list so I thought I would try my luck here...


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



Re: [PHP] Optimized PHP

2007-10-02 Thread Cameron Just
One trick that one of my friends has taught me is to only use double 
quotes "s where needed as they are parsed by PHP and instead use single 
quotes 's


i.e.
$fred['john'] = 10;
is better than
$fred["john"] = 10;

or
echo 'This is some text' . "\n";
instead of
echo "This is some text\n";

He told me that everything within double quotes must be walked through 
by PHP looking for variables or other escaped characters. Since most 
code has these style statements every few lines the overall time saved 
adds up.


ashish.sharma wrote:

Hello All,

I am working on PHP from quite some time. I am pretty much comfortable in
writing PHP code but I always want that I should write good, quality code.
For this I always look for the best practices which other developers uses
and implement and I am writing this for the same reason as I would like to
know how can i code a good, optimized PHP code. What are the areas where I
can optimize my code more to avoid extra consumption of resources h/w or
s/w. What are the best practices I can follow to optimize my code to
increase the speed and performance of my application and to reduce down the
memory consumption. For example ..

In an application where I am having some different settings for each of the
user/visitor, then what will be the best approach of doing this? Should I
keep all the settings in sessions or should i create an xml/ini file for
each user and call that in the bootstrap file (at runtime, on the basis of
the the User) to pick the settings of that user.

These are the kind of questions for which I always have to think. So, can
anyone suggest me some source / article / reference from where I can find
the solutions of such of my problems.

Looking forward for your suggestions ..

Thx to all ..

Ashish
  


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



Re: [PHP] Anyone else doing PHP on Symbian?

2008-02-05 Thread Cameron Just
More info can be found here... When I get my Nokia N82 I am going to try 
it out.


http://wiki.opensource.nokia.com/projects/PAMP

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



[PHP] Windows Share access with filesystem functions.

2001-01-30 Thread Cameron Just

Hi,

I am running PHP 4.0.4pl1 on a windows box as a CGI.
Why can't I access files on the network via a windows share?
ie
\\nt4server\wwwroot\thisfile.phtml
It used to work on other systems I have used PHP on.
It seems that PHP now only accepts files references like this.
d:\wwwroot\thisfile.phtml

I have used escape characters when referencing the directories too.
$filename = "nt4server\\wwwroot\\thisfile.phtml"

It still doesn't work.
Is there something on my NT box that I need to set up?


Thanks




********
Cameron Just ([EMAIL PROTECTED])

Phoenix Digital Development



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]