[PHP] PHP Mailing list software..

2003-06-06 Thread Chad Day
Can anyone make a recommendation for me?  I'm looking to tie mailing lists
in to my existing site, which is coded in php/mysql.  I would be looking for
a script that has browseable archives, ability to restrict access to them to
subscribers only, and the ability to send mail to the list a web form, which
would require a u/p stored in mysql, preferably in md5 format.  I know I'll
have to do a lot of customization to get it to integrate into my site, but
I'm looking for a solid script that I need to tweak the least.  Any
suggestions?

Thanks,
Chad Day


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



[PHP] Reading remote image into a file and displaying..

2003-02-20 Thread Chad Day
I'm trying to get weather channel information without using their form to
submit the zip code .. the url format is :

http://oap.weather.com/fcgi-bin/oap/generate_magnet?loc_id=$ZIPcode=689861;
destination=$ZIP

so I tried:

$weatherfile =
readfile(http://oap.weather.com/fcgi-bin/oap/generate_magnet?loc_id=$_SESSI
ON[ZIP]code=689861destination=$_SESSION[ZIP]);
echo $weatherfile;

but of course it just outputs the raw image data .. I tried echoing it out
in a img src tag, same result.  Is there some function I'm unaware of that
will help me out here?

Thanks,
Chad


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




[PHP] problem with mysql / auto increment fields.. ?

2003-02-19 Thread Chad Day
On my website there are a couple places where people can sign up ..

The querys after the sign up process look like

$blahblah = query(insert firstname lastname) values (blah blah blah)
$userid = mysql_insert_id($blahblah);

$insertintoothertable = query(userid, blah blah blah) etc.

it then uses this userid var to insert them into a variety of other tables
for other things on the site, such as a phpBB account, etc.

if multiple people are signing up for accounts at different places, is there
the possibility that a duplicate userid could be assigned, or anything like
that?

Thanks,
Chad


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




RE: [PHP] setcookie() in various browsers.. 3rd followup.. anyone?

2003-02-11 Thread Chad Day
This is with PHP 4.2 and register_globals off.

I am setting cookies and starting a session in the following fashion:

setcookie(EMAILADDR, $row[EMAIL], time()+2592000, '/', .$dn);

where $dn = mydomain.com

I want the cookies accessible sitewide .. at www.mydomain.com, mydomain.com,
forums.mydomain.com, etc.

in IE 5.5, IE 6.0, and NS 7.0, it seems this is being accomplished
correctly.

In NS 4.8 (and 4.7 I assume), the cookies are never even getting set.  Can
anyone tell me as to why?  I've been prodding around cookie docs and trying
to find something that works in all browsers, and a lot of people seem to
have the same question..

Thanks!
Chad



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




RE: [PHP] setcookie() in various browsers..

2003-02-10 Thread Chad Day
Following up from Friday.. no replies over the weekend.. can anyone help?

Thanks,
Chad

-Original Message-
From: Chad Day [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 07, 2003 3:02 PM
To: php general
Subject: [PHP] setcookie() in various browsers..


This is with PHP 4.2 and register_globals off.

I am setting cookies and starting a session in the following fashion:

setcookie(EMAILADDR, $row[EMAIL], time()+2592000, '/', .$dn);

where $dn = mydomain.com

I want the cookies accessible sitewide .. at www.mydomain.com, mydomain.com,
forums.mydomain.com, etc.

in IE 6.0, and NS 7.0, it seems this is being accomplished correctly.

In NS 4.8, the cookies are never even getting set.  Can anyone tell me as to
why?  I've been prodding around cookie docs and trying to find something
that works in all browsers, and a lot of people seem to have the same
question..

Thanks!
Chad



--
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] Limit the amount of returns in a MySQL query

2003-02-07 Thread Chad Day
if (!isset($startlimit)) {
$startlimit = 0;
}

$endlimit = $startlimit + 10;

$yourquery = your query data LIMIT $startlimit, $endlimit

that should give you enough insight on how to work it.

Chad

-Original Message-
From: Daniel Page [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 07, 2003 3:53 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Limit the amount of returns in a MySQL query


Hi All,

Imagine I have a giant database table tracking email addresses (I don't but
it is the first example that jumps to mind after my recent antispam
campaign!).

If i do a
 select * from mailaddresses;
I will get all of the table.
If i do a
 select * from mailaddresses where id  10;
I will get all the records where the id is less than 10...

The problem is that I want 10 records, period, so if id is not a primary
key, I could have 60 records that match... or if it is a P.K., but I delete
2 to 8, it will only return 2 records (1 and 9...)

How can I structure the query to only return only 10 records ? the idea
being able to construct a query where if there are more than 10 (or x)
results on a page, you click on a link 'page 2' and so on, and the next
query will return the next 10 (or x) records...


Cheers,
Daniel



-- 
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] Sorting multidimensional arrays..

2003-01-30 Thread Chad Day
I'm struggling with array_multisort, was hoping someone could give me some
help.

I have a multidim array, such as:

$myarray[0][FIRSTNAME] = JOE
$myarray[1][FIRSTNAME] = TIM
$myarray[2][FIRSTNAME] = BOB

$myarray[0][LASTNAME] = SMITH
$myarray[1][LASTNAME] = BROWN
$myarray[2][LASTNAME] = JONES

$myarray[0][EXTENSION] = 2000
$myarray[1][EXTENSION] = 4000
$myarray[2][EXTENSION] = 1000

I was trying array_multisort($myarray[EXTENSION], SORT_NUMERIC, SORT_DESC),
but nothing seems to be happening to the array.  If anyone has any clues or
can point me in the right direction, I would appreciate it.

Thanks,
Chad


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




[PHP] array_sum, multidimensional arrays?

2003-01-21 Thread Chad Day
Is it possible to use array_sum to add up values in multidimensional arrays?
I have an array like:

$array[0][VALUE] = 10;
$array[1][VALUE] = 8;
$array[2][VALUE] = 5;

$array[0][OTHERVALUE] = 20;
$array[1][OTHERVALUE] = 15;
$array[2][OTHERVALUE] = 9;

Thanks,
Chad


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




[PHP] security question regarding including files..

2003-01-21 Thread Chad Day
I want to give my users the ability to submit a URL to a database, then when
they pull up their page, their photo is included .. what I'm worried about
is them pointing the link to some malicious code or something..

Obviously I can validate the file extension (.gif or .jpg) .. and I'm going
to force the files to be stored offsite -  they dont get to upload anything
to the server.  I'm just a bit paranoid about this, so I'm hoping someone
more security-minded can tell me what to watch out for, what to check, if
I'm missing anything..

Thanks,
Chad


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




[PHP] Template tutorials?

2003-01-10 Thread Chad Day
I'm googling around for template tutorials and such after seeing a link to
the Smarty template engine .. can anyone point me to any particularly good
ones?  I've always been going with the 'one-file' approach .. which I think
it's time I changed.

Thanks,
Chad


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




[PHP] Recommend payment processors?

2003-01-03 Thread Chad Day
Just wondering what people are using/recommend out there.. I'm going to be
getting a merchant account and let people purchase services through my
website on a secure server, all in PHP.  What concerns me is this archived
post I came across:

http://marc.theaimsgroup.com/?l=php-generalm=102165623600464w=2

Reading that, it sounds like it's not possible to use Payment Pro, or
possibly other systems, with PHP .. is this correct?  Some of the other
posts in the archive sounded like people were using it, so I'm not really
sure what is possible at this point.

Thanks,
Chad


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




RE: [PHP] Recommend payment processors?

2003-01-03 Thread Chad Day
Paypal is not an option for reasons I won't begin to get into.  I'm sure
someone is using something solid out there ..

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 03, 2003 11:36 AM
To: php general
Subject: Re: [PHP] Recommend payment processors?


I use PayPal.  Does not require a merchant account.  PHP payment interface
and interaction is easy
to implement.  Via HTML in your webpage, you pass to PayPal the URL of the
PHP script to be executed
when a payment is received.

- Original Message -
From: Chad Day [EMAIL PROTECTED]
To: php general [EMAIL PROTECTED]
Sent: Friday, January 03, 2003 10:14 AM
Subject: [PHP] Recommend payment processors?


Just wondering what people are using/recommend out there.. I'm going to be
getting a merchant account and let people purchase services through my
website on a secure server, all in PHP.  What concerns me is this archived
post I came across:

http://marc.theaimsgroup.com/?l=php-generalm=102165623600464w=2

Reading that, it sounds like it's not possible to use Payment Pro, or
possibly other systems, with PHP .. is this correct?  Some of the other
posts in the archive sounded like people were using it, so I'm not really
sure what is possible at this point.

Thanks,
Chad


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




[PHP] Round robin script revisited..

2002-12-30 Thread Chad Day
I was trying to find a script to do round robin pairings for a sports
schedule generator..  I was able to come across one in Perl, and am in the
process of trying to convert it to PHP, but since my perl knowledge is a bit
(well, a lot) lacking, I was hoping someone could help..

Perl script:

http://www.perlmonks.org/index.pl?parent=90132title=Round%20Robin%20Schedul
inglastnode_id=90132displaytype=displaytype=superdocnode=Comment%20on


The part I'm having trouble with:

for(1..($size-$even))
{
my @this_week;
# push the weeks worth of games onto @games
foreach my $sched_ref (@stripes)
{
push (@this_week, [$teams[$sched_ref-[0]], $teams[$sched_ref-
+[1]]]);
}
push(@games, \@this_week);


I'm not sure how to rewrite that in PHP and be pushing the correct array
elements into the games array .. If anyone can help me out or point me in
the right direction, I'd appreciate it.

Thanks,
Chad


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




RE: [PHP] Warning?

2002-12-30 Thread Chad Day
You can't have any text output to the browser before a redirect.  Make sure
you have nothing abouve line 58 echoing out text (specifically whatever is
in line 2, judging by your error) .. I believe I've had the problem when
I've included a file where the 1st line was blank, so you may want to check
that as well..

Chad

-Original Message-
From: Doug Coning [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 30, 2002 12:25 PM
To: php general
Subject: [PHP] Warning?


Hi everyone,

I'm using Dreamweaver to create an insert page and after the record is
inserted I receive this error:

Warning: Cannot add header information - headers already sent by (output
started at
/home/virtual/site8/fst/var/www/html/admin_gs/products_insert.php:2) in
/home/virtual/site8/fst/var/www/html/admin_gs/products_insert.php on line 62

Line 58 - 62 is as follows:

  if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ?  : ?;
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
  }
  header(sprintf(Location: %s, $insertGoTo));

This same code works in my update page without an error.

If you can help, thank you

Doug




--
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] Round robin script revisited..

2002-12-30 Thread Chad Day
Ok, after some more fiddling, I'm really close to getting this to work.

The script seems to correctly generate a schedule if an odd number of teams
are specified:

Given an array of 5 teams, A through E, the following pairs are generated:

Round 1 - A/E, B/D
Round 2 - D/E, A/C
Round 3 - C/D, B/E
Round 4 - B/C, A/D
Round 5 - A/B, C/E

Looks good.. each team gets a bye, each team plays each other.  With an even
number of teams however, some pairings are repeated, and I'm sure this is a
bug I created when translating the code from perl to PHP.  The PHP code I
have is below, the link to the perl source is
(http://www.perlmonks.org/index.pl?parent=90132title=Round%20Robin%20Schedu
linglastnode_id=90132displaytype=displaytype=superdocnode=Comment%20on),
and the set of pairings I get with 6 teams, A through F is below.

6 teams, A/F

Round 1 - A/E, B/D, C/F
Round 2 - F/D, A/C, B/E
Round 3 - E/C, F/B, A/D
Round 4 - D/B, E/A, F/C (dupe of round 1)
Round 5 - C/A, D/F, E/B (dupe of round 2)

PHP code:

?

$teamarray = array('A', 'B', 'C', 'D', 'E', 'F');

$num_teams = sizeof($teamarray);

$pivot = undef;
$even = 0;
$end_point_a = 0;
$end_point_b = $num_teams-1;

if($num_teams % 2 == 0) {
# $pivot = array_pop($teamarray);
#$pivot = $#teams;
#$pivot = $num_teams-;
$pivot = ($num_teams - 1);
$even = 1;
$end_point_b--;
}


# Create a list of the stripes of the polygon, the stripes will be
# pairs of indices into the array

$stripes = array();

# Assume that each element in the array is a vertex of the polygon
# and the vertices are listed in order, stripes are created

for ($x = 1; $x  (sizeof($teamarray) / 2); $x++) {
# for (1..int(($size-1)/2)) {
array_push($stripes, array($end_point_a, $end_point_b));
$end_point_a++;
$end_point_b--;
}

if ($even) {
array_push($stripes, array($end_point_a,  $pivot));
}

$games = array();
for ($x = 0; $x  ($num_teams - $even); $x++) {
$this_week = array();
for ($y = 0; $y  sizeof($stripes); $y++) {
$num1 = $stripes[$y][0];
$num2 = $stripes[$y][1];
array_push($this_week, $teamarray[$num1], $teamarray[$num2]);
}
array_push($games, $this_week);

# Now rotate the @teams array
# Save the last team as the pivot for the polygon
$last_team = array_pop($teamarray);
array_unshift($teamarray, $last_team);
//  echo pArray Order: ;
//  for ($z = 0; $z  sizeof($teamarray); $z++) {
//  echo $teamarray[$z];
//  }
/*  if ($even) {
array_push($teamarray, $last_team);
}
*/
}

// echo 'brbrbr';
print_r($games);

?

-Original Message-
From: Chad Day [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 30, 2002 10:57 AM
To: php general
Subject: [PHP] Round robin script revisited..


I was trying to find a script to do round robin pairings for a sports
schedule generator..  I was able to come across one in Perl, and am in the
process of trying to convert it to PHP, but since my perl knowledge is a bit
(well, a lot) lacking, I was hoping someone could help..

Perl script:

http://www.perlmonks.org/index.pl?parent=90132title=Round%20Robin%20Schedul
inglastnode_id=90132displaytype=displaytype=superdocnode=Comment%20on


The part I'm having trouble with:

for(1..($size-$even))
{
my @this_week;
# push the weeks worth of games onto @games
foreach my $sched_ref (@stripes)
{
push (@this_week, [$teams[$sched_ref-[0]], $teams[$sched_ref-
+[1]]]);
}
push(@games, \@this_week);


I'm not sure how to rewrite that in PHP and be pushing the correct array
elements into the games array .. If anyone can help me out or point me in
the right direction, I'd appreciate it.

Thanks,
Chad


--
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] Round robin script revisited..

2002-12-30 Thread Chad Day
Nevermind, I found the bug.

End of the code should be:

# Now rotate the @teams array
# Save the last team as the pivot for the polygon
if ($even) {
$last_team_save = array_pop($teamarray);
}
$last_team = array_pop($teamarray);
array_unshift($teamarray, $last_team);
if ($even) {
array_push($teamarray, $last_team_save);
}


Hope this helps anyone else who needs it.

Chad

-Original Message-
From: Chad Day [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 30, 2002 2:03 PM
To: php general
Subject: RE: [PHP] Round robin script revisited..


Ok, after some more fiddling, I'm really close to getting this to work.

The script seems to correctly generate a schedule if an odd number of teams
are specified:

Given an array of 5 teams, A through E, the following pairs are generated:

Round 1 - A/E, B/D
Round 2 - D/E, A/C
Round 3 - C/D, B/E
Round 4 - B/C, A/D
Round 5 - A/B, C/E

Looks good.. each team gets a bye, each team plays each other.  With an even
number of teams however, some pairings are repeated, and I'm sure this is a
bug I created when translating the code from perl to PHP.  The PHP code I
have is below, the link to the perl source is
(http://www.perlmonks.org/index.pl?parent=90132title=Round%20Robin%20Schedu
linglastnode_id=90132displaytype=displaytype=superdocnode=Comment%20on),
and the set of pairings I get with 6 teams, A through F is below.

6 teams, A/F

Round 1 - A/E, B/D, C/F
Round 2 - F/D, A/C, B/E
Round 3 - E/C, F/B, A/D
Round 4 - D/B, E/A, F/C (dupe of round 1)
Round 5 - C/A, D/F, E/B (dupe of round 2)

PHP code:

?

$teamarray = array('A', 'B', 'C', 'D', 'E', 'F');

$num_teams = sizeof($teamarray);

$pivot = undef;
$even = 0;
$end_point_a = 0;
$end_point_b = $num_teams-1;

if($num_teams % 2 == 0) {
# $pivot = array_pop($teamarray);
#$pivot = $#teams;
#$pivot = $num_teams-;
$pivot = ($num_teams - 1);
$even = 1;
$end_point_b--;
}


# Create a list of the stripes of the polygon, the stripes will be
# pairs of indices into the array

$stripes = array();

# Assume that each element in the array is a vertex of the polygon
# and the vertices are listed in order, stripes are created

for ($x = 1; $x  (sizeof($teamarray) / 2); $x++) {
# for (1..int(($size-1)/2)) {
array_push($stripes, array($end_point_a, $end_point_b));
$end_point_a++;
$end_point_b--;
}

if ($even) {
array_push($stripes, array($end_point_a,  $pivot));
}

$games = array();
for ($x = 0; $x  ($num_teams - $even); $x++) {
$this_week = array();
for ($y = 0; $y  sizeof($stripes); $y++) {
$num1 = $stripes[$y][0];
$num2 = $stripes[$y][1];
array_push($this_week, $teamarray[$num1], $teamarray[$num2]);
}
array_push($games, $this_week);

# Now rotate the @teams array
# Save the last team as the pivot for the polygon
$last_team = array_pop($teamarray);
array_unshift($teamarray, $last_team);
//  echo pArray Order: ;
//  for ($z = 0; $z  sizeof($teamarray); $z++) {
//  echo $teamarray[$z];
//  }
/*  if ($even) {
array_push($teamarray, $last_team);
}
*/
}

// echo 'brbrbr';
print_r($games);

?

-Original Message-
From: Chad Day [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 30, 2002 10:57 AM
To: php general
Subject: [PHP] Round robin script revisited..


I was trying to find a script to do round robin pairings for a sports
schedule generator..  I was able to come across one in Perl, and am in the
process of trying to convert it to PHP, but since my perl knowledge is a bit
(well, a lot) lacking, I was hoping someone could help..

Perl script:

http://www.perlmonks.org/index.pl?parent=90132title=Round%20Robin%20Schedul
inglastnode_id=90132displaytype=displaytype=superdocnode=Comment%20on


The part I'm having trouble with:

for(1..($size-$even))
{
my @this_week;
# push the weeks worth of games onto @games
foreach my $sched_ref (@stripes)
{
push (@this_week, [$teams[$sched_ref-[0]], $teams[$sched_ref-
+[1]]]);
}
push(@games, \@this_week);


I'm not sure how to rewrite that in PHP and be pushing the correct array
elements into the games array .. If anyone can help me out or point me in
the right direction, I'd appreciate it.

Thanks,
Chad


--
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] Finding # of weekdays between 2 dates..

2002-12-27 Thread Chad Day
I should have specified, those dates were in US form.. so:

$nowdate = mktime(0, 0, 0, 1, 4, 2002);
$futuredate = mktime(0, 0, 0, 2, 5, 2002);

$futuredate - $nowdate equals 2764800
((2764800 / 86400) / 7) = 4.57142

then when floored, comes out to 4.

The only thing I can think of possibly getting around it is setting
futuredate to mktime(23, 59, 59, $month, $day, $year), but I still come up
short .. those two timestamps, after all the math before the floor(), equals
4.71, which still results in a 4.  I've tried ceil and round, but with
similar inaccuracies in other dates (going 1 day too far in some cases with
ceil).

Perhaps this function I found is just not the right way to go about it, but
if anyone has any more insight, it's greatly appreciated.

Chad

-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 27, 2002 2:48 AM
To: Chad Day
Cc: php general
Subject: Re: [PHP] Finding # of weekdays between 2 dates..


WFM:

$nowdate = mktime(0, 0, 0, 4, 1, 2002);
$futuredate = mktime(0, 0, 0, 5, 2, 2002);

echo weekdaysBetween ($nowdate,$futuredate,2);

I get 5

Chad Day wrote:

I found this function in the list archives while searching on how to find
the number of a weekday (say, Tuesdays) between 2 dates..

  function weekdaysBetween ($timestamp1, $timestamp2, $weekday)
  {
return floor(intval(($timestamp2 - $timestamp1) / 86400) / 7)
  + ((date('w', $timestamp1) = $weekday) ? 1 : 0);
  }

Sometimes it works, but I've come across a date while testing this that
doesn't work, which makes me think there is some bug in the function that
I'm not seeing.

The 2 dates I am trying are:

01-04-2002
and
02-05-2002

There should be 5 Tuesdays:

01-08-2002
01-15-2002
01-22-2002
01-29-2002
02-05-2002

Yet the script only returns 4, leaving off 02-05-2002.

   $nowdate = mktime(0, 0, 0, $STARTMONTH, $STARTDAY, $STARTYEAR);
   $futuredate = mktime(0, 0, 0, $ENDMONTH, $ENDDAY, $ENDYEAR);

That's how I'm generating the time stamps to pass to the function, and I've
confirmed the dates I've entered are correct..

   echo weekdaysBetween($nowdate, $futuredate, 2);

Returns 4 ..


can anyone assist?

Thanks,
Chad







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




[PHP] Finding # of weekdays between 2 dates..

2002-12-26 Thread Chad Day
I found this function in the list archives while searching on how to find
the number of a weekday (say, Tuesdays) between 2 dates..

  function weekdaysBetween ($timestamp1, $timestamp2, $weekday)
  {
return floor(intval(($timestamp2 - $timestamp1) / 86400) / 7)
  + ((date('w', $timestamp1) = $weekday) ? 1 : 0);
  }

Sometimes it works, but I've come across a date while testing this that
doesn't work, which makes me think there is some bug in the function that
I'm not seeing.

The 2 dates I am trying are:

01-04-2002
and
02-05-2002

There should be 5 Tuesdays:

01-08-2002
01-15-2002
01-22-2002
01-29-2002
02-05-2002

Yet the script only returns 4, leaving off 02-05-2002.

$nowdate = mktime(0, 0, 0, $STARTMONTH, $STARTDAY, $STARTYEAR);
$futuredate = mktime(0, 0, 0, $ENDMONTH, $ENDDAY, $ENDYEAR);

That's how I'm generating the time stamps to pass to the function, and I've
confirmed the dates I've entered are correct..

echo weekdaysBetween($nowdate, $futuredate, 2);

Returns 4 ..


can anyone assist?

Thanks,
Chad


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




[PHP] Creating access DB in PHP ..

2002-12-19 Thread Chad Day
Not sure if this is possible, and I haven't turned up what I'm looking for
in my searches yet..

I am running PHP on a FreeBSD box .. I need to create an Access database,
fill it in with some data, and have a client download it (as the software
the client is using only imports mdb files).  Is this possible in any way,
even if I have to go some route like creating it as a MySQL DB, doing a
conversion to mdb (I've seen conversion tools for vice versa), etc? ..

Thanks,
Chad


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




RE: [PHP] Cookie handling, NS 4.x?

2002-12-10 Thread Chad Day
Ok, I understand.  I was able to get NS to set the cookie, but -only- if I
put nothing in the domain field.


setcookie(NSUSERNAME, cday, time()+2592000, /, .domain.com);
echo meta HTTP-EQUIV=\REFRESH\ content=\0;url=nscookie2.php\;

did not work.  domain.com also did not work . .  this is kind of a pain, but
this is what I get for trying to make a site NS 4.x compatible I guess.  Is
there any way to specify the domain of a cookie with NS 4.x in this kind of
situation?

Thanks,
Chad

-Original Message-
From: Chris Shiflett [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 09, 2002 5:30 PM
To: Chad Day; php general
Subject: RE: [PHP] Cookie handling, NS 4.x?


--- Chad Day [EMAIL PROTECTED] wrote:
 I'm not sure how this would matter since the cookie is
 never set at all.. it's not an issue of it reading the
 cookie, as it can't read what is never set. I'll give
 it a shot when I get home though anyway.

Read my response again, and you'll see that what you are
saying here does not conflict. The cookie is indeed not
getting set, and that is likely because the browser does
not take action on the Set-Cookie header when it is
contained within a 302 response. If you use a meta redirect
rather than a header(Location: ...) call, the response
status will be 200 instead of 302, so the browser might
accept the cookie.

Chris

--
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] Cookie handling, NS 4.x?

2002-12-10 Thread Chad Day
domain.com, but www is pointed to it as well.  When I was setting the
cookies with Header calls and using .domain.com, they worked fine (I want
to be able to access these cookies from my.domain.com, forums.domain.com,
etc, which is why they need to be set in .domain.com).  But then the NS 4.x
Header problem popped up, and now the domain issue..

In IE, the code I posted below:

setcookie(NSUSERNAME, cday, time()+2592000, /, .domain.com);
echo meta DEFANGED_HTTP-EQUIV=\REFRESH\
content=\0;url=nscookie2.php\;

works fine in regards to setting the cookie still.  NS 4.x is a piece of
crap. :(

Chad

-Original Message-
From: Jaime Bozza [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 10, 2002 9:07 AM
To: 'Chad Day'
Cc: 'php general'
Subject: RE: [PHP] Cookie handling, NS 4.x?


Hello,
   By any chance, is your website named http://domain.com or is it
http://www.domain.com ?

Jaime Bozza


 -Original Message-
 From: Chad Day [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, December 10, 2002 8:09 AM
 To: [EMAIL PROTECTED]; php general
 Subject: RE: [PHP] Cookie handling, NS 4.x?


 Ok, I understand.  I was able to get NS to set the cookie,
 but -only- if I
 put nothing in the domain field.


 setcookie(NSUSERNAME, cday, time()+2592000, /, .domain.com);
 echo meta DEFANGED_HTTP-EQUIV=\REFRESH\
 content=\0;url=nscookie2.php\;

 did not work.  domain.com also did not work . .  this is kind
 of a pain, but
 this is what I get for trying to make a site NS 4.x
 compatible I guess.  Is
 there any way to specify the domain of a cookie with NS 4.x
 in this kind of
 situation?

 Thanks,
 Chad

 -Original Message-
 From: Chris Shiflett [mailto:[EMAIL PROTECTED]]
 Sent: Monday, December 09, 2002 5:30 PM
 To: Chad Day; php general
 Subject: RE: [PHP] Cookie handling, NS 4.x?


 --- Chad Day [EMAIL PROTECTED] wrote:
  I'm not sure how this would matter since the cookie is
  never set at all.. it's not an issue of it reading the
  cookie, as it can't read what is never set. I'll give
  it a shot when I get home though anyway.

 Read my response again, and you'll see that what you are
 saying here does not conflict. The cookie is indeed not
 getting set, and that is likely because the browser does
 not take action on the Set-Cookie header when it is
 contained within a 302 response. If you use a meta redirect
 rather than a header(Location: ...) call, the response
 status will be 200 instead of 302, so the browser might
 accept the cookie.

 Chris

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



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




RE: [PHP] Cookie handling, NS 4.x?

2002-12-10 Thread Chad Day
So, basically... cookies aren't going to work in NS 4.x if I specify a
domain and need to do a redirect afterwards.  (I tried the dot at the end,
also no go) ... wow, that sucks. :\

Thanks,
Chad

-Original Message-
From: Jaime Bozza [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 10, 2002 9:33 AM
To: 'Chad Day'
Cc: 'php general'
Subject: RE: [PHP] Cookie handling, NS 4.x?


The original cookie specifications required that the domain in the
cookie has at least 2 (or 3 for domains not in the primary tlds) periods
in it.  (So as to stop someone from using .com, .edu, etc...)

So, you use .domain.com, right?  Well, Netscape 4.x is strict in that
.domain.com does not match http://domain.com ...  Sounds like you're
having this problem.

I don't believe you're going to have any luck with cookies in Netscape
4.x with only one period.  (I had heard some references to using
domain.com., but I just setup a primary domain webserver to test that
and it doesn't work)


Jaime



 -Original Message-
 From: Chad Day [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, December 10, 2002 8:17 AM
 To: Jaime Bozza
 Cc: 'php general'
 Subject: RE: [PHP] Cookie handling, NS 4.x?


 domain.com, but www is pointed to it as well.  When I was setting the
 cookies with Header calls and using .domain.com, they
 worked fine (I want
 to be able to access these cookies from my.domain.com,
 forums.domain.com,
 etc, which is why they need to be set in .domain.com).  But
 then the NS 4.x
 Header problem popped up, and now the domain issue..

 In IE, the code I posted below:

 setcookie(NSUSERNAME, cday, time()+2592000, /, .domain.com);
 echo meta DEFANGED_HTTP-EQUIV=\REFRESH\
 content=\0;url=nscookie2.php\;

 works fine in regards to setting the cookie still.  NS 4.x is
 a piece of
 crap. :(

 Chad

 -Original Message-
 From: Jaime Bozza [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, December 10, 2002 9:07 AM
 To: 'Chad Day'
 Cc: 'php general'
 Subject: RE: [PHP] Cookie handling, NS 4.x?


 Hello,
By any chance, is your website named http://domain.com or is it
 http://www.domain.com ?

 Jaime Bozza


  -Original Message-
  From: Chad Day [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, December 10, 2002 8:09 AM
  To: [EMAIL PROTECTED]; php general
  Subject: RE: [PHP] Cookie handling, NS 4.x?
 
 
  Ok, I understand.  I was able to get NS to set the cookie,
  but -only- if I
  put nothing in the domain field.
 
 
  setcookie(NSUSERNAME, cday, time()+2592000, /, .domain.com);
  echo meta DEFANGED_HTTP-EQUIV=\REFRESH\
  content=\0;url=nscookie2.php\;
 
  did not work.  domain.com also did not work . .  this is kind
  of a pain, but
  this is what I get for trying to make a site NS 4.x
  compatible I guess.  Is
  there any way to specify the domain of a cookie with NS 4.x
  in this kind of
  situation?
 
  Thanks,
  Chad
 
  -Original Message-
  From: Chris Shiflett [mailto:[EMAIL PROTECTED]]
  Sent: Monday, December 09, 2002 5:30 PM
  To: Chad Day; php general
  Subject: RE: [PHP] Cookie handling, NS 4.x?
 
 
  --- Chad Day [EMAIL PROTECTED] wrote:
   I'm not sure how this would matter since the cookie is
   never set at all.. it's not an issue of it reading the
   cookie, as it can't read what is never set. I'll give
   it a shot when I get home though anyway.
 
  Read my response again, and you'll see that what you are
  saying here does not conflict. The cookie is indeed not
  getting set, and that is likely because the browser does
  not take action on the Set-Cookie header when it is
  contained within a 302 response. If you use a meta redirect
  rather than a header(Location: ...) call, the response
  status will be 200 instead of 302, so the browser might
  accept the cookie.
 
  Chris
 
  --
  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








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




RE: [PHP] Cookie handling, NS 4.x?

2002-12-10 Thread Chad Day
I think I understand now .. I was purposely making all my login forms/etc go
to http://domain.com so that when the cookies were set, they would be
ensured to set in .domain.com so I could read them on other parts of
domain.com (www., my., calendar., forums.) .. It looks like dropping the
support for domain.com is the best bet, as bizarre of a solution as that
sounds.  But I guess according to the cookie standards, that's correct..
as long as I set the cookie path, I should be good.

Another bright part of setting the cookie this way is that it seems to no
longer rely on the meta refresh, and I can continue using Header:  calls ..
hmm.

Thanks for all the help, Jaime and Chris, much appreciated.

Chad

-Original Message-
From: Jaime Bozza [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 10, 2002 10:22 AM
To: 'Chad Day'
Cc: 'php general'
Subject: RE: [PHP] Cookie handling, NS 4.x?


Well, not quite.

Cookies won't work if you specify a domain and you don't use something
like http://www.domain.com

For instance, if you drop the support for http://domain.com and then set
your cookie with .domain.com, everything will work fine.  (Perhaps
setup a virtual host for domain.com that redirects everything to
www.domain.com?)

Redirecting and cookies work fine with Apache.  We redirect with cookies
here quite a bit and it works fine in everything I've tested (Netscape,
IE, Opera, Mozilla, even IE Mac! G)

There's a problem using IIS with cookies and redirects (IIS parses the
headers and removes most of them if you have a Location header.)

And yes, Netscape 4.x is the bane of all existence. :)  Now that
Netscape 7.0 and Mozilla 1.x are out, someone should remove all copies
of Netscape 4.x.  (Cookies aren't the only big issue for me there.  CSS
and Dynamic HTML support are horrible in NS4.x!)

Jaime


 -Original Message-
 From: Chad Day [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, December 10, 2002 9:11 AM
 To: Jaime Bozza
 Cc: 'php general'
 Subject: RE: [PHP] Cookie handling, NS 4.x?


 So, basically... cookies aren't going to work in NS 4.x if I specify a
 domain and need to do a redirect afterwards.  (I tried the
 dot at the end,
 also no go) ... wow, that sucks. :\

 Thanks,
 Chad

 -Original Message-
 From: Jaime Bozza [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, December 10, 2002 9:33 AM
 To: 'Chad Day'
 Cc: 'php general'
 Subject: RE: [PHP] Cookie handling, NS 4.x?


 The original cookie specifications required that the domain in the
 cookie has at least 2 (or 3 for domains not in the primary
 tlds) periods
 in it.  (So as to stop someone from using .com, .edu, etc...)

 So, you use .domain.com, right?  Well, Netscape 4.x is strict in that
 .domain.com does not match http://domain.com ...  Sounds like you're
 having this problem.

 I don't believe you're going to have any luck with cookies in Netscape
 4.x with only one period.  (I had heard some references to using
 domain.com., but I just setup a primary domain webserver to
 test that
 and it doesn't work)


 Jaime



  -Original Message-
  From: Chad Day [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, December 10, 2002 8:17 AM
  To: Jaime Bozza
  Cc: 'php general'
  Subject: RE: [PHP] Cookie handling, NS 4.x?
 
 
  domain.com, but www is pointed to it as well.  When I was
 setting the
  cookies with Header calls and using .domain.com, they
  worked fine (I want
  to be able to access these cookies from my.domain.com,
  forums.domain.com,
  etc, which is why they need to be set in .domain.com).  But
  then the NS 4.x
  Header problem popped up, and now the domain issue..
 
  In IE, the code I posted below:
 
  setcookie(NSUSERNAME, cday, time()+2592000, /, .domain.com);
  echo meta DEFANGED_HTTP-EQUIV=\REFRESH\
  content=\0;url=nscookie2.php\;
 
  works fine in regards to setting the cookie still.  NS 4.x is
  a piece of
  crap. :(
 
  Chad
 
  -Original Message-
  From: Jaime Bozza [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, December 10, 2002 9:07 AM
  To: 'Chad Day'
  Cc: 'php general'
  Subject: RE: [PHP] Cookie handling, NS 4.x?
 
 
  Hello,
 By any chance, is your website named http://domain.com or is it
  http://www.domain.com ?
 
  Jaime Bozza
 
 
   -Original Message-
   From: Chad Day [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, December 10, 2002 8:09 AM
   To: [EMAIL PROTECTED]; php general
   Subject: RE: [PHP] Cookie handling, NS 4.x?
  
  
   Ok, I understand.  I was able to get NS to set the cookie,
   but -only- if I
   put nothing in the domain field.
  
  
   setcookie(NSUSERNAME, cday, time()+2592000, /,
 .domain.com);
   echo meta DEFANGED_HTTP-EQUIV=\REFRESH\
   content=\0;url=nscookie2.php\;
  
   did not work.  domain.com also did not work . .  this is kind
   of a pain, but
   this is what I get for trying to make a site NS 4.x
   compatible I guess.  Is
   there any way to specify the domain of a cookie with NS 4.x
   in this kind of
   situation?
  
   Thanks,
   Chad
  
   -Original

[PHP] Cookie handling, NS 4.x?

2002-12-09 Thread Chad Day
I am having a fairly confusing problem with setcookie() in NS 4.x.

My script:

nscookie.php:

setcookie(NSUSERNAME, 'cday', time()+2592000, '/', .mydomain.com);
Header(Location: nscookie2.php);
exit();


nscookie2.php:

echo $_COOKIE[NSUSERNAME];




In IE (all versions I have tested), this works fine.

In NS 7, this works fine.

In NS 4.7 and 4.8 .. nothing is returned.  No cookie is set in the
cookies.txt file at all.

Can anyone tell me why?  I've been poking around the PHP manual pages but
haven't come across anything let.

Thanks,
Chad


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




RE: [PHP] Cookie handling, NS 4.x?

2002-12-09 Thread Chad Day
I'm not sure how this would matter since the cookie is never set at all..
it's not an issue of it reading the cookie, as it can't read what is never
set.  I'll give it a shot when I get home though anyway.

-Original Message-
From: Chris Shiflett [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 09, 2002 4:31 PM
To: Chad Day; php general
Subject: Re: [PHP] Cookie handling, NS 4.x?


--- Chad Day [EMAIL PROTECTED] wrote:
 I am having a fairly confusing problem with setcookie()
 in NS 4.x.

 My script:

 nscookie.php:

 setcookie(NSUSERNAME, 'cday', time()+2592000, '/',
 .mydomain.com);
 Header(Location: nscookie2.php);
 exit();

 nscookie2.php:

 echo $_COOKIE[NSUSERNAME];

 In IE (all versions I have tested), this works fine.

 In NS 7, this works fine.

 In NS 4.7 and 4.8 .. nothing is returned.  No cookie is
 set in the
 cookies.txt file at all.

 Can anyone tell me why?

I believe this has something to do with the fact that the
HTTP response status code is no longer a 200 when you send
a Location header, as PHP will automatically change it to a
302 for you. Thus, in some browsers, the result is that the
browser will submit a GET request for the URL identified in
the Location header, but it will ignore the HTTP headers
sent in the 302 response.

To see if this is in fact the trouble with Netscape 4.x,
try using a meta tag redirect instead. Even though the W3C
dislikes this use of http-equiv, it is very consistently
supported, and I know many Web sites that use it
(SourceForge, for example).

Good luck.

Chris


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




[PHP] Confused about $_SESSION and $_COOKIE scope..

2002-12-06 Thread Chad Day
I'm not sure why this isn't working, been banging my head at it for a couple
hours now.

I have a file (index.php), which calls a function that draws the header to
my page.

Inside that function (site_header), is an include to a file (menu.php) which
draws dynamic javascript menus based on
cookie or session values.

I can't seem to access ANY variables, be them $_SESSION, $_COOKIE, or
anything else, inside this menu.php file.  I've tried even passing simple
variables, globalizing them, etc, all the way down to see if I can access
them in that menu.php file.  I still can't.. the closest I get is being able
to access them in the site_header function, but when the include(menu.php)
is called, everything seems to vanish.

And yes, I have session_start(); at the top of my menu.php file as well..

Can anyone help me out on this?  I was under the impression that the
superglobals would be available from basically anything.. apparently I was
wrong.

Thanks,
Chad


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




[PHP] Pairing algorithm?

2002-08-12 Thread Chad Day

Has anyone written any sort of pairing algorithm for a round robin sports
schedule, or something similar?  I couldn't find anything in the archives
surprisingly, and I'm looking around google and not turning up much except
some PDFs and white papers addressing the mathmatical complications of it.

Thanks,
Chad


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




RE: [PHP] Pairing algorithm?

2002-08-12 Thread Chad Day

I found a pairing algorithm finally via Google in C that I've been trying to
translate over into PHP, with no success (seemingly creates an infinite
loop).  I'm also surprised I haven't seen it in PHP yet.. thought someone
would have done it by now.

http://www.devenezia.com/downloads/round-robin/

And the source for that:

http://www.devenezia.com/downloads/round-robin/schedule-source.html

I'm still mucking around with it, but I don't know C very well, so I'm sure
there's a few bugs in my translation of it that's causing the infinite loop
in PHP, I'm just still trying to track it down..

Here's the code I very quickly tried to translate over, surely to be
littered with errors:

?

$teams = 10;
$MaxTeams = 50;

$combinations = ($teams/2 * ($teams-1));

$m = 1;
for ($a = 1; $a  $teams; $a++) {
for ($b = ($a+1); $b = $teams; $b++) {
$clist[$m][one] = $a;
$clist[$m][two] = $b;
$m++;
}
}

$roundcount = 1;
$index = 1;


while ($roundcount = $teams-1) {
$matchcount = 1;
$round_set = 0;
for ($i = 0; $i = $MaxTeams/2; $i++) {
$mlist[$i] = 0;
}

$startC = $roundcount;
while ($matchcount = $teams/2) {
$c = ($combinations + 1);
while ($c  $combinations) {
$c = $startC;
while (($c = $combinations)  ($round_set  (1  
$clist[$c][one])) ||
($round_set  (1  $clist[$c][two])) || ($cused[$c])) 
{
$c++;
}

if ($c  $combinations) {
do {
$mlist[$matchcount] = 0;
$matchcount--;
$index--;

$round_set = ~(1  
$cList[$mList[$matchCount]][one]);
$round_set = ~(1  
$cList[$mList[$matchCount]][two]);

$cUsed[$mList[$matchCount]] = FALSE;

$tourn[$index][one] = 0;
$tourn[$index][two] = 0;

} while ($clist[$mlist[$matchcount]][one] !=
$clist[$mlist[$matchcount]+1][one]);

$startc = $mlist[$matchcount] + 1;
}

}
$tourn[$index] = $clist[$c];
$totalchecks++;
if (($totalchecks % 1000) == 0) {
}

$cused[$c] = TRUE;
$mlist[$matchcount] = $c;

$startc = 1;

$round_set |= (1  $clist[$c][one]);
$round_set |= (1  $clist[$c][two]);

$index++;
$matchcount++;
}
$roundcount++;
}

?



-Original Message-
From: Bas Jobsen [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 12, 2002 12:19 PM
To: Chad Day
Subject: Re: [PHP] Pairing algorithm?


Hi

Never Seen it in php. There are many variants, mostly depending on your
needs.
Do you have the algorithm you want in pseudo code?




Op maandag 12 augustus 2002 16:24, schreef Chad Day:
 Has anyone written any sort of pairing algorithm for a round robin sports
 schedule, or something similar?  I couldn't find anything in the archives
 surprisingly, and I'm looking around google and not turning up much except
 some PDFs and white papers addressing the mathmatical complications of it.

 Thanks,
 Chad


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




[PHP] ldap_modify parameters?

2002-08-01 Thread Chad Day

I think something is wrong with the way I am calling ldap_modify, but I'm
not sure exactly what, from the scripts and tutorials I've been looking
at/experimenting with:

$ds=ldap_connect(online-leagues.com);
if ($ds) {
$r=ldap_bind($ds, 'username', 'password');
// Search surname entry
$sr=ldap_search($ds, 'cn=online-leagues.com', 'uid=testing');
echo Search result is .$sr.p;
$info = ldap_get_entries($ds, $sr);
   echo dn is: . $info[0][dn] .br;
echo first cn entry is: . $info[0][cn][0] .br;
echo first email entry is: . $info[0][mail][0] .p;
echo st = . $info[0][st][0] .p;

$info[0][st][0]=stchanged!;

ldap_modify($ds, 'uid=testing,cn=online-leagues.com', $info);
echo Closing connection;
ldap_close($ds);

} else {
echo h4Unable to connect to LDAP server/h4;
}

The error returned is:

Fatal error: LDAP: Unknown Attribute in the data in
/usr/local/www/sites/online-leagues.com/htdocs/ldapform.php on line 31

I looked up the error on google but didn't find anything..


Running ldapsearch from the command line on my box, the record looks like:


#
# filter: (objectclass=*)
# requesting: ALL
#

# online-leagues.com
dn: cn=online-leagues.com
objectclass: top
objectclass: organization
objectclass: CommuniGateDomain
cn: online-leagues.com
o: www.online-leagues.com


# testing, online-leagues.com
dn: uid=testing,cn=online-leagues.com
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
objectclass: CommuniGateAccount
cn: rn
hostServer: online-leagues.com
sn:
st: st
street: str
telephoneNumber: tn
uid: testing
mail: [EMAIL PROTECTED]


so I think the dn is right, but I'm not 100% sure now.  Any ideas?

Thanks,
Chad


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




RE: [PHP] ldap_modify parameters?

2002-08-01 Thread Chad Day

Also tried that, no success, unless I am missing something.

...
$info[st]=stchanged!;
...

ldap_modify($ds, 'uid=testing,cn=online-leagues.com', $info);

Fatal error: LDAP: Unknown Attribute in the data in
/usr/local/www/sites/online-leagues.com/htdocs/ldapform.php on line 31

Chad

-Original Message-
From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 01, 2002 9:41 AM
To: Chad Day
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] ldap_modify parameters?


I think your problem is that you are passing the output of
ldap_get_entries() directly back into ldap_modify().  ldap_get_entries()
returns an array of result elements whereas ldap_modify() is expecting a
single element.

So, to change the 'st' attribute for the uid=testing record, you should
simply do:

$data['st'] = 'stchanged';
ldap_modify($ds, 'uid=testing,cn=online-leagues.com', $data);

If st takes multiple values, use:

$data['st'][0] = 'stchanged';
$data['st'][1] = '2nd value';
ldap_modify($ds, 'uid=testing,cn=online-leagues.com', $data);

-Rasmus

On Thu, 1 Aug 2002, Chad Day wrote:

 I think something is wrong with the way I am calling ldap_modify, but I'm
 not sure exactly what, from the scripts and tutorials I've been looking
 at/experimenting with:

   $ds=ldap_connect(online-leagues.com);
   if ($ds) {
   $r=ldap_bind($ds, 'username', 'password');
   // Search surname entry
   $sr=ldap_search($ds, 'cn=online-leagues.com', 'uid=testing');
   echo Search result is .$sr.p;
   $info = ldap_get_entries($ds, $sr);
echo dn is: . $info[0][dn] .br;
 echo first cn entry is: . $info[0][cn][0] .br;
 echo first email entry is: . $info[0][mail][0] .p;
   echo st = . $info[0][st][0] .p;

   $info[0][st][0]=stchanged!;

   ldap_modify($ds, 'uid=testing,cn=online-leagues.com', $info);
   echo Closing connection;
   ldap_close($ds);

   } else {
   echo h4Unable to connect to LDAP server/h4;
   }

 The error returned is:

 Fatal error: LDAP: Unknown Attribute in the data in
 /usr/local/www/sites/online-leagues.com/htdocs/ldapform.php on line 31

 I looked up the error on google but didn't find anything..


 Running ldapsearch from the command line on my box, the record looks like:


 #
 # filter: (objectclass=*)
 # requesting: ALL
 #

 # online-leagues.com
 dn: cn=online-leagues.com
 objectclass: top
 objectclass: organization
 objectclass: CommuniGateDomain
 cn: online-leagues.com
 o: www.online-leagues.com


 # testing, online-leagues.com
 dn: uid=testing,cn=online-leagues.com
 objectclass: top
 objectclass: person
 objectclass: organizationalPerson
 objectclass: inetOrgPerson
 objectclass: CommuniGateAccount
 cn: rn
 hostServer: online-leagues.com
 sn:
 st: st
 street: str
 telephoneNumber: tn
 uid: testing
 mail: [EMAIL PROTECTED]


 so I think the dn is right, but I'm not 100% sure now.  Any ideas?

 Thanks,
 Chad


 --
 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] FreeBSD 4.6 / PHP 4.2.2 / Apache 2.0.39 install trouble

2002-07-25 Thread Chad Day

Simple build, no real complicated configure options
(--with-mysql, --with-apxs2..) ..

During make:

php_functions.c:93: syntax error
*** Error code 1

Stop in /usr/local/php-4.2.2/sapi/apache2filter.

etc
etc


Any idea what the problem would be?  I googled around for a little and heard
there might be problems getting the latest php to work with apache 2.0.39,
but that was a couple weeks ago.. I thought the new 4.2.2 build might
address it, but I guess if it's only a security fix like the site says,
maybe not.. does 4.2.* just not work with Apache 2.0.39, or is something
else amiss?

Thanks,
Chad


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




RE: [PHP] FreeBSD 4.6 / PHP 4.2.2 / Apache 2.0.39 install trouble

2002-07-25 Thread Chad Day

The apache configure line was a vanilla configure, only turning on
mod_rewrite and enabling so.

It's really as basic of a configure as I could do.. I don't understand why
it failed. :(

So I did what someone else suggested, tried the ports.. installed apache2,
fine, tried to install mod_php4, selected zlip, mysql, + openldap2.x
support.  Got the packages, then when installing them and it got to apxs, it
was looking for --with-apxs2 since apache 2.x is being used.  apparently the
script used --with-apxs.  I don't see where I can change this.

Unreal that this is this difficult to get working. :\

Chad

-Original Message-
From: Tech Support [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 25, 2002 2:49 PM
To: Chad Day
Subject: Re: [PHP] FreeBSD 4.6 / PHP 4.2.2 / Apache 2.0.39 install
trouble


Without seeing exactly what steps you took in building both apache and php
it would be next to impossible to guess.

Jim Grill
Support
Web-1 Hosting
http://www.web-1hosting.net
- Original Message -
From: Chad Day [EMAIL PROTECTED]
To: Tech Support [EMAIL PROTECTED]
Sent: Thursday, July 25, 2002 12:53 PM
Subject: RE: [PHP] FreeBSD 4.6 / PHP 4.2.2 / Apache 2.0.39 install trouble


 Ok, I decided to revert back to 1.3.26.

 PHP builds fine..

 When I go to start Apache:

 Syntax error on line 205 of /usr/local/www/conf/httpd.conf:
 Cannot load /usr/local/www/libexec/libphp4.so into server:
 /usr/local/www/libexec/libphp.so: Undefined symbol core_globals

 What does that mean?  Google turned up 4 results, none relevant, php.net
 search turned up 0.

 Thanks,
 Chad

 -Original Message-
 From: Tech Support [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, July 25, 2002 1:16 PM
 To: Chad Day; [EMAIL PROTECTED]
 Subject: Re: [PHP] FreeBSD 4.6 / PHP 4.2.2 / Apache 2.0.39 install
 trouble


 4.2.2 will not work with apache 2.X from what I've read. However, I have
 heard that if you get the latest CVS of both php and apache it will work.
I
 have not, and probably will not, go down that road just yet :-)

 Jim Grill
 Support
 Web-1 Hosting
 http://www.web-1hosting.net
 - Original Message -
 From: Chad Day [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, July 25, 2002 11:38 AM
 Subject: [PHP] FreeBSD 4.6 / PHP 4.2.2 / Apache 2.0.39 install trouble


  Simple build, no real complicated configure options
  (--with-mysql, --with-apxs2..) ..
 
  During make:
 
  php_functions.c:93: syntax error
  *** Error code 1
 
  Stop in /usr/local/php-4.2.2/sapi/apache2filter.
 
  etc
  etc
 
 
  Any idea what the problem would be?  I googled around for a little and
 heard
  there might be problems getting the latest php to work with apache
2.0.39,
  but that was a couple weeks ago.. I thought the new 4.2.2 build might
  address it, but I guess if it's only a security fix like the site says,
  maybe not.. does 4.2.* just not work with Apache 2.0.39, or is something
  else amiss?
 
  Thanks,
  Chad
 
 
  --
  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




[PHP] Sessions / logins / cookies / security

2002-07-16 Thread Chad Day

I asked something similar a little while ago, but didn't do a good job
clarifying.

What I'm looking to do is when a user logs in, I start up the session.. I
then have the registered session var to verify they are authenticated as
they move throughout the site.

Now, when they close the browser and come back, I want them to still be
authenticated.  Obviously, I have to set a cookie.  But what do I set?  Do I
set just their user ID?  The MD5 of their password?  What's the most secure
way, that's not easily spoofed?  I don't know that much about cookies, but
if I just use a user ID, couldn't someone just change that ID value and
'become' another user?

Thanks for any advice,
Chad


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




RE: [PHP] Sessions / logins / cookies / security

2002-07-16 Thread Chad Day

Anyone?  Can someone at least point me to some web article for
recommendations?  I saw some examples where a password variable was stored,
but is that really safe (as long as I MD5 it first?)

Chad

-Original Message-
From: Chad Day [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 16, 2002 12:30 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Sessions / logins / cookies / security


I asked something similar a little while ago, but didn't do a good job
clarifying.

What I'm looking to do is when a user logs in, I start up the session.. I
then have the registered session var to verify they are authenticated as
they move throughout the site.

Now, when they close the browser and come back, I want them to still be
authenticated.  Obviously, I have to set a cookie.  But what do I set?  Do I
set just their user ID?  The MD5 of their password?  What's the most secure
way, that's not easily spoofed?  I don't know that much about cookies, but
if I just use a user ID, couldn't someone just change that ID value and
'become' another user?

Thanks for any advice,
Chad


--
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] Dumb session / cookie / password questions

2002-07-10 Thread Chad Day

I am a little confused about storing stuff in cookies/sessions and how to
prevent spoofing of them.

A user logs in, his e-mail address or user id and password(md5'ed) is
checked against my database.

Assuming it matches, I then set a cookie with the users id + email.

What is to stop someone from spoofing that cookie?  I obviously don't want
to put the password in a cookie .. can someone point me in the direction of
an article about this?  I've searched around, but I'm not finding stuff
about in a preventing spoofing / security aspect.

Thanks,
Chad


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




[PHP] multi dimensional arrays / radio buttons / mass confusion on my part

2002-07-09 Thread Chad Day

Ok.. what I have is a database of first names and last names, and some other
columns that don't matter here.

A form is presented to a user, lets them enter a bunch of names, attributes
of the person, etc.

After submission, each record is checked against the current database to see
if the name currently exists, or names similar to it exist.

If so, it gives the option of either:

a) entering the new record
or
b) selecting one of the existing records


Example:

Enter your names, positions:
Joe Schmoe, LW
Random Guy, RW

(submit button)

After DB check for existing users:

Found:

()  Joey Schmoe   Click radio button to se this record
()  Create New Record


No matches found for Random Guy, must be a new user.

(submit button)


My problem is keeping this data consistent form by form, and updating the
data when an existing record is selected instead of creating a new one (the
existing data needs to go into another table, so I need to grab the user id
# of the existing record, etc)

Any thoughts on how to approach this?  After the first form, should I make a
multi-dimensional array, and have the second form update/change the elements
of it?  I haven't used any PHP arrays in this yet, just been messing with
the HTML form array stuff..

Sorry if this is confusing.. if any part needs clarification, please let me
know.

Thanks,
Chad


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




[PHP] PHP to Excel?

2002-06-18 Thread Chad Day

I'm trying to get data from my MySQL database into Excel using PHP.  I know
and I am doing it right now by generating a CSV file, but is there any way I
can do formatting, like make certain cells bold, etc etc?  Is there a list
of codes somewhere I can use to put before my field output to make a field
bold, stuff like that?

Thanks,
Chad


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




RE: [PHP] PHP to Excel?

2002-06-18 Thread Chad Day

Annoying doesn't begin to describe it.

I'm going with the HTML/Excel Header bit, since Biffwriter costs way too
much for a for-profit business to use.  Thanks anyway.. looks pretty neat,
and I'll probably use it for some other projects I do.

Thanks,
Chad

-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 18, 2002 11:47 AM
To: Martin Lucas; 'Chad Day'; [EMAIL PROTECTED]
Subject: Re: [PHP] PHP to Excel?


The layout on that site is so annoying. Yeah, it looks pretty, but it's
annoying. It's PHP2Excel BiffWriter that your looking for on that site.
Should be one of the topics when you expand the central dot (after you
close the news' popup). annoying...

Like someone else said, I just use HTML and send an Excel header(). Works
great and it's perfect for simple stuff. I'll probably move to PHP2Excel
BiffWriter eventually, though.

---John Holmes...
- Original Message -
From: Martin Lucas [EMAIL PROTECTED]
To: 'Chad Day' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, June 18, 2002 11:24 AM
Subject: AW: [PHP] PHP to Excel?


hi chad,

on http://www.cnovak.com/ you'll find a php-class that generates native
excel-files, even with cell formatings and other more or less useful things.


greetings

martin

 -Ursprüngliche Nachricht-
 Von: Chad Day [mailto:[EMAIL PROTECTED]]
 Gesendet: Dienstag, 18. Juni 2002 16:52
 An: [EMAIL PROTECTED]
 Betreff: [PHP] PHP to Excel?


 I'm trying to get data from my MySQL database into Excel
 using PHP.  I know
 and I am doing it right now by generating a CSV file, but is
 there any way I
 can do formatting, like make certain cells bold, etc etc?  Is
 there a list
 of codes somewhere I can use to put before my field output to
 make a field
 bold, stuff like that?

 Thanks,
 Chad


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




[PHP] Mailing list software recommendation?

2002-05-23 Thread Chad Day

I'm looking for PHP/MySQL based mailing list software for a project I'm
doing.. I plan on hosting a bunch of virtual domains and having to set up
mailing lists for all of them, and I don't want to go installing a new copy
of the software for each virtual domain.  The rest of the site is in PHP and
uses a MySQL back-end for user-authentication and authentication to other
software (tying in a bulletin board/forum login, and some other custom
things), so I definetly want MySQL involved for the authentication.

Any suggestions?  I've been poking around for a little while and I haven't
really seen anything addressing the virtual domain issue.. I'm sure there's
something out there, ISPs and such have to be using something, I just don't
know what it is..

Thanks,
Chad


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




RE: [PHP] Problems upgrading PHP..

2002-05-02 Thread Chad Day

php.ini didn't exist before apparently on this server I'm on.. or rather, it
was a 0 byte file.

Thanks, Rasmus.

Chad

-Original Message-
From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 02, 2002 2:58 PM
To: Chad Day
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Problems upgrading PHP..


Turn on register_globals in your php.ini file.

This shouldn't have changed in a simple upgrade, unless you didn't have a
php.ini file before, or you forgot to compile PHP to find your existing
php.ini file.

-Rasmus

On Thu, 2 May 2002, Chad Day wrote:

 So I'm trying to upgrade PHP from 4.0.1 to 4.2.0 on a box I have that had
 Apache 1.3.12 preinstalled, the source isn't on the box.

 mod_so is installed, so I just grabbed the new PHP tarball, unzipped it in
 /usr/local, and started compiling with the options I want, successfully
 built it, overwrote the old libphp4.so with the new one created, copied
over
 the php.ini file with the new one, and restarted.

 It loads up fine, but sessions don't seem to work -at all-.

 Even variables I tack onto the end of URLs seem to get lost, which renders
 just about everything I've done in PHP inoperable, it just seems to lose
 these variables or not keep track of them to begin with.

 What did I do wrong?

 Chad


 --
 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] Problems upgrading PHP..

2002-05-02 Thread Chad Day

Well, that worked for variable tracking, but MySQL seems to have been broken
in the process.. or rather, PHP accessing it..

Warning: MySQL: Unable to save result set in
/usr/local/www/vhosts/bangable.com/htdocs/forums/admin/db_mysql.php on line
92

If I do a phpinfo();, my PHP configure line reads:

'./configure' '--with-mysql' '--with-apxs'

but I know I did
./configure --with-mysql=/usr/local --with-apxs=/mypathtoapxs etc etc ..

Still really confused..

Chad

-Original Message-
From: Chad Day [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 02, 2002 2:52 PM
To: Rasmus Lerdorf
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Problems upgrading PHP..


php.ini didn't exist before apparently on this server I'm on.. or rather, it
was a 0 byte file.

Thanks, Rasmus.

Chad

-Original Message-
From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 02, 2002 2:58 PM
To: Chad Day
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Problems upgrading PHP..


Turn on register_globals in your php.ini file.

This shouldn't have changed in a simple upgrade, unless you didn't have a
php.ini file before, or you forgot to compile PHP to find your existing
php.ini file.

-Rasmus

On Thu, 2 May 2002, Chad Day wrote:

 So I'm trying to upgrade PHP from 4.0.1 to 4.2.0 on a box I have that had
 Apache 1.3.12 preinstalled, the source isn't on the box.

 mod_so is installed, so I just grabbed the new PHP tarball, unzipped it in
 /usr/local, and started compiling with the options I want, successfully
 built it, overwrote the old libphp4.so with the new one created, copied
over
 the php.ini file with the new one, and restarted.

 It loads up fine, but sessions don't seem to work -at all-.

 Even variables I tack onto the end of URLs seem to get lost, which renders
 just about everything I've done in PHP inoperable, it just seems to lose
 these variables or not keep track of them to begin with.

 What did I do wrong?

 Chad


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



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




[PHP] Problem reading in and displaying an image...

2002-04-02 Thread Chad Day

I'm trying to read in a 1x1 pixel file and display it, basically to assist
in setting 3rd party cookies (our other affiliated sites that don't follow
under the same domain.. it's really sloppily set up, but thats another
story)..  The problem I have is the script is just hanging, sits there and
does nothing, constantly trying to load..


setcookie($cookieName, $u, $expire, /);
setcookie($cookieName.logon, $t, $expire, /);

$fd = fopen(http://www.armytimes.com/images/spacer.gif;, r);
$image = fread($fd, 5024);
fclose($fd);
Header(Content-type: image/gif);
echo $image;

exit();


now, if I comment out the Header and echo $image; lines, the script works
fine, it reads in the file with no problem it seems.  But when I turn those
2 lines back on, it totally hangs.  does anyone have any ideas?  I am
totally stumped.

Thanks,
Chad


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




RE: [PHP] Session problem

2001-08-08 Thread Chad Day

I wish it did.

Still the same problem.

?php
session_start();
global $count;
session_register (count);
$count++;
?

Hello visitor, you have seen this page ?php echo
$HTTP_SESSION_VARS[count]; ? times.p

http://www.militarycity.com/classified/realtors/count.php

Chad

-Original Message-
From: karthik [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 08, 2001 1:08 AM
To: Chad Day
Subject: Re: [PHP] Session problem


Hi,

Have u tried $HTTP_SESSION_VARS[NAME] ?

Try it. I am sure it will work.

Karthik


- Original Message -
From: Chad Day [EMAIL PROTECTED]
To: mike cullerton [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, August 07, 2001 6:46 PM
Subject: RE: [PHP] Session problem


 I tried this, I still have the same problem.  Is this a bug in the version
 of PHP I am running?

 Chad

 -Original Message-
 From: mike cullerton [mailto:[EMAIL PROTECTED]]
 Sent: Monday, August 06, 2001 4:58 PM
 To: Chad Day; [EMAIL PROTECTED]
 Subject: Re: [PHP] Session problem


 i would try

 session_start();
 session_register(NAME);

 $res = mysql_query(SELECT NAME FROM dbhere where EMAIL = '$EMAIL' AND
 PASSWORD = '$PASSWORD');

 if ($row = mysql_fetch_array($res)) {
  $NAME = $row[NAME];
 }

 notice that $NAME is registered before being assigned to.

 on 8/6/01 2:23 PM, Chad Day at [EMAIL PROTECTED] wrote:

  PHP 4.0.2 ..
 
  I have a very basic script, gets the user's name, registers it, then
  displays Welcome, $NAME.   $NAME is the session registered name.
 
  If I constantly reload that page that says Welcome, sometimes $NAME
 appears,
  sometimes not.  Completely random.  It just loses track of the variable.
 
  My code:
 
  auth.php:
 
  session_start();
 
  ...
 
  $res = mysql_query(SELECT NAME FROM dbhere where EMAIL = '$EMAIL' AND
  PASSWORD = '$PASSWORD');
 
  if ($row = mysql_fetch_array($res)) {
  $NAME = $row[NAME];
  session_register(NAME);
  }
 
  ...
 
  Header(Location: menu.php);
 
 
 
  menu.php:
 
  session_start();
 
  echo Welcome, $NAME;
 
 
 
  So like, what the hell.  Why would it keep losing track of $NAME?
 
  Thanks,
  Chad
 


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



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

2001-08-08 Thread Chad Day

Nope.  Same problem.  I'm seriously thinking there's a bug in the version of
PHP I am running at this point, but I searched php.net and found no mention
of anything ..

Chad

-Original Message-
From: Brian Dunworth [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 08, 2001 10:37 AM
To: [EMAIL PROTECTED]
Cc: 'Chad Day'
Subject: RE: [PHP] Session problem



On Wednesday, August 08, 2001 at 9:16 AM, Chad Day said:
 I wish it did.

 Still the same problem.

 ?php
 session_start();
 global $count;
 session_register (count);
 $count++;
 ?

 Hello visitor, you have seen this page ?php echo
 $HTTP_SESSION_VARS[count]; ? times.p


  You're asking the session to remember a value ( session_register() ), then
changing that value ( $count++ ) and not re-registering it, then complaining
when the session returns the value you asked it to remember.

  What if you did:

?php
session_start();
$count++;
session_register (count);
?


 - Brian

 ---
  Brian S. Dunworth
  Sr. Software Development Engineer
  Oracle Database Administrator
  The Printing House, Ltd.
  (850) 875-1500 x225
 ---



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

2001-08-08 Thread Chad Day

No, as the way I'm getting around this right now is I'm -using- cookies.
Plus, I gave the URL, so you guys could see what is happening .. it's not a
client-side issue.

Sorry if I sound frustrated, but I really am at this point. :)

The URL again is: http://www.militarycity.com/classified/realtors/count.php

Chad

-Original Message-
From: Bjorn Van Simaeys [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 08, 2001 1:09 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Session problem


Maybe you have your cookies turned off in your
browser? Something that is easily forgotten..


Greetz,
Bjorn Van Simaeys
www.bvsenterprises.com



--- Chad Day [EMAIL PROTECTED] wrote:
 Nope.  Same problem.  I'm seriously thinking there's
 a bug in the version of
 PHP I am running at this point, but I searched
 php.net and found no mention
 of anything ..

 Chad

 -Original Message-
 From: Brian Dunworth
 [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 08, 2001 10:37 AM
 To: [EMAIL PROTECTED]
 Cc: 'Chad Day'
 Subject: RE: [PHP] Session problem



 On Wednesday, August 08, 2001 at 9:16 AM, Chad Day
 said:
  I wish it did.
 
  Still the same problem.
 
  ?php
  session_start();
  global $count;
  session_register (count);
  $count++;
  ?
 
  Hello visitor, you have seen this page ?php echo
  $HTTP_SESSION_VARS[count]; ? times.p


   You're asking the session to remember a value (
 session_register() ), then
 changing that value ( $count++ ) and not
 re-registering it, then complaining
 when the session returns the value you asked it to
 remember.

   What if you did:

 ?php
 session_start();
 $count++;
 session_register (count);
 ?


  - Brian

  ---
   Brian S. Dunworth
   Sr. Software Development Engineer
   Oracle Database Administrator
   The Printing House, Ltd.
   (850) 875-1500 x225
  ---



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



__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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

2001-08-08 Thread Chad Day

Still not working.  My script is -exactly- as you have it below, and I
believe I've tried that before.

(begins pulling out hair)

Chad

-Original Message-
From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 08, 2001 2:31 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Session problem


   ?php
   session_start();
   global $count;
   session_register (count);
   $count++;
   ?
  
   Hello visitor, you have seen this page ?php echo
   $HTTP_SESSION_VARS[count]; ? times.p

There was a bug in PHP in versions prior to 4.0.6: $count and
$HTTP_SESSION_VARS[count] did not reference the same value while on the
*current* page. Try this:

?php
session_start();
$count++;
session_register (count);
?
Hello visitor, you have seen this page ?php echo $count; ? times.

Kirk

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

2001-08-08 Thread Chad Day

What it looks like it is doing to me, if you hit the script and reload it a
bunch, is it creates a session, sticks with it for a while, then dumps it ..
it then creates another session, starts over at 1, and begins counting up..
then sometimes it will see the old session, and go back to it ..

Like, this will happen:

You've seen this page 1 times  (not gonna repeat the text)
2
3
4
5
1 // lost 1st session here
2
6 // regain 1st session
3 // switch
7
8
9
4 // switch

no matter how many times I reload that page, it seems to generate a max of 2
sessions.  wtf is going on?

Chad

-Original Message-
From: Chad Day [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 08, 2001 2:36 PM
To: Johnson, Kirk; [EMAIL PROTECTED]
Subject: RE: [PHP] Session problem


Still not working.  My script is -exactly- as you have it below, and I
believe I've tried that before.

(begins pulling out hair)

Chad

-Original Message-
From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 08, 2001 2:31 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Session problem


   ?php
   session_start();
   global $count;
   session_register (count);
   $count++;
   ?
  
   Hello visitor, you have seen this page ?php echo
   $HTTP_SESSION_VARS[count]; ? times.p

There was a bug in PHP in versions prior to 4.0.6: $count and
$HTTP_SESSION_VARS[count] did not reference the same value while on the
*current* page. Try this:

?php
session_start();
$count++;
session_register (count);
?
Hello visitor, you have seen this page ?php echo $count; ? times.

Kirk

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

2001-08-07 Thread Chad Day

I tried this, I still have the same problem.  Is this a bug in the version
of PHP I am running?

Chad

-Original Message-
From: mike cullerton [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 06, 2001 4:58 PM
To: Chad Day; [EMAIL PROTECTED]
Subject: Re: [PHP] Session problem


i would try

session_start();
session_register(NAME);

$res = mysql_query(SELECT NAME FROM dbhere where EMAIL = '$EMAIL' AND
PASSWORD = '$PASSWORD');

if ($row = mysql_fetch_array($res)) {
 $NAME = $row[NAME];
}

notice that $NAME is registered before being assigned to.

on 8/6/01 2:23 PM, Chad Day at [EMAIL PROTECTED] wrote:

 PHP 4.0.2 ..

 I have a very basic script, gets the user's name, registers it, then
 displays Welcome, $NAME.   $NAME is the session registered name.

 If I constantly reload that page that says Welcome, sometimes $NAME
appears,
 sometimes not.  Completely random.  It just loses track of the variable.

 My code:

 auth.php:

 session_start();

 ...

 $res = mysql_query(SELECT NAME FROM dbhere where EMAIL = '$EMAIL' AND
 PASSWORD = '$PASSWORD');

 if ($row = mysql_fetch_array($res)) {
 $NAME = $row[NAME];
 session_register(NAME);
 }

 ...

 Header(Location: menu.php);



 menu.php:

 session_start();

 echo Welcome, $NAME;



 So like, what the hell.  Why would it keep losing track of $NAME?

 Thanks,
 Chad



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



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

2001-08-07 Thread Chad Day

Done, still not working.   I know that usually has to be there, I was just
going to copy the example from the manual directly, since the session should
automatically kickoff when it hits the session_register bit.  This truly has
me baffled.

Chad

-Original Message-
From: hassan el forkani [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 9:37 AM
To: Chad Day
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Session problem


oh i forgot!!!
you have to put this at the beginning of your page
?php
session_start();
?

indeed it's not working properly,
first of all please make sur the pages are not cashed send a header
(Cache-control: NO cache) i'm not sure about the syntax so check the manual
then try to modify your code like this and tell us what happens:

?php
if (!HTTP_SESSION_VARS['count'])
{
global $count;
$count = 0;
session_register (count);
echo Hello visitor, you have seen this page $count;  times;
}
else {
$count = HTTP_SESSION_VARS['count'];
$count++;
session_register (count);
echo Hello visitor, you have seen this page
.HTTP_SESSION_VARS['count'].;  times;

?
might seem a little overloaded but it's to make sur there is no confusion
between count as a session var and the other var;
if this is not working then the problem is else whrere and w'll continue
lokkin :))

regards



At 15:41 07/08/01, you wrote:
Still loses it .. check this out:

http://www.militarycity.com/classified/realtors/count.php

The entire code for that page, taken from an example on zend:

?php
session_register (count);
$count++;
?

Hello visitor, you have seen this page ?php echo $count; ? times.p


Try loading it about 10 times or so, watch what happens.

Chad

-Original Message-
From: hassan el forkani [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 8:34 AM
To: Chad Day
Subject: RE: [PHP] Session problem


hello

At 15:16 07/08/01, you wrote:
 My code:
  
   auth.php:
  
   session_start();
  
   ...
  
   $res = mysql_query(SELECT NAME FROM dbhere where EMAIL = '$EMAIL' AND
   PASSWORD = '$PASSWORD');
  
   if ($row = mysql_fetch_array($res)) {

//try adding this:
  global $NAME;

   $NAME = $row[NAME];
   session_register(NAME);
   }
  
   ...
  
   Header(Location: menu.php);


regards



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

2001-08-06 Thread Chad Day

PHP 4.0.2 ..

I have a very basic script, gets the user's name, registers it, then
displays Welcome, $NAME.   $NAME is the session registered name.

If I constantly reload that page that says Welcome, sometimes $NAME appears,
sometimes not.  Completely random.  It just loses track of the variable.

My code:

auth.php:

session_start();

...

$res = mysql_query(SELECT NAME FROM dbhere where EMAIL = '$EMAIL' AND
PASSWORD = '$PASSWORD');

if ($row = mysql_fetch_array($res)) {
$NAME = $row[NAME];
session_register(NAME);
}

...

Header(Location: menu.php);



menu.php:

session_start();

echo Welcome, $NAME;



So like, what the hell.  Why would it keep losing track of $NAME?

Thanks,
Chad


-- 
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] auto link?

2001-07-16 Thread Chad Day

Here's a function I use on a text field..


function activateUrls( $s ) {
  $o = '';
  while ($s != '') {
$url = '';
$temp = split('://', $s, 2);
if (count($temp)1) {   # '://' found; now extract schema
  $s = $temp[1];
  $temp2 = split('[^[:alpha:]]', strrev($temp[0]), 2);
  $schema = strrev($temp2[0]); # this gets schema
  $o .= substr($temp[0], 0, strlen($temp[0])-strlen($schema));
  if ($schema != '') { # this ensures a non-null schema
$temp3 = split([[:space:],'\:], $s, 2);
$url = $schema . '://' . $temp3[0];
$ns = substr($s, strlen($temp3[0]),1) . $temp3[1];
if ($temp3[0] != '') {
  $o .= a href=$url target=_new$url/a;
} else {
  $o .= $url;
}
$s = $ns;
  }
  else {
$o .= '://';
  }
}
else {
  $o .= $s;
  $s = '';
}
  } // while
  return $o;
}


Hope this helps,
Chad

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 16, 1979 4:01 PM
To: [EMAIL PROTECTED]
Subject: [PHP] auto link?


On Ray's advice I've given up on letting the users put html into my form.
But I would like any http:// type addresses they include to be turned into
hyper links:



a href=http://www.mysite.comwww.mysite.com/a

is there a script or function some place I can use to do this? Or must I try
to write something of my own?


Susan


--
[EMAIL PROTECTED]
http://futurebird.diaryland.com



--
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 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] Not sure how to describe this problem..

2001-07-10 Thread Chad Day

I have a chunk of code in a webpage that works like this, to rotate some
ads.. :

if ($row = mysql_fetch_array($getads)) {
do {
$POS = $row[LASTPOS];
$ID = $row[ID];
$POS++;
if ($POS  $numads) {
$POS = 1;
}

$update = mysql_query(UPDATE adtracker set LASTPOS = '$POS' 
where ID =
'$ID');
echo $row[LINKLOC];

} while ($row = mysql_fetch_array($getads));

}

so it grabs the last position that ad was in from the DB, increments it by
1, unless incrementing it would push it past the max # of ads, so it resets
the position to 1.

The problem is, the site gets a lot of traffic, and instead of the ads
retaining positions like:

1, 2, 3   or  2, 3, 1   or  3, 1, 2   as they should, I've seen it somehow
go to:

1, 1, 3,  or  2, 2, 1  etc.

So I guess what is happening is that when 2 people hit the page at the exact
same time, it's getting updated values out of the DB for some of the ads
before they are all updated.. how can I go about controlling this?

Thanks,
Chad


-- 
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] addslashes problem ..

2001-07-06 Thread Chad Day

I have to use addslashes on a string of mine so I can use it in a javascript
function, so that when a link is clicked, a html textarea box is populated
with that string.

The problem I have is that if there are line breaks in the string, the
br's seem to get created when addslashes is run on the string, then in the
textarea box my string looks like:

i can't do thatbrright nowbrbut maybe laterbr

How can I get the slashes escaped properly, but keep the same format?  I
tried this:

$RESPONSE = eregi_replace('br[[:space:]]*/?[[:space:]]*', \n,
$RESPONSE);

but it didn't work for me, it just kinda merged all the strings together, no
line breaks (or br's) at all.

Thanks,
Chad


-- 
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] string formatting help

2001-07-06 Thread Chad Day

I'm trying to pull a string from a database to use in a javascript
function.. but it's doing line breaks on me, which in turn messes up the
javascript.

The string in the mysql db is like:
kjdsakjadkbrskjdksbrbrkjkdfjdfkjfd

When I pull it out, it becomes:

kjdsakjadk
br
skjdks
br
br
kjkdfjdfkjfd

I've tried replacing the br's with blank spaces or new line characters, but
in the html code it still breaks on those breaks when I echo it back out.
How can I force this string to be all on one line?

Thanks,
Chad


-- 
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: string formatting help

2001-07-06 Thread Chad Day

Yeah, I was seeing them.  And when I stripped them out and replaced them
with white space, it still broke in those places, it'd look like:

kdjsakdasja

dsakjaskjsa


dsakaskj

But I got it fixed..

$RESPONSE = addslashes($row[RESPONSE]);
$OVERLIBBED = str_replace(chr(13), , $RESPONSE);
$OVERLIBBED = str_replace(chr(10), , $OVERLIBBED);

is what worked for me ..

Thanks all,
Chad

-Original Message-
From: Steve Edberg [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 06, 2001 4:29 PM
To: Chad Day; [EMAIL PROTECTED]
Subject: [PHP] Re: string formatting help


In the original message below, did you mean that you're actually
SEEING the br tags in the output? If so, there may be a conversion
with htmlentities() going on somewhere that converts the br tags to
lt;brgt; (so they are displayed instead of being interpreted).

If you replaced the br's with spaces or newlines, the output
_should_ all be on one line, since HTML considers ALL strings of
whitespace (tabs, newlines, returns, spaces) to be a single space. If
you replaced br's with newlines and you are getting the line breaks
still, your output may be in a pre.../pre block.

- steve


At 3:36 PM -0300 7/6/01, InÈrcia Sensorial [EMAIL PROTECTED] wrote:
   Maybe:

$array = explode(br, $string);

foreach ($array as $key = $value) {
 echo $value;
}

   Would separate the string by br's and print all in one line.



Or, more compactly:

echo str_replace('br', '', $string);

This would only work if tags were lowercased; to handle mixed case,
you'd need to do

echo eregi_replace('br', '', $string);

or use the preg equivalent




   Julio Nobrega.

A hora est· chegando:
http://sourceforge.net/projects/toca

Chad Day [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I'm trying to pull a string from a database to use in a javascript
  function.. but it's doing line breaks on me, which in turn messes up the
  javascript.

  The string in the mysql db is like:
  kjdsakjadkbrskjdksbrbrkjkdfjdfkjfd

  When I pull it out, it becomes:

  kjdsakjadk
  br
  skjdks
  br
  br
  kjkdfjdfkjfd

  I've tried replacing the br's with blank spaces or new line characters,
but
  in the html code it still breaks on those breaks when I echo it back
out.
  How can I force this string to be all on one line?

  Thanks,
   Chad


--
+-- Factoid: Of the 100 largest economies in the world, 51 are --+
| Steve Edberg   University of California, Davis |
| [EMAIL PROTECTED]   Computer Consultant |
| http://aesric.ucdavis.edu/  http://pgfsun.ucdavis.edu/ |
+--- corporations -- http://www.ips-dc.org/reports/top200text.htm ---+

--
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 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] problems with round ..

2001-06-27 Thread Chad Day

Yes, it is.  I've tried it on a couple different php4 servers, I've never
gotten it to work.

Chad

-Original Message-
From: CC Zona [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 26, 2001 8:00 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] problems with round ..


In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Chad Day) wrote:

 $BLAH = round($BLAH, 2);

 Spits out a wrong parameter error.  I've tried quotes around the variable,
 the parameter, and any combinations, but it still pukes on me.  Why can't
I
 specify a precision?

According to the manual, the second parameter is only available in PHP4--is
that what you're using?

--
CC

--
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 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] problems with round ..

2001-06-26 Thread Chad Day

I'm trying a simple round in php4 and having problems .. rounding to 2
decimal places..

$BLAH = round($BLAH, 2);

Spits out a wrong parameter error.  I've tried quotes around the variable,
the parameter, and any combinations, but it still pukes on me.  Why can't I
specify a precision?

Thanks,
Chad


-- 
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] help with header/cookies ..

2001-05-17 Thread Chad Day

I'm submitting a form to a search page that performs different searches
based on what engine was selected.  One of these searches is restricted, and
runs a function that checks for a cookie.  If the user has no cookie, they
are redirected to a login page.

I've used echo tests to make sure the function is being run correctly, that
I don't have a cookie, etc, and it all checks out.  I *SHOULD* be redirected
to a login page, but I am not.


if ($fromwhere == ARCHIVES) {
check_cookie($cookiename);
Header(Location: gotosearch);
}

switch ($fromwhere) {
case SITE:
Header(Location: gotosearch2);
break;
case ARCHIVES:
check_cookie($cookiename);
Header(Location: gotosearch3);
break;
}


I tried putting the check_cookie statement in and outside of the switch
statement, but both places perform the cookie check, fail it, but don't
redirect me, and continue to allow me to search?  What is wrong with my
code?  Is there something I'm missing about how I'm handling my
headers/cookies?  I have the check_cookie function working on several other
parts of the site, but for some reason I can't get this to work .. :(

Thanks,
Chad


-- 
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] help with header/cookies ..

2001-05-17 Thread Chad Day

Sweet, thanks!  Fixed it .. learn something new every day ..

Chad

-Original Message-
From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 17, 2001 12:19 PM
To: Php-General@Lists. Php. Net
Subject: RE: [PHP] help with header/cookies ..


Add an exit(); immediately following all the header() calls. Hitting a
header() does not end execution of the script, so without the exit() the
last header() that gets called is the one that actually occurs.

Kirk

 -Original Message-
 From: Chad Day [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 17, 2001 9:13 AM
 To: Php-General@Lists. Php. Net
 Subject: [PHP] help with header/cookies ..
 
 
 I'm submitting a form to a search page that performs 
 different searches
 based on what engine was selected.  One of these searches is 
 restricted, and
 runs a function that checks for a cookie.  If the user has no 
 cookie, they
 are redirected to a login page.
 
 I've used echo tests to make sure the function is being run 
 correctly, that
 I don't have a cookie, etc, and it all checks out.  I 
 *SHOULD* be redirected
 to a login page, but I am not.
 
 
   if ($fromwhere == ARCHIVES) {
   check_cookie($cookiename);
   Header(Location: gotosearch);
   }
 
   switch ($fromwhere) {
   case SITE:
   Header(Location: gotosearch2);
   break;
   case ARCHIVES:
   check_cookie($cookiename);
   Header(Location: gotosearch3);
   break;
   }
 
 
 I tried putting the check_cookie statement in and outside of 
 the switch
 statement, but both places perform the cookie check, fail it, 
 but don't
 redirect me, and continue to allow me to search?  What is 
 wrong with my
 code?  Is there something I'm missing about how I'm handling my
 headers/cookies?  I have the check_cookie function working on 
 several other
 parts of the site, but for some reason I can't get this to work .. :(
 
 Thanks,
 Chad
 
 
 -- 
 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 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 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] FTP problem..

2001-04-24 Thread Chad Day

I'm trying to write a script to ftp the contents of one directory structure
onto another server.. I'm having problems recursing the directories, either
it a) doesn't do it or b) gets stuck in a loop.

Here's the function I'm having the problem with..


function recurseUp()
{
global $conn_id, $recurse;
$handle=opendir('.');
while (false!==($file = readdir($handle))) {
if ($file != .  $file != ..)
echo brb$file/bbr;
{
//if dir then recurse
if (is_Dir($file)) {
chDir($file);
$result = ftp_chdir($conn_id, $file);
if (!$result) {
@ftp_mkdir($conn_id, $file);
$result = ftp_chdir($conn_id, $file);
}
recurseUp();
} else {
//put
$result = ftp_put($conn_id, $file, $file, FTP_BINARY);
if (!$result) {
echo BRbError attempting retrieve file: 
$file/b;
} else {
echo BRRemote File Successfully Saved as: 
$file;
}
}
}
}

chDir('c:\inetpub\wwwroot\php\xfer');
ftp_cdup($conn_id);
closedir($handle);

}


Does anyone see the problem?  Thanks!

Chad


-- 
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] Returning part of a string, ereg..

2001-04-17 Thread Chad Day

I'm horrible at regex's, maybe someone can help me out.

What I'm trying to do is parse a string in the format:  number-number-number
(ex.  1-23123-312039128)

I need to pull that second number, regardless of length

This code returns nothing:

$part = ereg("([0-9]{1})-([0-9])-", $f, $regs);

but

$part = ereg("([0-9]{1})-([0-9]{1,10})-", $f, $regs);

will return the number, but I don't want to take a chance and limit it to 10
characters.  I thought the first bit of code would work.. any ideas what is
wrong?

Thanks,
Chad


-- 
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 a URL for mailing..

2001-04-11 Thread Chad Day

What I'm trying to do is specify a URL in a form, and then take that URL,
put its contents into a variable, and mail it out in an e-mail message with
the body of the message being that URL.  I haven't gotten anywhere so far,
just getting blank messages for the body..   can anyone point me in the
right direction on saving the contents of a page to a variable?  I've ran
across a few examples, but nothing has worked for me yet. :(

Thanks,
Chad


-- 
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] Including a URL for mailing..

2001-04-11 Thread Chad Day

Various things, but I finally hit upon something that worked.  Thanks
anyway.

Chad

-Original Message-
From: Rodney J. Woodruff [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 11, 2001 5:03 PM
To: Chad Day
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Including a URL for mailing..


What have you tried so far?

-- Rodney

Chad Day wrote:

 What I'm trying to do is specify a URL in a form, and then take that URL,
 put its contents into a variable, and mail it out in an e-mail message
with
 the body of the message being that URL.  I haven't gotten anywhere so far,
 just getting blank messages for the body..   can anyone point me in the
 right direction on saving the contents of a page to a variable?  I've ran
 across a few examples, but nothing has worked for me yet. :(

 Thanks,
 Chad

 --
 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 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 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] To The Hacker: CodeBoy

2001-02-08 Thread Chad Day

Your momma pays full commission!

(sorry, couldn't resist)

As far as hacking is concerned, I wouldn't know my arse from my elbow :)

James

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