[PHP] Adding Business Days

2005-02-11 Thread Ben C
I am trying to add 5 business/week days to today's date.  Does anyone
know a good way of how to do it?

Thanks,

Ben

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



[PHP] Forms and viewing Text Area

2004-12-09 Thread Ben C
I have a form which has a text box which then stores in MySQL.  When I
write seperate paragraphs and try and then view what I wrote it lumps
it all together in one paragraph when I echo.  I am sure I am doing
something simply wrong.  Anyone have any ideas?

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



[PHP] Exporting Data to Excel

2003-10-23 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.

?
session_start();

$connection = @mysql_connect($host, $uname, $pass) or die(Couldn't
connect.);
$db = @mysql_select_db($db_name, $connection) or die(Couldn't select
database.);

/* Specify the filename, which includes a datestamp for archival purposes...
*/
$date_stamp = date(Ymd);
$file_name = ExportedData . _ . $date_stamp . .xls;

/* Specify MIME type for tab-separated-values... */
//header(Content-type: text/tab-separated-values);

/* To open file directly into Excel, use this MIME type instead... */
header(Content-type: application/x-msexcel);

/* To force file download... */
header(Content-Disposition: attachment; filename=$file_name);

/* List the spreadsheet column labels (optional)... */
$column_labels = array(Label 1, Label 2 , Label 3);   /* ...and so on
*/
foreach($column_labels as $value) {
  echo($value\t);
}
echo(\n);
/* ...end column labels row */

/* Specify the SELECT query (you will need to change this)... */
$query = SELECT * FROM buyers;

/* Execute the query... */
$result = mysql_query($query);

/* Format data as tab-separated values... */
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
  while (list($key, $value) = each($row)) {
echo ($value . \t);
  }
  echo (\n);
}
?

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



[PHP] Uploading files via SSH

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

2003-08-06 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



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

?
$i = 0;
$sql = SELECT a,b,c FROM foo;
$res = mysql_query($sql);
while($myrow = mysql_fetch_array($res))
{
$i++;
echo $i.br /;
echo $myrow['a'] .br /;
echo $myrow['b'] .br /;
echo $myrow['c'] .br /;
}
?

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] Another hosting question....

2003-06-19 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] 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



[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



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


?
$otherDate = 2003-11-15;  // -mm-dd format
$otherDateStamp = strtotime($otherDate);// now a unix timestamp

$difference = time() - $otherDateStamp; // diff in seconds
?

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

I'll show you hours and days:

?
$differenceHours = $difference / 3600;  // 60secs x 60 mins
$differenceDays  = $difference / 86400; // 60 x 60 x 24 hours
?

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


?
$otherDate = 2003-11-15;  // -mm-dd format
$otherDateStamp = strtotime($otherDate);// now a unix timestamp

$difference = time() - $otherDateStamp; // diff in seconds
?

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

I'll show you hours and days:

?
$differenceHours = $difference / 3600;  // 60secs x 60 mins
$differenceDays  = $difference / 86400; // 60 x 60 x 24 hours
?

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




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 .= option value=\$state\ $selected.
 $state/option\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 .= option value=\$state\$state/option;
 }

 $display_block = 

 select name=\state\ class=Pgtext
 $option_block
 /select
 ?

 tr
 td width=258 class=Pgtext height=21State/td
 td width=259 height=21? echo $display_block; ?/td
 /tr

 
--
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] 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
-
?
$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 .= option value=\$state\$state/option;
}

$display_block = 

select name=\state\ class=Pgtext
$option_block
/select
?

tr
td width=258 class=Pgtext height=21State/td
td width=259 height=21? echo $display_block; ?/td
/tr
 



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




RE: [PHP] Struggling with code

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

?

$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 user
SET
name = '$name',
lname = '$lname',
mobil = '$mobil',
email = '$email',
url = '$url',
WHERE id= '$id'

;

$result = mysql_query($sql,$connection) or mysql_error(Couldn't execute
query.);


?

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

?

$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 user
SET
name = '$name',
lname = '$lname',
mobil = '$mobil',
email = '$email',
url = '$url',
WHERE id= '$id'

;

$result = mysql_query($sql,$connection) or mysql_error(Couldn't execute
query.);


?

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

?

$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.);

?

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




[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:
?

 require(fns.php);
 session_start();

 if (!filled_out($HTTP_POST_VARS))
 {
   echo You have not filled out the form completely.
 Please try again.;
 exit;
 }
 else 
 {
if ($new_passwd!=$new_passwd2)
   echo Passwords entered were not the same.  Not changed.;
else if (strlen($new_passwd)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




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=somevaluevar2=somevalue2var3=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] 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




[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] 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 ?
echo $id; ? 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