[PHP-DB] Re: Firebird and PHP

2004-11-19 Thread Lester Caine
Mario Lacunza wrote:
Is possible work with Firebird ? and how?
Perfectly possible.
Just use the ibase_* functions.
Windows or Linux
Old windows getting started is at
http://www.ibphoenix.com/main.nfs?a=ibphoenixpage=ibp_beginners_php
Help with linux can be found on the firebird-php list
http://groups.yahoo.com/group/firebird-php
You will get Firebird related help there.
--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] password encryption

2004-11-19 Thread php_user
Han,
You can try installing mcrypt, it gives you encryption/decryption 
capabilities in PHP.  It's fairly easy to install in you're running a 
Windows system; I think you have to recompile php if your on a Linux 
system, and I have never been able to successfully do that.  You might 
look into it though, I don't quite understand why it can't be included 
with the default PHP installation, or be made easier to install.

http://us2.php.net/mcrypt
-JD
Han wrote:
Hello,
I'm having a real problem and wondering if anyone can help.
I need to set up htaccess ans htpasswd files to authenticate users on 
my system.
I need to do it with PHP, but can't find a way of encrypting the 
password so it works.

I've used an online encrypter for testing the system, and I've got the 
.htaccess and .htpasswd files correct, but I need to programmatically 
encrypt the password in my script then write it to the 2 files.

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


Re: [PHP-DB] password encryption

2004-11-19 Thread Han
Thanks to evryone for their help.
Haven't done it yet as I'm working on someone else's server and they won't 
do certain things.
I've got all the info I was lacking now, so I'm sure I can work something 
out.

Han.
- Original Message - 
From: php_user [EMAIL PROTECTED]
To: Han [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, November 19, 2004 12:21 PM
Subject: Re: [PHP-DB] password encryption


Han,
You can try installing mcrypt, it gives you encryption/decryption 
capabilities in PHP.  It's fairly easy to install in you're running a 
Windows system; I think you have to recompile php if your on a Linux 
system, and I have never been able to successfully do that.  You might 
look into it though, I don't quite understand why it can't be included 
with the default PHP installation, or be made easier to install.

http://us2.php.net/mcrypt
-JD
Han wrote:
Hello,
I'm having a real problem and wondering if anyone can help.
I need to set up htaccess ans htpasswd files to authenticate users on my 
system.
I need to do it with PHP, but can't find a way of encrypting the password 
so it works.

I've used an online encrypter for testing the system, and I've got the 
.htaccess and .htpasswd files correct, but I need to programmatically 
encrypt the password in my script then write it to the 2 files.

Han.

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


[PHP-DB] Updating count on record results

2004-11-19 Thread Stuart Felenstein
I am setting up a table to log a count on individual
records for every time they are returned in a results
return.

Just so to illustrate 

Record1 

First search brings up Record1 (counter is set too 1)
Second search brings up Record1 (counter is set too 2)
Third search brings up Record1 (counter is set too 3)
...etc.

So I have a vauge idea of the sql statement but where
to place is the question. My thoughts are that it
should be in the loop that generates the result rows
return.  In other words - 

Maybe here :
?php echo $row_rsVJ['JobTitle']; ?/div/td

Or maybe here ?: 
?php } while ($row_rsVJ = mysql_fetch_assoc($rsVJ));
?

Hope what I'm asking is clear.

Thank you ,
Stuart

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



RE: [PHP-DB] Updating count on record results

2004-11-19 Thread Bastien Koert
this is how I did it for a client's site
// update the number of times the vehicle has been viewed
mysql_db_query($dbname, UPDATE vehicle_inventory SET viewed=viewed+1 WHERE 
ccode='$ccode', $link);

bastien
From: Stuart Felenstein [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Updating count on record results
Date: Fri, 19 Nov 2004 04:59:20 -0800 (PST)
I am setting up a table to log a count on individual
records for every time they are returned in a results
return.
Just so to illustrate
Record1
First search brings up Record1 (counter is set too 1)
Second search brings up Record1 (counter is set too 2)
Third search brings up Record1 (counter is set too 3)
...etc.
So I have a vauge idea of the sql statement but where
to place is the question. My thoughts are that it
should be in the loop that generates the result rows
return.  In other words -
Maybe here :
?php echo $row_rsVJ['JobTitle']; ?/div/td
Or maybe here ?:
?php } while ($row_rsVJ = mysql_fetch_assoc($rsVJ));
?
Hope what I'm asking is clear.
Thank you ,
Stuart
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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


RE: [PHP-DB] Updating count on record results

2004-11-19 Thread Stuart Felenstein

--- Bastien Koert [EMAIL PROTECTED] wrote:

 this is how I did it for a client's site
 
 // update the number of times the vehicle has been
 viewed
 mysql_db_query($dbname, UPDATE vehicle_inventory
 SET viewed=viewed+1 WHERE 
 ccode='$ccode', $link);
 
Where did this code go though ? Meaning, was it in a
seperate script / page or was it part of a bigger
query that first got the results based on certain
criteria , the did the update?

Stuart

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



RE: [PHP-DB] Updating count on record results

2004-11-19 Thread Bastien Koert
its a separate query on the same page, its activated after the data 
retreival query runs.

?
...
// get the information for this vehicle
$result = mysql_db_query($dbname, SELECT * FROM vehicle_inventory WHERE 
ccode='$ccode', $link);
$data = mysql_fetch_array($result);
$data[comments] = nl2br($data[comments]);

// update the number of times the vehicle has been viewed
mysql_db_query($dbname, UPDATE vehicle_inventory SET viewed=viewed+1 WHERE 
ccode='$ccode', $link);

...?
bastien
From: Stuart Felenstein [EMAIL PROTECTED]
To: Bastien Koert [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Updating count on record results
Date: Fri, 19 Nov 2004 07:28:48 -0800 (PST)
--- Bastien Koert [EMAIL PROTECTED] wrote:
 this is how I did it for a client's site

 // update the number of times the vehicle has been
 viewed
 mysql_db_query($dbname, UPDATE vehicle_inventory
 SET viewed=viewed+1 WHERE
 ccode='$ccode', $link);

Where did this code go though ? Meaning, was it in a
seperate script / page or was it part of a bigger
query that first got the results based on certain
criteria , the did the update?
Stuart
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Cisco UBR interface with PHP

2004-11-19 Thread Doug Finch
I have an idea that I wanted to throw out there.  I have a cable ISP
plant that I am trying to help with a project.  They are using Cisco
7114 UBRs to connect their cable modems with their Internet backbone -
this device assigns it a dhcp address and associates it with the modems
MAC address.  It does a lot more than that but that is all I am
concerned with.  I want to see if I can write a script that will
constantly execute the command show ip arp which will return the
current routing table with the MAC and IP address (dhcp).  I can foresee
two problems so far, one is that you have to have enable mode access to
run this function and two, I would fear creating a security loophole by
running an enabled function all of the time.  Can I get your thoughts on
this?
thanks,
Doug

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



[PHP-DB] Question on FilesSessions

2004-11-19 Thread Kathy_A_Wright
Can you hold a file in a session?   I am trying to send a file to a third 
page and it won't seem to work sending it in a session.   Does anyone know 
how to do this?

Thanks


Kathy A Wright | Keane Inc. | Suite: 
Outside: 617-517-1706 | E-mail: [EMAIL PROTECTED]
[ Mailing: 100 City Sq.  Charlestown, MA 02129 USA ]


RE: [PHP-DB] Question on FilesSessions

2004-11-19 Thread Gryffyn, Trevor
How are you storing the file in your PHP code?

If it'll fit in a variable, it should be able to be stored in $_SESSION.

This might mean using serialize() and unserialize().

Although someone may have a better way of doing this.  It seems to me
that storing an entire file in a variable is going to be cumbersome on
your server.  You might try storing the file name and path or something:

C:\somepath\somefilename.ext


Someone probably has a better way to do this, but those are my initial
thoughts.. Without much experience having to do something like this with
files and without knowing more about your situation.

-TG



 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: Friday, November 19, 2004 11:46 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Question on FilesSessions
 
 
 Can you hold a file in a session?   I am trying to send a 
 file to a third page and it won't seem to work sending
 it in a session.   Does anyone know how to do this?
 
 Thanks
 
 
 Kathy A Wright | Keane Inc. | Suite: 
 Outside: 617-517-1706 | E-mail: [EMAIL PROTECTED]
 [ Mailing: 100 City Sq.  Charlestown, MA 02129 USA ]
 

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



[PHP-DB] array messing up

2004-11-19 Thread Rainer Bendig aka Ny
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

i don't know if this is the right list to post it, or php-general...
I am posting here because i think its database related.

so here we go:

I want to build an array containing two arrays $navm[] and $navs[],
$navs[] should go to $navm[items].

I am using an commercial db class to do my queries.

This is the snippet making my array:

- -sourcecode:start8--

$resultm = $db-query(SELECT * FROM .$p._cats  WHERE ms='m' \
   ORDER BY sortorder ASC);
while($work_res_navm = $db-fetch_array($resultm)) {
  $results = $db-query(SELECT * FROM .$p._cats  \
 WHERE master='.$work_res_navm['catid'].' \
 ORDER BY sortorder ASC);
 
   while($work_res_navs = $db-fetch_array($results)) {
 $navs[]=array('link'=$work_res_navs['link'], \
   'text'= $work_res_navs['name'], \
   'id'= $work_res_navs['catid'], \
   'master'=$work_res_navs['master']
   );
   }
  $navm[] =array('link'=$work_res_navm['link'], \
 'text'= $work_res_navm['name'], \
 'id'= $work_res_navm['catid'], \
 'items'=$navs);
};
- -sourcecode:stop-8--

table looks like this:
- -table:start-8--
 CREATE TABLE `ui_cats` (
   `catid` tinyint(11) NOT NULL auto_increment,
   `ms` char(1) NOT NULL default 's',
   `master` tinyint(1) NOT NULL default '1',
   `sortorder` tinyint(3) NOT NULL default '0',
   `name` varchar(150) NOT NULL default '',
   `link` varchar(150) NOT NULL default '',
   PRIMARY KEY  (`catid`)
   ) TYPE=MyISAM AUTO_INCREMENT=8 ;
- -table:stop--8--
 
MySQL Version: 3.23.58
PHP-Version:   4.2.2
( I can not update those versions..)

the array now looks like this:
$navm1-0
 $navs1-1
 $navs1-2
$navm2-0
 $navs1-1
 $navs1-2
 $navs2-1
$navm3-0
 $navs1-1
 $navs1-2
 $navs2-1
 $navs3-1

and the same procedure a lot more often... but it should look like
this:
$navm1-0
 $navs1-1
 $navs1-2
$navm2-0
 $navs2-1
$navm3-0
 $navs3-1
and so on

what is my error? i cant see it after trying several other querys in
two days :-(

any ideas?
thanks in advice
- -- 
- -
Rainer 'Ny' Bendig | http://UnresolvedIssue.org | GPG-Key: 0xCC7EA575
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFBni4ltpAZoWtAN98RAi18AJ9ToJhWXlvJiVVE/GoH3ArHTYN/cACdHzU4
dU9lkx+M8UnVQPak/+ikQYs=
=su6z
-END PGP SIGNATURE-

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



[PHP-DB] Currency and number types...

2004-11-19 Thread Mark Benson
I'm trying to display data calculated by my script as a currency. The problem I 
have is that PHP is treating the results of the math as a 'float' number (or 
'double') so I am getting results like:

12.0594393

in my table. I have tried using:

print round($foobar,2)

but that cuts off the trailing zero on numbers that comne out as, for example 
'12.10' or '12.00'.

Does anyone know a way to force PHP to print numbers to a set number of 
significant figures (i.e. 2) and stop the trailing zero suppression?

-- 
Mark Benson

http://homepage.mac.com/markbenson

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



RE: [PHP-DB] Currency and number types...

2004-11-19 Thread Gryffyn, Trevor
You might try this:
http://us2.php.net/manual/en/function.money-format.php

Money_format()

In your database query, you can probably format the number how you want
there too... Before you even get to PHP and round()ing it inside PHP.
But do your math and using the money_format() function to display it
should work just fine I think.

-TG

 -Original Message-
 From: Mark Benson [mailto:[EMAIL PROTECTED] 
 Sent: Friday, November 19, 2004 12:36 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Currency and number types...
 
 
 I'm trying to display data calculated by my script as a 
 currency. The problem I have is that PHP is treating the 
 results of the math as a 'float' number (or 'double') so I am 
 getting results like:
 
 12.0594393
 
 in my table. I have tried using:
 
 print round($foobar,2)
 
 but that cuts off the trailing zero on numbers that comne out 
 as, for example '12.10' or '12.00'.
 
 Does anyone know a way to force PHP to print numbers to a set 
 number of significant figures (i.e. 2) and stop the trailing 
 zero suppression?
 
 -- 
 Mark Benson
 
http://homepage.mac.com/markbenson

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

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



RE: [PHP-DB] Currency and number types...

2004-11-19 Thread Gryffyn, Trevor
Either way. :)

 -Original Message-
 From: Joseph Crawford [mailto:[EMAIL PROTECTED] 
 Sent: Friday, November 19, 2004 12:48 PM
 To: Gryffyn, Trevor; [PHP-DB] Mailing List
 Subject: Re: [PHP-DB] Currency and number types...
 
 
 how about good old number_format()
 
 -- 
 Joseph Crawford Jr.
 Codebowl Solutions
 [EMAIL PROTECTED]
 
 For a GMail account
 contact me OFF-LIST
 

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



RE: [PHP-DB] Currency and number types...

2004-11-19 Thread Bastien Koert
number_format() is what you need
look it up
bastien
From: Mark Benson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Currency and number types...
Date: Fri, 19 Nov 2004 17:35:53 +
I'm trying to display data calculated by my script as a currency. The 
problem I have is that PHP is treating the results of the math as a 'float' 
number (or 'double') so I am getting results like:

12.0594393
in my table. I have tried using:
print round($foobar,2)
but that cuts off the trailing zero on numbers that comne out as, for 
example '12.10' or '12.00'.

Does anyone know a way to force PHP to print numbers to a set number of 
significant figures (i.e. 2) and stop the trailing zero suppression?

--
Mark Benson
http://homepage.mac.com/markbenson
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Question on FilesSessions

2004-11-19 Thread Bastien Koert
Better to save the file locally, the pass the name in a session variable. 
otherwise the overhead of holding a multi Kb or Mb file will be killer on 
the system.

What are you trying to do with the file?
Bastien

From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Question on FilesSessions
Date: Fri, 19 Nov 2004 11:45:45 -0500
Can you hold a file in a session?   I am trying to send a file to a third
page and it won't seem to work sending it in a session.   Does anyone know
how to do this?
Thanks
Kathy A Wright | Keane Inc. | Suite:
Outside: 617-517-1706 | E-mail: [EMAIL PROTECTED]
[ Mailing: 100 City Sq.  Charlestown, MA 02129 USA ]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] password encryption

2004-11-19 Thread Bastien Koert
You need to understand how the htaccess file and its passwords are created. 
using mcrypt will likely lead to problems. htaccess passwords are encrypted 
with DES algorithm

[quote  http://www.edevcafe.com/viewdoc.php?eid=97]
If you wanted to write a CGI script to help you add/delete users from the 
.htpasswd file, then you need to know something about the format of this 
file. Each line of the .htpasswd file contains one username/password 
combination that looks something like this:

Username:w8G2g305KxNd2

Note that the first 2 characters of the encrypted password represent the 
SALT used by the 2-char DES encryption algorithm that produced the encrypted 
string you see above. The command “crypt(‘password’, ‘w8’)” in PHP4 will 
produce “w8G2g305KxNd2”. Since DES encryption is a one-way encryption 
algorithm, this provides us with a way to encrypt the suspect password so it 
can be compared to the known password.

[/quote]
There is no need to use decrypt since that is not how the htaccess 
authorization works (unless you write a custom page to check the values (and 
since you can encrypt before checking) decrypt is not used)

hth
bastien

From: php_user [EMAIL PROTECTED]
To: Han [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: [PHP-DB] password encryption
Date: Fri, 19 Nov 2004 07:21:53 -0500
Han,
You can try installing mcrypt, it gives you encryption/decryption 
capabilities in PHP.  It's fairly easy to install in you're running a 
Windows system; I think you have to recompile php if your on a Linux 
system, and I have never been able to successfully do that.  You might look 
into it though, I don't quite understand why it can't be included with the 
default PHP installation, or be made easier to install.

http://us2.php.net/mcrypt
-JD
Han wrote:
Hello,
I'm having a real problem and wondering if anyone can help.
I need to set up htaccess ans htpasswd files to authenticate users on my 
system.
I need to do it with PHP, but can't find a way of encrypting the password 
so it works.

I've used an online encrypter for testing the system, and I've got the 
.htaccess and .htpasswd files correct, but I need to programmatically 
encrypt the password in my script then write it to the 2 files.

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


[PHP-DB] Optimize Query Output

2004-11-19 Thread GH
I have the following query:

SELECT A.`AttID` , S.`SessionDate` , P.LastName, P.FirstName, A.`Present`
FROM `Attendance` A, Sessions S, Participants P
WHERE S.SessionID = A.`Session` AND P.Part_ID = A.`Participant`
GROUP BY P.LastName, P.FirstName, A.Present, A.AttID

I would like to have the output to have the P.LastName and P.FirstName
values only shown once and the rest of the output printed...

So instead of something like:

+---+-+-+---+-+
| AttID | SessionDate | LastName| FirstName | Present |
+---+-+-+---+-+
| 1 | 2004-10-30  | Apple | Robert  | Yes |
|11 | 2004-11-06  | Apple | Robert  | Yes |
|31 | 2004-11-13  | Apple | Robert  | Yes |
| 2 | 2004-10-30  | Bravo | Lisa   | Yes |
|32 | 2004-11-13  | Bravo | Lisa   | Yes |
|12 | 2004-11-06  | Bravo | Lisa   | No  |
| 3 | 2004-10-30  | Beta   | Elaine| Yes |
|13 | 2004-11-06  | Beta   | Elaine| Yes |
|14 | 2004-11-06  | Delta | Alexander | Yes |
|35 | 2004-11-13  | Delta | Alexander | Yes |



To have it look like:

+-+---+---+-+-+
| LastName| FirstName | AttID | SessionDate | Present |
+-+---+---+-+-+
| Apple | Robert S. | 1 | 2004-10-30  | Yes |
|   |   |11|  2004-11-06 | Yes |
|   |   |31|  2004-11-13 | Yes |
| Bravo | Luz   | 2 | 2004-10-30  | Yes |
|  | |32|  2004-11-06 | No |
|   |   |12|  2004-11-13 | Yes |
| Beta   | Elaine| 3 | 2004-10-30  | Yes |
|  |   |13|  2004-11-06 | Yes |
| Delta  | Alexander |14 | 2004-11-06  | Yes |
|   |   |35|  2004-11-13 | Yes |
.

Please advise I am running on mySql 4.0

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