Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Charles
On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling tedd.sperl...@gmail.com wrote:
 On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote:
 From: Tedd Sperling [mailto:tedd.sperl...@gmail.com]
 But why does anyone have to use the next month to figure out how
 many days there are are in this month? Do you see my point?

 Actually, no. To figure this out, somewhere along the line you've
 got to know where the last day of this month / first day of next
 month boundary lies, so I don't see how you can ever find the number
 of days in a month without bringing the start of next month into it
 somehow. (Even if it's implicitly be getting someone else's clever
 code to figure out 'last day of this month'!)

 Well no, I don't need to know the first day of next month to know the last 
 day of this month. That's like saying I need to know who is going to stand 
 at the 'end of the line' NEXT before I can tell who is standing at the 'end 
 of the' line NOW.

The number of days in each month is fixed, except for february. If
that's what you want, why don't make a table of the number of days in
each month, and check for the special case of leap year.

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



Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Charles
On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling tedd.sperl...@gmail.com wrote:
 On Mar 9, 2012, at 11:17 AM, Charles wrote:

 On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling tedd.sperl...@gmail.com 
 wrote:
 On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote:
 From: Tedd Sperling [mailto:tedd.sperl...@gmail.com]
 But why does anyone have to use the next month to figure out how
 many days there are are in this month? Do you see my point?

 Actually, no. To figure this out, somewhere along the line you've
 got to know where the last day of this month / first day of next
 month boundary lies, so I don't see how you can ever find the number
 of days in a month without bringing the start of next month into it
 somehow. (Even if it's implicitly be getting someone else's clever
 code to figure out 'last day of this month'!)

 Well no, I don't need to know the first day of next month to know the last 
 day of this month. That's like saying I need to know who is going to stand 
 at the 'end of the line' NEXT before I can tell who is standing at the 'end 
 of the' line NOW.

 The number of days in each month is fixed, except for february. If
 that's what you want, why don't make a table of the number of days in
 each month, and check for the special case of leap year.

 No offense, but that's not the point. A look-up table would work, but why 
 when there are all sorts of built-in functions that will?

You just said yourself that I don't need to know the first day of
next month to know the last day of this month, and AFAIK there is no
such function in PHP to get the number of days
without accessing the last second in the month. Besides, showing how
it is done is part of education.

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



Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Charles
On Sat, Mar 10, 2012 at 12:52 AM, Charles peac...@gmail.com wrote:
 On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling tedd.sperl...@gmail.com 
 wrote:
 On Mar 9, 2012, at 11:17 AM, Charles wrote:

 On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling tedd.sperl...@gmail.com 
 wrote:
 On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote:
 From: Tedd Sperling [mailto:tedd.sperl...@gmail.com]
 But why does anyone have to use the next month to figure out how
 many days there are are in this month? Do you see my point?

 Actually, no. To figure this out, somewhere along the line you've
 got to know where the last day of this month / first day of next
 month boundary lies, so I don't see how you can ever find the number
 of days in a month without bringing the start of next month into it
 somehow. (Even if it's implicitly be getting someone else's clever
 code to figure out 'last day of this month'!)

 Well no, I don't need to know the first day of next month to know the last 
 day of this month. That's like saying I need to know who is going to 
 stand at the 'end of the line' NEXT before I can tell who is standing at 
 the 'end of the' line NOW.

 The number of days in each month is fixed, except for february. If
 that's what you want, why don't make a table of the number of days in
 each month, and check for the special case of leap year.

 No offense, but that's not the point. A look-up table would work, but why 
 when there are all sorts of built-in functions that will?

 You just said yourself that I don't need to know the first day of
 next month to know the last day of this month, and AFAIK there is no
 such function in PHP to get the number of days
 without accessing the last second in the month. Besides, showing how
 it is done is part of education.

Unless, of course you install the calendar extension, of which it
will provides just the required function

http://php.net/manual/en/function.cal-days-in-month.php

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



Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Charles
On Sat, Mar 10, 2012 at 12:57 AM, Charles peac...@gmail.com wrote:
 On Sat, Mar 10, 2012 at 12:52 AM, Charles peac...@gmail.com wrote:
 On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling tedd.sperl...@gmail.com 
 wrote:
 On Mar 9, 2012, at 11:17 AM, Charles wrote:

 On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling tedd.sperl...@gmail.com 
 wrote:
 On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote:
 From: Tedd Sperling [mailto:tedd.sperl...@gmail.com]
 But why does anyone have to use the next month to figure out how
 many days there are are in this month? Do you see my point?

 Actually, no. To figure this out, somewhere along the line you've
 got to know where the last day of this month / first day of next
 month boundary lies, so I don't see how you can ever find the number
 of days in a month without bringing the start of next month into it
 somehow. (Even if it's implicitly be getting someone else's clever
 code to figure out 'last day of this month'!)

 Well no, I don't need to know the first day of next month to know the 
 last day of this month. That's like saying I need to know who is going 
 to stand at the 'end of the line' NEXT before I can tell who is standing 
 at the 'end of the' line NOW.

 The number of days in each month is fixed, except for february. If
 that's what you want, why don't make a table of the number of days in
 each month, and check for the special case of leap year.

 No offense, but that's not the point. A look-up table would work, but why 
 when there are all sorts of built-in functions that will?

 You just said yourself that I don't need to know the first day of
 next month to know the last day of this month, and AFAIK there is no
 such function in PHP to get the number of days
 without accessing the last second in the month. Besides, showing how
 it is done is part of education.

 Unless, of course you install the calendar extension, of which it
 will provides just the required function

 http://php.net/manual/en/function.cal-days-in-month.php

Okay, scratch that, the standard function works fine

$number_of_days = idate('t', strtotime($year.'-'.$month));

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



Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Charles
On Fri, Mar 9, 2012 at 9:23 AM, Tedd Sperling tedd.sperl...@gmail.com wrote:
 On Mar 8, 2012, at 6:53 PM, Daniel Brown wrote:
 On Mar 8, 2012 6:14 PM, Tedd Sperling tedd.sperl...@gmail.com wrote:

  Side-point: I find it interesting that getdate() has all sorts of neat 
  descriptions for the current month (such as, what weekday a numbered day 
  is), but lacks how many days are in the month. Doesn't that seem odd?

 Oh, I see what you're saying now.  Well, using getdate(), how else would you 
 think to pass the parameter to get the last day other than using the current 
 month and the last day (which would then obviously be overkill, of course).

 Well.. you could use any number that exceeds 31 -- or -- as I would have 
 suggested if it had been up to me, zero day would provide the number of days 
 in *that* month rather than the number of days in the previous month, which 
 was the point of my post.

 All of this aside, though, you may instead want to use something along the 
 lines of date('d',strtotime('last day of this month')); in tandem with your 
 date formatting.

 That's a good idea, but

 date('d',strtotime('last day of this month'));


 gives me the number of days in *this* month, but not the next, or previous, 
 month.

 I need the result to be whatever date was selected -- something like:

 $number_days = date('d',strtotime('last day of April, 2014'));

 But that doesn't work.

 You see, I need something that makes sense to students. The idea that you 
 have to use the zero day (whatever that is) of the next month to see how many 
 days there are in this month is strange and confusing -- again my point.

 Thus far, the following looks better than what I came up with::

 $what_date = getdate(mktime(0, 0, 0, $mon, 32, $year));
 $days_in_month = 32 - $what_date['mday'];

 But it's still strange.

 I was using:

        // get the last day of the month
        $cont = true;
        $tday = 27;
        while (($tday = 32)  ($cont))
                {
                $tdate = getdate(mktime(0,0,0,$mon,$tday,$year));
                if ($tdate[mon] != $mon)
                        {
                        $lastday = $tday - 1;
                        $cont = false;
                        }
                $tday++;
                }

 It made sense, but was too long. I figured there should be something better 
 and easier to explain -- but I'm still looking.

function count_days($month, $year) { return (mktime(0, 0, 0, $month+1,
1, $year) - mktime(0, 0, 0, $month, 1, $year))/86400; }

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



Re: [PHP] Function mktime() documentation question

2012-03-07 Thread Charles
On Thu, Mar 8, 2012 at 7:01 AM, Simon Schick
simonsimc...@googlemail.com wrote:
 $date = new DateTime($year . '-' . $current_month . '-1');
 $date-add( new DateInterval( 'P1M' ) ); // Add a period of 1 month to
 the date-instance (haven't tried that with the 30th of Jan ... would
 be kind-of interesting)

 $days_in_current_month = $date-format('j'); // Get the date of the month

I think you'd need to subtract it with 1 day

date_create(date('Y-m'))-add(new DateInterval('P1M'))-sub(new
DateInterval('P1D'))-format('d');

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



Re: [PHP] no traffic

2012-03-06 Thread Charles
On Tue, Mar 6, 2012 at 8:55 PM, Lawrence Decker lld0...@gmail.com wrote:
 I've been playing with PHP for about 6 years and I have no idea why this is
 happening... I've been writing a script to auth to AD.  When I run the
 script on my dev box, nothing.  I have wireshark running in the background
 on the dev box, I can see the script's traffic go out and hit the DNS
 server but no other traffic. Command line, no problem talking to other
 hosts with whatever port I'm trying to hit.  On my box, all the scripts
 work fine.  LDAP is enabled, but I can't hit ANY port other than DNS and if
 I use the IP in the script, I see no traffic.  Both are FC16-64 patched as
 of last week. I matched line-by-line in the phpinfo() on my box and the dev
 box - no difference.  Used this script to try any port open on other hosts
 but no traffic shows up in wireshark!! Any ideas

Have you checked that it's not a firewall problem? e.g. by running

# telnet server-ip ldap

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



Re: [PHP] no traffic

2012-03-06 Thread Charles
On Tue, Mar 6, 2012 at 8:55 PM, Lawrence Decker lld0...@gmail.com wrote:
 I've been playing with PHP for about 6 years and I have no idea why this is
 happening... I've been writing a script to auth to AD.  When I run the
 script on my dev box, nothing.  I have wireshark running in the background
 on the dev box, I can see the script's traffic go out and hit the DNS
 server but no other traffic. Command line, no problem talking to other
 hosts with whatever port I'm trying to hit.  On my box, all the scripts
 work fine.  LDAP is enabled, but I can't hit ANY port other than DNS and if
 I use the IP in the script, I see no traffic.  Both are FC16-64 patched as
 of last week. I matched line-by-line in the phpinfo() on my box and the dev
 box - no difference.  Used this script to try any port open on other hosts
 but no traffic shows up in wireshark!! Any ideas

Do you have selinux enabled on your dev box?

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



[PHP] PHP 5.4 new output control API callback buffer

2012-03-05 Thread Charles
Hi,

I'm just wondering, what is the right output of below code should be

ob_start(function($o) { fwrite(STDERR, $o); });
echo 'hello';
ob_end_clean();

Does it should print hello or does it should print nothing?

In PHP 5.3, it prints hello, but in 5.4.0 it prints nothing.

Looking at the C code of PHP 5.4, it explicitly discards the output
buffer before calling the callback, except when flushing
or when using the internal callback handler.

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



Re: [PHP] ldap_add - Server is unwilling to peform

2011-01-27 Thread CHARLES HUNT
I finally got it to create the user.  I had to remove the memberOf 
attributes. 
 
Apparently you have to add the User to the Group rather than the Group to the 
User. 
Now I need to figure out how to enable the user and set the password. 
As well as adding the User to the desired Groups.


- Original Message 
From: Daniel Brown danbr...@php.net
To: CHARLES HUNT ch5...@yahoo.com
Cc: php-general@lists.php.net
Sent: Wed, January 26, 2011 9:39:32 AM
Subject: Re: [PHP] ldap_add - Server is unwilling to peform

On Wed, Jan 26, 2011 at 10:17, CHARLES HUNT ch5...@yahoo.com wrote:
 Hello-
 I am trying to add create a user account with the ldap_add function.  However 
I
 get the error below when it is invoked.  Does anyone have ideas what may be
 causing this error?  What I can look into?  Anything would be helpful.

 Warning: ldap_add() [function.ldap-add]: Add: Server is unwilling to perform
 in C:\xampp\htdocs\Infrastructure\al_ldap.php on line 354

What LDAP server are you using (Active Directory, openLDAP,
iPlanet, eDirectory, et cetera)?  You may want to try swapping out
ldap_add() for ldap_mod_add().

http://php.net/ldap_mod_add


-- 
/Daniel P. Brown
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/


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



[PHP] ldap_add - Server is unwilling to peform

2011-01-26 Thread CHARLES HUNT
Hello-
I am trying to add create a user account with the ldap_add function.  However I 
get the error below when it is invoked.  Does anyone have ideas what may be 
causing this error?  What I can look into?  Anything would be helpful.

Warning: ldap_add() [function.ldap-add]: Add: Server is unwilling to perform 
in C:\xampp\htdocs\Infrastructure\al_ldap.php on line 354

Line 354 is the actual call to ldap_add().  

Thanks-
Chuck

function al_ldap_add_user($Fname,$Lname,$Aname,$UPname,$Hdir,$MemberOf,$Admin)
{
session_start();
$info = array();
$user = $_SESSION['username'].@dh2.pub.com;
$password = $_SESSION['password'];
$iv = $_SESSION['iv'];//for decryption
$key = $_SESSION['key'];//for decryption
//$dn_ending = ,OU=Lab Associates,OU=Accounts,DC=DH2,DC=pub,DC=com;
$dn_ending = ,OU=Testing,OU=Accounts,DC=DH2,DC=pub,DC=com;
$obj_cat = CN=Person,CN=Schema,CN=Configuration,DC=DH2,DC=pub,DC=com;
$decryptedpw = al_decrypt($password,$iv,$key);//call decryption function to get 
the plain text password
$FullName = $Fname .. $Lname;
$DN = CN= . $FullName . $dn_ending;
$ds=ldap_connect($_SESSION['ldap_addr']);  // must be a valid LDAP server!
if ($ds) 
{ 
$r=ldap_bind($ds,$user,$decryptedpw); 
// prepare data
$info[sAMAccountName] = $Aname;
$info[sAMAccountType] = 805306368;
$info[cn] = $FullName;
$info[displayName] = $FullName;
$info[name] = $FullName;
$info[sn] = $Lname;
$info[givenName] = $Fname;
$info[userPrincipalName] = $UPname;
$info[homeDirectory] = $Hdir;
$info[homeDrive] = U:;
$info[objectCategory] = $obj_cat;
$info[objectClass][0] = top;
$info[objectClass][1] = person;
$info[objectClass][2] = organizationalPerson;
$info[objectClass][3] = user;
if( $Admin)
$info[adminCount] = 1;
$N = count($MemberOf);
for($i=0; $i  $N; $i++)
{
  $info[memberOf][$i] = str_replace(',,$MemberOf[$i]);
}

// add data to directory
var_dump($info);
$ad = ldap_add($ds, $DN, $info);
if($ad)
return true;
else
{
echo h4Unable to create user/h4;
return false;
}
} else {
echo h4Unable to connect to LDAP server/h4;
}

}

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



Re: [PHP] ldap_add - Server is unwilling to peform

2011-01-26 Thread CHARLES HUNT
Win 2000 Active Directory.

I'll give ldap_mod_add a shot.


- Original Message 
From: Daniel Brown danbr...@php.net
To: CHARLES HUNT ch5...@yahoo.com
Cc: php-general@lists.php.net
Sent: Wed, January 26, 2011 9:39:32 AM
Subject: Re: [PHP] ldap_add - Server is unwilling to peform

On Wed, Jan 26, 2011 at 10:17, CHARLES HUNT ch5...@yahoo.com wrote:
 Hello-
 I am trying to add create a user account with the ldap_add function.  However 
I
 get the error below when it is invoked.  Does anyone have ideas what may be
 causing this error?  What I can look into?  Anything would be helpful.

 Warning: ldap_add() [function.ldap-add]: Add: Server is unwilling to perform
 in C:\xampp\htdocs\Infrastructure\al_ldap.php on line 354

What LDAP server are you using (Active Directory, openLDAP,
iPlanet, eDirectory, et cetera)?  You may want to try swapping out
ldap_add() for ldap_mod_add().

http://php.net/ldap_mod_add


-- 
/Daniel P. Brown
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/


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



Re: [PHP] ldap_add - Server is unwilling to peform

2011-01-26 Thread CHARLES HUNT
It seems ldap_mod_add is for adding attributes to a dn that is already there.  
I 
get the error: Modify: No such object in...


- Original Message 
From: Daniel Brown danbr...@php.net
To: CHARLES HUNT ch5...@yahoo.com
Cc: php-general@lists.php.net
Sent: Wed, January 26, 2011 9:39:32 AM
Subject: Re: [PHP] ldap_add - Server is unwilling to peform

On Wed, Jan 26, 2011 at 10:17, CHARLES HUNT ch5...@yahoo.com wrote:
 Hello-
 I am trying to add create a user account with the ldap_add function.  However 
I
 get the error below when it is invoked.  Does anyone have ideas what may be
 causing this error?  What I can look into?  Anything would be helpful.

 Warning: ldap_add() [function.ldap-add]: Add: Server is unwilling to perform
 in C:\xampp\htdocs\Infrastructure\al_ldap.php on line 354

What LDAP server are you using (Active Directory, openLDAP,
iPlanet, eDirectory, et cetera)?  You may want to try swapping out
ldap_add() for ldap_mod_add().

http://php.net/ldap_mod_add


-- 
/Daniel P. Brown
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/


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



Re: [PHP] ldap_add - Server is unwilling to peform

2011-01-26 Thread CHARLES HUNT
Do I need to be using SSL?  Not sure how to implement that.  (if you can't tell 
I'm pretty new to PHP)


- Original Message 
From: Daniel Brown danbr...@php.net
To: CHARLES HUNT ch5...@yahoo.com
Cc: php-general@lists.php.net
Sent: Wed, January 26, 2011 9:39:32 AM
Subject: Re: [PHP] ldap_add - Server is unwilling to peform

On Wed, Jan 26, 2011 at 10:17, CHARLES HUNT ch5...@yahoo.com wrote:
 Hello-
 I am trying to add create a user account with the ldap_add function.  However 
I
 get the error below when it is invoked.  Does anyone have ideas what may be
 causing this error?  What I can look into?  Anything would be helpful.

 Warning: ldap_add() [function.ldap-add]: Add: Server is unwilling to perform
 in C:\xampp\htdocs\Infrastructure\al_ldap.php on line 354

What LDAP server are you using (Active Directory, openLDAP,
iPlanet, eDirectory, et cetera)?  You may want to try swapping out
ldap_add() for ldap_mod_add().

http://php.net/ldap_mod_add


-- 
/Daniel P. Brown
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/


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



Re: [PHP] I need ideas for things to code

2009-04-25 Thread Charles Harvey
This was a surprisingly good idea that works for me, as I haven't coded in
about 3 years and need to get my hand back in.  Trying to make use of one
idea led to several others.  Thanks, tedd!

Charles

On Sat, Apr 25, 2009 at 4:54 AM, tedd tedd.sperl...@gmail.com wrote:

 At 7:00 PM -0400 4/24/09, Andrew Hucks wrote:

 I've been coding PHP for about a year, and I'm running out of things to
 code
 that force me to learn new things. If you have any suggestions, I'd
 greatly
 appreciate it.


 Andrew:

 Here's an idea. Go through the php manuals and make small examples of
 everything you find.

 That way not only do you learn, but you have examples to fall back on when
 the need rises.

 Here's a small (believe me) portion of the demo's I've written over the
 years:

 http://webbytedd.com/a.php

 These cover different languages, but it will give you the idea. Just make a
 inventory of examples and post them with code. Not only will it help you,
 but might help others when you answer questions on this list showing the
 solution.

 Cheers,

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


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




Re: [PHP] 5.2.9 changes - phpwiki

2009-03-31 Thread Charles Sprickman

On Mon, 30 Mar 2009, Michael A. Peters wrote:


Charles Sprickman wrote:

Hello all,

Recently I upgraded a box running phpwiki from php 5.2.8 to 5.2.9.  After 
the upgrade, phpwiki (1.3.14) started spitting out the following two 
errors, both of which are basically leaving the wiki dead in the water:


[30-Mar-2009 22:01:23] PHP Parse error:  syntax error, unexpected T_CLONE, 
expecting T_STRING in /usr/local/www/data/wikisvn/lib/config.php(500) : 
eval()'d code on line 2
[30-Mar-2009 22:01:23] PHP Fatal error:  Class 
'WikiDB_backend_PearDB_PearDB' not found in 
/usr/local/www/data/wikisvn/lib/WikiDB/SQL.php on line 25





first error is in this block:

/**
 * safe php4 definition for clone.
 * php5 copies objects by reference, but we need to clone deep copy in
   some places.
 * (BlockParser)
 * We need to eval it as workaround for the php5 parser.
 * See http://www.acko.net/node/54
 */
if (!check_php_version(5)) {
eval('
function clone($object) {
  return $object;
}
');
}


I know nothing about phpwiki - but it looks like check_php_version() is a 
function they have defined?


Because reading the code, if check_php_version(5) is support to return true 
for php 5 then the eval should only be triggered if the version of php is not 
5 - in which case, where phpwiki is broken is in the check_php_version() 
function.


What happens when you run

?php
if (check_php_version(5)) {
  echo php 5;
  } else {
  echo not php 5;
  }
?

of course you'll need to copy their check_php version() function into your 
page.


Well, I fixed it...  Two things:

-Since I'm running php5 and I know it, I removed the version check above. 
That got me past one error.
-Next I started getting bizarre errors everywher preg_match() was called. 
That stumped me for a bit then I found that between 5.2.8 and 5.2.9 my 
saved compile options changed and I had NOT used the built-in PCRE 
library.  Switching to the built-in one fixed the preg_match() errors, 
which in turn let config.php build the right path to the PEAR includes...


Thanks!

Charles


--
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] 5.2.9 changes - phpwiki

2009-03-30 Thread Charles Sprickman

Hello all,

Recently I upgraded a box running phpwiki from php 5.2.8 to 5.2.9.  After 
the upgrade, phpwiki (1.3.14) started spitting out the following two 
errors, both of which are basically leaving the wiki dead in the water:


[30-Mar-2009 22:01:23] PHP Parse error:  syntax error, unexpected T_CLONE, 
expecting T_STRING in /usr/local/www/data/wikisvn/lib/config.php(500) : 
eval()'d code on line 2
[30-Mar-2009 22:01:23] PHP Fatal error:  Class 
'WikiDB_backend_PearDB_PearDB' not found in 
/usr/local/www/data/wikisvn/lib/WikiDB/SQL.php on line 25


Looking at the changelog, I'm simply not seeing anything that would cause 
this.


Snippets of both files are below.  Looking for any pointers - I need to 
get the wiki up and running again and phpwiki releases are few and far 
between.


Thanks,

Charles

first error is in this block:

/**
 * safe php4 definition for clone.
 * php5 copies objects by reference, but we need to clone deep copy in
   some places.
 * (BlockParser)
 * We need to eval it as workaround for the php5 parser.
 * See http://www.acko.net/node/54
 */
if (!check_php_version(5)) {
eval('
function clone($object) {
  return $object;
}
');
}

And the second error is in here:

 function WikiDB_SQL ($dbparams) {
$backend = 'PearDB';
if (is_array($dbparams['dsn']))
$backend = $dbparams['dsn']['phptype'];
elseif (preg_match('/^(\w+):/', $dbparams['dsn'], $m))
$backend = $m[1];
if ($backend == 'postgres7') { // ADODB cross-compatiblity hack 
(for uni

t testing)
$backend = 'pgsql';
if (is_string($dbparams['dsn']))
$dbparams['dsn'] = $backend . ':' . 
substr($dbparams['dsn'], 10)

;
}
include_once (lib/WikiDB/backend/PearDB_.$backend..php);
$backend_class = WikiDB_backend_PearDB_.$backend;
$backend =  new $backend_class($dbparams);
if (DB::isError($backend-_dbh)) return;
$this-WikiDB($backend, $dbparams);
}

The variable $backend is getting futzed up somewhere...

Not much to go on, I know...



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



[PHP] RE: Installation problems on Vista

2009-01-20 Thread lucson pierre-charles

Dear Nathan,
 The short_tags is sure off but when I changed the scripts, 
they're still being output to the browser. 
 
These are the lines I added to the modules section:
#LoadModule php5_module c:/php5/php5apache2.dll#AddType application/x-httpd-php 
.php#PHPIniDir c:/php5
 
I added these lines to the DirectoryIndex:
DirectoryIndex index.html index.html.var index.php
 
Lucson Date: Mon, 19 Jan 2009 22:49:01 + From: nrix...@gmail.com To: 
lucsonpie...@hotmail.com CC: php-general@lists.php.net Subject: Re: 
Installation problems on Vista  lucson pierre-charles wrote:  I am having 
problems installing the zip package (PHP5) on Windows Vista. The output will 
not come on the browser upon testing. Only the code is being output to the 
browser. Apache (Apache 2) was properly installed. Your assistance please. 
Regards, Lucson  check the php.ini setting for short_tags - quite sure it 
will be off  and that you are using short tags in your php scripts ? rather 
than  ?php - either change the ini setting to off or change you're scripts 
 to use ?php instead.  should fix it :)

RE: [PHP] Installation problems on Vista

2009-01-20 Thread lucson pierre-charles

TG,
 I configured it as follows but will still not work. 
 
These are the lines I added to the modules section:
#LoadModule php5_module c:/php5/php5apache2.dll#AddType application/x-httpd-php 
.php#PHPIniDir c:/php5
 
I added these lines to the DirectoryIndex:
DirectoryIndex index.html index.html.var index.php
 
Lucson From: tg-...@gryffyndevelopment.com To: lucsonpie...@hotmail.com; 
php-general@lists.php.net Date: Mon, 19 Jan 2009 18:35:08 -0500 Subject: Re: 
[PHP] Installation problems on Vista  You most likely need to configure 
Apache to process PHP script files. Check  out this page:  
http://www.ampsoft.net/webdesign-l/how-to-install-apache-php-mysql-3.html  
-TG  - Original Message - From: lucson pierre-charles 
lucsonpie...@hotmail.com To: php-general@lists.php.net Date: Mon, 19 Jan 
2009 22:37:25 + Subject: [PHP] Installation problems on Vista I 
am having problems installing the zip package (PHP5) on Windows Vista.  The 
output will not come on the browser upon testing. Only the code is  being 
output to the browser. Apache (Apache 2) was properly installed. Your  
assistance please. Regards, Lucson--  PHP General Mailing List 
(http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php 

RE: [PHP] Re: Installation problems on Vista

2009-01-20 Thread lucson pierre-charles

Nathan,
 
  When I remove the #'s, I can't have Apache to restart. I keep 
receiving error messages.
 
Lucson Date: Tue, 20 Jan 2009 22:41:44 + From: nrix...@gmail.com To: 
lucsonpie...@hotmail.com CC: php-general@lists.php.net Subject: [PHP] Re: 
Installation problems on Vista  lucson pierre-charles wrote:  Dear Nathan, 
 The short_tags is sure off but when I changed the   scripts, they're 
still being output to the browser. These are the lines I added to the 
modules section:  #LoadModule php5_module c:/php5/php5apache2.dll  #AddType 
application/x-httpd-php .php  #PHPIniDir c:/php5remove the #'s  
 --  PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: 
http://www.php.net/unsub.php 

RE: [PHP] Re: Installation problems on Vista

2009-01-20 Thread lucson pierre-charles

Yes. It can't find a file. To: php-general@lists.php.net Date: Tue, 20 Jan 
2009 17:14:14 -0600 From: nos...@mckenzies.net Subject: Re: [PHP] Re: 
Installation problems on Vista  lucson pierre-charles wrote:  Nathan,   
 When I remove the #'s, I can't have Apache to restart. I keep receiving error 
messages.Lucson Date: Tue, 20 Jan 2009 22:41:44 + From: 
nrix...@gmail.com To: lucsonpie...@hotmail.com CC: php-general@lists.php.net 
Subject: [PHP] Re: Installation problems on Vista  lucson pierre-charles 
wrote:  Dear Nathan,  The short_tags is sure off but when I changed the  
 scripts, they're still being output to the browser. These are the 
lines I added to the modules section:  #LoadModule php5_module 
c:/php5/php5apache2.dll  #AddType application/x-httpd-php .php  #PHPIniDir 
c:/php5remove the #'s   --  PHP General Mailing List 
(http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php   
What is the error message from the windows event viewer? Most likely it can't 
find a file.  --  Thanks! -Shawn http://www.spidean.com  --  PHP 
General Mailing List (http://www.php.net/) To unsubscribe, visit: 
http://www.php.net/unsub.php 

[PHP] Installation problems on Vista

2009-01-19 Thread lucson pierre-charles

I am having problems installing the zip package (PHP5) on Windows Vista. The 
output will not come on the browser upon testing. Only the code is being output 
to the browser. Apache (Apache 2) was properly installed. Your assistance 
please. Regards, Lucson

[PHP] need loop help

2006-10-03 Thread Charles Kline

hi all.

i am trying to modify some old code and struggling a bit with this one:

// returns an array of the names in the form post
$fields = $_SESSION['case']-getComplaintKeys();

// here is the array returned
Array ( [0] = eligibility [1] = payment [2] = service [3] =  
document [4] = licensing [5] = source [6] = date [7] = contact  
[8] = description [9] = status )


for ($j = 0; $j  count($fields); $j++) {
  if (${$fields[$j]} == 'on') ${$fields[$j]} = 1;
  if (is_null(${$fields[$j]})) ${$fields[$j]} = 0;
  $data[$fields[$j]] = ${$fields[$j]};
}

The problem I am having is that the code is now on a more secure  
server with register_globals off (and I don't want to turn that on).


I am not sure how to get the POST data sorted out using this method.  
Hope it is clear what I mean.


Thanks,
Charles

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



[PHP] HAXPLORER - any info?

2006-03-30 Thread Charles Kline
My buddy just called me and let me know he found this running on his  
server.


I have googled it and come up with much, but it appears to be a php  
script that gives the user pretty much total control of adding,  
editing, deleting - files, folders, etc. As well as giving them  
access to run any shell script they want.


Does anyone know anything about this, and if they do - have any  
thoughts on how it may have gotten on the server and how to secure  
against it in the future? Just trying to help out a friend here.


Thanks,
Charles

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



Re: [PHP] HAXPLORER - any info?

2006-03-30 Thread Charles Kline
Turned out to be a security hole in Mambo. He has fixed it. Thanks  
for your assistance.


- Charles

On Mar 30, 2006, at 3:33 PM, Brady Mitchell wrote:


-Original Message-
Does anyone know anything about this, and if they do - have any
thoughts on how it may have gotten on the server and how to secure
against it in the future? Just trying to help out a friend here.


Without knowing the exact setup of the server, we can't help much.   
Any

service running on the system that allows people to access the system
could be the culprit, or it could be weak passwords on the server, it
could even be a piece of poorly written php code that allowed  
someone to

get control.

I would suggest that your friend make a list of the things he has
running on his server and spend some time googling for security issues
with those services/programs.

Brady


--
RightCode, Inc.
900 Briggs Road #130
Mount Laurel, NJ 08054
P: 856.608.7908
F: 856.439.0154
E: [EMAIL PROTECTED]

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



[PHP] setting the same value to multiple variables

2006-03-30 Thread charles stuart

Hi,

I'm sure this is quite basic. Nonetheless I'm new to PHP so I haven't  
figured it out.


I'd like to set each variable to the same value (without having to  
set that value individually for each variable).


Thanks for the help.


best,

Charles



if ( 1 == 1 )
{
	$goodToGo = 0; $errorArray[] = You must declare some goals on  
Activity 1.;



// this block of code does not set each variable to class=\errorHere 
\;


$readingGoalsEnjoymentLabelClass  
$readingGoalsInformationLabelClass 
$readingGoalsAlphabeticLabelClass 
$readingGoalsPrintLabelClass  
$readingGoalsPhonologicalLabelClass 
$readingGoalsPhoneticLabelClass   
$readingGoalsComprehensionLabelClass 
$readingGoalsVocabularyLabelClass 
$readingGoalsInstructionsLabelClass 
$readingGoalsCriticalLabelClass   
$readingGoalsCommunicateLabelClass = class=\errorHere\;
}

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



Re: [PHP] setting the same value to multiple variables

2006-03-30 Thread charles stuart

On Mar 30, 2006, at 11:01 PM, Jasper Bryant-Greene wrote:


charles stuart wrote:

if ( 1 == 1 )


^^ what is the point of this?



Just cutting out the long IF statement so everyone didn't have to  
look past it.



{
$goodToGo = 0; $errorArray[] = You must declare some goals on  
Activity 1.;
// this block of code does not set each variable to class= 
\errorHere\;
$readingGoalsEnjoymentLabelClass 
$readingGoalsInformationLabelClass 
$readingGoalsAlphabeticLabelClass 
$readingGoalsPrintLabelClass 
$readingGoalsPhonologicalLabelClass 
$readingGoalsPhoneticLabelClass 
$readingGoalsComprehensionLabelClass 
$readingGoalsVocabularyLabelClass 
$readingGoalsInstructionsLabelClass 
$readingGoalsCriticalLabelClass 
$readingGoalsCommunicateLabelClass = class=\errorHere\;

}


While this seems like excessively ugly code (have you considered an  
array? what is the point of all those variables if they all hold  
the same value?), replace all of those '' with '=' and you will  
be fine. PHP evaluates right-to-left and the result of an  
assignment is the value that was assigned, so that will work.


Ah, I see. Thanks.

I place the variable in the label tag for each of the corresponding  
inputs (checkboxes in this case). If none are checked (at least one  
is required) I set an error message at the top of the page and then  
set a background color on each label via the now present  
class=errorHere.


I'm sure there's a better way to do this, but I'm not the best with  
PHP. I'll look into using an array.


Thanks again for your help. You've shortened my code at least a  
little bit.



best,

Charles

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



[PHP] str_replace

2005-10-10 Thread Charles Stuart

Hi,

I'm on shared hosting. Because of security concerns on their part  
[1], every time the text curl u is inputted, a 403 forbidden is  
given and the form is not submitted. This is of course a problem as  
I'm doing work for a children's literacy program, and plenty of  
people try to input curl up with a book.


I'm trying to use 'str_replace' to solve this issue, but I can't seem  
to get around the 403 error.


It appears as if the hosting service doesn't give me a chance to  
replace curl u with something else prior to them blocking the  
attempted submit.


I can tell my str_replace is working as if I change the searched text  
to something other than curl u it does in fact replace it and  
submit it correctly.


Anyone have any ideas for a workaround? My next thought is to use  
javascript, but I think the site serves quite a few people who might  
not have javascript on.


Thanks for listening. Below is the PHP [2].


best,

Charles


[2]
// Grabbing the data from the form.

if ($task == updateInfo)
{
$activityChallenges = cs_remove_curl_up(sanitize_paranoid_string 
($_POST[activityChallenges]));

}



// change curl u to EDIT kurl u

function cs_remove_curl_up($string, $min='', $max='')
{
  $string = str_replace(curl u, EDIT kurl u, $string);
  $len = strlen($string);
  if((($min != '')  ($len  $min)) || (($max != '')  ($len   
$max)))

return FALSE;
  return $string;
}



[1]
My host told me this:

Mod_security is restricting this and blocks all url's with C-url.  
This is done because of some php worms that are spread using c-url. I  
would recommend trying to work around this. It will be a major  
security issue for us to allow this.


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



Re: [PHP] str_replace

2005-10-10 Thread Charles Stuart
A student run server on my old campus used to turn off PHP for  
security reasons - ridiculous.


Would it be possible to use XSS to call curl from a remote site? I'm  
just a beginner so that may or not make sense.


Indeed it does seem like JS is the solution - unfortunately - as it  
seems like their 'trap' catches any string including CURL U before I  
can str_replace the string after gathering the input with _POST.  
Anyone disagree?




best,

Charles



On Oct 10, 2005, at 3:12 PM, Rory Browne wrote:


I'm not completely sure, but I think they're talking shite. If curl is
a security problem, then disable curl. They seem from what you've
said, to be pretty irrational. I respect security paranoia, but this
is ridicules.

You could try replacing every letter in the word curl with it's #xxx;
equivlent, but that might not work. You would also have to do it in
JS, although I think that any browser with the exception on lynx has
JS capabilities.

On 10/10/05, Charles Stuart [EMAIL PROTECTED] wrote:


Hi,

I'm on shared hosting. Because of security concerns on their part
[1], every time the text curl u is inputted, a 403 forbidden is
given and the form is not submitted. This is of course a problem as
I'm doing work for a children's literacy program, and plenty of
people try to input curl up with a book.

I'm trying to use 'str_replace' to solve this issue, but I can't seem
to get around the 403 error.

It appears as if the hosting service doesn't give me a chance to
replace curl u with something else prior to them blocking the
attempted submit.

I can tell my str_replace is working as if I change the searched text
to something other than curl u it does in fact replace it and
submit it correctly.

Anyone have any ideas for a workaround? My next thought is to use
javascript, but I think the site serves quite a few people who might
not have javascript on.

Thanks for listening. Below is the PHP [2].


best,

Charles


[2]
// Grabbing the data from the form.

if ($task == updateInfo)
 {
$activityChallenges = cs_remove_curl_up(sanitize_paranoid_string
($_POST[activityChallenges]));
 }



// change curl u to EDIT kurl u

function cs_remove_curl_up($string, $min='', $max='')
{
   $string = str_replace(curl u, EDIT kurl u, $string);
   $len = strlen($string);
   if((($min != '')  ($len  $min)) || (($max != '')  ($len 
$max)))
 return FALSE;
   return $string;
}



[1]
My host told me this:

Mod_security is restricting this and blocks all url's with C-url.
This is done because of some php worms that are spread using c-url. I
would recommend trying to work around this. It will be a major
security issue for us to allow this.

--
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] Accessing data in an object?

2005-09-27 Thread Charles Kline
I am confused on how to get to the data in this object, anyone help  
me out?


here is the result of my var_dump() which is inside a class function  
functionTest($data){ var_dump($data); }


object(staff)(2) {
  [arrStaff]=
  array(12) {
[bsStaffID]=
string(4) 9090
[bsLastName]=
string(5) kline
[bsFirstName]=
string(7) charles
[bsPhone]=
string(4) 1212
[bsSite]=
string(1) 4
[bsCube]=
string(4) 1212
[bsEmail]=
string(6) klinec
[bp_boOrgID]=
NULL
[bpPositionID]=
NULL
[ptTitleName]=
NULL
[bp_ptTitleID]=
NULL
[bpVacantDate]=
NULL
  }
  [created]=
  int(0)
}

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



Re: [PHP] Accessing data in an object?

2005-09-27 Thread Charles Kline


On Sep 27, 2005, at 12:07 PM, Charles Kline wrote:

I am confused on how to get to the data in this object, anyone help  
me out?


here is the result of my var_dump() which is inside a class  
function functionTest($data){ var_dump($data); }


object(staff)(2) {
  [arrStaff]=
  array(12) {
[bsStaffID]=
string(4) 9090
[bsLastName]=
string(5) kline
[bsFirstName]=
string(7) charles
[bsPhone]=
string(4) 1212
[bsSite]=
string(1) 4
[bsCube]=
string(4) 1212
[bsEmail]=
string(6) klinec
[bp_boOrgID]=
NULL
[bpPositionID]=
NULL
[ptTitleName]=
NULL
[bp_ptTitleID]=
NULL
[bpVacantDate]=
NULL
  }
  [created]=
  int(0)
}




Nevermind... I got it :)

echo $s-arrStaff['bsLastName'];

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



[PHP] Two MySQL connections in one script not working as expected

2005-09-27 Thread Charles Kline

Hi all,

I have a script that needs to update data in two databases. My db  
connections are both in class files that I created to execute the  
various connections and queries.


What is happening is that the second database connection does not  
seem to work. The error I get is that it seems the second query is  
being executed against the first database connection - does that make  
sense? So I get an error that the database_name.table_name does not  
exist, which is true, but the query is getting executed against the  
wrong database name.


Any ideas?

Thanks,
Charles

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



Re: [PHP] Two MySQL connections in one script not working as expected

2005-09-27 Thread Charles Kline


On Sep 27, 2005, at 3:42 PM, Andy Pieters wrote:



Hi

Without you actually showing us these class files we can only guess  
but a

common mistake is this:

mysql_open(connection details)
mysql_query(query)

In those cases the last opened handle is used.  To prevent this,  
use this

syntax

$db1=mysql_open(connection for db1);
$db2=mysql_open(connection for db2);

mysql_query($db1,$query_db_1);
mysql_query($db2,$query_db_2);

If you have used this syntax then check your class if it is using a  
global
variable to hold the database handle and if it does make it a class  
variable

instead

Instead of

$db=null

class db
{function db()
 {$GLOBALS['db']=mysql_open(...

do instead

class db
{var $db=null;
 function db()
 {$this-db=mysql_open

That way you can instanciate as many instances of the class as you  
like and

each will have its own database handle.

HTH


Andy




What I have is more like this:

class db {
  var $dbpath = localhost;
  var $dbname = testdb;
  var $dblogin = test;
  var $dbpass = test;

  function db() {
$link = mysql_connect($this-dbpath, $this-dblogin, $this- 
dbpass) or die ('Not Connected: ' . mysql_error());
mysql_select_db($this-dbname, $link) or die ('Can\'t use this  
database: ' . mysql_error());

  }

  function retrieveData( $sql ) {
$rs = mysql_query( $sql ) or die(Invalid query:  . mysql_error 
());

// if no result, return null
if (($rs == null) || (mysql_num_rows($rs) == 0)) {
  return null;
} else {
  return ( $rs );
}
  }

  function insertData( $sql ) {
mysql_query( $sql );
// return new id if insert is successful
if ( mysql_affected_rows()  0 ) {
  return ( mysql_insert_id() );
} else {
  return null;
}
  }

  function updateData( $sql ) {
$rs = mysql_query( $sql );
if (mysql_affected_rows()  0) {
  return ( $rs );
} else {
  return null;  // no changes were made
}
  }
}


I then have another class with a different name and I changed the  
names of the functions as well. I have another set of class files  
that contain my various queries etc.


Thanks for any help.
Charles

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



Re: [PHP] Two MySQL connections in one script not working as expected

2005-09-27 Thread Charles Kline


On Sep 27, 2005, at 5:23 PM, M. Sokolewicz wrote:


Charles Kline wrote:



On Sep 27, 2005, at 3:42 PM, Andy Pieters wrote:


Hi

Without you actually showing us these class files we can only  
guess  but a

common mistake is this:

mysql_open(connection details)
mysql_query(query)

In those cases the last opened handle is used.  To prevent this,   
use this

syntax

$db1=mysql_open(connection for db1);
$db2=mysql_open(connection for db2);

mysql_query($db1,$query_db_1);
mysql_query($db2,$query_db_2);

If you have used this syntax then check your class if it is using  
a  global
variable to hold the database handle and if it does make it a  
class  variable

instead

Instead of

$db=null

class db
{function db()
 {$GLOBALS['db']=mysql_open(...

do instead

class db
{var $db=null;
 function db()
 {$this-db=mysql_open

That way you can instanciate as many instances of the class as  
you  like and

each will have its own database handle.

HTH


Andy




What I have is more like this:
class db {
  var $dbpath = localhost;
  var $dbname = testdb;
  var $dblogin = test;
  var $dbpass = test;
  function db() {
$link = mysql_connect($this-dbpath, $this-dblogin, $this-  
dbpass) or die ('Not Connected: ' . mysql_error());
mysql_select_db($this-dbname, $link) or die ('Can\'t use  
this  database: ' . mysql_error());

  }
  function retrieveData( $sql ) {
$rs = mysql_query( $sql ) or die(Invalid query:  .  
mysql_error ());

// if no result, return null
if (($rs == null) || (mysql_num_rows($rs) == 0)) {
  return null;
} else {
  return ( $rs );
}
  }
  function insertData( $sql ) {
mysql_query( $sql );
// return new id if insert is successful
if ( mysql_affected_rows()  0 ) {
  return ( mysql_insert_id() );
} else {
  return null;
}
  }
  function updateData( $sql ) {
$rs = mysql_query( $sql );
if (mysql_affected_rows()  0) {
  return ( $rs );
} else {
  return null;  // no changes were made
}
  }
}
I then have another class with a different name and I changed the   
names of the functions as well. I have another set of class files   
that contain my various queries etc.

Thanks for any help.
Charles

that's where it's going wrong. You're not linking db::db()'s link  
in the db::insertData() mysql_query() function. Thus, the  
mysql_query function defaults to the last opened mysql connection  
regardless of object. A way to fix this is to store the link in  
$this-link instead, and changing your mysql_query()'s to  
mysql_query($sql, $this-link);
same goes for your mysql_affected_rows() and mysql_insert_id()  
functions


-tul



Hmm... still getting the same results. Here is my modified class files:

class db {
  // database setup.  These should be changed accordingly.
  var $dbpath = localhost;
  var $dbname = blah1;
  var $dblogin = test;
  var $dbpass = test;


  function db() {
$this-link = mysql_connect($this-dbpath, $this-dblogin, $this- 
dbpass) or die ('Not Connected: ' . mysql_error());
mysql_select_db($this-dbname, $this-link) or die ('Can\'t use  
this database: ' . mysql_error());

  }

  function retrieveData( $sql ) {
$rs = mysql_query( $sql,$this-link ) or die(Invalid query:  .  
mysql_error());

// if no result, return null
if (($rs == null) || (mysql_num_rows($rs) == 0)) {
  return null;
} else {
  return ( $rs );
}
  }

  function insertData( $sql ) {
mysql_query( $sql,$this-link );
// return new complaint id if insert is successful
if ( mysql_affected_rows($this-link)  0 ) {
  return ( mysql_insert_id($this-link) );
} else {
  return null;
}
  }

  function updateData( $sql ) {
$rs = mysql_query( $sql,$this-link );
if (mysql_affected_rows($this-link)  0) {
  return ( $rs );
} else {
  return null;  // no changes were made
}
  }
}

and stored in another file...

class db2 {
  // database setup.  These should be changed accordingly.
  var $dbpath = localhost;
  var $dbname = blah2;
  var $dblogin = test;
  var $dbpass = test;


  function dbzen() {
$this-link = mysql_pconnect($this-dbpath, $this-dblogin,  
$this-dbpass) or die ('Not Connected: ' . mysql_error());
mysql_select_db($this-dbname, $this-link) or die ('Can\'t use  
this database: ' . mysql_error());


  }

  function retrieveZenData( $sql ) {
$rs = mysql_query( $sql,$this-link ) or die(Invalid query:  .  
mysql_error());

// if no result, return null
if (($rs == null) || (mysql_num_rows($rs) == 0)) {
  return null;
} else {
  return ( $rs );
}
  }

  function insertZenData( $sql ) {
mysql_query( $sql,$this-link ) or die(Invalid query:  .  
mysql_error());

// return new complaint id if insert is successful
if ( mysql_affected_rows($this-link)  0 ) {
  return ( mysql_insert_id($this-link) );
} else {
  return null;
}
  }

  function updateZenData( $sql ) {
$rs = mysql_query( $sql,$this-link

[PHP] Handling file uploads for download

2005-09-12 Thread Charles Kline

Hi all,

I have an application where I need to allow the admin of a site to  
upload PDF files for download by their clients.


I am uploading files to a directory ABOVE the web root, but I have no  
clue what the best way to have a link on the site to allow for  
downloading those files by visitors twould be.


Any suggestions?

Thanks,
Charles

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



Re: [PHP] Re: Security, Late Nights and Overall Paranoia

2005-07-13 Thread Charles Stuart


On Jul 12, 2005, at 6:50 AM, Chris Shiflett wrote:



As far as allowing [red] goes, you can just as easily add red to  
the list of available tags and not have to come up with a  
replacement for every other HTML tag that already exists.



but what about the poor bastards that'll go around trying to use  
redin HTML/red?






cs

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



Re: [PHP] XML and PHP

2005-07-06 Thread Charles Stuart
use a search engine. if you can't find what you need, then ask. if  
you already did this, then state that you already looked and you  
found xyz, but xyz isn't telling you what you need to know, which is  
specifically blah.



best,

charles




On Jul 6, 2005, at 2:59 PM, Cima wrote:


hi all,


i would like to know where i could find more info on xml and  
working xml with php.



thanks.


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



[PHP] extending a class using includes not working

2005-05-25 Thread Charles Kline

hi all.

i have 2 class files. say for example.

class 1

class 2 extends class 1

class 2  uses include_once(firstclass.php)

then i use include_once (secondclass.php) in my template. this does  
not work. to get it to work, i must put both the files as includes in  
my template.

any ideas why?

thanks,
charles

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



Re: [PHP] extending a class using includes not working

2005-05-25 Thread Charles Kline


On May 25, 2005, at 7:53 PM, Richard Lynch wrote:


On Wed, May 25, 2005 11:30 am, Charles Kline said:


i have 2 class files. say for example.

class 1

class 2 extends class 1

class 2  uses include_once(firstclass.php)

then i use include_once (secondclass.php) in my template. this does
not work. to get it to work, i must put both the files as includes in
my template.
any ideas why?



Could you define does not work a little more precisely?

Do you get error messages?

What do the error messages say?

Is there any output at all?

Does your computer blow up?

What?



Sorry I should have been more specific (or course)...

The template does not load. I get no error messages of any kind. Both  
classes function fine when included into the template separately -  
but when in include the secondclass.php which in turn includes  
firstclass.php the page does not load.


Running on Mac OS X Server version 10.3

- Charles

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



[PHP] Recursive function and formatting string for javascript tree

2005-05-24 Thread Charles Kline

Hi all.

I can't seem to figure this one out. I am trying to output a string  
for a javascript that builds a DHTML tree. The sample string looks  
like this:


[
['Executive Director', null, null,
['Executive Assistant ', null, null],
['Operations Director', null, null,
['Information Technology Director', null, null,
['Information Technology Analyst', null, null]
]
],
['Finance Director', null, null],
['Human Resources Director', null, null],
['Program Services Director', null, null]
]
]

My class contains these two functions to make this happen:

function generateOrg() {
$this-getDepts(0,1);
$str = [. $this-str.];
return ($str);
}

function getDepts ( $parent, $level ) {
$sql = 'SELECT BudgetedOrganization.* ';
$sql .= 'FROM BudgetedOrganization ';
$sql .= 'WHERE BudgetedOrganization.boSuperiorOrgID = ' .  
$parent;


$rs = $this-retrieveData($sql);
$totalRows = mysql_num_rows($rs);
if ($totalRows  0)
{
while($row = mysql_fetch_array($rs)){
$currRow = 0;
$this-str .= [' . $row['boOrgName'] . ',null,null;

($totalRows == $currRow) ? $delim = , : $delim =  
],;


$this-str .= $delim;
$this-getDepts($row['boOrgID'],$level+1);
$currRow++;

}
}

return($this-str);
}


Here is the output I am getting from my database, and the format is  
not right. I have played with it for hours and still can't figure out  
how to get the brackets and commas formatted properly to represent  
the data tree properly.


['Organization XYZ',null,null],
['Operations',null,null],
['Finance',null,null],
['Information Technology',null,null],
['Program Services',null,null],
['Program Support',null,null],
['Provider Resources',null,null],
['MOST',null,null],
['Family Resources',null,null],
['Family Resources - Chatham Site',null,null],
['Team 13',null,null],
['Team 14',null,null],
['Enhanced Programs',null,null],
['Teen Parent Program',null,null],
['External Relations',null,null],

]

AND here is is when it is nested the way I want it (I did this by hand):

[
['Organization XYZ',null,null,
['Operations',null,null,
['Finance',null,null],
['Information Technology',null,null]
],
['Program Services',null,null,
['Program Support',null,null]
['Provider Resources',null,null,
['MOST',null,null]
],
['Family Resources',null,null,
['Family Resources - Chatham Site',null,null,
['Team 13',null,null],
['Team 14',null,null]
],
['Enhanced Programs',null,null,
['Teen Parent Program',null,null]
]
],
],
['External Relations',null,null]
]
]


Any help would be great. I am stuck.

Thanks,
Charles

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



Re: [PHP] PHP5 qne MySQL

2005-05-19 Thread Charles FENDT
Terrence Mullin a écrit :
I have been trying to set an area at home to run and
test php and MySQL applications. I used the tutorial
on http://www.ricocheting.com/server/cgi.html 
to install Apache, PHP, and MySQL. Everything is
working great except for trying to test a simple
connection to the MySQL database through php. I have
seen some other people quote on how PHP5 no longer
   

has
 

a direct link to MySQL. My platform is Windows XP at
the moment. I will shortly be partitioning two hard
drives for use of Linux on one of them. I would like
to know if there is a solution for WIndows XP. I
   

have
 

seen people just go back to php4 to correct this. I
was wondering if there is a simple way I can stick
with PHP5 and make my connections. I receive this
error right now:
Fatal error: Call to undefined function
mysql_connect() in C:\public_html\MySQLphptry.php on
line 18
Where line 18, is just the mydsql_connect ();
   

command.
 

Thank you for your help in this I know myself as
   

well
 

as other forums out there would like to know a
   

simple
 

solution if there is one.
   

SIncerely,
Terry Mullin
 

Try to edit your PHP.INI file
check if PHP_MYSQL.DLL in declared as module...
if the file is in the path...
But try to use MySQLi or PDO (PHP 5.1 or PECL modules for PHP 5.0)
This is a must better way to acces mysql Database...
regards,
FENDT Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Class function calling another function in class

2005-05-18 Thread Charles Kline
Hi all,
Not sure if I am doing this right and I can't figure it out, was  
hoping someone here can help.

I have an organization table in mySQL. Pretty standard. My first  
function getDepts() is working as I intend and returning the tree  
just as I like it. The new piece I added in there that is not working  
now is the call to getPositions() within the first function. What I  
am trying to do is once I get a Department, I want to loop through  
the Positions table and get the positions that are under that  
Department. This code goes haywire and loops for ever printing a huge  
list to the screen. Eventually I need to return this data not to the  
screen but into an array. Anyone see what I might have wrong in my  
logic?

I have a class and it contains these two functions.
function getDepts ( $parent = 0, $level = 1 ) {
$sql = 'SELECT BudgetedOrganization.* ';
$sql .= 'FROM BudgetedOrganization ';
$sql .= 'WHERE BudgetedOrganization.boSuperiorOrgID = ' .  
$parent;

$rs = $this-retrieveData($sql);
if ($rs)
{
while($row = mysql_fetch_array($rs)){
$num = 1;
while ($num = $level) {
$this-str .= \t;
$num++;
}
$this-str .= $row['boOrgID'] . ,  . $row 
['boOrgName'] . \n;

   // just added this and it ain't working
$this-str .= $this-getPositions($row['boOrgID']);
$this-getDepts($row['boOrgID'],$level+1);
}
}
return($this-str);
}
function getPositions ( $org = 0 ) {
$sql = 'SELECT BudgetedPosition.* ';
$sql .= 'FROM BudgetedPosition ';
$sql .= 'WHERE BudgetedPosition.bp_boOrgID = ' . $org;
//echo $sql;
$rs = $this-retrieveData($sql);
if ($rs)
{
while($row = mysql_fetch_array($rs)){
$this-str .=  -  . $row['bpPositionID'] . \n;
}
}
return($this-str);
}
Later
$depts = $org-getDepts();
echo pre . $depts . /pre;
Thanks,
Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PDO and Oracle...

2005-04-21 Thread Charles FENDT
I try to use PDO to access to Oracle database...
I use PDO::prepare and bindParam to set var values...
but it didn't work !!!
PDO_PARAM_INT didn't work with columns of type NUMBER...
What can i do ???
Regards,
FENDT Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PDO Oracle

2005-04-21 Thread Charles FENDT
I try PDO with Oracle...
I want to use a prepared query with a param... but bindParam freeze 
Apache, exec(arra(...)) send me an error :

OCIBindByPos: ORA-01036: numro/nom de variable interdit
(..\pecl\pdo_oci\oci_statement.c:259)
Any idee ??
Regards,
FENDT Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PDO Oracle

2005-04-21 Thread Charles FENDT
Charles FENDT a crit :
I try PDO with Oracle...
I want to use a prepared query with a param... but bindParam freeze 
Apache, exec(arra(...)) send me an error :

OCIBindByPos: ORA-01036: numro/nom de variable interdit
(..\pecl\pdo_oci\oci_statement.c:259)
Any idee ??
Regards,
FENDT Charles
more precisions...
table.id is NUMBER(8)
?php
$pdo   = new PDO(oci:dbname=MRFL3, nemca12, nemca12);
$query = $pdo-prepare(SELECT * FROM table WHERE id = :id_value);
$val = 1;
$query-bindParam(':id_value', $val, PDO_PARAM_INT);
$query-execute();
var_dump($query-errorInfo());
?
array(3) {
[0]=
string(5) HY000
[1]=
int(1460)
[2]=
string(116) OCIStmtExecute: ORA-01460: unimplemented or unreasonable 
conversion requested
(..\pecl\pdo_oci\oci_statement.c:132)

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


Re: [PHP] reverse MD5 ???

2005-04-21 Thread Charles FENDT
William Stokes a écrit :
Hello,
I have a system that uses certain id info. This info is stored in a session 
cookie in MD5 format. At certain parts of the code I need to update or 
insert to MySQL DB with that id info value in cleartext. Is this possible?

If so, how to put this to a sql query?
$sqlquery = insert into x_table (team_id,number,) values 
('$team_id','$number')

$team_id is the MD5 formatted cookie value and I need to put it to the 
x_table column team_id in cleartext.

Thanks a lot
-Will
 

MD5 = no reverse
that's why it's secure...
sorry...
FENDT Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] secure document : solution wanted

2005-04-06 Thread Charles Hamel
Hi

I am bulding a secure intranet.(php, mysql, apache)
I am using a session and Mysql to handel the user accounts. Everythying 
works fine with that.

The client now needs to share word/pdf document with the registered user. I 
created a secure directory using .htaccess for this purpose and it works as 
well  the user are promt to enter a username password.

Is there a way to bypass this login box so logged user would be able to 
access the file, but the directory would still be protected against 
non-logged user who would know the path and the name the file? I can deal 
with one .htacces account (username pw) since all the file can be shared 
with all the users.

I was expecting this to work ... 
http://username:[EMAIL PROTECTED]/safeDir/Word.doc  but it isn't.

Any idea what I could do?

Thanks 

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



[PHP] PDO and Oracle

2005-04-06 Thread Charles FENDT
I try to use PDO with Oracle and PHP 5.0.4 on windows...
my php.ini includes php_pdo.dll
and when I try to create an object, I got an error message could not 
find driver

Any idea ?
regards,
FENDT Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PDO and Oracle

2005-04-06 Thread Charles FENDT
I try to use PDO with Oracle and PHP 5.0.4 on windows...
my php.ini includes php_pdo.dll
and when I try to create an object, I got an error message could not 
find driver

Any idea ?
regards,
FENDT Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] secure document : solution wanted

2005-04-06 Thread Charles Hamel

Duncan Hill [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Wednesday 06 April 2005 16:23, Charles Hamel typed:
 Hi

 I am bulding a secure intranet.(php, mysql, apache)
 I am using a session and Mysql to handel the user accounts. Everythying
 works fine with that.

 The client now needs to share word/pdf document with the registered user. 
 I
 created a secure directory using .htaccess for this purpose and it works 
 as
 well  the user are promt to enter a username password.

 I was expecting this to work ...
 http://username:[EMAIL PROTECTED]/safeDir/Word.doc  but it isn't.

 IE dropped support (or severely neutered it) for username:password in URLs 
 a
 while back.

 One way to handle this is to write a wrapper script that accepts the file 
 name
 as a parameter.  The script verifies that the user is allowed to access 
 the
 file, and sends back the file with appropriate content type etc.  Files 
 can
 then be stored outside of the document root, preventing access even if you
 guess the file name.

Can you provide a little more infos about wrapper scripts ... first time 
earing about this expession.

Can this script be written in php ... or it is some kind of cgi?  Any 
exemple online of these type of script that a could study to make my own?

Thanks
Charles 

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



Re: [PHP] secure document : solution wanted

2005-04-06 Thread Charles Hamel

Duncan Hill [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Wednesday 06 April 2005 17:02, Charles Hamel wrote:
 Duncan Hill [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  One way to handle this is to write a wrapper script that accepts the 
  file
  name
  as a parameter.  The script verifies that the user is allowed to access

 Can you provide a little more infos about wrapper scripts ... first time
 earing about this expession.

 Can this script be written in php ... or it is some kind of cgi?  Any

 http://lists.evolt.org/archive/Week-of-Mon-20011224/064591.html has some
 sample code to do with forcing IE to download a file where it can't 
 determine
 the mime type properly.  This forms the core of being able to feed a file 
 to
 a browser when a .php file is called.

 The rough flow of the code would be:
 1) Check that the user is authenticated.  Kick them out if they aren't.
 2) (Optional) Check that the user is allowed to access the file being
 requested.  This might be a MySQL DB lookup, a secret word request, 
 whatever.
 3) Check that the file exists.  Even better, rather than feed a file name,
 store a mapping of a unique ID to real file name in a data source of some
 type, and throw the ID around.  You can enforce the format of the ID etc 
 to
 avoid attacks against your system.
 4) If all is good, use the code linked above (in some form) to feed the 
 file
 to the browser.  The user will get a Save dialog box in pretty much any
 browser.

I am all set guys  thanks ... What would I do without the community?

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



[PHP] use_soap_error_handler

2005-02-17 Thread FENDT Charles
Hello...
Someone knows how this work ?
use_soap_error_handler
I search a way to handle SoapFault exceptions from the SoapServer class...
Regards
FENDT Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] use_soap_error_handler

2005-02-17 Thread FENDT Charles
Jochem Maas a écrit :
FENDT Charles wrote:
Hello...
Someone knows how this work ?
use_soap_error_handler

I don't have a clue but looking at the docs you have at least 2 other 
ways of
handling SOAP errors:

1. http://php.paradoxical.co.uk/manual/en/function.is-soap-fault.php
is_soap_fault is only for SoapClient...
2. use a try/catch block
try {
// do some SOAP stuff here
}
catch (SoapFault $e) {
// catch SOAP specific exceptions here
}
catch (Exception $e) {
// catch general exceptions
}
and try catch nothing !!!
just an exmple :
?php
echo begin\n;
$server = new SoapServer(null, http://test/;);
try {
  $server-handle();
} catch (Exception $e) {
  echo ERROR\n;
}
echo end\n;
?
:-(
that's why y search some stuff over use_soap_error_handler
Is the solution there ???
FENDT Charles

I DO NOT KNOW what the classname of the Soap Exception assuming SoapServer
does not just throw std Exceptions... so I guessed that it might be called
SoapFault the manual seems to indicate that this is correct.
HTH - (I just figured out wtf HTH means :-)
I search a way to handle SoapFault exceptions from the SoapServer 
class...

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


Re: [PHP] use_soap_error_handler

2005-02-17 Thread FENDT Charles
Jochem Maas a écrit :
FENDT Charles wrote:
Jochem Maas a écrit :
FENDT Charles wrote:
Hello...
Someone knows how this work ?
use_soap_error_handler


I don't have a clue but looking at the docs you have at least 2 other 
ways of
handling SOAP errors:

1. http://php.paradoxical.co.uk/manual/en/function.is-soap-fault.php

is_soap_fault is only for SoapClient...

ah, ok, sorry.

2. use a try/catch block
try {
// do some SOAP stuff here
}
catch (SoapFault $e) {
// catch SOAP specific exceptions here
}
catch (Exception $e) {
// catch general exceptions
}

and try catch nothing !!!
just an exmple :
?php
echo begin\n;
$server = new SoapServer(null, http://test/;);
try {
  $server-handle();
} catch (Exception $e) {
  echo ERROR\n;
}
echo end\n;
?

I can't test this (no machine with the SOAP extension + lack of time +
less than stellar skills when it comes to compiling stuff :-)
I am wondering what the return value of $server-handle() is, maybe
you will have to check the return value to see if an error occurs.
void ... :-(
void SoapServer::handle([string])
no exception...
in 2 words... NO INFORMATION on what happened
FENDT Charles

:-(
that's why y search some stuff over use_soap_error_handler
Is the solution there ???
FENDT Charles

I DO NOT KNOW what the classname of the Soap Exception assuming 
SoapServer
does not just throw std Exceptions... so I guessed that it might be 
called
SoapFault the manual seems to indicate that this is correct.

HTH - (I just figured out wtf HTH means :-)
I search a way to handle SoapFault exceptions from the SoapServer 
class...

Regards
FENDT Charles

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


[PHP] SoapServer::handlle

2005-02-16 Thread Charles FENDT
Hello,
here is an example:
?php
  $server = new SoapServer(null, array('uri' = http://test-uri/;));
  $server-handle();
  echo \nAlive\n;
?
here is the result
?xml version=1.0 encoding=UTF-8?
SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/;
  SOAP-ENV:Body
SOAP-ENV:Fault
  faultcodeSOAP-ENV:Server/faultcode
  faultstringBad Request/faultstring
/SOAP-ENV:Fault
  /SOAP-ENV:Body
/SOAP-ENV:Envelope
this didn't output Alive on stdout...
the script ends with the SoapServer::handle() call.
Did i miss something?
an option ?
regards
FENDT Charles
P.S. I need to use the WSDL mode. The same happened, but this is easier show my 
probleme
(no need of a WSDL file)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] SoapServer::handlle

2005-02-16 Thread FENDT Charles
Hello,
I (try) to use a SoapServer in a CLI program.
I want to redirect the SoapServer::handle() output from STDOUT to a 
socket stream.
(my second question is how can i prevent SoapServer::handle() to kill my 
daemon process... cf php.soap)

How can I o this ?
regards
FENDT Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP Cached Templates

2004-08-31 Thread charles kline
On Aug 31, 2004, at 9:18 PM, raditha dissanayake wrote:
rogue wrote:
Sorry if this is the wrong place for this post. I am having problems 
where PHP templates that I modify via ftp are not showing changes for 
like 1 minute or so. I assume this is some kind of server caching but 
I am not sure how to adjust this (it is my development server). 
Running Apache server.
It could well be a caching issue are you working behind a proxy? what 
are your browser cache settings?

No proxy, and I don't have any caching issues with my production 
server. Guess I will keep searching :)

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


Re: [PHP] Techniques for doing story

2004-08-17 Thread charles kline
I understand how the pages are designed etc. What I wanted to 
understand better was how the pages were being displayed using PHP. I 
guess it is obvious now after getting a few responses, that the HTML is 
stored in a table, perhaps one record per page... then you just query 
the story_id and page through the records. Guess it isn't that 
mysterious after all ;)


On Aug 17, 2004, at 12:18 PM, Matthew Sims wrote:
Hi all,
I want to do something like this:
http://www.cgnetworks.com/story_custom.php?story_id=2259corresponding
Where we can publish an article, multiple page even and lay it out in 
a
nice design with images etc. How do you think this is done?
Uh...HTML? It is a website, correct?
These stories are dynamically generated it seems since the page is
passed in the URL. I am just not sure where to start...
Thanks,
Rogue
PHP has nothing to do with the layout. The story is probably stored in 
a
database and the story_id var is passed through $_GET to pull up the
cooresponding story.

Learn HTML and CSS and you can make a website look however you want it 
to
look. PHP simply makes the pages change depending on user events.

--
--Matthew Sims
--http://killermookie.org
--
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] Techniques for doing story

2004-08-17 Thread charles kline
Yea, But then I took his advice and found this 
http://www.catb.org/~esr/faqs/smart-questions.html#keepcool so I was 
not so offended :)

I had all the other links, but that one and did not think my question 
was that out there for the list... oh well.

On Aug 17, 2004, at 12:31 PM, Jason Davidson wrote:
Friendly crew today. :)
Jason
John Nichel [EMAIL PROTECTED] wrote:
rogue wrote:
Hi all,
I want to do something like this:
http://www.cgnetworks.com/story_custom.php?story_id=2259
Where we can publish an article, multiple page even and lay it out 
in a
nice design with images etc. How do you think this is done? These
stories are dynamically generated it seems since the page is passed 
in
the URL. I am just not sure where to start...
First : http://vzone.virgin.net/sizzling.jalfrezi/iniframe.htm
Second : http://us4.php.net/manual/en
Third : http://dev.mysql.com/doc/mysql/en/index.html
And before you come to a mailing list
http://www.google.com
http://groups.google.com
http://marc.theaimsgroup.com
http://www.catb.org/~esr/faqs/smart-questions.html
RTFM
STFW
STFA
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
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] Techniques for doing story

2004-08-17 Thread charles kline
On Aug 17, 2004, at 1:04 PM, Matthew Sims wrote:
snip
hn C. Nichel
OMG, John. You broke through to someone. This could be good sign. Now 
if
we can just get him to stop top posting he'll be ready for anything. ;)

/snip
oops... now i got it! :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Working with a new design client

2004-08-09 Thread charles kline
Hi all,
I have a new client (a design company). They have never developed a 
dynamic website at all and do all their HTML editing using Dreamweaver.

When I build sites, I am used to using a class for pages. Many of the 
pages in this site are totally static except for a few elements (Bread 
Crumb, Nav Bar, etc.). So I am not sure if this method is the best way 
to go...

My big concern is that I am going to totally screw them up if they want 
to edit some details on a page, they are going to have to go in and 
mess with the HTML that gets passed to the drawPage() function. Maybe 
there is a better way to handle this?

I have never used Smarty, which I understand might be a big help in 
these situations. One concern of mine is that I have a tight budget on 
this project and don't want to spend a lot of time learning a new 
system unless I have to.

Thanks for any advice,
Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] CMS Ideas Welcome

2004-08-04 Thread charles kline
Hi all,
I could use some advice/pointers on a sold method for achieving this 
feature on a site I am building. One of the features is an event 
calendar. The events are listed by date, not in a calendar view, but a 
list with a short description of the event. This part is no problem. 
What I am not sure about as far as a best method is the next part. 
Each event could have a longer description. The client wants to be able 
to style this longer description using formatting and images, but does 
not want to have to code the HTML into a textarea and then upload the 
images via ftp or whatever. The idea I came up with is to have a few 
pre-defined layouts they can choose from. Some of which could 
incorporate some images. Once the style is picked and the text is 
entered (different fields get different styles applied) the submit the 
data, and if the style makes images a part of the layout, I give them a 
form based image upload feature. Another thought was to have them 
upload .html files and the images via a form, but then I thought this 
could really cause problems if they had screwed up code.

Any thoughts would be greatly appreciated.
Thanks,
Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Finding a value in an array

2004-07-22 Thread charles kline
Hi all,
I am using fgetcsv() to get a tab delimited text file into an array. It 
gives me an array in this format:

Array
(
[0] = Array
(
[0] = 97
[1] = Effects of Slow Heating Rates on Products of 
Polyethylene Pyrolysis
)

[1] = Array
(
[0] = 103
[1] = Effect of Heating Rate of Oxidative Degradation of 
Polymeric Materials
)

[2] = Array
(
[0] = 106
[1] = Identification and Differentiation of Synthetic 
Polymers by Pyrolysis Capillary Gas Chromatography
)
)

From a form, I am passing in some values from checkboxes like:
input type=checkbox name=notes[] value=97 /
input type=checkbox name=notes[] value=106 /
I need to be able to display the description string in the array for 
whichever checkboxes are checked. So for example if the user submits 
the form with the value 106 I want to display Identification and 
Differentiation...

Any ideas? Please copy me on replies.
Thanks,
Rogue
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Finding a value in an array

2004-07-22 Thread charles kline
Thanks!!!
On Jul 22, 2004, at 11:39 PM, Justin Patrin wrote:
On Thu, 22 Jul 2004 23:34:56 -0400, charles kline 
[EMAIL PROTECTED] wrote:
Hi all,
I am using fgetcsv() to get a tab delimited text file into an array. 
It
gives me an array in this format:

Array
(
 [0] = Array
 (
 [0] = 97
 [1] = Effects of Slow Heating Rates on Products of
Polyethylene Pyrolysis
 )
 [1] = Array
 (
 [0] = 103
 [1] = Effect of Heating Rate of Oxidative Degradation of
Polymeric Materials
 )
 [2] = Array
 (
 [0] = 106
 [1] = Identification and Differentiation of Synthetic
Polymers by Pyrolysis Capillary Gas Chromatography
 )
)
 From a form, I am passing in some values from checkboxes like:
input type=checkbox name=notes[] value=97 /
input type=checkbox name=notes[] value=106 /
I need to be able to display the description string in the array for
whichever checkboxes are checked. So for example if the user submits
the form with the value 106 I want to display Identification and
Differentiation...
Any ideas? Please copy me on replies.
Just loop through and check...
foreach($csvArray as $entry) {
  if(in_array($entry[0], $_REQUEST['notes'])) {
echo $entry[1].'br/;
  }
}
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
--
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] PHP Coding Standards

2004-05-29 Thread charles kline
Hi all,
I was having a conversation with a friend and talking about coding 
standards in the open source community (focusing on PHP). I seem to 
remember there being a document out there that sort of laid it out 
pretty well.

Anyone know where I might find a copy?
Thanks,
Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] session variables

2004-04-20 Thread Charles Collins
I have two test files running on a server, which is giving me a headache,
due to the fact the session variables are not been maintained across the two
pages.

The server is running ...

PHP Version  = 4.0.5
register_globals = ON
Session Support = Enabled
session.auto_start = Off
session.cache_expire =  180
session.cache_limiter = nocache
session.cookie_domain = inweb.net.uk
session.cookie_lifetime = 600
session.cookie_path =  /
session.cookie_secure = Off
session.entropy_file = no value
session.entropy_length = 0
session.gc_maxlifetime = 1440
session.gc_probability = 1
session.name = PHPSESSID
session.referer_check = no value
session.save_handler = files
session.save_path = /tmp
session.serialize_handler php
session.use_cookies = On

The two script files are as follows: -

Page #1:

?
 session_start();
 session_register(test);
 $test = Hullo World;
 print $test; // prints test
?

Page # 2

?
 session_start();
 print $test;// prints nothing, zip!
?

Can anyone tell me where I'm going wrong, works fine of test servers, etc.,
only screwed up when site was lauched.

Thanks in advance ...

Regards
Charlie.

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



Re: [PHP] session variables

2004-04-20 Thread Charles Collins
Dear Vincent,

Tried that as well as $HTTP_SERVER_VARS, $_SESSION, etc., still cannot get
the damn thing working.

Regards,
Charlie.

Vincent Dupont [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I would do
script 1 :
$_SESSION['test'] = hello world;

and in script2 :
print($_SESSION['test']);


vincent

-Original Message-
From: Charles Collins [mailto:[EMAIL PROTECTED]
Sent: mardi 20 avril 2004 17:44
To: [EMAIL PROTECTED]
Subject: [PHP] session variables


I have two test files running on a server, which is giving me a headache,
due to the fact the session variables are not been maintained across the two
pages.

The server is running ...

PHP Version  = 4.0.5
register_globals = ON
Session Support = Enabled
session.auto_start = Off
session.cache_expire =  180
session.cache_limiter = nocache
session.cookie_domain = inweb.net.uk
session.cookie_lifetime = 600
session.cookie_path =  /
session.cookie_secure = Off
session.entropy_file = no value
session.entropy_length = 0
session.gc_maxlifetime = 1440
session.gc_probability = 1
session.name = PHPSESSID
session.referer_check = no value
session.save_handler = files
session.save_path = /tmp
session.serialize_handler php
session.use_cookies = On

The two script files are as follows: -

Page #1:

?
 session_start();
 session_register(test);
 $test = Hullo World;
 print $test; // prints test
?

Page # 2

?
 session_start();
 print $test;// prints nothing, zip!
?

Can anyone tell me where I'm going wrong, works fine of test servers, etc.,
only screwed up when site was lauched.

Thanks in advance ...

Regards
Charlie.

--
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] [Solved] session variables

2004-04-20 Thread Charles Collins
Thanks for the suggestions, turned out to be a server setting the hosting
compnay had set in the php.ini, see below: -

session.cookie_domain = inweb.net.uk// this points to the hosting
companies url

by adding the following resolved the problem: -

ini_set(session.cookie_domain, $domain_name)

Works a treat now, the server was saving the session cookie for the wrong
url and hence when the secoudn page was called in the same browser it wa not
able to collect up the session variables as the domain names were different.

Thanks again,

Regards
Charlie.


Vincent Dupont [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I would do
script 1 :
$_SESSION['test'] = hello world;

and in script2 :
print($_SESSION['test']);


vincent

-Original Message-
From: Charles Collins [mailto:[EMAIL PROTECTED]
Sent: mardi 20 avril 2004 17:44
To: [EMAIL PROTECTED]
Subject: [PHP] session variables


I have two test files running on a server, which is giving me a headache,
due to the fact the session variables are not been maintained across the two
pages.

The server is running ...

PHP Version  = 4.0.5
register_globals = ON
Session Support = Enabled
session.auto_start = Off
session.cache_expire =  180
session.cache_limiter = nocache
session.cookie_domain = inweb.net.uk
session.cookie_lifetime = 600
session.cookie_path =  /
session.cookie_secure = Off
session.entropy_file = no value
session.entropy_length = 0
session.gc_maxlifetime = 1440
session.gc_probability = 1
session.name = PHPSESSID
session.referer_check = no value
session.save_handler = files
session.save_path = /tmp
session.serialize_handler php
session.use_cookies = On

The two script files are as follows: -

Page #1:

?
 session_start();
 session_register(test);
 $test = Hullo World;
 print $test; // prints test
?

Page # 2

?
 session_start();
 print $test;// prints nothing, zip!
?

Can anyone tell me where I'm going wrong, works fine of test servers, etc.,
only screwed up when site was lauched.

Thanks in advance ...

Regards
Charlie.

--
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] Re: session variables

2004-04-20 Thread Charles Collins
Thanks for the suggestions, turned out to be a server setting the hosting
compnay had set in the php.ini, see below: -

session.cookie_domain = inweb.net.uk// this points to the hosting
companies url

by adding the following resolved the problem: -

ini_set(session.cookie_domain, $domain_name)

Works a treat now, the server was saving the session cookie for the wrong
url and hence when the secoudn page was called in the same browser it wa not
able to collect up the session variables as the domain names were different.

Thanks again,

Regards
Charlie.


Charles Collins [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I have two test files running on a server, which is giving me a headache,
due to the fact the session variables are not been maintained across the two
pages.

The server is running ...

PHP Version  = 4.0.5
register_globals = ON
Session Support = Enabled
session.auto_start = Off
session.cache_expire =  180
session.cache_limiter = nocache
session.cookie_domain = inweb.net.uk
session.cookie_lifetime = 600
session.cookie_path =  /
session.cookie_secure = Off
session.entropy_file = no value
session.entropy_length = 0
session.gc_maxlifetime = 1440
session.gc_probability = 1
session.name = PHPSESSID
session.referer_check = no value
session.save_handler = files
session.save_path = /tmp
session.serialize_handler php
session.use_cookies = On

The two script files are as follows: -

Page #1:

?
 session_start();
 session_register(test);
 $test = Hullo World;
 print $test; // prints test
?

Page # 2

?
 session_start();
 print $test;// prints nothing, zip!
?

Can anyone tell me where I'm going wrong, works fine of test servers, etc.,
only screwed up when site was lauched.

Thanks in advance ...

Regards
Charlie.

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



[PHP] Shopping Cart Solutions

2003-09-22 Thread Charles Kline
Anyone have suggestions for open source shopping cart apps in PHP?

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


[PHP] PHP and Palm

2003-09-16 Thread Charles Kline
I have a project in mind where I would like to be able to Sync my Palm 
with the calendar in my CRM. Anyone have info on doing this?

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


[PHP] Messages for group@php.net are in pending

2003-09-10 Thread Gibier Jean-Charles
Hello,
I have a request destined to the php group, relevant of the
authorization to use PHP root in a project name. This must be done by
sending a mail to group_at_php.net but this adresse seems to be out of
order.

---8--
Hi. This is the qmail-send program at php.net.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

group_at_pair2.php.net:
j-c.gibier_at_wanadoo.fr is in pending
I'm not going to try again; this message has been in the queue too long.
---8--

Is there another way to pass my demand to the persons supposed to deliver
prior written permission ?
Thanks for your advices.

regards
JCG

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



Re: [PHP] Encrypt/Serialize Source Code for Sale

2003-09-07 Thread Charles Kline
Thanks. This is one I had not turned up in my search. Much appreciated.

- Charles

On Sunday, Sep 7, 2003, at 00:44 US/Eastern, Evan Nemerson wrote:

Take a look at Turck MMCache (free) and Zend Encoder (not).

http://www.turcksoft.com/en/e_mmc.htm
http://www.zend.com/store/products/zend-encoder.php


On Saturday 06 September 2003 01:59 pm, Charles Kline wrote:
What methods are available (ups and downs) for encrypting and
serializing php applications for sale?
Thanks,
Charles
--
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] Encrypt/Serialize Source Code for Sale

2003-09-06 Thread Charles Kline
What methods are available (ups and downs) for encrypting and 
serializing php applications for sale?

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


[PHP] PHP MS Exchange Server problem

2003-07-16 Thread Charles Vos
Hello All---
 
I'm having some trouble getting PHP to communicate with my Windows 2000 MS 
Exchange Server... I'm running PHP 4.3.2 on a Win2000 machine serving with Apache 1.3.
 
The code I'm using is:
 
$mbox = imap_open({x.x.x.x:143},admin,adminpass, OP_HALFOPEN);
$err = imap_errors();
while (list($key, $val) = each($err))
print imap_utf7_decode($val).br\n;
$alrt = imap_alerts();
while (list($key, $val) = each($alrt))
print imap_utf7_decode($val).br\n;
 
This yields the error:
Warning: imap_open(): Couldn't open stream {x.x.x.x:143} in 
c:\apache\apache\htdocs\sdimail.php on line 11
Connection refused

If I change the imap_open command to use {x.x.x.x:143\} as the host, I get a 
different error:
 
Warning: imap_open(): Couldn't open stream {x.x.x.x:143\} in 
c:\apache\apache\htdocs\sdimail.php on line 11
Can't open mailbox {192.168.0.3:143\}: invalid remote specification

which makes me suspect that I am actually able to connect but PHP isn't finding 
anything it likes (what is it looking for?)
 
can anyone help me with this or at least point me towards a tutorial on using PHP with 
MS Exchange?
 
Thanks in advance for your help,
 
-Charlie
[EMAIL PROTECTED]


Re: [PHP] stripping newlines from a string

2003-06-09 Thread Charles Kline
Yes. Is weird. I thought this would work too, but for some reason it 
was not removing them all. I wonder if re-saving the files with UNIX 
linebreaks (or try DOS) would have any effect. Will report back.

- Charles

On Monday, June 9, 2003, at 02:24 AM, Joe Pemberton wrote:

http://www.php.net/str_replace

$newstr = str_replace(\n, , $oldstr);

- Original Message -
From: Charles Kline [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, June 08, 2003 10:44 PM
Subject: [PHP] stripping newlines from a string

Hi all,

How would i go about stripping all newlines from a string?

Thanks,
Charles
--
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] reading a file into variable for using in a javascript

2003-06-08 Thread Charles Kline
Hi all,

I am reading the content of a text file into a variable to be used in a 
javascript. I am reworking some code that was originally done using 
ColdFusion and the jsStringFormat(var) function. What is the PHP 
equivalent string function? Is there one? I have searched the docs, but 
can't figure out which to use.

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


[PHP] stripping newlines from a string

2003-06-08 Thread Charles Kline
Hi all,

How would i go about stripping all newlines from a string?

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


[PHP] When to use a text file rather then a database

2003-04-05 Thread Charles Kline
Hello all,

I have a text blurb that is on the home page of a site. I need to make 
this block of text editable through a form in  the admin section of the 
site. Is it worth having a table in the db or would I be better off 
writing to a file for this?

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


[PHP] getting values from objects

2003-04-01 Thread Charles Kline
hi there,

if this:

$res_pform-getSubmitValue(investigator5);

returns an array, how do I get to the individual values in that array 
without first setting it to a variable like:

$myvar = $res_pform-getSubmitValue(investigator5);

echo $myvar['field'];

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


Re: [PHP] getting values from objects

2003-04-01 Thread Charles Kline
My objective was to try and NOT use a temporary variable.

for example I can do this:

foreach ($res_pform-getSubmitValue(investigator5) AS $k=$v){
echo $k . br;
}
I was just wondering in other circumstances, how I can maybe just get 
to the value of one of the keys without setting it first to a variable 
(which is the only way I know how to now).

Thanks,
Charles
On Tuesday, April 1, 2003, at 03:18 PM, Dan Joseph wrote:

Have you tried:

extract ($myvar = $res_pform-getSubmitValue(investigator5));

-Dan Joseph

-Original Message-
From: Charles Kline [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 01, 2003 2:58 PM
To: [EMAIL PROTECTED]
Subject: [PHP] getting values from objects
hi there,

if this:

$res_pform-getSubmitValue(investigator5);

returns an array, how do I get to the individual values in that array
without first setting it to a variable like:
$myvar = $res_pform-getSubmitValue(investigator5);

echo $myvar['field'];

thanks
charles
--
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] Validate MySQL date

2003-03-31 Thread Charles Kline
try the checkdate() function. i think that will do what you need.

On Monday, March 31, 2003, at 11:06 PM, Ben C. wrote:

How do I easily check to see if a MySQL formatted date is valid such  
as if a
user enters

2003/02/28 would return true
2003/02/31 would return false
I have check the manual and other resources but can't come up with  
anything.

--- 
---
The content of this email message and any attachments are confidential  
and
may be legally privileged, intended solely for the addressee.  If you  
are
not the intended recipient, be advised that any use, dissemination,
distribution, or copying of this e-mail is strictly prohibited.  If you
receive this message in error, please notify the sender immediately by  
reply
email and destroy the message and its attachments.

--
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] date math question

2003-03-27 Thread Charles Kline
I am storing my dates as unix timestamp (epoch). Am I right in assuming 
that if I need to add or subtract days from this it is done in seconds?

So for example if I have the timestamp 1041397200 and I wanted to 
subtract 24 hours from it I would do this:

$newtime = $orig_time - 86400;

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


Re: [PHP] date math question

2003-03-27 Thread Charles Kline
Okay cool.

This leads me to another question. If I have stored the date as an 
epoch then is there a way using PHP and MySQL to say find all the 
records that have been added this YEAR (not last 365 days)?

Thanks
Charles
On Friday, March 28, 2003, at 12:31 AM, Leo Spalteholz wrote:

On March 27, 2003 09:15 pm, Charles Kline wrote:
I am storing my dates as unix timestamp (epoch). Am I right in
assuming that if I need to add or subtract days from this it is
done in seconds?
yes

--
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] date math question

2003-03-27 Thread Charles Kline
Caught that :) Thanks for the tip... worked just perfect (after I fixed 
typo)

On Friday, March 28, 2003, at 12:57 AM, Foong wrote:

sorry
typo error should be:
date('Y')

Foong

Foong [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
hi,

$start = mktime ( 0, 0, 0, 1, 1, date['Y']);  // first day of this 
year
$end = mktime ( 0, 0, 0, 12, 31, date['Y']);  // last day of this year

then select all record where timestamp = $start and timestamp = $end

should do the job
Hope this helps
Foong



Charles Kline [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Okay cool.

This leads me to another question. If I have stored the date as an
epoch then is there a way using PHP and MySQL to say find all the
records that have been added this YEAR (not last 365 days)?
Thanks
Charles
On Friday, March 28, 2003, at 12:31 AM, Leo Spalteholz wrote:

On March 27, 2003 09:15 pm, Charles Kline wrote:
I am storing my dates as unix timestamp (epoch). Am I right in
assuming that if I need to add or subtract days from this it is
done in seconds?
yes

--
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] html_quickform - array question

2003-03-26 Thread Charles Kline
hi all,

using html_quickform (pear) and it has a date type that passes the date 
info like this:

array(24) {
  [lr_pub_date]=
  array(3) {
[m]=
string(1) 3
[d]=
string(2) 12
[Y]=
string(4) 2003
  }
I am used to getting this data like:

$form-getSubmitValue(field_name);

But doing that with this array just returns: Array

Anyone know how to get to the data?

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


Re: [PHP] html_quickform - array question

2003-03-26 Thread Charles Kline
Okay. I think I understand. So I do something like this:

$thedate = $lr_form-getSubmitValue('lr_pub_date');

echo The month: $thedate['m'];

Is that what you meant?

- Charles

On Wednesday, March 26, 2003, at 09:31 PM, Leif K-Brooks wrote:

Are you trying to print/echo it? That converts it to a string first. 
Either print_r it, var_dump it, or do something else with it.

Charles Kline wrote:

hi all,

using html_quickform (pear) and it has a date type that passes the 
date info like this:

array(24) {
  [lr_pub_date]=
  array(3) {
[m]=
string(1) 3
[d]=
string(2) 12
[Y]=
string(4) 2003
  }
I am used to getting this data like:

$form-getSubmitValue(field_name);

But doing that with this array just returns: Array

Anyone know how to get to the data?

Thanks
charles

--
The above message is encrypted with double rot13 encoding.  Any 
unauthorized attempt to decrypt it will be prosecuted to the full 
extent of the law.



--
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] html_quickform - array question

2003-03-26 Thread Charles Kline
Great. Thanks.

- Charles

On Wednesday, March 26, 2003, at 09:48 PM, Leif K-Brooks wrote:

Yes, but you can't put put the single quoted array key directly in the 
double-quotes string, try:

$thedate = $lr_form-getSubmitValue('lr_pub_date');

echo The month: {$thedate['m']};

Charles Kline wrote:

Okay. I think I understand. So I do something like this:

$thedate = $lr_form-getSubmitValue('lr_pub_date');

echo The month: $thedate['m'];

Is that what you meant?

- Charles

On Wednesday, March 26, 2003, at 09:31 PM, Leif K-Brooks wrote:

Are you trying to print/echo it? That converts it to a string first. 
Either print_r it, var_dump it, or do something else with it.

Charles Kline wrote:

hi all,

using html_quickform (pear) and it has a date type that passes the 
date info like this:

array(24) {
  [lr_pub_date]=
  array(3) {
[m]=
string(1) 3
[d]=
string(2) 12
[Y]=
string(4) 2003
  }
I am used to getting this data like:

$form-getSubmitValue(field_name);

But doing that with this array just returns: Array

Anyone know how to get to the data?

Thanks
charles

--
The above message is encrypted with double rot13 encoding.  Any 
unauthorized attempt to decrypt it will be prosecuted to the full 
extent of the law.



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


--
The above message is encrypted with double rot13 encoding.  Any 
unauthorized attempt to decrypt it will be prosecuted to the full 
extent of the law.



--
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] formatting textarea input on output

2003-03-25 Thread Charles Kline
hi all,

i have a textarea in a form which gets inserted into a table in my 
database (mySQL). When displaying this text back to the screen, how do 
i retain the line breaks etc. that were in the original input?

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


Re: [PHP] MySQL and phpMyAdmin Issues

2003-03-25 Thread Charles Kline
I am by no means an expert (even remotely) but I do recall instructions 
on exactly how to do this in the documentation for MySQL - I think 
under the how to upgrade section.

- Charles

On Monday, March 3, 2003, at 06:53 PM, Stephen Craton wrote:

Hello,

Yesturday I made a big mistake. I had to import a 60MB file into a 
database
and I used ssh. I'm very unfamiliar with it and when I connected to the
MySQL connection thing, I forgot to switch databases when I imported. 
This
overwrite (I don't know why but it did) the users table in the mysql
database and caused everything to get messy.

For some reason, though, the sites on the server are still working with
their old MySQL username and password (I'm not sure why since I 
imported a
fresh install's mysql database from my local server). Everything seems 
to be
working except phpMyAdmin. When I try logging in using the default 
user as
root and password as nothing, it gives me an access denied error. It 
does
this for every user we had in the database as well. Is there anyway I 
can
fix this is ssh? The only option I can think of is reinstalling MySQL 
but
even then we'll loose all the old databases and I'm not sure how to 
export
the tables to a file in ssh.

Any help here would be most obliging and I need a reply rather 
urgently in
order to allow my hosted sites access to phpMyAdmin once again...

Thanks,
Stephen Craton
http://www.melchior.us
--
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] formatting textarea input on output

2003-03-25 Thread Charles Kline
I hang my head in shame... yes. As a matter of fact, I did on my second 
skim through my PHP ref. manual... thanks for the pointer just the same.

- charles

On Tuesday, March 25, 2003, at 05:38 PM, CPT John W. Holmes wrote:

i have a textarea in a form which gets inserted into a table in my
database (mySQL). When displaying this text back to the screen, how do
i retain the line breaks etc. that were in the original input?
I bet if you searched for textarea and line breaks you'd of found 
the
nl2br() function... but I'm not a betting man... unless there's money
involved... and beer.

---John Holmes...

--
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] prepare() and execute()

2003-03-24 Thread Charles Kline
hi

Could anyone give me an example of a prepare() and execute() that 
retrieves a simple dataset as an associative array and then prints it 
to the screen? I can only seem to find examples that do an INSERT and I 
am having trouble doing the translation.

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


Re: [PHP] Dynamic Form

2003-03-24 Thread Charles Kline
If the page does not submit between changes, PHP will not be much help, 
that would be JavaScript's job. You could use PHP to prepare the arrays 
that JavaScript will use to accomplish this.

- Charles

On Monday, March 24, 2003, at 11:32 AM, Keven Jones wrote:

Hi,

Can someone tell me if I can use php to accomplish
the following:
I would like to create a form that can:

A. Total the sum of a certain number of numerical
fields, Before the user clicks submit
B. Automatically fill in sections of a form
based on selections made by the user. As an example,
if my user selects option A, then a certain numerical
code is filled into a given section of the form.
We are just trying to make the forms user friendly.

Can I do this in php or will it require javascript as well?

Thanks

_
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus

--
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] Parsing results from mySQL query

2003-03-22 Thread Charles Kline
Hi everyone,

I have ALMOST gotten this working (mySQL part works).

I have gotten the advice that this is easier to do in PHP then to try 
and make this query work in mySQL. Here is the query and a sampling of 
the current results (from phpMyAdmin)

SELECT p.fname, p.lname,
   w.web_link,
   a.dra_id,
   dra.area,
   t.title
FROM tbl_personnel p
LEFT JOIN tbl_personnel_weblinks w ON p.id = w.person_id
LEFT  JOIN tbl_personnel_dras a ON p.id = a.person_id
LEFT  JOIN tbl_dra dra ON a.dra_id = dra.id
LEFT  JOIN tbl_personnel_titles t ON p.id = t.person_id;
Because some of these people have multiple records in 
tbl_personnel_dras AND in tbl_personnel_titles - I get many repeats of 
each person (one for every combo). I was told this would be really 
messy to deal with in SQL (though I am open) - but I have no idea where 
to start in PHP. I would like to display the data to the web like:

fname lname
title(s) - (this would be the list of titles for this person)
Areas: area, area, area   (this would be the list of areas in one place 
as opposed to making the record repeat)

Thank you for any help.

The above query returns something like this (the first set are the 
column names):

fname
lname
web_link
dra_id
area
title
Jeffrey
Whittle
NULL
NULL
NULL
Investigator
Jeffrey
Whittle
NULL
NULL
NULL
Staff Physician
Adam
Gordon
NULL
5
Mental Illness
Staff Physician
Adam
Gordon
NULL
5
Mental Illness
Assistant Professor of Medicine
Adam
Gordon
NULL
5
Mental Illness
Investigator, VISN4 Mental Illness Research, Educa...
Adam
Gordon
NULL
5
Mental Illness
Investigator, Center for Research on Health Care
Adam
Gordon
NULL
5
Mental Illness
Investigator
Adam
Gordon
NULL
8
Special (Underserved, High Risk) Populations
Staff Physician
Adam
Gordon
NULL
8
Special (Underserved, High Risk) Populations
Assistant Professor of Medicine
Adam
Gordon
NULL
8
Special (Underserved, High Risk) Populations
Investigator, VISN4 Mental Illness Research, Educa...
Adam
Gordon
NULL
8
Special (Underserved, High Risk) Populations
Investigator, Center for Research on Health Care
Adam
Gordon
NULL
8
Special (Underserved, High Risk) Populations
Investigator
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] php, mysql, and method question

2003-03-20 Thread Charles Kline
hi all,

i have a question about a good method of handling this challenge.

i have a table that contains articles. i have another table which 
contains  the order 1 - 9 that i would like to display them in.

this part is done, and is not a problem. here is where I am not sure 
how to proceed.

1. tbl_display_order - can only have 9 records in it (or do i just 
ignore anything beyond 9?)
2. when a new article is added to tbl_display_order - it needs to get 
the field that contains it's order set to 1 so it shows up first when I 
display the articles, and all the other articles need to have their 
order number incremented.

Maybe there is a better way to do this? Just not sure. Maybe not with a 
database at all?

Thanks for suggestions.
Charles 

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


Re: [PHP] To use PEAR::DB or the PHP database functions

2003-03-20 Thread Charles Kline
Pear is really nice. I am very happy with it.

- Charles

On Thursday, March 20, 2003, at 02:56 PM, Merritt, Dave wrote:

All,

I've always used MySQL databases and the MySQL functions in PHP for my 
code
in the past.  However, I'm now working on a project that I want the 
project
to be able to be database independent so that the user of the project 
can
use whatever database he/she wishes.  I'm looking primarily at 
providing
support for MySQL, PostgreSQL, Oracle,  SQL Server databases.  What's 
the
general consensus on how to handle this?  Do I need to look at using
PEAR::DB so that the type of database is hidden from my code or 
would I
look at writing different include files for each database type and 
each of
the include files use the relevant PHP functions?  Or some other 
totally
different way?

Thanks

Dave Merritt
[EMAIL PROTECTED]
--
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] Validation of Numeric string sent in a form

2003-03-20 Thread Charles Kline
is_numeric(yoursting);

this returns true if string is a number



On Thursday, March 20, 2003, at 08:32 PM, Orlando Pozo wrote:

Hello all, I am Orlando Pozo

How could I verify if a variable is a Numeric string? , I need help 
in this; for example when I submit a form, all texts fields are sent 
in strings, if you need to verify that the string is all numeric, How 
could I verify?, thanks for your help.



-
Do You Yahoo!?
Todo lo que quieres saber de Estados Unidos, América Latina y el resto 
del Mundo.
Visíta Yahoo! Noticias.


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


[PHP] Anybody have any thoughts on Smarty?

2003-03-19 Thread Charles Kline
Was reading this and it sounds really cool. I do work as a consultant 
to designers and thought this may be a good way to improve work flow? I 
have read mixed thoughts on this, but was wondering what this list 
thought? Anyone using it? Real world?

http://www.zend.com/zend/tut/tutorial-cezar.php

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


[PHP] date question

2003-03-19 Thread Charles Kline
Hi all,

I have a form where users will be adding publication dates for uploaded 
files. I want to store the date in mySQL as date('U') format. If the 
date is entered as mm/dd/ - will the date function know this or is 
there some way of 'telling' php how the date to be converted is 
formatted, if you all get what I am saying...

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


[PHP] strstr() question

2003-03-18 Thread Charles Kline
What is the expected return when using strtr() to compare a string to 
an empty string?

example:

$myval = strstr('bob', '');

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


  1   2   3   >