RE: [PHP-DB] format dates from a database

2001-08-19 Thread Matthew Loff


strftime(format, strtotime($database_time_string));

format is defined in the page for strftime().  strtotime() converts
the MySQL date into a UNIX timestamp.


-Original Message-
From: Caleb Walker [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, August 18, 2001 4:06 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] format dates from a database


I am wondering if there is an easier way to format dates that come out
of a 
database.  My database stores my date in the format- -MM-DD.  I
know 
that I can take this and rearrange it with some string manipulation but
is 
there any other easier way to do that say like making it say Sep. 09,
2001 
instead of 2001-09-09 without using ereg()?

Thanks for your help

-- 
PHP Database 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 Database 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-DB] Include

2001-08-19 Thread Tom Carter

   Yes that is correct. On a security point of view therer is something
extra you can do.. when using require you can require files that are outside
the web tree...by this I mean are not accessible thru the internet. So if
you site was in /home/web then you could setup a directory, say
/home/web_vars and in this put these kind of files.

In the require statement you just then simple put in the full path, eg
require(/home/web_vars/vars.php);

The advantage of doing this is security When the file with such sensitive
information is included in the web tree then there are (admittedly limited)
possible scenarios in which this could be compramised. It is generally
accepted that it is sensible to avoid putting such information in the web
tree.

Hope I've been clear, let me know if you need any more advice.

 so in var.php i will put something like this

 $db=mydatabse;
 $username=myusername;
 $password=mypassword;


 and so on?


 --
 Cross Walk Central
 www.crosswalkcentral.net
 Support Center
 Your Web Hosting Community!

 Seb Frost [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  chuck all the common variables in var.php
 
  then just put
 
  ?php
  require(var.php);
  ?
 
  - seb
 
  -Original Message-
  From: CrossWalkCentral [mailto:[EMAIL PROTECTED]]
  Sent: 19 August 2001 03:18
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Include
 
 
  OK here is one for you folks that know what you are doing.
 
  I am making a script and I have about 5 php files in it. That have alot
of
  the same system variables can I create one file with these settings in
it
  and if so any one want to give me some hints on this
 
  thanks again.
 
  --
  Cross Walk Central
  www.crosswalkcentral.net
  Support Center
  Your Web Hosting Community!
 
 
 
 
  --
  PHP Database 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 Database 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 Database 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-DB] PHP4 OCIFetch with Oracle

2001-08-19 Thread Thies C. Arntzen

On 17 Aug 2001 19:41:26 +0200, Konrad BüKo wrote:
 Hi
 
 We've a Problem with PHP4 OCIFetch and varchar2 !
 
 OCHIFetch with number or date Field it work's fine but when i'll fetch a
 varchar2 Field then i've no output in the browser !
 
 When i dump the array then i see the character is 20 Bytes my field is 10
 bytes i suppose so the character is unicode !
 
  Anybody have i idea what i can do for change the characterset ?

please set NLS_LANG before you start your webserver.

see http://www.php.net/manual/en/ref.oci8.php

re,
tc



--
PHP Database 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-DB] Masking a reacuring result

2001-08-19 Thread Ron Gallant

I am querying a list with a date field.  I want to order the list by the
date field and only show each days date once with the other fields showing.


(row 1) 2001-08-19 - some text here.
(row 2)more text under same date.  My date does not
show.
(row 3) 2001-08-20 - Lots of text today.
(row 4)Even more text here today.   My date does not
show.
(row 5)Yes more text, date not showing.






-- 
PHP Database 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-DB] Re: Masking a reacuring result

2001-08-19 Thread Hugh Bothwell


Ron Gallant [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I am querying a list with a date field.  I want to order the list by the
 date field and only show each days date once with the other fields
showing.

 (row 1) 2001-08-19 - some text here.
 (row 2)more text under same date.  My date does
not
 show.
 (row 3) 2001-08-20 - Lots of text today.
 (row 4)Even more text here today.   My date does
not
 show.
 (row 5)Yes more text, date not showing.

This seems to be a recurrent question in various guises;

The idea is simple: sort by date (so all equal dates are together),
then keep a temporary variable set to the last-seen date.  When the
date changes, output a new date value.

== example.php 
?php
mysql_connect(host, user, pwd)
or die(Error connecting: .mysql_error());

// return the 20 most recent items
$query =
 SELECT mydate,mytext 
.FROM table 
.ORDER BY mydate DESC 
.LIMIT 20;
$result = mysql_db_query(dbase, $query)
or die(Error querying: .mysql_error());

// show results in a table
$lastdate = ;
echo \ntable;

while ($row = mysql_fetch_array($result)) {
extract($row);

if ($lastdate == $mydate)
$t = ;
else
$t = $lastdate = $mydate;

echo \n\ttrtd$t/tdtd$mytext/td/tr;
}

echo \n\table;
?
===



-- 
PHP Database 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-DB] Re: Masking a reacuring result

2001-08-19 Thread Ron Gallant

I just wanted to say that this is one of the most informative un-judging
groups I have used.

And thanks for everything Hugh.


Ron Gallant [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I am querying a list with a date field.  I want to order the list by the
 date field and only show each days date once with the other fields
showing.


 (row 1) 2001-08-19 - some text here.
 (row 2)more text under same date.  My date does
not
 show.
 (row 3) 2001-08-20 - Lots of text today.
 (row 4)Even more text here today.   My date does
not
 show.
 (row 5)Yes more text, date not showing.








-- 
PHP Database 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-DB] phpMyAdmin (well mySQL) and listing DB's

2001-08-19 Thread BoNzO

Look closer in the config.inc.php file..

There is a show only this table option

/BoNzO
http://bonzo.sineleven.nu


-Original Message-
From: Tom Carter [mailto:[EMAIL PROTECTED]] 
Sent: den 19 augusti 2001 15:54
To: [EMAIL PROTECTED]
Subject: [PHP-DB] phpMyAdmin (well mySQL) and listing DB's

Hi All,

I was trying to set up phpMyAdmin for a client on my machine, and I've
created a mysql account for him such that he can only use his database,
yet
when I use phpMyAdmin (with the correct setting) he can see all the
databases. The security is still there, it just looks messy + reveals
all
the dbs.

Anyone have any advice?

TIA, Tom
Tom Carter
Web Architect
roundcorners ltd.


-- 
PHP Database 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 Database 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-DB] Include

2001-08-19 Thread CrossWalkCentral

Thank you I got it working good deal

--
Cross Walk Central
www.crosswalkcentral.net
Support Center
Your Web Hosting Community!

Tom Carter [EMAIL PROTECTED] wrote in message
001201c12888$bb8a9790$0a00a8c0@bjorn">news:001201c12888$bb8a9790$0a00a8c0@bjorn...
Yes that is correct. On a security point of view therer is something
 extra you can do.. when using require you can require files that are
outside
 the web tree...by this I mean are not accessible thru the internet. So if
 you site was in /home/web then you could setup a directory, say
 /home/web_vars and in this put these kind of files.

 In the require statement you just then simple put in the full path, eg
 require(/home/web_vars/vars.php);

 The advantage of doing this is security When the file with such sensitive
 information is included in the web tree then there are (admittedly
limited)
 possible scenarios in which this could be compramised. It is generally
 accepted that it is sensible to avoid putting such information in the web
 tree.

 Hope I've been clear, let me know if you need any more advice.

  so in var.php i will put something like this
 
  $db=mydatabse;
  $username=myusername;
  $password=mypassword;
 
 
  and so on?
 
 
  --
  Cross Walk Central
  www.crosswalkcentral.net
  Support Center
  Your Web Hosting Community!
 
  Seb Frost [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   chuck all the common variables in var.php
  
   then just put
  
   ?php
   require(var.php);
   ?
  
   - seb
  
   -Original Message-
   From: CrossWalkCentral [mailto:[EMAIL PROTECTED]]
   Sent: 19 August 2001 03:18
   To: [EMAIL PROTECTED]
   Subject: [PHP-DB] Include
  
  
   OK here is one for you folks that know what you are doing.
  
   I am making a script and I have about 5 php files in it. That have
alot
 of
   the same system variables can I create one file with these settings in
 it
   and if so any one want to give me some hints on this
  
   thanks again.
  
   --
   Cross Walk Central
   www.crosswalkcentral.net
   Support Center
   Your Web Hosting Community!
  
  
  
  
   --
   PHP Database 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 Database 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 Database 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-DB] getting ID

2001-08-19 Thread Cynic

At 19:19 8/19/2001, CrossWalkCentral wrote the following:
-- 
I have a script where I submit user data to the database in my script I need
to get the id  # how can I do this w/o creating a query that does the
following considering that user could have 10 other entires.

mysql_query(insert into ...);
$id = mysql_insert_id();


// Request info
$result = mysql_query(
SELECT * FROM supportsys WHERE email = $email);
if (!$result) {
echo(PError performing query:  .
mysql_error() . /P);
exit();
}


I basicly need to get the id$ of the record just entered
--
Cross Walk Central
www.crosswalkcentral.net
Support Center
Your Web Hosting Community!




-- 
PHP Database 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]
--end of quote-- 


[EMAIL PROTECTED]
-
And the eyes of them both were opened and they saw that their files
were world readable and writable, so they chmoded 600 their files.
- Book of Installation chapt 3 sec 7 


-- 
PHP Database 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-DB] Re: phpMyAdmin (well mySQL) and listing DB's

2001-08-19 Thread Alexandre Santos

Tom Carter wrote:
 
 Hi All,
 
 I was trying to set up phpMyAdmin for a client on my machine, and I've
 created a mysql account for him such that he can only use his database, yet
 when I use phpMyAdmin (with the correct setting) he can see all the
 databases. The security is still there, it just looks messy + reveals all
 the dbs.
 
 Anyone have any advice?
 
 TIA, Tom
 Tom Carter
 Web Architect
 roundcorners ltd.
See how it works in phpPgAdmin. The loop that creates the left menu as
an if clause that only lists the DB's the user owns.

Alexandre Santos

-- 
PHP Database 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-DB] strange upload and db-insert problem with explorer5.5

2001-08-19 Thread Serge Adamowsky

dear community,

i've got a script which handles the correct upload of certain documents.
the way:
1)select the document, then upload  through form with method post - target
same document
2)do the checking stuff with the document, if ok call the same script again
for displaying the property-page - form-target same document
3) if everything went well, document-properties are inserted in the db in
two tables, then script
displays js-redirect to do more stuff with the doc.
the problem here is, that although no browser goes wrong, except explorer
5.5 (sp2).
using this version, the document's properties are inserted twice, both
relating to the same physical doc
but with different ids.
did anyone ever had same effects or even the remedy for this particular
problem?
(remedy get rid of stinkin' ms-junk won't help, since customer is tied to
this trash ;)


thanks
serge




-- 
PHP Database 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-DB] Inseting info into MySQL and retrieving all in one SQL command

2001-08-19 Thread CrossWalkCentral

Question how do you use this function?

mysql_insert_id();

I have tried it and it gives me and error every time any one have any sample
conde on this

--
Cross Walk Central
www.crosswalkcentral.net
Support Center
Your Web Hosting Community!

Beau Lebens [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 not so much in one step, but once you have inserted it you can call the
 function

 mysql_insert_id();

 and it will return the auto_increment value of the last insert operation.

 see the manual for more.

 HTH
 Beau

 // -Original Message-
 // From: Scott Mebberson [mailto:[EMAIL PROTECTED]]
 // Sent: Thursday, 9 August 2001 8:49 AM
 // To: [EMAIL PROTECTED]
 // Subject: [PHP-DB] Inseting info into MySQL and retrieving
 // all in one SQL
 // command
 //
 //
 // Hi guys,
 //
 // I am adding some information to my MySQL database. It is
 // user's information.
 // So it has things like email address, password, username, all
 // that sort of
 // stuff.
 //
 // What I need to do is once I have added it found out the id -
 // a primary key
 // which auto increments itself. At the moment I am doing two
 // different MySQL
 // queries an INSERT and a SELECT to first of all add the
 // information and then
 // find out the primary key.
 //
 // Is there anyway I can do this in one step?
 //
 // Thanks in advance
 //
 // Scott Mebberson
 // [EMAIL PROTECTED]
 //
 //
 //
 // --
 // PHP Database 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 Database 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-DB] oracle (oci8) intro

2001-08-19 Thread Graeme Merrall

Quoting Cynic [EMAIL PROTECTED]:

 Hi there,
 
 I'm in a situation where I need to produce a small app
 on top of an Oracle server really quickly. I'm quite a
 seasoned developer, but have only experience with MySQL
 so far. It's my understanding that Oracle lacks the 
 MySQL's LIMIT feature. Looking at the OCI section of 
 the PHP manual, it also looks like there's no 
 OCIDataSeek() or some equivalent. Since the app I need
 to build will be a standard report builder with paging,
 I need this functionality. What is the common way to 
 achieve this? Always fetch all rows, cycling through the
 resultset, discarding the records that preceed the one
 I want to start displaying with, and quit when I reach
 the one where the page should end?
 
 Is there a PHP + OCI tutorial somewhere?
 
 I need an intro to Oracle, and I need it now. :(

Thies has an Oracle/PHP tutorial online at http://conf.php.net/ which may be of 
some assitance. 
The LIMIT problem is a real bitch is Oracle. There are a few ways to get around 
it, the most obvious people use being ROWNUM. However, ROWNUM does not listen 
to sorting which makes life amusing.
One option is to try a query like the following:
SELECT * FROM (SELECT field1, field2 FROM table WHERE id10 ORDER BY field1 
DESC) WHERE ROWNUM11

which gives you 10 rows, but still leaves the question of paging behind unless 
you use between values. I can't say I've tried paging record sets though.

Cheers,
 Graeme

-- 
PHP Database 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-DB] getting dbase functions to work

2001-08-19 Thread Travis Cannell

Ok I am trying to use some of the PHP dbase functions and I get a call to
undefined function error.  Looking at the documentation I found a post on
the site that said in order for these to work I need to compile PHP with
dbase support with a command.  Here is the explination

You need to compile php with dbase support. `./configure --with-dbase '
will give you dbase support.  Try `./configure --help' to get a list of
modules and compile options.
Geoff

So my question is how can I compile php with this command?  Will I have to
get the source or is there some way that I can do this to my current version
of php?  Or would this command work when installing php?  And how can I
invoke this command when I do compile the source, say in Vis C++.

Thanks,

T P Cannell



-- 
PHP Database 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-DB] E-Commerce - Integrating Sessions With Charging Processes That rePOST

2001-08-19 Thread Fotwun

Hi,

I have basically seen and used two methods for integrating credit card
gateways into PHP code.

The first method is one that opens a socket to the gateway server and sends
the data from within the code.

The second is where FORM data is posted to a https URL with the URL is
should send the response back to, with the confirmation code, etc.

I traditionally use PG for situations of e-commerce, mainly because of
transactions. I like the first method better, because I feel it is more
secure, seemless, and less chance for errors to occur (either user induced,
or other problems). I like being able to store all of the required data in
sessions (rather than adding to the DB at each step) and then making all of
the transactional queries at the end of the credit card charging process.

The problem I face is that all of the companies I've researched that allow
direct socket integration seem to charge quite a bit more in general than
those that use the POST/REDIRECT method of charging.  So, if anyone
knows of a reliable and affordable company that allows socket integration,
that would solve the problem best. 

However, because of budget issues, I may need to use one of these cheaper
companies, who ultimately use the POST/REDIRECT method.

My questions are how do you securly, reliably, and seemlessly integrate
sessions within that type of gateway. Because once the form data is posted
to the credit card gateway, it redirects (posts response data) back to the
script of your choice. However, in my experience, the sessions are not
restored/recognized until the browser is refreshed on the client side
(through the use of JavaScript) to get the server to recognize the request
as coming from your user, rather than the as a post from the gateway. I
don't want to have to deal with getting sloppy and adding additional
refreshes/java script if thats the only way to do it. If I were to merely
have the code generate a form based on hidden tags and have javascript
auto-form submit, then I would open to security problems, because I could no
longer restrict the script the gateway respondes to by an HTTP_REFFER.

Because the clients order id that is generated will be stored as a session,
I need a way to reference the order ID and confirmation code that is
returned by the posted data from the gateway, against the session data to
start inserting the data into the DB if it was a successful charge.

Any ideas...? Maybe there's a quick solution out there I am just
overlooking. The solution would be easy if I wasn't inserting all of my data
at the end of the process based on the session data. But this is how the
code is has to work, so what do you all think, how should I deal with this?

Thanks,

FT


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