[PHP] date question

2003-11-19 Thread Martin Cameron
$ndays=14;

function get_next_dates($ndays)
{
 $today=date(m-d-Y,mktime(0,0,0,date(m),date(d),date(Y)));

$forward_date=date(m-d-Y,mktime(0,0,0,date(m),date(d)+$few_days,date(Y)));
 print h1$today === $few_days === $forward_date/h1;
 for($i=0;$i$ndays;$i++)
 {

$new_days_array[]=date(m-d-Y,mktime(0,0,0,date(m),date(d)+$i,date(Y)));
 }
 return($new_days_array);
}


-- 
This message has been scanned for viruses and
dangerous content by WebNet Internet Services, and is
believed to be clean.
WebNet Internet Services .

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



Re: [PHP] Phone Number #s Only?

2001-08-02 Thread Martin Cameron

Just as the solution to spray paint the m/b green made me smile, this did 
too. 

This will strip out all characters except numerals at the beginning, right!

martin Cameron

On Fri, 03 Aug 2001 11:52, you wrote:
 on 8/2/01 5:32 PM, Jeff Oien at [EMAIL PROTECTED] wrote:
  Is there a routine out there to strip all characters from a phone
  number except the numbers? I was going to write my own but
  figured there must already be one out there I can use. Thanks.
  Jeff Oien

 ereg_replace ([^0-9],,$string);

  -- mike cullerton

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




Re: [PHP] Re: limit items per page

2001-07-23 Thread Martin Cameron

Here's a Quick  Dirty script that I ran up to get a display of 10 items per 
page with each click on a hyper-linked page returning a new page .. if you 
know what I mean. I've even included the headers so that any newbies can see 
the complete script and not just bits. The theory is that the first sql 
statement goes and gets the total number of rows for the display. This is 
then held in a global variable. The second query goes and gets the rows 
limited by an incrementing number. Simple, huh!

?
  include(radius.inc);
radius_db_connect();
define (INITIAL_PAGE,0);
 
$sql=select distinct username from user;
$res=mysql_query($sql) or die (OK);;
$num_rows=mysql_num_rows($res);
$j=1;
$i=0;
 
function initial_page(){
   global $PHP_SELF, $num_rows, $i,$j, $n;
   $sql=select distinct username from user limit $n, 10;
   $res=mysql_query($sql);
   while($row=mysql_fetch_array($res)){
  print $row[username].br;
   }
   $k=0;
   while($i = $num_rows){
  print a href = '$PHP_SELF?action=0n=$i' [$k]nbsp/a\n;
  $k++;
  $i+=10;
   }
}
 
switch($action){
 case INITIAL_PAGE:
   initial_page();
   break;
 default:
   die (Could not find function number $action);
}
?


On Mon, 23 Jul 2001 21:25, you wrote:
 Perhaps I shouldn't have made the assumption that steph was using mysql :)

 Henrik Hansen [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

  [EMAIL PROTECTED] (James Holloway) wrote:
Hi Steph,
   
as the name suggests, use LIMIT ;)
 
  AFAIK it's mysql specific (at least it does not work with mssql)
 
  --
  Henrik Hansen

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




Re: [PHP] User ID's

2001-07-23 Thread Martin Cameron

Try Sessions, bud. That's what they're there for.

On Mon, 23 Jul 2001 21:46, you wrote:
 Hi all,
   I need store all the userid's connected to my site, in a
 database. the database, if the user has closed his browser a php script
 will check after intervals of a few minutes, if the user is not logged in,
 then changed relating to that user, will be undone.
 my quesiotns are ,

 1) how do i get a user's ID.
 2) what sort of check do i put to see if the variable is destroyed or not.

 thanx in advance

-- 
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] Using input type = 'button rather than input type = 'submit'

2001-04-23 Thread Martin Cameron

Here is a simple form file that needs to pass a variable - $hello - from
the form to a new function. Unfortunately, it doesn't.  When you click
the submit button, the URL looks like this:

 http://localhost/test5.php?action=1hello=

 It should have the variable there after the hello=

I suspect it's something to do with parent.location. Looking for a
solution. Here's the script:

 head
 /head
 body bgcolor=white
 ?
 define(INITIAL_PAGE,0);
 define(SELECT,1);
 function initial_page(){
global $PHP_SELF,$hello;
print form action = '$PHP_SELF?action=1' method = 'post'
 name = 'hello';
print input type='text' name='hello';
print input name = 'hello' type='button' value='Submit'
 onClick=\parent.location='$PHP_SELF?action=1hello=$hello'\;

print /form;
 }

 function select(){
global $hello;
print Hellooo, $hello!;
 }

 initial_page();

 switch($action){
  case INITIAL_PAGE:
initial_page;
break;
  case SELECT:
select();
break;
  default:
die (Hello, can't find that function.);
 }
 ?
 /body
 /html


The thing is that if you simply hit enter - rather than click the
submit button, the first directive in the form tag is invoked, and
the value of the $hello variable IS passed.

regards
Martin Cameron



Re: [PHP] Using input type = 'button rather than input type = 'submit'

2001-04-23 Thread Martin Cameron

Hi Rene

I think that I first used a submit button about html ver 2.0. I want to
use a button type - not submit.

regards
Martin

Rene Maldonado wrote:

 Hi I think it woulf be better this way:

 print form action = '$PHP_SELF?action=1' method = 'post'
 name = 'hello';
 print input type='text' name='var_hello';
 print input type  = submit value = 'Submit' ;


 and, the var name is $var_hello

 this way, the value of your var do not appear in the URL,

 This work for me...



 Martin Cameron wrote:

 Here is a simple form file that needs to pass a variable - $hello -
 from
 the form to a new function. Unfortunately, it doesn't.  When you
 click
 the submit button, the URL looks like this:

  http://localhost/test5.php?action=1hello=

  It should have the variable there after the hello=

 I suspect it's something to do with parent.location. Looking for a
 solution. Here's the script:

  head
  /head
  body bgcolor=white
  ?
  define(INITIAL_PAGE,0);
  define(SELECT,1);
  function initial_page(){
 global $PHP_SELF,$hello;
 print form action = '$PHP_SELF?action=1' method = 'post'
  name = 'hello';
 print input type='text' name='hello';
 print input name = 'hello' type='button' value='Submit'

 onClick=\parent.location='$PHP_SELF?action=1hello=$hello'\;

 print /form;
  }

  function select(){
 global $hello;
 print Hellooo, $hello!;
  }

  initial_page();

  switch($action){
   case INITIAL_PAGE:
 initial_page;
 break;
   case SELECT:
 select();
 break;
   default:
 die (Hello, can't find that function.);
  }
  ?
  /body
  /html

 The thing is that if you simply hit enter - rather than click the
 submit button, the first directive in the form tag is invoked,
 and
 the value of the $hello variable IS passed.

 regards
 Martin Cameron




[PHP] Maintaining Session State Across Clusters

2001-03-13 Thread Martin Cameron

Does anyone know if it is possible to maintain session state across a
cluster of four web servers?

Regards
Martin Cameron


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