[PHP] binary POST data

2004-01-23 Thread C C
Hello,
 
I am trying to process POST data sent from a device. Here is a capture of what is 
being sent from the device (with the file data replaced by ):
 
 
POST file.php HTTP/1.1
Host: ---.---.---.---
Connection: Keep-Alive
Content-Type: multipart/form-data; boundary=BC368B1E
Content-Length: 4841
--BC368B1E
Content-Disposition: form-data; name="ID"
50
--BC368B1E
Content-Disposition: form-data; name="FName"
File.doc
--BC368B1E
Content-Disposition: form-data; name="FileLength"
4096
--BC368B1E
Content-Disposition: form-data; name="FileData"

BC368B1E--
 
 
 

The FileData contains the contents of a file being sent to the script. It works for 
sending text files, but when sending binary files, it stops at the first null byte. I 
tried parsing it using php://input and $HTTP_RAW_POST_DATA 
(always_populate_raw_post_data is On in php.ini), but neither of these are set. Is it 
possible to get the contents of binary files POSTed this way in PHP? I can't change 
how the data is sent from the device. Our ASP page is able to do this with the same 
POST.

Also, inserting binary data using odbc into a MS SQL Server database fails if the data 
has null bytes. We are using Apache + PHP on Windows.

Thanks,

CC



-
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

[PHP] odbc functions - not binary safe?

2004-01-26 Thread C C
Hi,

I'm trying to insert binary data into a MS SQL Server
database. Text files are added fine, but binary files
with null bytes are not. The field I'm adding the
binary data to is image type. I get an error about
unclosed quotation marks at the null byte, but I've
replaced ' with ''.

I tried escaping the null byte with a backslach, but
it just changes it to the string "\0" when I download
it.

Anyone have any ideas about this?

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

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



[PHP] COM objects

2004-01-27 Thread C C
Hi,

I am running PHP 4.3.4 on Windows 2000 server with
Apache 2.0.48. I am using COM objects in some of the
pages. My question is, how do I release them when I'm
done? Right now, I'm unsetting them, but after a few
days I get COM+ Errors in the Event Viewer:

The COM+ Services DLL (comsvcs.dll) was unable to load
because allocation of thread local storage failed. 

Process Name: Apache.exe
Error Code = 0x80070008 : Not enough storage is
available to process this command.
COM+ Services Internals Information:
File: .\comsvcs.cpp, Line: 289

Anyone have any suggestions? Thanks,

CC

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

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



[PHP] Excel sheets

2002-09-01 Thread -C-

Hey,
sorry if this has already been answered somewhere, but I cant find a clear
answer to this question.

I have multiple xls files with 4 sheets a piece. I need to load them into
either mysql or directly php.
>From what I understand I could simply save as text file tab delimited, but I
need something automatic.
These xls sheets will be updated at random, and I will need the most current
version avalible online.

Any comments would be welcome.

-C-



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




Re: [PHP] Can't set a cookie? [SOLVED]

2002-06-15 Thread C

I've recently been learning about cookies myself, and had the same problem
with "" vs. 0  (PHP Fast&Easy Web Development showed the "" in their book).

I know that setting the expire parameter to 0 is supposed to kill the cookie
when browser is closed, but I can't seem to make that happen.  I've closed
all browser windows and the mail client, opened a browser again, and the
cookie is still active (let's me get back to a "protected" page).  Only a
full reboot seem to totally clear the cookie.

I've been using the time function instead, which is fine, but I'm just
curious why 0 doesn't seem to work.  Is there something else besides the
browser that could be holding onto the cookie?  I tried closing MSN
Messenger just in case, but it didn't make a difference.

Carol


- Original Message -
From: "Ed Lazor" <[EMAIL PROTECTED]>
Newsgroups: php.general
To: "php-general" <[EMAIL PROTECTED]>
Sent: Saturday, June 15, 2002 9:45 AM
Subject: RE: [PHP] Can't set a cookie? [SOLVED]


> Thanks for your help Everyone =)
>
> I needed the 3rd parameter set in order to specify the fourth "/", because
> the cookie is being set by a script located in a sub-directory.  One of
the
> old documents I read said "" would work as the third parameter - and it
did
> on my old servers.  Setting the third parameter to 0 worked on all
servers.
>
> -Original Message-
>
> The 3rd parameter is an optional time to expire parameter, if you don't
want
> to set it, leave it out.  setcookie(cookiename,"value");  works fine
>
>
>

> This message is intended for the sole use of the individual and entity to
> whom it is addressed, and may contain information that is privileged,
> confidential and exempt from disclosure under applicable law.  If you are
> not the intended addressee, nor authorized to receive for the intended
> addressee, you are hereby notified that you may not use, copy, disclose or
> distribute to anyone the message or any information contained in the
> message.  If you have received this message in error, please immediately
> advise the sender by reply email and delete the message.  Thank you very
> much.

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




[PHP] Re: How to change the newline () into "dot" and ?

2001-10-19 Thread c

$var = str_replace("\n", "", $var);
sometimes \r\n , but Im not sure... :)

c

[EMAIL PROTECTED] (Manisha) wrote in news:[EMAIL PROTECTED]:

> I am having the text fetched from mySQL database. I converted newline to 
>  with nl2br function.
> 
> I need to detect  and need to put 'dot'  in front of it and then 
> display. (like unnumbered list with 'dot' as a separator)
> 
> Is there any command line (substring and indexof to detect it ?)
> 
> thanks in advance,
> 
> manisha



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




[PHP] some.php/value -> on win32

2001-10-27 Thread c

hi,

I can make an URL like www.some.com/index.php/value1/value2/  on Linux+Apache
but I can't do it on my win2k+apache 1.3.22 machine.

Why? How could I do it?

(I want to get "values" with explode ('/',$PATH_INFO) )

Thanx a lot!

c

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




[PHP] call_user_func problem

2001-11-30 Thread C

Prior to 4.0.6 it worked fine, however, now when I try:

$result = call_user_func("foo", &$bar);

function foo( &$bar ) {
   $bar .= 'foobar';
   return 1;
}

I get this:

Warning: Call-time pass-by-reference has been deprecated - argument passed
by value; If you would like to pass it by reference, modify the declaration
of call_user_func(). If you would like to enable call-time
pass-by-reference, you can set allow_call_time_pass_reference to true in
your INI file. However, future versions may not support this any longer.

Does that mean I can't pass by reference anymore? I kinda need to (the two
functions above are not my actual functions btw)

Thanks.



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




[PHP] Struggling with code

2002-12-04 Thread Ben C.
I am struggling with the code below.  I keep getting the error "Couldn't
execute query".  Please help me out, let me know where I am going wrong.



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




RE: [PHP] Struggling with code

2002-12-04 Thread Ben C.
I am now getting the following error:

Warning: Supplied argument is not a valid MySQL-Link resource in
/home/httpd/vhosts/localhost/httpdocs/data/up.php
on line 21

Why do you think that is?

-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 04, 2002 9:53 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Struggling with code


On Thursday 05 December 2002 13:24, Ben C. wrote:
> I am struggling with the code below.  I keep getting the error "Couldn't
> execute query".  Please help me out, let me know where I am going wrong.
>
> 
> $db_name = "db1";
> $table_name = "user";
>
> $connection = @mysql_connect("localhost", "user", "password") or
> die("Couldn't connect.");
>
> $db = @mysql_select_db($db_name, $connection) or die("Couldn't select
> database.");
>
> $sql = "UPDATE $table_name
>   SET
>   name = \"$name\",
>   lname = \"$lname\",
>   mobil = \"$mobil\",
>   email = \"$email\",
>   url = \"$url\",
>   WHERE id= \"$id\"
> ";
>
> $result = @mysql_query($sql,$connection) or die("Couldn't execute
query.");
>
> ?>

How about NOT masking the error message by using mysql_query(), instead of
@mysql_query(). And instead of using die(), use echo mysql_error().

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
A rolling stone gathers no moss.
-- Publilius Syrus
*/


--
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] Struggling with code

2002-12-05 Thread Ben C.
I have incorporated most of the suggestions.  My most recent code is:



-Original Message-
From: Hugh Danaher [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 12:07 AM
To: Ben C.
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Struggling with code


please post lines 20 and 21, get rid of all @, the comma after url='$url'
and show your most recent code.  Others have posted and given you good
advice, you should incorporate their suggestions.

hugh
- Original Message -
From: "Ben C." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 04, 2002 11:44 PM
Subject: RE: [PHP] Struggling with code


> I am now getting the following error:
>
> Warning: Supplied argument is not a valid MySQL-Link resource in
> /home/httpd/vhosts/localhost/httpdocs/data/up.php
> on line 21
>
> Why do you think that is?
>
> -Original Message-
> From: Jason Wong [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 04, 2002 9:53 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Struggling with code
>
>
> On Thursday 05 December 2002 13:24, Ben C. wrote:
> > I am struggling with the code below.  I keep getting the error "Couldn't
> > execute query".  Please help me out, let me know where I am going wrong.
> >
> >  >
> > $db_name = "db1";
> > $table_name = "user";
> >
> > $connection = @mysql_connect("localhost", "user", "password") or
> > die("Couldn't connect.");
> >
> > $db = @mysql_select_db($db_name, $connection) or die("Couldn't select
> > database.");
> >
> > $sql = "UPDATE $table_name
> > SET
> > name = \"$name\",
> > lname = \"$lname\",
> > mobil = \"$mobil\",
> > email = \"$email\",
> > url = \"$url\",
> > WHERE id= \"$id\"
> > ";
> >
> > $result = @mysql_query($sql,$connection) or die("Couldn't execute
> query.");
> >
> > ?>
>
> How about NOT masking the error message by using mysql_query(), instead of
> @mysql_query(). And instead of using die(), use echo mysql_error().
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> A rolling stone gathers no moss.
> -- Publilius Syrus
> */
>
>
> --
> 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] Struggling with code

2002-12-05 Thread Ben C.
Hugh, I took away the comma from $url and it works.

Everyone, Thanks for your help!

Ben

-Original Message-
From: Ben C. [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 12:15 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Struggling with code


I have incorporated most of the suggestions.  My most recent code is:



-Original Message-
From: Hugh Danaher [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 12:07 AM
To: Ben C.
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Struggling with code


please post lines 20 and 21, get rid of all @, the comma after url='$url'
and show your most recent code.  Others have posted and given you good
advice, you should incorporate their suggestions.

hugh
- Original Message -
From: "Ben C." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 04, 2002 11:44 PM
Subject: RE: [PHP] Struggling with code


> I am now getting the following error:
>
> Warning: Supplied argument is not a valid MySQL-Link resource in
> /home/httpd/vhosts/localhost/httpdocs/data/up.php
> on line 21
>
> Why do you think that is?
>
> -Original Message-
> From: Jason Wong [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 04, 2002 9:53 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Struggling with code
>
>
> On Thursday 05 December 2002 13:24, Ben C. wrote:
> > I am struggling with the code below.  I keep getting the error "Couldn't
> > execute query".  Please help me out, let me know where I am going wrong.
> >
> >  >
> > $db_name = "db1";
> > $table_name = "user";
> >
> > $connection = @mysql_connect("localhost", "user", "password") or
> > die("Couldn't connect.");
> >
> > $db = @mysql_select_db($db_name, $connection) or die("Couldn't select
> > database.");
> >
> > $sql = "UPDATE $table_name
> > SET
> > name = \"$name\",
> > lname = \"$lname\",
> > mobil = \"$mobil\",
> > email = \"$email\",
> > url = \"$url\",
> > WHERE id= \"$id\"
> > ";
> >
> > $result = @mysql_query($sql,$connection) or die("Couldn't execute
> query.");
> >
> > ?>
>
> How about NOT masking the error message by using mysql_query(), instead of
> @mysql_query(). And instead of using die(), use echo mysql_error().
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> A rolling stone gathers no moss.
> -- Publilius Syrus
> */
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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


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




[PHP] Training Courses in PHP & MySQL

2002-12-19 Thread Ben C .
Does anyone know where I can get a good training course in both PHP and MySQL that 
would make me proficient?  Or does anyone know of a good tutor?  I would prefer it to 
be in California or on the west coast.  Please provide your comments.


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




[PHP] Select value for driopdown box

2003-01-22 Thread Ben C .
I am using the query below to edit a record. I want to edit the field which has a list 
of states in a dropdown box.   I want to have the state that is in the selected field 
shown as the selected state.  How would I do this?


Query
-
$state";
}

$display_block = "


$option_block

?>


State


 



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




[PHP] writing a newsletter program in php?

2003-01-22 Thread Mark C
Hi,

I'm new to php (ok new, try 3 days ;), althought, I'm finding it fun, I 
'm trying to think of a project to do, to get me more into it.

And after having a discussion with a friend and also setting up several 
Mailman mailing lists for people that want to compose HTML mails and 
post them as newsletters, it got me thinking, would I be able to create 
a similar program to mailman in php?

So admins just login to the list. copy and past the html into a text box 
and php then renders it for a preview, then if they like it, they click 
send, this send queries the database and sends it to all the people list 
to receive mail on that list.

I would assume that the sending could be handed off somehow to 
sendmail/postfix?

The list front end would also hold list preferances as well, for 
subscribers and admins,
basically I want to mimik Mailman, but in php and be able to render 
previews of mails first, basically it will be a newsletter program, 
rather than a mailing list one, which is where Mailman falls over.

Cheers

Mark


--
To steal ideas from one person is plagiarism;
to steal from many is research.


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



RE: [PHP] Select value for driopdown box

2003-01-25 Thread Ben C.
I tried to use the below but it does not work.  Please help!

-Original Message-
From: Michael Sweeney [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 22, 2003 10:29 AM
To: Ben C.
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Select value for driopdown box


Assuming that you know which state is selected before you build the
select list:

$sel_state = $_REQUEST['state'];

...

while($row = mysql_fetch_array($result)) {
$buyerid = $row['buyerid'];
$state = $row['state'];
$selected = $state == $sel_state ? "selected=\"selected\"" : "";

$option_block .= "".
 "$state\n";
}

That will put the string "selected=\"selected\"" (xhtml compliant) into
the option statement for the state that was selected.

..michael..

On Wed, 2003-01-22 at 10:14, Ben C. wrote:
> I am using the query below to edit a record. I want to edit the field
which has a list of states in a dropdown box.   I want to have the state
that is in the selected field shown as the selected state.  How would I do
this?
>
>
> Query
> -
>  $sql = "SELECT *
>   FROM $table_name
>   WHERE buyerid = \"$buyerid\"
>   ";
>
> $result = @mysql_query($sql,$connection) or die(mysql_error());
>
>
> while ($row = mysql_fetch_array($result)) {
>  $buyerid = $row['buyerid'];
>  $state = $row['state'];
>
>   $option_block .= "$state";
> }
>
> $display_block = "
>
> 
> $option_block
> 
> ?>
>
> 
> State
> 
> 
>
> 
--
Michael Sweeney <[EMAIL PROTECTED]>
Verisity Design, Inc


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




[PHP] Removing a comma from a form field

2003-02-13 Thread Ben C .
I'm trying to update a field which contains a $USD figure.  But when I update it as 
200,000 it become 200.  I need to take out the comma.  Is using ereg_replace function 
the best way of doing so?  What do you think.

Thanks, 

Ben


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




[PHP] Subtracting two dates

2003-03-10 Thread Ben C.
There are a lot of artlicles on this but I need a simple solution.  I need
to subtract two dates as follows:

$date = date("Y-m-d");
$date1 = "2003-03-03";
$differencedate = ($date - $date1);
echo $differencedate;

When I do this I get 0.  Please help!


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



RE: [PHP] Subtracting two dates

2003-03-10 Thread Ben C.
Thanks, Justin.  It works.

-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]
Sent: Monday, March 10, 2003 8:27 PM
To: Ben C.; [EMAIL PROTECTED]
Subject: Re: [PHP] Subtracting two dates




Then you need to decide if you want to show days, or hours, or years
difference...

I'll show you hours and days:



You then need to round the number using round().


Justin



on 11/03/03 3:02 PM, Ben C. ([EMAIL PROTECTED]) wrote:

> There are a lot of artlicles on this but I need a simple solution.  I need
> to subtract two dates as follows:
>
> $date = date("Y-m-d");
> $date1 = "2003-03-03";
> $differencedate = ($date - $date1);
> echo $differencedate;
>
> When I do this I get 0.  Please help!
>
>
> --
> 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



RE: [PHP] Subtracting two dates

2003-03-11 Thread Ben C.
Is there a way not to round the number but get a whole number?   I don't
want to have 1.5 days show as 2 days because it really has not gone into day
2?

-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]
Sent: Monday, March 10, 2003 8:27 PM
To: Ben C.; [EMAIL PROTECTED]
Subject: Re: [PHP] Subtracting two dates




Then you need to decide if you want to show days, or hours, or years
difference...

I'll show you hours and days:



You then need to round the number using round().


Justin



on 11/03/03 3:02 PM, Ben C. ([EMAIL PROTECTED]) wrote:

> There are a lot of artlicles on this but I need a simple solution.  I need
> to subtract two dates as follows:
>
> $date = date("Y-m-d");
> $date1 = "2003-03-03";
> $differencedate = ($date - $date1);
> echo $differencedate;
>
> When I do this I get 0.  Please help!
>
>
> --
> 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] Connect Active Directory using LDAP... please help :)

2003-07-02 Thread Vince C
Hi everyone,

I tried to connect to Active Directory (AD) by using php. I heard that it
could use LDAP to achieve it.  I have written some code on my machine
(Win2000) and try to connect to AD.  It looks like the it could connect,
bind, and even search (I determined base on the line I placed).  However, it
return 0 entries.  If I used the same filter and use utilites "lpd.exe" on
Windows 2000 Server (the AD machine).  I could return some entries. I am
hestitating whether do I made some mistake on my program, or something other
than my code.  Does anyone know what the problem is?  Any comment are
welcome!  Thanks!

Vince

P.S. Here is my code:




 Brand New Checking..  




AD Test


Connected and ready to bind...";
 if (!($res = @ldap_bind($ldap, $dn2, $password))) {
  print(ldap_error($ldap) . "");
  die ("Could not bind the $dn2");
  echo "Couldn't bind ";
 } else {
  echo "Binded and Ready to search";
  echo "LDAP = $ldap";
  echo "oudc = $oudc";

 // $filter="(&(objectClass=user)(objectCategory=person)(|(sn=sorg)))";
 $filter= "sn=*";
  $sr=ldap_search($ldap,$oudc,$filter);
  echo "number of entries found: " . ldap_count_entries($ldap, $sr) .
"";
  echo "filter = $filter";
  echo "sr=$sr";

  if (!$sr) {
   die("search failed\n");
  } else {
   echo " Searched and ready for get entries.";
   $info= ldap_get_entries($ldap, $sr);

   for ($i=0; $i<$info["count"]; $i++) {
print ("");
print ("" . $info[$i]["cn"][0] . " " . $info[$i]["sn"][0]
. "");
print ("" . $info[$i]["mail"][0] . "");
print ("");
print "In the display FOR loop";
   }
   echo " After loop.";
  }
 }
 ldap_unbind($ldap);
 echo "LDAP unbinded";
}

?>





Thanks in advance!  Vince



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



[PHP] Re: Connect Active Directory using LDAP... please help :)

2003-07-03 Thread Vince C
Hi Sven,

I have tried to put the my login username in that place. But it showed
"Invalid Credental". Since I am new to this AD and LDAP, would it be the
format of my username? Should I just put my login username, or should I put
the whole bunch of line such as "CN=my name, DN=" something like this? I
really confuse the login format of this and so does "objectClass" stuff for
filter. Could you give me an idea? Do you know any web site that talk about
this ? Thank you very much!

Vince

"Sven" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> hi vince,
>
> Vince C wrote:
> >  > $ldaphost= "company.com";
> >
> > if(!($ldap = ldap_connect($ldaphost,389))){
> >  die("ldap server cannot be reached");
> > } else {
> >  $oudc = " dc=company, dc=com";
> >  $dn2 = "";
> >  $password = "";
>
> did you define your user and password? afaik win ad isn't searchable by
> anonymous.
> ciao SVEN
>
> >  echo "Connected and ready to bind...";
> >  if (!($res = @ldap_bind($ldap, $dn2, $password))) {
> >   print(ldap_error($ldap) . "");
> >   die ("Could not bind the $dn2");
> >   echo "Couldn't bind ";
> >  } else {
> >   echo "Binded and Ready to search";
> >   echo "LDAP = $ldap";
> >   echo "oudc = $oudc";
> >
> >  //
> >  $filter="(&(objectClass=user)(objectCategory=person)(|(sn=sorg)))";
> >   $filter= "sn=*"; $sr=ldap_search($ldap,$oudc,$filter);
> >   echo "number of entries found: " . ldap_count_entries($ldap,
> > $sr) . "";
> >   echo "filter = $filter";
> >   echo "sr=$sr";
> >
> >   if (!$sr) {
> >die("search failed\n");
> >   } else {
> >echo " Searched and ready for get entries.";
> >$info= ldap_get_entries($ldap, $sr);
> >
> >for ($i=0; $i<$info["count"]; $i++) {
> > print ("");
> > print ("" . $info[$i]["cn"][0] . " " .
> > $info[$i]["sn"][0] . "");
> > print ("" . $info[$i]["mail"][0] . "");
> > print ("");
> > print "In the display FOR loop";
> >}
> >echo " After loop.";
> >   }
> >  }
> >  ldap_unbind($ldap);
> >  echo "LDAP unbinded";
> > }
>
>



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



[PHP] tcp sockets

2003-07-10 Thread Robert C.
I have a java server running to handle xml requests and send back a
response to the sender.
It runs on one port for tcp and another for udp.
I got the udp version working fine, but I am having problems with the
tcp version.
Watching the debug output on the java server, I can see that it is
receiving the request from the php client and sending the response.
However, the php client hangs up when trying to read the response.
I'm guessing the problem is in the socket read function because when
I comment that part out it executes fine.
Also I am not using a while loop for the reading because I know the
response is only one line and < 1024 bytes.
Code snippet posted below. Any help would be greatly appreciated.

$xml = "blah blah
blah";
$port = 1234;
$address = gethostbyname( "www.mysite.com" );

$socket = socket_create( AF_INET, SOCK_STREAM, getprotobyname( "tcp"
) );
if( $socket == FASLE ) {
//error out...
}

$result = socket_connect( $socket, $address, $port );
if ( $result == FALSE ) {
//error out...
}

if( socket_write( $socket, $xml, strlen ($xml) ) == FALSE ) {
//error out...
}

$response = socket_read( $socket, 1024, PHP_NORMAL_READ );

socket_close($socket);

print "$response";

//now parse the response
$p = xml_parser_create();
xml_parser_set_option( $p, XML_OPTION_CASE_FOLDING, 0 );
xml_parser_set_option( $p, XML_OPTION_SKIP_WHITE, 1 );
xml_parse_into_struct( $p, $response, $vals, $index);
xml_parser_free( $p );

//this will show you whats in the array
print "xml response array: ";
print_r( $vals );


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



RE: [PHP] nlist

2003-07-10 Thread Robert C.
http://www.php.net/readdir

 Original Message 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED], 
Subject: RE: [PHP] nlist
Date: Thu, 10 Jul 2003 16:17:30 -0700

>Hi all,
>Is there a local filesystem-based function comparable to the 
>ftp-based
>'nlist' that lists files in a directory?
>
>Johnny
>
>-- 
>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] Storing SQL Queries for Reuse in Apps

2003-07-10 Thread Jacob C
Hello All,

I just want to survey the list and see what kind of solutions people are using 
for the storage and reuse of SQL queries.

Right now I am working on an application that has native SQL queries as well 
as custom queries that can be added by developers as they build on the 
framework.

In the past I have done several things to store large sets of SQL queries. 
Some are better than others and some just shouldn't be used (hardcoded):

- Hardcoded into the application (written into classes or procedural code as 
needed).
- Stored in a delimited text file.
- Placed into a function or class method using switch to iterate by category 
and ID.
- Stored in an XML file.

I am kind of leaning towards the XML solution since the native queries can 
then easily be updated for people using the application. Of course using XML 
adds execution time and complexity to the app.

Anybody have any other solutions I haven't thought of or trick/tweaks to the 
ones I have listed?

Thanks!
Jacob

-- 
"If there's a World War III, World War IV will be fought with sticks and 
stones."

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



Re: [PHP] Storing HTML string in database

2003-07-10 Thread Jacob C

Have a look at:

http://www.php.net/addslashes


Quoting Aaron Axelsen <[EMAIL PROTECTED]>:

>  
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> I have a php script set up for a user to upload a word document,
> which is then coverted to html form, which I would then lke to store
> in a database.
> 
> Howver, when I run the following command:
> 
> INSERT into sermons (data) VALUE ('$output');
> 
> It failes to work, because the $output strings contains "", which
> messes things up.  Is there some way that this can be ignored while
> entering into the databse?
> 
> Or am I better of replace all the "" with ''?
> 
> Thanks for the assistance.
> 
> - ---
> Aaron Axelsen
> AIM: AAAK2
> Email: [EMAIL PROTECTED]
> 
> Want reliable web hosting at affordable prices?
> www.modevia.com
>  
> Web Dev/Design Community/Zine
> www.developercube.com
> 
> 
> -BEGIN PGP SIGNATURE-
> Version: PGPfreeware 7.0.3 for non-commercial use 
> 
> iQA/AwUBPw4PI7rnDjSLw9ADEQLL5QCg6rxSs/roIiGyxC6nN3XNiuONg00AoK/T
> PSAAAbM+O7+e6iVNMMnpK5AC
> =phqJ
> -END PGP SIGNATURE-
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
"If there's a World War III, World War IV will be fought with sticks and 
stones."

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



[PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C.
How do I add a column of numbers generated through a MySQL query without
using the SQL SUM() function? I have tried looking through the different
documentation.  I am probably missing something.

Thanks,

Ben


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



RE: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C.
Yes.  From there I want to add all the 'a' values together using PHP.

-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]
Sent: Monday, August 04, 2003 12:40 AM
To: Ben C.
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Addin a column of numbers not using MySQL


Do you mean something like:

";
echo $myrow['a'] ."";
echo $myrow['b'] ."";
echo $myrow['c'] ."";
}
?>

Justin

On Monday, August 4, 2003, at 05:34  PM, Ben C. wrote:

> How do I add a column of numbers generated through a MySQL query 
> without
> using the SQL SUM() function? I have tried looking through the 
> different
> documentation.  I am probably missing something.
>
> Thanks,
>
> Ben
>
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> ---
> [This E-mail scanned for viruses]
>
>



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



Re: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
I tried the code you provided below but it returned 0.  Is there another way I can do 
it? 


> 
> From: Jason Wong <[EMAIL PROTECTED]>
> Date: 2003/08/04 Mon AM 04:25:13 EDT
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Addin a column of numbers not using MySQL
> 
> On Monday 04 August 2003 15:59, Ben C. wrote:
> > Yes.  From there I want to add all the 'a' values together using PHP.
> 
> So do it then. 
> 
> $total = $total + $myrow['a'] // or something as you go through the loop
>   // is just one of the ways to do this
> 
> 
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> A beautiful woman is a picture which drives all beholders nobly mad.
>   -- Emerson
> */
> 
> 
> -- 
> 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: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
I tried doing as you said and it returned 0.  Is there another way to add up the 
column?

> 
> From: Jason Wong <[EMAIL PROTECTED]>
> Date: 2003/08/04 Mon AM 04:25:13 EDT
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Addin a column of numbers not using MySQL
> 
> On Monday 04 August 2003 15:59, Ben C. wrote:
> > Yes.  From there I want to add all the 'a' values together using PHP.
> 
> So do it then. 
> 
> $total = $total + $myrow['a'] // or something as you go through the loop
>   // is just one of the ways to do this
> 
> 
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> A beautiful woman is a picture which drives all beholders nobly mad.
>   -- Emerson
> */
> 
> 
> -- 
> 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: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
CODE Begin-
$sql_2 = "SELECT SUM(paidamount) as paid
FROM $tb_name
WHERE id = \"$id\"
";

$result_2 = @mysql_query($sql_2,$connection) or die(mysql_error());

while ($row = mysql_fetch_array($result_2)) {
$paid = $row['paid'];
}
CODE End-

What I want to do from here is add up all the 'paid' figures.

> 
> From: Jason Wong <[EMAIL PROTECTED]>
> Date: 2003/08/04 Mon PM 01:55:40 EDT
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Addin a column of numbers not using MySQL
> 
> On Tuesday 05 August 2003 01:21, Ben C. wrote:
> > I tried the code you provided below but it returned 0.  Is there another
> > way I can do it?
> 
> Please post your code.
> 
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> "Trust me.  I know what I'm doing."
> -- Sledge Hammer
> */
> 
> 
> -- 
> 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: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
When I echo the select state the id is the first of many ids that need to be added 
together.  It is still not summing the total value of the records.

> 
> From: "Jay Blanchard" <[EMAIL PROTECTED]>
> Date: 2003/08/04 Mon PM 04:09:36 EDT
> To: "Ben C." <[EMAIL PROTECTED]>,  <[EMAIL PROTECTED]>
> Subject: RE: Re: [PHP] Addin a column of numbers not using MySQL
> 
> [snip]
> It still returns '0'.  I think we are missing something.  Any other
> ideas?  Anyone else have any ideas?
> [/snip]
> 
> echo the SELECT statement to make sure that $id is worth something
> 


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



RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
I tried the code again and still returns a '0'.  It looks like the while() is only 
looping one record at a time.  It does looks like it is add all the records.  Do you 
or anyone have any other suggestions?  

> 
> From: "Jay Blanchard" <[EMAIL PROTECTED]>
> Date: 2003/08/04 Mon PM 02:16:22 EDT
> To: "Ben C." <[EMAIL PROTECTED]>,  <[EMAIL PROTECTED]>
> Subject: RE: Re: [PHP] Addin a column of numbers not using MySQL
> 
> [snip]
> while ($row = mysql_fetch_array($result_2)) {
>   $paid = $row['paid'];
> }
> CODE End-
> 
> What I want to do from here is add up all the 'paid' figures.
> [/snip]
> 
> while ($row = mysql_fetch_array($result_2)) {
>   $paid = $row['paid'];
>   $total = $total + $paid;
> }
> 
> --
> 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: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
Unsure.  How would I do that?

> 
> From: "Jay Blanchard" <[EMAIL PROTECTED]>
> Date: 2003/08/04 Mon PM 04:36:15 EDT
> To: "Ben C." <[EMAIL PROTECTED]>,  <[EMAIL PROTECTED]>
> Subject: RE: Re: [PHP] Addin a column of numbers not using MySQL
> 
> [snip]
> When I echo the select state the id is the first of many ids that need
> to be added together.  It is still not summing the total value of the
> records.
> [/snip]
> 
> Are you looping through the id's somehow?
> 


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



RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
When I echo the select state the id is the first of many ids that need to be added 
together.  It is still not summing the total value of the records.

> 
> From: "Jay Blanchard" <[EMAIL PROTECTED]>
> Date: 2003/08/04 Mon PM 04:09:36 EDT
> To: "Ben C." <[EMAIL PROTECTED]>,  <[EMAIL PROTECTED]>
> Subject: RE: Re: [PHP] Addin a column of numbers not using MySQL
> 
> [snip]
> It still returns '0'.  I think we are missing something.  Any other
> ideas?  Anyone else have any ideas?
> [/snip]
> 
> echo the SELECT statement to make sure that $id is worth something
> 


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



RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
When I echo the select state the id is the first of many ids that need to be added 
together.  It is still not summing the total value of the records.

> 
> From: "Jay Blanchard" <[EMAIL PROTECTED]>
> Date: 2003/08/04 Mon PM 04:09:36 EDT
> To: "Ben C." <[EMAIL PROTECTED]>,  <[EMAIL PROTECTED]>
> Subject: RE: Re: [PHP] Addin a column of numbers not using MySQL
> 
> [snip]
> It still returns '0'.  I think we are missing something.  Any other
> ideas?  Anyone else have any ideas?
> [/snip]
> 
> echo the SELECT statement to make sure that $id is worth something
> 


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



RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
Jay, 

It still returns '0'.  I think we are missing something.  Any other ideas?  Anyone 
else have any ideas?

Ben

> 
> From: "Jay Blanchard" <[EMAIL PROTECTED]>
> Date: 2003/08/04 Mon PM 03:10:15 EDT
> To: "Ben C." <[EMAIL PROTECTED]>,  <[EMAIL PROTECTED]>
> Subject: RE: Re: [PHP] Addin a column of numbers not using MySQL
> 
> [snip]
> CODE Begin-
> $sql_2 = "SELECT SUM(paidamount) as paid
>   FROM $tb_name
>   WHERE id = \"$id\"
>   ";
> 
> $result_2 = @mysql_query($sql_2,$connection) or die(mysql_error());
> 
> while ($row = mysql_fetch_array($result_2)) {
>   $paid = $row['paid'];
> }
> CODE End-
> [/snip]
> 
> FOUND IT!
> 
> CODE Begin-
> $sql_2 = "SELECT paidamount
>   FROM $tb_name
>   WHERE id = \"$id\"
>   ";
> 
> $result_2 = @mysql_query($sql_2,$connection) or die(mysql_error());
> 
> while ($row = mysql_fetch_array($result_2)) {
>   $paid = $row['paidamount'];
>   $total = $total + $paid;
> }
> CODE End-
> 
> 


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



RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
Let me try and explain a little better and easier.  What I am trying to do is take a 
list of values and add them to get.  I am getting the values from a database query.  

Assuming that I had the following:
val_1 100.00
val_2 150.00
val_3 200.00
val_4 250.00
val_5 100.00

What I want to do now is add up the values 1-5 and get 800.00.  

Does this help clarify?




> 
> From: "Jay Blanchard" <[EMAIL PROTECTED]>
> Date: 2003/08/04 Mon PM 04:57:17 EDT
> To: "Ben C." <[EMAIL PROTECTED]>,  <[EMAIL PROTECTED]>
> Subject: RE: Re: [PHP] Addin a column of numbers not using MySQL
> 
> [snip]
> Unsure.  How would I do that?
> [/snip]
> 
> Ben I think that we have a communications failure. Let's start
> over...you wish to total a database column using php, correct?
> Everything that you have been shown so far will do that. Is it possible
> that there are no query results? If not, then we are doing the query
> wrong. Try it with single quotes;
> 
> $sql_2 = "SELECT paidamount FROM $tb_name WHERE id = '" . $id . "' ";
> 
> Please do a verbose check on the query to see if it is working properly
> 
> if(!($result_2 = mysql_query($sql_2, $connection))){
>print("MySQL reports: " . mysql_error() . "\n");
>exit();
> }
> 
> Let's use objects instead of arrays (humor me for a moment)
> 
> while($row = mysql_fetch_object($result_2)){
>   $paid = $row->paidamount;
>   echo "$paid \n";
>   $total = $total + paid;
> }
> 
> echo "$total \n";
> 
> Please copy and paste the results into your reply
> 


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



RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
Jay, No results are returned.  It is blank.

> 
> From: "Jay Blanchard" <[EMAIL PROTECTED]>
> Date: 2003/08/04 Mon PM 04:57:17 EDT
> To: "Ben C." <[EMAIL PROTECTED]>,  <[EMAIL PROTECTED]>
> Subject: RE: Re: [PHP] Addin a column of numbers not using MySQL
> 
> [snip]
> Unsure.  How would I do that?
> [/snip]
> 
> Ben I think that we have a communications failure. Let's start
> over...you wish to total a database column using php, correct?
> Everything that you have been shown so far will do that. Is it possible
> that there are no query results? If not, then we are doing the query
> wrong. Try it with single quotes;
> 
> $sql_2 = "SELECT paidamount FROM $tb_name WHERE id = '" . $id . "' ";
> 
> Please do a verbose check on the query to see if it is working properly
> 
> if(!($result_2 = mysql_query($sql_2, $connection))){
>print("MySQL reports: " . mysql_error() . "\n");
>exit();
> }
> 
> Let's use objects instead of arrays (humor me for a moment)
> 
> while($row = mysql_fetch_object($result_2)){
>   $paid = $row->paidamount;
>   echo "$paid \n";
>   $total = $total + paid;
> }
> 
> echo "$total \n";
> 
> Please copy and paste the results into your reply
> 


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



RE: [PHP] Sum a column of values from a MySQL query

2003-08-05 Thread Ben C.
Yes, I know.  However, the while() loop should generate all the invoice in a
list.

-Original Message-
From: Giz [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 12:03 AM
To: 'Ben C.'; [EMAIL PROTECTED]
Subject: RE: [PHP] Sum a column of values from a MySQL query


I think you're a big confused here.  Your query will only return one row,
because you're using sum().  $invoicepartpaid will be your total for the
invoiceid specified.

-Original Message-
From: Ben C. [mailto:[EMAIL PROTECTED]
Sent: Monday, August 04, 2003 11:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Sum a column of values from a MySQL query

I am trying to sum a query of values from a MySQL table.  The code I am
using is:

---BEGIN CODE #1--
$sql_2 = "SELECT SUM(partpaidamount) as partpaid
FROM $tb_name
WHERE invoiceid = \"$invoiceid\"
";

$result_2 = @mysql_query($sql_2,$connection) or die(mysql_error());

while ($row = mysql_fetch_array($result_2)) {
$invoicepartpaid = $row['partpaid'];
}
---END CODE #2





--
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] Sum a column of values from a MySQL query

2003-08-05 Thread Ben C.
I am trying to sum a query of values from a MySQL table.  The code I am
using is:

---BEGIN CODE #1--
$sql_2 = "SELECT SUM(partpaidamount) as partpaid
FROM $tb_name
WHERE invoiceid = \"$invoiceid\"
";

$result_2 = @mysql_query($sql_2,$connection) or die(mysql_error());

while ($row = mysql_fetch_array($result_2)) {
$invoicepartpaid = $row['partpaid'];
}
---END CODE #2

1) The code returns the sum of a partially paid invoice.  The individual
invoice is 'partpaid'. WORKS...NO PROBLEM
2) The while() then return a list of partially paid invoices which is
$invoicepartpaid.  WORKS..NO PROBLEM
3) I then want to add the list of partially paid invoices ($invoicepartpaid)
together.  I AM STUCK HERE ADDING THE INVOICES AMOUNTS TOGETHER.

If anyone can help I would greatly appreciate it.


--
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] Sum a column of values from a MySQL query

2003-08-14 Thread Ben C.
I am trying to sum a query of values from a MySQL table.  The code I am
using is:

---BEGIN CODE #1--
$sql_2 = "SELECT SUM(partpaidamount) as partpaid
FROM $tb_name
WHERE invoiceid = \"$invoiceid\"
";

$result_2 = @mysql_query($sql_2,$connection) or die(mysql_error());

while ($row = mysql_fetch_array($result_2)) {
$invoicepartpaid = $row['partpaid'];
}
---END CODE #2

1) The code returns the sum of a partially paid invoice.  The individual
invoice is 'partpaid'. WORKS...NO PROBLEM
2) The while() then return a list of partially paid invoices which is
$invoicepartpaid.  WORKS..NO PROBLEM
3) I then want to add the list of partially paid invoices ($invoicepartpaid)
together.  I AM STUCK HERE ADDING THE INVOICES AMOUNTS TOGETHER.

If anyone can help I would greatly appreciate it.


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



[PHP] PHP.ini file and register_globals

2003-08-15 Thread Ben C .
I have a quick simple question.  I am using PHP 4.2.3 on Linux.  I am trying to turn 
register_globals from off to on.  Is all that I need to do change it from off to on in 
the php.ini file?  Do you I need to reboot to have the changes go into effect?  Sorry 
for a simple question but I am new at configuring PHP.  Thanks for the help.


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



Re: Re: [PHP] PHP.ini file and register_globals

2003-08-15 Thread Ben C .
Is the change in the php.ini file the only thing that I need to change to turn on 
register_globals?

> 
> From: "Jonatan Pugliese." <[EMAIL PROTECTED]>
> Date: 2003/08/15 Fri PM 01:18:01 EDT
> To: "Ben C." <[EMAIL PROTECTED]>,  <[EMAIL PROTECTED]>
> Subject: Re: [PHP] PHP.ini file and register_globals
> 
> never reboot !!
> is not necessary !
> - Original Message - 
> From: "Ben C." <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, August 15, 2003 2:14 PM
> Subject: [PHP] PHP.ini file and register_globals
> 
> 
> > I have a quick simple question.  I am using PHP 4.2.3 on Linux.  I am
> trying to turn register_globals from off to on.  Is all that I need to do
> change it from off to on in the php.ini file?  Do you I need to reboot to
> have the changes go into effect?  Sorry for a simple question but I am new
> at configuring PHP.  Thanks for the help.
> >
> >
> > -- 
> > 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: Re: [PHP] PHP.ini file and register_globals

2003-08-15 Thread Ben C .
Is the change in the php.ini file the only thing that I need to change to turn on 
register_globals?

> 
> From: "Jonatan Pugliese." <[EMAIL PROTECTED]>
> Date: 2003/08/15 Fri PM 01:18:01 EDT
> To: "Ben C." <[EMAIL PROTECTED]>,  <[EMAIL PROTECTED]>
> Subject: Re: [PHP] PHP.ini file and register_globals
> 
> never reboot !!
> is not necessary !
> - Original Message - 
> From: "Ben C." <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, August 15, 2003 2:14 PM
> Subject: [PHP] PHP.ini file and register_globals
> 
> 
> > I have a quick simple question.  I am using PHP 4.2.3 on Linux.  I am
> trying to turn register_globals from off to on.  Is all that I need to do
> change it from off to on in the php.ini file?  Do you I need to reboot to
> have the changes go into effect?  Sorry for a simple question but I am new
> at configuring PHP.  Thanks for the help.
> >
> >
> > -- 
> > 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] Mail() Problem Sending

2003-08-18 Thread Ben C .
I have recently had php installed on my server with sendmail.  The server is behind a 
firewall and SMTP is open on the firewall.  However, when I execute the mail(), it 
appears to have sent the mail, but I never receive it.  I am not getting any error 
messages.  Has anyone ever run into this problem?  Does anyone have any ideas?


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



[PHP] Need help with coding problem

2003-03-18 Thread Ben C.
I have a subscription service and am trying to not allow the buyer to
proceed purchasing another subscription if one of their subscriptions is
over 29 days past due in their payment.  I am trying to query each invoice
and checking to see if it is past due more than 29 days, if it is I want a
message to come up saying that it can not proceed because they account is
not current.  Can you look at the code below and let me know if you see
something wrong.  It is not working for me. Thanks.


--START CODE--

$sql_1 ="SELECT * FROM $table_name
WHERE buyerid = \"$buyerid\" AND paidinfull is NULL";
$result_1 = @mysql_query($sql_, $connection) or die("Error #" .
mysql_errno() . ": " . mysql_error());

if(mysql_num_rows($result_1) > 0){
 while($row = mysql_fetch_array($result_1)) {

 $duedate1 = $row['duedate'];
   $paiddate1 = $row['paiddate'];
 $paidinfull = $row['paidinfull'];

$duedatestamp = strtotime($duedate1);  // due date unix
timestamp
$difference = time() - $duedatestamp; // diff in seconds
$differencedays  = $difference / 86400;  // 60 x 60 x 24 hours floor
rounds the days down
$differencedays1 = floor($differencedays);

$paiddatestamp = strtotime($paiddate1);// paid date unix timestamp
$diffdays = floor(((paiddatestamp - duedatestamp) / 86400));


if (!$paiddate1)
{
$daysout = $differencedays1;
}
else
{
$daysout = $diffdays;
}

if ($daysout > 29)
{
echo "You cannot add this product as your account is 30 days past due";
exit;
}

END CODE--



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

2003-03-31 Thread Ben C.
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



RE: [PHP] Another hosting question....

2003-06-18 Thread Ben C.
I have tested a lot of the hosting providers and the best I have found is
Valueweb.  Lots of bandwidth (500gb), unlimited domain hosting, and managed
ensim control panel.  I have been with them a couple months and everything
seems good.

-Original Message-
From: Mike Morton [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 18, 2003 4:52 PM
To: PHP eMail List
Subject: [PHP] Another hosting question


I know that this subject has been beaten to death, but I going through old
lists, I see a lot of hosting companies for site hosting, but I am
interested specifically in dedicated server hosting.

It is tough to find a hosting facility that is state of the art, with big
pipes and redundancy, but is not a huge corporate company that could not
care less about you

What I am looking for specifically is a company that someone can recommend
from direct experience, one that is customer friendly, offers dedicated
servers at a REASONABLE price, offers admin support and server support, etc,
etc, etc, and most importantly has expertise in compiling PHP.

If anyone out there know of a company like this and can recommend them - I
would appreciate it :) It will save literally hours and hours of sorting
through the  google listings that a php dedicated hosting search brings
back!  (2 days of sorting to this point anyhow!)

TIA

--
Cheers

Mike Morton


*
* Tel: 905-465-1263
* Email: [EMAIL PROTECTED]
*


"Indeed, it would not be an exaggeration to describe the history of the
computer industry for the past decade as a massive effort to keep up with
Apple."
- Byte Magazine

Given infinite time, 100 monkeys could type out the complete works of
Shakespeare. Win 98 source code? Eight monkeys, five minutes.
-- NullGrey


--
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 in contents of URL

2002-08-02 Thread Mike C

I am trying to create a really simple proxy using PHP.

Basically, i need to:

1. read in the contents of a URL.
2. get the content-type
3. set the content type for the response
4. write the contents of the URL to the response.

here is what i have thus far:

$dataURL = "http://www.foo.com/data.xml";;
$fp = fopen($dataURL, "r");
$content = fread($fp, true);
echo($content);
fclose($fp);

I am running into two problems. One, the second param for fread takes 
the size of the file / content. how do i get this?

there is a comment at:
http://www.php.net/manual/en/function.fread.php

which says to just specify a constant and it will work, but what ever 
number i specify, that is the amount of data that is read.

how do i retrieve the content type?

thanks for any help...

mike c

[EMAIL PROTECTED]


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




[PHP] Creating a variable out of a IF statement

2002-10-15 Thread Ben C.

What I want to do is have an IF statement which the results would create a
variable.  The IF statement is:

IF ($car == "BMW" AND $model == "530i") echo ("Price is 35,000 dollars");

I want the "Price is 35,000 dollars" to be a variable.  Please help with how
to do this.

Thanks,

Ben


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




RE: [PHP] Creating a variable out of a IF statement

2002-10-15 Thread Ben C.

John, It works...thanks

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 15, 2002 8:34 PM
To: 'Ben C.'; [EMAIL PROTECTED]
Subject: RE: [PHP] Creating a variable out of a IF statement


> What I want to do is have an IF statement which the results would
create a
> variable.  The IF statement is:
> 
> IF ($car == "BMW" AND $model == "530i") echo ("Price is 35,000
dollars");
> 
> I want the "Price is 35,000 dollars" to be a variable.  Please help
with
> how
> to do this.

if($car == "BMW" && $modle == "530i") { $var = "Price is 35,000
dollars"; }

---John Holmes...




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




[PHP] Displaying Data of a MySQL Table in PHP

2002-10-31 Thread Ben C.
I want to create a table in PHP with data from a MySQL database table.  Can
someone please help with a sample script.  I know this is probably easy but
I need quick help.  I searched the archives and couldn't find something this
simple.

Please help.

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




Re: Re: [PHP] Creating SSL Connection to Accept Credit Cards

2002-11-05 Thread Ben C .
I am not sure if that is what they want.  I will try it and get back.  Good suggestion.
> 
> From: Adam Voigt <[EMAIL PROTECTED]>
> Date: 2002/11/05 Tue PM 12:33:00 EST
> To: [EMAIL PROTECTED]
> CC: [EMAIL PROTECTED]
> Subject: Re: [PHP] Creating SSL Connection to Accept Credit Cards
> 
> Like:
> 
> $f = fopen("https://whatever.com","r";)
> 
> ?
> 
> On Tue, 2002-11-05 at 12:31, [EMAIL PROTECTED] wrote:
> > My credit card processor requires that I create an SSL connection in order to 
>generate a transaction key.  How would I go about writing a script to do so.  Please 
>point me in the right direction.  The tech support says that it can only be done in 
>ASP, but I find that hard to believe.
> > 
> > 
> > -- 
> > 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: Re: [PHP] Creating SSL Connection to Accept Credit Cards

2002-11-05 Thread Ben C .
Is there anything else that I can do.  I am running PHP 4.1.2 so the fopen() doesn't 
work and I donot have support for CURL.  Any other suggestions?

> 
> From: "Jaime Bozza" <[EMAIL PROTECTED]>
> Date: 2002/11/05 Tue PM 01:09:37 EST
> To: "'Ben C.'" <[EMAIL PROTECTED]>,  "'Adam Voigt'" <[EMAIL PROTECTED]>
> CC: <[EMAIL PROTECTED]>
> Subject: RE: Re: [PHP] Creating SSL Connection to Accept Credit Cards
> 
> Except that https:// doesn't work with fopen until PHP 4.3.0.
> 
> Suggestions are only good if they work with a current version of PHP. :)
> (No, I don't consider 4.3.0 current until it's at *least* released)
> 
> Regardless, until then, CURL support is probably the way to go.
> Assuming you have curl support, it's fairly straightforward:
> 
> ---
> $ch = curl_init("https://somesite.com";);
> curl_setopt($ch, CURLOPT_HEADER, 0);
> curl_setopt($ch, CURLOPT_POST, 1);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($ch, CURLOPT_POSTFIELDS, $authorization_data);
> 
> $result = curl_exec($ch);
> $errorstr = curl_error($ch);
> curl_close($ch);
> ---
> 
> $result contains the data received and $errorstr contains the error
> message (if any) if it was unsuccessful.  Translating $result depends on
> how they return the data.
> 
> With the above example, you'll need to have $authorization_data in POST
> format, which really is nothing more than the GET format string.
> (Secure transaction APIs typically don't allow GET)
> 
>   var=somevalue&var2=somevalue2&var3=anothervalue
> 
> 
> 
> 
> > -Original Message-
> > From: Ben C. [mailto:benc@;cox.net] 
> > Sent: Tuesday, November 05, 2002 11:55 AM
> > To: Adam Voigt
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: Re: [PHP] Creating SSL Connection to Accept Credit Cards
> > 
> > 
> > I am not sure if that is what they want.  I will try it and 
> > get back.  Good suggestion.
> > > 
> > > From: Adam Voigt <[EMAIL PROTECTED]>
> > > Date: 2002/11/05 Tue PM 12:33:00 EST
> > > To: [EMAIL PROTECTED]
> > > CC: [EMAIL PROTECTED]
> > > Subject: Re: [PHP] Creating SSL Connection to Accept Credit Cards
> > > 
> > > Like:
> > > 
> > > $f = fopen("https://whatever.com","r";)
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


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




[PHP] Using info from a MySQL Query

2002-11-05 Thread Ben C .
I am using the following query:

$sql ="SELECT company, name, email FROM $table_name 
   WHERE email = '$_POST[email]' AND password = password('$_POST[password]')"; 

Then I am echoing the $email on my form (it works because the person has posted their 
e-mail name when logging in).  How can I echo the company and email on to my form as 
well.  Please help.


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




[PHP] Error Message

2002-11-12 Thread Ben C .
I am receiving the following error on my change password form:

Warning: Cannot send session cache limiter - headers already sent (output started at 
/home/httpd/vhosts/localhost/httpdocs/order/change_psswd.php:14) in 
/home/httpd/vhosts/localhost/httpdocs/order/change_psswd2.php on line 4

Does anyone have a clue as to why?

Please help!


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




Re: Re: [PHP] Error Message

2002-11-12 Thread Ben C .
I am using the require() function.  

 - 1st require() includes the top portion of my page on every page. 

 - 2nd require puts the following code in the middle:
16 || strlen($new_passwd)<6)
   echo "New password must be between 6 and 16 characters.  Try again.";
else
{
// attempt update
if (change_password($valid_user, $old_passwd, $new_passwd))
   echo "Password changed.";
else
   echo "Password could not be changed.";
}


 }

?>

 - 3rd require() includes the top portion of my page on every page. 

Does this help you understand???

Thanks, Ben


> 
> From: Adam Williams <[EMAIL PROTECTED]>
> Date: 2002/11/12 Tue PM 05:26:09 EST
> To: "Ben C." <[EMAIL PROTECTED]>
> CC: <[EMAIL PROTECTED]>
> Subject: Re: [PHP] Error Message
> 
> are you using header() after you've already sent data to the browser (such
> as printing something to the user)?
> 
>   Adam
> 
> On Tue, 12 Nov 2002, Ben C. wrote:
> 
> > I am receiving the following error on my change password form:
> >
> > Warning: Cannot send session cache limiter - headers already sent (output started 
>at /home/httpd/vhosts/localhost/httpdocs/order/change_psswd.php:14) in 
>/home/httpd/vhosts/localhost/httpdocs/order/change_psswd2.php on line 4
> >
> > Does anyone have a clue as to why?
> >
> > Please help!
> >
> >
> >
> 
> 
> -- 
> 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] Trying to e-mail password

2002-11-12 Thread Ben C .
I am trying to have a form that send a user their email and password to login.  I am 
using the following:

while ($row = mysql_fetch_array($result)) {
$email = $row['email'];
$password = $row['password(password)'];

When I use the mail() function to send both $email and $password I receive an e-mail 
with a blank password.  

What am I doing wrong.  Please help!


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




Re: [PHP] Trying to e-mail password

2002-11-12 Thread Ben C .
Is there not any way to reverse the crypted password before e-mailing??  

If not, how do I use ENCODE / DECODE?


> 
> From: "rija" <[EMAIL PROTECTED]>
> Date: 2002/11/12 Tue PM 07:32:28 EST
> To: "php" <[EMAIL PROTECTED]>, 
>   "Ben C." <[EMAIL PROTECTED]>
> Subject: Re: [PHP] Trying to e-mail password
> 
> You should do like this:
> 
> $password = $row['password'];
> This return weird crypted value of your password.
> 
> Unless you want send the this weird password. The function mysql_password is
> irreversible, you cannot get back the value crypted by password. Use ENCODE
> and DECODE instead,
> 
> 
> 
> - Original Message -
> From: "Ben C." <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, November 13, 2002 11:09 AM
> Subject: [PHP] Trying to e-mail password
> 
> 
> > I am trying to have a form that send a user their email and password to
> login.  I am using the following:
> >
> > while ($row = mysql_fetch_array($result)) {
> > $email = $row['email'];
> > $password = $row['password(password)'];
> >
> > When I use the mail() function to send both $email and $password I receive
> an e-mail with a blank password.
> >
> > What am I doing wrong.  Please help!
> >
> >
> > --
> > 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] Trying to e-mail password

2002-11-12 Thread Ben C.
I was setting up a news site that is customized for the registered user.  I
wanted that user to have the ability to be able to click a button and have
the password e-mailed to him.  The password function that I used is
password(password) through mysql.  Do you know how I can get the encrypted
string to translate to the password to be emailed?

-Original Message-
From: @ Edwin [mailto:copperwalls@;hotmail.com]
Sent: Tuesday, November 12, 2002 10:45 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Trying to e-mail password




"John W. Holmes" <[EMAIL PROTECTED]> wrote:

>

...[snip]...

> And where do you plan on storing this 'secret code' that your dynamic
> PHP script have to have access to in order to add users and send
> forgotten email messages??
>
> If you have something to protect, then you should have your own server
> or get it with someone you can trust. If the hacker can see your mysql
> data, they can see the source of your PHP scripts, and nothing is hidden
> anymore.

Unless you encode your PHP scripts ;) ...with Zend Encoder, perhaps?

I agree. You really need to have your own server, within your own premises,
(physically) accessible only by your own self if you're really thinking
about making your scripts/db/site "secure".

I am not against encoding/decoding passwords in the db. In fact, I'd even
say that it's a good idea to encode names, tel nos., e-mail addresses, etc.

But what beats me is this: This thread is about e-mailing passwords. If
you're thinking about security why would you send your user's password?
Beats me. (Unless of course you're using some kind of digital signature,
etc. and encoding you're e-mails as well...)

Just mho,

- E


--
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: [PHP-WIN] PHP meetup [CROSS-POST] Meet other PHP Developers in Your Area

2002-07-12 Thread C. Hendrie

Tho, when you think about it, most PHP developers COULD use a dating
service. :)

Seriously tho, this is a good idea. Thanks for the info Jay.
~ Chris
D.O.D

-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED]] 
Sent: Friday, July 12, 2002 12:24 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-WIN] PHP meetup [CROSS-POST] Meet other PHP Developers in
Your Area

No, it's not a dating service :)
Want to meet other PHP developers in your area? Check out:

http://php.meetup.com/

Pretty nifty idea... especially given the lack of user groups in the
U.S.
[/snip]

I thought for others who had not seen this I would post this. There is
probably already a user group in your area if you live near a major
city.
According to the PHPusergroups.org web site
[http://www.phpusergroups.org/groups.phtml?menu=groups] there 189 PHP
user
groups in 52 countries.

Jay

"Chaos, panic & disorder.my work here is done!"



-- 
PHP Windows 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] Uploading files via SSH

2003-09-03 Thread Ben C.
This is not a PHP question but didn't know where else to ask it.  I am
uploading files via SSH Secure File Transfer and am getting the following
error message.

--error message start--
Failed to scan directories. Error 6: C:/Documents and Settings/My
Documents/My Webs/dynamic/1.php: No such file or directory..
DONE - 0 Files  0 Total
Encountered 1 errors.
--error message stop--

Does anyone know why I am getting this message.  It only happens when I am
trying to add a file to a directory.  Any advice or help is appreciated.

Ben

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



[PHP] Error when using built in functions

2003-09-06 Thread Ben C.
I am having problems using the following functions; trim(), ucwords(), and
others.  Do I have a setting wrong?

Ben

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



RE: [PHP] Session stealing, ..

2003-09-13 Thread Ben C.
I would also be interested in seeing the code as well.  If you could also
e-mail it to me, I would be very appreciative.

Ben

-Original Message-
From: Jason Sheets [mailto:[EMAIL PROTECTED]
Sent: Friday, September 12, 2003 4:56 PM
To: Wouter van Vliet
Cc: PHP General
Subject: Re: [PHP] Session stealing, ..


I wrote a custom session handler that encrypts the session before it is
stored in /tmp that way even if someone has access to the session files
they are useless.

It stores the randomly generated encryption key on the user's client
base64_encoded, which can be intercepted as well all know but it still
increases the difficulty of reading the /session files now they must
have access AND sniff the encryption key.  Additionally for the more
secure sites I require the user access the site through SSL so the
cookie is not passed in plain text.

If you are interested I'll see if I can send it to you, it uses my Crypt
Class (PHP class simplifying Mcrypt usage).

Jason

Wouter van Vliet wrote:

>Hi All,
>
>There's always been a lot of discussion about how safe sessions are. I'd
>like to store a complete user object (instance of a class) in a session
with
>the best security measures possible. Who doesn't.
>
>Now, to prevent that the session file from the server gets stolen by some
>other user of the virtual host I did this to my object:
>
> 87 # Called upon serialization of the object. It stored the IP
>address and serialization time.
> 88 function __sleep() {
> 89 $this->Night = Array('Time' => time(), 'IP' =>
>$_SERVER['REMOTE_ADDR']);
> 90 return Array('Data', 'Night');
> 91 }
> 92
> 93 # When deserialized we are called and need to check if the
>stored IP address equals the client's
> 94 function __wakeup() {
> 95 global $Log;
> 96 if ($_SERVER['REMOTE_ADDR'] != $this->Night['IP'])
{
> 97 $Log->Warning('IP Address changed during
>sleep and wakeup, will clear userdata');
> 98 $this->Data = Array();
> 99 };
>100 }
>
>Upon sleep it stores the IP and time in the session data, and when it
smells
>coffee my object wakes up, checks if he's still being used on the same host
>and if not the userdata is plainly cleared.
>
>This all probably takes care about the problem with session id's in the
>query string, which is known as referrer to the next website our visitor
>visits. What I'm worrying and wondering about now are other users of the
>server my site's at. They can most likely go into the /tmp folder and just
>read my session files. Not Nice. I know it has been discussed for quite
some
>times now .. but never really found anything else than warnings for stuff,
>no real solutions.
>
>So, get your idea's rolling and let the good things flow...
>
>Wouter
>
>
>

--
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] Exporting Data to Excel

2003-10-22 Thread Ben C.
I am using the code below to export my data into an excel file.  The code is
located in a password protected area which is checked against saved session
variables.  However when I put session_start(); the download errors out.
Does any one have any suggestions?  Please help.



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



[PHP] PHP Books

2001-04-20 Thread Michael C

Hello
Could I get a recommendation on some good starting PHP books?
Thanks

-- 
Later Days:)
Michael Clesceri

""Perfection (in design) is achieved not when there is nothing more to add, but rather 
when there is nothing more to take away."



[PHP-CVS] What is CVS?

2001-04-20 Thread Michael C

Forgive me for asking again
What is CVS?
I am really new to PHP and just want to make sure I am looking at the right list
Thanks for your information in advance

-- 
Later Days:)
Michael Clesceri

""Perfection (in design) is achieved not when there is nothing more to add, but rather 
when there is nothing more to take away."



[PHP] filepro()

2001-05-07 Thread Kent C

I need to port a large amount of data from a filepro database, into a MySQL
database, and believe the built-in filepro() functions of PHP would make it
easy.  I have scoured the net, and am unable to find the filepro add-on
module for PHP.  Can anyone help?  All of the PHP documentation says it
supports read-only access to filepro, but it looks like I'll need the
php_filepro.dll.

I'm running Win2K Pro and Apache

Any help in locating the module would be greatly appreciated.

Kent C.




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




[PHP] A question on how to get the root directory

2001-05-12 Thread C Benn

I am new to PHP having converted from ASP (don't beat me up, it just took me
a while to see the light)

MY QUESTION: What in PHP acts like the 'server.mappath' function in ASP? It
gives you the ability to determain the root of the web site and use it as a
reference.

MY PROBLEM: I have been able to use '/some/folder/whatever.gif' to point to
the image folder with GIFs inside no matter where I am in the site in the
HTML part of my pages. It doesn't seem to work includes in the 
tags. I either have to use
'http://www.mysite.com/some/folder/whatever.inc' -OR- '../../whatever.inc'.
Any ideas?

INFO: I am running Apache with PHP4.03 installed as a module

Thanx in advance!!



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




[PHP] Does any have the 'edit_member.php' script ....

2002-01-17 Thread Mike C

In electronic format that I can have? It is included in the book 'MySQL' by Paul 
DuBois ? I have a parse error in my script that I simply cannot find (after many, many 
tries).

TIA

Regards
Mike C
-- 

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




[PHP] Does anyone have the 'edit_member.php' script ....

2002-01-19 Thread Mike C

I have not been able to find an electronic copy of the above script that is in the 
book 'MySQL'.
Is anyone prepared to help me out. My, self-typed version contains a parse error that 
I cannot find?

Regards
Mike C
-- 

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




[PHP] Re: Does anyone have the 'edit_member.php' script ....

2002-01-19 Thread Mike C

It was suggested I send this to the list. The 'samp_db.inc' file follows this. The 
parse error is:
Parse error: parse error in /edit_member.php on line 11

#edit_member.php

\n",
$PHP_SELF, DISPLAY_ENTRY);
print ("Enter your membership ID number and password,\n");
print ("then select submit.\n\n");
print ("\n");
print ("");
print ("Member ID");
print ("\n");
print ("");
print ("");
print ("Password");
print ("\n");
print ("");
print ("\n");
print ("\n");
print "\n";
}

function display_entry ()
{
global $PHP_SELF;
global $member_id, $password;

$member_id = trim ($member_id);
if (empty ($member_id))
die ("No member ID specified");
if (!ereg ("^[0-9]+$", $member_id))
die ("Invalid member ID specified (must be a number)");
if (empty ($password))
die ("No password specified");
if (check_pass ($member_id, $password))
$admin = 0;
else if (check_pass (0, $password))
$admin = 1;
else
die ("Invalid password");

$query = "SELECT last_name, first_name, suffix, email,"
. "street, city, state, zip, phone, interests,"
. "member_id, expiration"
. " FROM member"
. " WHERE member_id = $member_id"
. " ORDER by last_name";
$result = mysql_query ($query)
or die ("Cannot execute query");
if (mysql_num_rows ($result) == 0)
die ("No user with member_id = $member_id found");
if (mysql_num_rows ($result) > 1)
die ("More than one user with member_id = $member_id found");

printf ("\n",
$PHP_SELF, UPDATE_ENTRY);
 
hidden_field ("member_id", $member_id);
hidden_field ("password", $password);
print ("\n");
$row = mysql_fetch_array ($result);
display_column ("Member ID", $row, "member_id", 0);

display_column ("Expiration", $row, "expiration", $admin);

display_column ("Last name", $row, "last_name", 1);
display_column ("First name", $row, "first_name", 1);
display_column ("Suffix", $row, "suffix", 1);
display_column ("Email", $row, "email", 1);
display_column ("Street", $row, "street", 1);
display_column ("City", $row, "city", 1);
display_column ("State", $row, "state", 1);
display_column ("Zip", $row, "zip", 1);
display_column ("Phone", $row, "phone", 1);
display_column ("Interests", $row, "interests", 1);
print ("\n");
print ("\n");
print "\n";

}

function check_pass ($id, $pass)
{

$query = "Select password from member_pass where member_id = $id";
if (!($result = mysql_query ($query)))
die ("Error reading password table");
if (!($row = mysql_fetch_array ($result)))
return (FALSE);
return ($row["password"] == $pass);
}

function display_column ($label, $row, $col_name, $editable)
{
print ("\n");
printf ("%s\n", htmlspecialchars ($label));
$value = htmlspecialchars ($row[$col_name]);
if ($editable)
{
$str = sprintf ("\n", $value);
}
else
$str = $value;
printf ("%s\n", $str);
print ("\n");
}

function update_entry ()
{
global $row, $member_id, $password;

$member_id = trim ($member_id);
if (empty ($member_id))
die ("No member ID specified");
if (!ereg ("^[0-9]+$", $member_id))
die ("Invalid member ID specified (must be number)");
if (!check_pass ($member_id, $password) && !check_pass (0, $password))
die ("Invalid password");
$result = mysql_query ("select * from member where 1 = 0");
if (!$result)
die ("Cannot query member table");

$query = "Update member ";
$delim = "set ";# put "set" before first column,"," before others
while (list ($col_name, $val) = each ($row))
{
$query .= "$delim $col_name =";
$delim = ",";

$val = trim ($val);
if (empty ($val))
{
if (nullable ($result, $col_name))
$query .= "NULL";
else
$query .= "\"\"";
}
else
$query .= "\"" . addslashes ($val) . "\"";
}
$query .= " where member_id = $member_id";
if (mysql_query ($query) && mysql_affected_rows () > 0)
print ("Entry updated successfully.\n");
else
print ("Entry not updated.\n");
}

function nullable ($result, $col_name)
{
for ($i = 0; $i < mysql_num_fields ($result); $i++)
{
if (!($fld = mysql_fetch_field ($result, $i)))
continue;
if ($fld->name == $col_name)
return (!$fld->not_null);
}
return (0);
}

if (empty ($action))
$action = INITIAL_PAGE;

$title = "Historical League member editing form";
html_begin ($title, $title);

samp_db_connect()
or die ("Cannot connect to the server");

switch ($action)
{
case initial_page:
solicit_member_id ();
break;
case display_entry:
display_entry ();
break;
case update_entry:
update_entry ();
break;


default:
die ("Unknown action code ($action)");
}

html_end ();
?>

_


#samp_db.inc

\n");
print ("\n");

if ($title)

print ("$title\n");
print ("\n");
print ("\n");

if ($header)
print ("$header\n");
}

function html_end ()
{
print ("\n");
}

?>

Regards
Mike
-- 

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




Re: [PHP] Re: Does anyone have the 'edit_member.php' script ....

2002-01-19 Thread Mike C

Hi Janet,

>
>The problem is on this line.
>
>print ("\n");
>
>There is a space between the \ and the " before Submit.

Yes indeed :-(, how could I miss that 

Your wonderful :-) Thank you (and others) so much.

Regards
Mike C
-- 


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




[PHP] Submit/View images using PHP/MySQL

2002-01-29 Thread Mike C

Hi,

Can anyone point me to some good examples of how to add images using PHP 4 (from 
within a browser) to a MySQL database running on MacOSX, which is already configured & 
working, then display the images by selecting their name or category etc, again within 
the browser. I also need to restrict the size of the file upload to approx  300kb

I found a good example at http://www.weberdev.com but it's a little too cut-down for 
me!

Thanks

Mike C
-- 

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




[PHP] Passing Variable

2002-04-17 Thread Ben C.

I know that people have asked about this before, so let me appologize ahead
of time but I need quick help.  I have a url which looks like
http://www.domain.com/remove/index.php?id=test.  I use the echo function  to show the word test.  What I want to do is send this variable
along with other information that a user inputs via a form to the next page
so it can be e-mailed via the mail() function.  Can someone please advice
how to do so.

Thanks,

Ben


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




[PHP] Upload a CSV file to MySQL

2002-03-04 Thread Ben C.

Is there an easy way to upload a CSV file into a MySQL table?  Is there also
a way to export the MySQL file into a CSV file?  I would like to make a form
using PHP to do import a CSV file into an existing table.  Any advise would
be appreciated.

Ben


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




[PHP] Re: zip_open in 4.0.6 ?

2001-10-18 Thread Christian C.


"Ilya V. Lazarev" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi !
> Has anyone tried zip_open in PHP 4.0.6 ?
> It says me that no such function. I've looked at php src and found
> zzip_open(), but this one expect more than 1 arg ( supposedly 2 ).

File/path name and password?

Christian



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




Re: [PHP] web base mail client???

2001-10-25 Thread Christian C.

> I would say this comes in a close second as the "most oft-asked question
on
> php-general", with the first, of course, being "What's a good text editor
for
> PHP?"
hehehehe... Thanks

Chrisrtian



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




[PHP] what's this???

2001-11-04 Thread Christian C.

Hello :c)

im looking at some  code i found on the net and
i cant find any info on "this"... it's used like:
$this->mode = $mode;

I have looked in the online help doc but it did'nt
return anything, any one know??

--
Thanks
Christian Charette
www.charetx2.com




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




[PHP] HTTP_POST_VARS, forms, and not allowing modifications.

2001-11-25 Thread C. Bensend


Hey folks,

I am working on a database-driven site, and
have run into a problem.  It's not a problem with any
existing code, more of a "how the heck do I do this"
sort of thing.

I have a table, that is generated from a database
query:

+---+---++-+
| unique_id | some_text | some_more_text | edit button |
+---+---++-+

The unique_id is an integer, and the user can
NOT be allowed to modify it.  However, I need to pass
that value to the php script that's the ACTION for
the "edit button".

register_globals is not allowed, so somehow I
need to get the value of unique_id into the HTTP_POST_VARS
array.  I tried:

$HTTP_POST_VARS['unique_id'] = id;

but it was ignored.  I know I can make the unique_id
a TEXT input area, but then it can be modified.  I did some
searching around for more information about what can and can
not be done with HTTP_POST_VARS, but I didn't find anything
helpful (I could have been looking in the wrong place, too).

Anyone have some Wise Tips(tm) for me?  Any help
would be greatly appreciated.  :)

Benny


~~
"The onions are irritating my buttocks."   - Sluggy Freelance
 10-12-1998



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




RE: [PHP] HTTP_POST_VARS, forms, and not allowing modifications.

2001-11-25 Thread C. Bensend


On Mon, 26 Nov 2001, Martin Towell wrote:

> you said you tried a text field, have you tried a hidden field?

Alrighty then, my greenness shows.  :)

The hidden field idea was perfect (never used one before).
Thank god I'm just playing around with my _own_ site.  ;)

Thanks Martin!

Benny


~~
"The onions are irritating my buttocks."   - Sluggy Freelance
 10-12-1998



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




[PHP] syntax questoin

2004-09-16 Thread Victor C.
Hi,
I just started with PHP.  (I used to work on ASP a lot)

What does  the syntax ".=" do?

i see a line of code that says

$Msg .= "Test is complete"

I'm thinking it means concatenate $Msg with "Test is complete" and then
store the new string into $Msg

Am I right?

Thanks.

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



[PHP] php, mySQL query character problem

2004-09-22 Thread Victor C.
Hi,

I have a query to mysql basically saying:

 $query = "select * from table1 where colum1 like '$email%'";
//where $email is defined string.

When i  "echo $query",  I get  the string : select * from table 1
where colum1 like 'testdata%'

If i copy paste the string into phpMyAdmin SQL, the query executes
successfully and returns one record.

However, when I just do$returnValue = QueryDatabase($query);
  echo
mysql_num_rows($returnValue);
I always get 0 for the # of records.

Does anyone know what causes this?

Also... the value i have for $email is from:
$email=explode("@",$emailAddress);

$email=$email[0];


Thanks,
Victor C.

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



[PHP] gethostbyaddr and IPv6

2008-11-21 Thread Glen C

Hello,

Does gethostbyaddr actually work for anyone while looking up an IPv6 
address?  I can't seem to get it to work.  For example:


echo gethostbyaddr ( '2001:470:0:64::2' );

should return "ipv6.he.net" but instead I get the following error:

[21-Nov-2008 22:43:37] PHP Warning:  gethostbyaddr()
 [function.gethostbyaddr]:
 Address is not in a.b.c.d form in C:\www\tests\saved\host.php on line 7

Google has not been my friend in this matter...

Any insight?
Thanks,
Glen

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



Re: [PHP] gethostbyaddr and IPv6

2008-11-22 Thread Glen C

On 11/22/2008 02:17 AM, Lars Torben Wilson wrote:

2008/11/21 Glen Carreras<[EMAIL PROTECTED]>:


On 11/22/2008 12:10 AM, Lars Torben Wilson wrote:

Hi Glen,

Works for me. IPv6 support was added in 2001. You didn't say what
version of PHP you are having this problem with, so it's hard to say
why yours doesn't have support for it. Perhaps it was configured with
--disable-ipv6 for some reason, or compiled on a system without the
necessary libraries installed (which would be somewhat surprising).


Torben



Thanks for the confirmation that it works Torben,

This is version 5.2 (Windows binaries) and according to phpinfo ipv6 is
enabled.
Hmmm well, at least I now know for sure that it works for someone else
and
I can start exploring other avenues.  I'm starting to think this is another
problem
resulting from Microsofts poor implementation of IPv6 on XP.

Glen


Hi Glen,

I suspect that you may be correct--I generally don't run Windows
(certainly not as a server) so I can't be sure; someone with more
knowledge of Windows internals will have to field that one for you.
With any luck you might find something in the user notes which leads
you to a way to solve your problem using some other function or idea.

Just for future reference, if you're having problems it will help
people to answer your questions if you specify your PHP version and OS
etc (where 'etc' means 'and all other relevant information, which of
course won't be obvious--hehe) when writing the original question. I
ain't tryin' to be some kind of netiquette freak here--just trying to
help out. :)

Anyway, good luck on your quest.


Regards,

Torben


Torben.. Indeed, after re-reading my initial post I can see I was 
lacking a little in the information department.  I appreciate your help.


Just to follow-up on this.  I installed PHP 5.3alpha as a test and the 
function does work as expected. (although there are other issues which 
preclude me from using that version at this time) I then tried 5.2.7RC4 
and the function no longer worked. So it looks like a problem with that 
version series. I suppose I should raise a bug report and see if 
anything can be done while it's still in the RC phase.


Thanks again,
Glen

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



[PHP] Re: -less layouts; Ideas welcome

2009-05-21 Thread Weston C
On Thu, 2009-05-21 at 09:54 -0400, tedd wrote:
> My thoughts are -- my understanding the reason why tables have
> received such bad-press is that designers have abused tables in
> holding designs together with nested tables AND in doing so made it
> difficult for the visually disabled to pull content from the site.
> Screen readers do not read the screen but rather read the source and
> pull out of it what they (the screen reader program) think is
> content. Translating nested tables becomes an impossible job for them.

I've heard a rumor this is exaggerated, and I buy it to some extent.
Lynx had an algorithm for distinguishing simple tabular data from more
complex (and probably layout) tables back in 1999. I'd assume a
serious screen reader with more development resources behind it could
do better, and I don't think heuristics for working with this would
even be particularly hard.

This isn't to say tangled table markup is never a problem. It is, both
for human and machine readers. But as much as I like CSS -- and as
much as it simplifies many designs -- there are some cases for which
table layouts are easier and/or more robust, so I almost just wish
we'd accepted the horse was out of the barn and tried to figure out an
easy way to signal distinctions between layout tables and semantic
tabular data, rather than trying to get the entire internet to
completely retool.

A few years ago, I started marking my layout tables with
class="layout". Not always a perfect solution, but makes the
distinction easy (and turns out to be a useful styling convention as
well), and if table-based layouts really are a significant obstacle to
machine readers, my guess is something like this would get us over
that hurdle a lot faster than waiting for everyone to give up those
layouts.

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



[PHP] Problems working with HTML using PHP's XML tools (placing mixed text/html into xpath-specified nodes...)

2009-05-21 Thread Weston C
Is there a straightforward way (or, heck, any way) of placing mixed
html/text content into xpath-specified nodes using any of PHP's XML
tools?

So far, I've tried SimpleXML and the DOM and things aren't coming out well.

SimpleXML:

 /* $filename contains path to valid XML file, $xpathxpr contains
valid XPath expression matching at least  one document node, $fillval
contains a mixed well-formed text/xhtml string to be pre-pended within
each matching node */

$sx = simplexml_load_file($filename);
$nodes = $sx->xpath($xpathxpr);
foreach($nodes as $node) {
  $children = $node->children();
  $children[0] = $fillval . $children[0];
}

This only sortof works. I get $fillval appended before the original
contents of each matching docment node but if I've put any markup
in, it's all there as literal text (ie, http://php.net";>php.net wouldn't show up as a link, you'd
see the actual markup when the document is rendered).

A variation on this that I tried is creating a new SimpleXMLElement
object, with the mixed text/markup string as an argument passed to the
constructor, since the docs seem to indicate this is blessed. Weirdly,
when I do this, it seems to actually be stripping out the markup and
just giving the text. For example:

$s = new SimpleXMLElement('Boo')
echo $s;

yields "Boo" (and echo $s->a yields nothing). This would be such a
huge bug I have a hard time believing it, so I have to suspect there's
a dance I'm not doing to make this work correctly.

DOM XML:

 /* again, $filename contains path to valid XML file, $xpathxpr
contains valid XPath expression matching at least  one document node,
$fillval contains a mixed well-formed text/xhtml string to be
pre-pended within each matching node */

$domDoc = new DOMDocument();
$domDoc->loadHTML(file_get_contents($filename));
$search = new DOMXPath($domDoc);
$nodes = $search->query($xpathxpr);
foreach($nodes as $emt) {
$f = $domDoc->createDocumentFragment();
$f->appendXML($fillval . $emt->nodeValue);
$emt->nodeValue = '';
$emt->appendChild($f);
}

This also gets mixed results. It gets cranky and issues warnings about
any HTML entities (despite that it seems it should be clear this is an
HTML document given the invocation of loadHTML), and while I'm seeing
some markup make it through, I'm not in other cases. I haven't quite
figured out the difference.

I can come up with some runnable tests if it will help, but I'm hoping
someone's already familiar with the general issues with using PHP's
XML tools to work with HTML that they can make some good commentary on
the matter.

Thanks,

Weston

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



Re: [PHP] Re: -less layouts; Ideas welcome

2009-05-21 Thread Weston C
On Thu, May 21, 2009 at 12:10 PM, tedd  wrote:
> Could you be certain that your algorithm would figure out which way it needs
> to present the text to a blind person?

My own experience browsing the web with Lynx (which for the most part,
tends to ignore table layout, giving you the content of table cells in
source order) suggests that order doesn't end up being a significant
issue. The common layouts tend to read surprising well in source
order. Navigation is usually at the top or the left, so you encounter
it quickly. If there's any problem, most of the time it's that the
page author has done something hideous with a lot of images with no
alt text or abuse of HTML entitites, or part of the navigation
structure is only accessible via javascript or flash or something like
that... all separate issues from repurposing tabular markup.

And when there *is* some kind of a layout issue, most of the time it's
easy to adapt as a human reader by searching/scanning (sometimes
easier than if you're looking at a bad visual layout). The tools that
enhance accessibility on a page in these respects really don't have a
lot to do with whether there's tabular markup -- if you want to enable
easy access to page navigation, you can add semantic information about
that regardless. In fact, that information is quite likely more
important and less prevalent than what you end up with even most
CSS-positioned sites, given that the vast majority of them simply
provide stylesheets for the purposes of... visual layout, and what
you're left with when a screen reader ignores them is linear
source-ordered elements.

None of this is to say that CSS can't be very useful in addressing
this problem (and other problems), or that there aren't some problems
with tabular markup. The presentation example you mentioned is
actually going to be an issue with even real tabular data without some
care taken in the markup. And I don't want to go back to coding 1999
markup for 1999 browsers. Mostly my point is that the problem with
using tables is a bit more limited in size than it's often made out to
be, there are other ways of dealing with the accessibility and
semanticity issues involved, some of them potentially more effective.
And for some cases, table layouts just work better. I think we'd be
better off with a wide variety of professionals who can balance these
different issues than with a  "tables considered harmful" summary.

> Now compound that with cells holding images,
> place-holders, empty cells and cells with navigation elements,
> flash, videos, and such -- and you might have a better appreciation
> as to the problem screen readers face.

These are actually some of the heuristic markers I believe some
browsers actually use (and if they don't, they certainly could). If
you have a table whose cells largely contain highly mixed markup,
largely presentational elements, no alternative data, chances are
pretty good that it isn't tabular data. And...

Benjamin Hawkes-Lewis 
> WCAG 1.0 ... explained how /authors/ could distinguish between layout
> tables and data tables:
>
> 1) When writing a presentational table, stick to the elements "table", "tr",
> "td". Do not use the "headers", "scope", "axis", or "summary" attributes.
> Make sure layout tables make sense when linearized.
>
> 2) When writing a data table, add the elements "th", "thead", "tbody",
> "tfoot", "caption", and "col" and the attributes "headers", "scope", "axis",
> and "summary" wherever appropriate.

Exactly. These are great markers for distinguishing between where
authors were using table markup semantically or presentationally. I
think in practice there are probably many others available.

> Fast forward a decade, and authors are getting another tool in our toolbox,
> not a million miles away from your 'class="layout"'. I don't think it's very
> well specified yet, but:
>
> http://www.w3.org/TR/wai-aria/#presentation

I'm actually amazed... this is very nearly what I proposed in some
discussions back in 2004. I eventually shifted to class="layout"
because it had some other practical benefits and everybody I talked to
seemed to feel cluttering up the attribute space with yet another item
was wrong (on top of this sortof general malaise about repurposed
table markup), especially when considering how much semantic mileage
you can get out of class attributes. I'd be totally happy to see
anything like it adopted, though, and as I said before, think it'd
push the semantic web forward faster than waiting for everyone to come
around to doing things one blessed way.

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



[PHP] socket_write return wrong data length

2009-06-09 Thread Manuel C.

Hi all,

I'm writting a little telnet client, but I've a problem with the socket_write 
function

public function send($data){
$datalen = strlen($data);
$datawritten = 0;
do {
$datawritten = socket_write($this->_tnsocket, $data, 
$datalen);
if( $datawritten === FALSE) {
echo __METHOD__." : 
".socket_strerror(socket_last_error())."\n";
return (FALSE);
}
echo "Bytes written : ".$datawritten."\n";
$data = substr($data, $datawritten);
$datalen = strlen($data);
} while($datawritten < $datalen);

return (TRUE);
}


When I use this function for writting a sample message of 4526 Bytes it returns 
:
Bytes written : 4526
But it really wrotes only 1460 Bytes (verified with Wireshark).

So my question is why socket_write returns me a wrong data length ?

Thanks


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



[PHP] Re: Same Page, Fundamentally Different Behavior OR is Firefox broken?

2009-06-11 Thread Manuel C.

Matt Neimeyer a écrit :

I'm at a complete loss... So I'm hoping someone can point me in the
right direction to even start looking.

We have an application written in PHP that lets users send out emails.
The basic process is as follows.

1. Go to "start" screen. (This resets anything currently in process
for the current logged in user)
2. Upload email addresses and other info (Names, etc)
3. Build Email
4. Send

In Step 3 the user can click a "Live Preview" button to see what the
email will look like with the merged data.

Here's the problem,  this works fine in all versions of IE, versions
1.5 or less of FireFox and versions 3 or less of Safari. However,
starting in FireFox 2, and now Safari 4, when you get to step four OR
click the live preview button in step three there is no more data in
the merge. In those browsers the system is acting like the end user
went BACK to the start page (in another window?) and reinitialized all
the data.

I immediately thought it might be pre-fetching so I tried using the
system before and after toggling the network.prefetch-next setting in
about:config with FireFox 2.0.0.20 and restarting the browser. No
luck. So I added code to my reset function to email me the output of
phpinfo() when the reset function is called. Using IE I get 1
notification. Using FF I get two notifications. This reinforces my
theory that FireFox is prefetching the menu item to start a new
mailing (just an  link...) from the top of the composer page. Even
still... I've disabled prefetch so it SHOULDN'T even be considering
those links right? I've also tried adding artificial
"?now=" fakes to the end of all menu links since I read
somewhere (don't remember where) that FireFox only prefetches pages
with no query section in the address.

Has anyone run into this behavior before? Any recommendations on how
to stop it? Preferably from the server with code of some sort...

Thanks in advance.

Matt




Hi Matt,

Have you tried to put this two lines in the HEAD section of your HTML pages :



Hope it helps you.

BR


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



[PHP] Add BCC parameter to mail()

2009-07-05 Thread c...@hosting4days.com

Hi folks - Newbie question...

Q: Is there a way to add BCC and/or CC parameters to this simple email  
function?


If there is a better way to do this - please let me know

Thanks in advance


$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional  
headerfields


$fullto = $recipientname . " <" . $recipient . ">";

ini_set('sendmail_from', 't...@test.com');

mail($fullto, $subject, $mail_body, $header); //mail command :)
?>


Thanks,
c...@hosting4days.com





[PHP] mod primary key field - newbie question

2009-07-13 Thread c...@hosting4days.com
newbie question ... I have a MySQL table where I want to update  
(renumber) the primary numeric key field.


- I successfully turned field off as a primary key index and UN auto  
incremented it

- then created new sequential numbers for it
- then turned back on primary key index and re added auto increment in


BUT when I make a new record it does NOT  start where new numbers stop

last is 51
next should be 52

but jumps to 157

Q: is there a way to reset the NEXT SERIAL ID NUMBER somewhere? how  
do I fix this?



--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]





[PHP] Exception not being caught

2009-07-15 Thread Weston C
So, I've got a little piece of code designed to play with catching the
exception that's thrown when an object doesn't have a __toString
method.



This does not run as expected. I'd think that when the implicit string
conversion in the try block hits, the exception would be thrown,
caught by the catch block, and relayed.

Instead you don't ever see the words "exception caught" and you get
"Catchable fatal error: Object of class A could not be converted to
string."

If it's catchable, why isn't it caught in my example?

Thanks,

Weston

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



Re: [PHP] Exception not being caught

2009-07-16 Thread Weston C
On Thu, Jul 16, 2009 at 7:42 AM, David
Otton wrote:
>> If it's catchable, why isn't it caught in my example?
>
> It's not an exception, it's a "fatal error". Fatal errors are caught
> by error handling functions, not by catch blocks.
>
> Consequence of having (at least) two separate error handling
> mechanisms in the same language.

That's definitely confusing, but more confusing to me is labeling the
fatal error as "catchable", which definitely implies a try / catch
block should handle it.

Maybe they should call it a "handleable" fatal error :) ... implying
it can be managed with set_error_handler().

On Thu, Jul 16, 2009 at 9:38 AM, Martin Scotta wrote:
...
> http://ar.php.net/manual/es/function.set-error-handler.php
...
> You can write a simple handler or a fully featured one, but the essence is
> the same...
>
> function errorHandler(/*args*/)
> {
> $e = new Exception( $message, $code );
> throw $e;
> }

This looks like a great idea -- I was thinking I'd have to give up the
convenient flow control involved in exception handling, but this
should bring it back nicely.

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



[PHP] newbie - Is there a calendar module for date entry?

2009-07-21 Thread c...@hosting4days.com

newbie ...

- is there a calendar module for date fields?

- so that a small calendar pops up - then you can click on a date,   
to add to a field - like google or yahoo calendars has...?


BTW: I saw this - but it doesn't seem to be the right thing ( more  
meant for Converter issues) for what I'm looking for...


http://us2.php.net/manual/en/intro.calendar.php


--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]




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



Re: [PHP] newbie - Is there a calendar module for date entry?

2009-07-22 Thread c...@hosting4days.com


On Jul 21, 2009, at 6:17 PM, Jonathan Tapicer wrote:


That is javascript thing, not PHP.

The Yahoo UI has a nice one, here you have an example:
http://developer.yahoo.com/yui/examples/calendar/ 
calcontainer_clean.html,

and here the module reference:
http://developer.yahoo.com/yui/calendar/

Jonathan

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



The Yahoo UI looks great.


On Jul 22, 2009, at 12:50 AM, Ashley Sheridan wrote:

When I do these sorts of things, I tend to use Tigra calendar. They do
two versions, the free and the pro version, but tbh, the free one does
everything you need. It's very easy to set up too.




Hi Ashley - the free one seems to be just the thing. - thanks

Thanks to all - They both look good - I'm checking them out now!

Another newbie question: storing dates and times...

I'm trying to build a simple notepad page where I can attach a date  
and even time field. So this Tigra or yahoo calendar will be great  
date picker helper.


This is for the US, so I'd like the user to see normal us formatting  
like:


date field -  7/1/2009 and separate time field like: 11:30 AM

mysql can use a DATE or TIME or datetime field type. and seems to use  
a different standard like: -MM-DD I want to to be able to do date  
calcs and such - so what is the best way (types) to store these  
fields in mysql and display them on the page with php?


I do know about some of the cool php functions like:

echo date('m-d-y g:i a', strtotime($row_this['myDate']));

so do I? ... store the date and time in separate fields then  
manipulate the display with php functions or???


- just looking for any favorite practices



--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]




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



[PHP] Trouble compiling in mysqli under PHP5 -- "mysql_config not found"

2007-01-02 Thread Weston C

I'm trying to build a CLI/CGI binary of PHP5 with MySQLi under Mac OS
X. When I invoke configure, I get the following error message:

"checking whether to enable embedded MySQLi support... no
mysql_config not found
configure: error: Please reinstall the mysql distribution"

Now, mysql (4.1.22) is in fact installed, and it looks to me like the
headers are in fact there (and mysql_config seems to be under ./bin),
and I did give it the path with the config option
(--with-mysqli=/usr/local/mysql -- yes, I know this isn't the
conventional Mac OS X path, but I like these things under /usr/local,
so).

Curiously, I note that a build using --with-mysql=/usr/local/mysql
works just fine.

Any ideas what I'm doing wrong here?

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



[PHP] Ways to tell if existing setup is SAPI or Shared Object?

2007-04-19 Thread Weston C

What ways are there to tell if PHP is actually built into an Apache 2
installation or if it's installed as a shared object?

I've dropped a file containing phpinfo() on the server I'm looking at,
hoping the Server API value would give me a clue, but it just says
"Apache 2.0 Filter," and I don't know if Apache filters are required
to be one or the other

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



Re: [PHP] Ways to tell if existing setup is SAPI or Shared Object?

2007-04-19 Thread Weston C

On 4/19/07, Richard Lynch <[EMAIL PROTECTED]> wrote:

On Thu, April 19, 2007 4:08 pm, Weston C wrote:
> What ways are there to tell if PHP is actually built into an Apache 2
> installation or if it's installed as a shared object?
>
> phpinfo() / Server API value .. just says "Apache 2.0 Filter"

If you can read httpd.conf, and find a LoadModule there with php, then
it's shared, I think.


I do have access to httpd.conf. I can't find a LoadModule directive
for php in it, though. Is that a bad sign? Could they possibly have
been stuffed into any of the other lesser-used conf files?


The php_sapi_name function and PHP_SAPI constant may be of use if you
just want SAPI info in your program, rather than all of phpinfo()

They're probably all exactly the same output, though.


Seems to give the same result.


... if you compiled it directly into Apache (does anybody do
that anymore?)


I certainly wouldn't. But I think this is the default Apache2
distribution on RH9, and you just never know with those folks. ;)

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



  1   2   3   4   5   6   >