php-general Digest 7 Jan 2002 03:33:33 -0000 Issue 1096

Topics (messages 79610 through 79642):

Re: What can I use instead?
        79610 by: Gerald Artman

Internal Server Error?
        79611 by: GoodFella
        79615 by: Kraa de Simon

...  [PHP] Stupid question alert
        79612 by: tim at 10Kv

Re: [PHP-DB] PHP/MySql - address book
        79613 by: Andrey Hristov

Re: distinct element from array
        79614 by: George Nicolae

setcookie()
        79616 by: Tyler Longren
        79619 by: George Nicolae
        79623 by: Casey Allen Shobe
        79637 by: Tyler Longren
        79638 by: Billy Harvey

PHP Parsing Efficiency
        79617 by: Marvin Sanders
        79629 by: Bogdan Stancescu

Re: [PHP-DB] mysql_num_rows
        79618 by: Andrey Hristov

Re: take links from url
        79620 by: Matt Moreton

Re: PHP Security Alert for Apache/Win32
        79621 by: LaserJetter
        79630 by: David

Re: Connect to IBM DB2
        79622 by: Maciej Uhlig
        79624 by: Casey Allen Shobe

Re: Can't get accurate day of year
        79625 by: Hugh Danaher

PHP4 and POP Email ?
        79626 by: Jason Caldwell
        79628 by: Bogdan Stancescu

Re: PHP software tool
        79627 by: Phillip Oertel

POSTing HTML into a database
        79631 by: James Arthur
        79633 by: Richard S. Crawford
        79634 by: Manuel Lemos
        79635 by: Adam Baratz

How to read/write form/into certain place in a text file
        79632 by: Zhang, Leon (STHK/Zh)

php-mysql connectivity problem
        79636 by: Vu Hoang Huynh

Remote Cookie ID and Web Statistics
        79639 by: Richard Spangenberg

bcc
        79640 by: Deependra B. Tandukar

Remote Javascript call to PHP MySQL Database
        79641 by: Richard Spangenberg
        79642 by: Richard Spangenberg

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
On 1/6/02 10:15 AM, "Mark Evans" <[EMAIL PROTECTED]> wrote:

> I am writing a piece of code that uses contstant names that are dynamic.

Is this an oximoron?
Just a thought...

--- End Message ---
--- Begin Message ---
Hello,

Does anybody have any ideas why the code below is giving me internal server errors?

if (!isset($PHP_AUTH_USER)) {

 header('WWW-Authenticate: Basic realm="XYZ Company Admin Area"');
 header('HTTP/1.0 401 Unauthorized');
 echo 'Authorization Required.';
 exit;

} else if (isset($PHP_AUTH_USER)) {

 if (($PHP_AUTH_USER != "admin") || ($PHP_AUTH_PW != "password")) {
 
  header('WWW-Authenticate: Basic realm="XYZ Company Admin Area"');
  header('HTTP/1.0 401 Unauthorized');
  echo 'Authorization Required.';
  exit;


Do I need to set or change anything in my PHP set-up?

Thanks in advance,

GF.
--- End Message ---
--- Begin Message ---
This only works if PHP is installed as an Apache module on the Linux/UNIX
platforms.

>From the docs:

One additional note about PHP: if PHP is installed as an Apache module on
the Linux/UNIX platforms, there are additional global variables available to
your PHP script: 

$PHP_AUTH_USER -- Authenticated User name 
$PHP_AUTH_PW -- Authenticated Password 
$PHP_AUTH_TYPE -- Authentication Type 

Additionally, your PHP program can force Apache to prompt the user for a
username and password with the following PHP commands: 

header('WWW-Authenticate: Basic realm="My Private Stuff"'); 
header('HTTP/1.0 401 Unauthorized'); 
echo 'Authorization Required.'; 

>From then on, your application logic can decide how to respond to the user.
Note that on the Windows platform, PHP is installed as a CGI, and these
features are therefore not available. 

> -----Original Message-----
> From: GoodFella [mailto:[EMAIL PROTECTED]]
> Sent: zondag 6 januari 2002 17:31
> To: php Mail
> Subject: [PHP] Internal Server Error?
> 
> 
> Hello,
> 
> Does anybody have any ideas why the code below is giving me 
> internal server errors?
> 
> if (!isset($PHP_AUTH_USER)) {
> 
>  header('WWW-Authenticate: Basic realm="XYZ Company Admin Area"');
>  header('HTTP/1.0 401 Unauthorized');
>  echo 'Authorization Required.';
>  exit;
> 
> } else if (isset($PHP_AUTH_USER)) {
> 
>  if (($PHP_AUTH_USER != "admin") || ($PHP_AUTH_PW != "password")) {
>  
>   header('WWW-Authenticate: Basic realm="XYZ Company Admin Area"');
>   header('HTTP/1.0 401 Unauthorized');
>   echo 'Authorization Required.';
>   exit;
> 
> 
> Do I need to set or change anything in my PHP set-up?
> 
> Thanks in advance,
> 
> GF.
> 
--- End Message ---
--- Begin Message ---

Thanks for everyone's comments. If I understand what you are saying it
should be possible to fill the content of a layer by issuing some sort of
server include command.. (?)  So, for example, rather than have a something
that looks like this:

<div id="haiti" style="position:absolute; left:752px; top:321px;
width:166px; height:162px; z-index:14; visibility: hidden">
  <table width=166 border=0 cellpadding=0 cellspacing=0>
    <tr> 
      <td> <img src="Atlas/images/photolayer_11.gif" width=81
height=55></td>
      <td> <img src="Atlas/images/photolayer_12.gif" width=85
height=55></td>
    </tr>
    <tr> 
      <td> <img src="Atlas/images/photolayer_14.gif" width=81
height=53></td>
      <td> <img src="Atlas/images/photolayer_15.gif" width=85
height=53></td>
    </tr>
    <tr> 
      <td> <img src="Atlas/haiti_17.gif" width=81 height=55></td>
      <td> <img src="Atlas/haiti_18.gif" width=85 height=55></td>
    </tr>
  </table>
</div>

It should be possible to have some code that gives the layer position but
rather than then having all the other code describing the layer contents,
have some sort of php command that says 'get the contents from file
xxx.php'. If this is the case what should I be learning about to make this
happen?

Thanks again,

Tim

(standing on the shoulders of giants)




> Your question is not stupid - it's just uninformed, and that's easily
> understandable if you never used PHP.
> 
> The concept is dynamically creating the page SERVER-SIDE. That is, use some
> databases or some nifty code to dynamically build a page using specific
> parameters. Unforunately for you, this means that all the fun ends on the
> server
> side. Once PHP ends its job, Apache takes over and serves the content
> generated
> by PHP as it would serve any regular file. What you actually pass to the
> client
> is "dead" information - it's not dynamic unless you echo some JavaScript code
> or
> something similar from PHP (which is the same as writing the respective code
> in
> a regular file, unless you create some custom parameters in JavaScript based
> on
> some other parameters you pass to PHP).
> 
> Hope my explanation makes sense... ;-)
> 
> Bogdan
> 
> tim at 10Kv wrote:
> 
>> Hi,
>> 
>> first of all apologise to the list ­ this is a very basic question for you
>> I¹m sure. I have tried to find an answer on the web but the problem is
>> knowing HOW to ask the question ­ and I hoping you can provide me with a
>> starting point.
>> 
>> Anyway.. I design a lot of graphic intensive pages which rely heavily on
>> layers that contain images, mouseovers and image swaps. The trouble is, when
>> there are more than a couple of these layers on a page the code gets long
>> and over complicated.  For example, if I have a page which on one side
>> contains an image map with 5 clickable points that shows one of 5 possible
>> layers on the other side of the page  (each with different content)  this is
>> automatically a page with lots of code which is slow to load ­ especially if
>> the page already has a layer based navigation bar!
>> 
>> My question is: is there a way to use a language like php to make this
>> process easier? For example populate the layers from a different file rather
>> than have all the code on the same page and perhaps slim the page down a
>> little ­ or is this missing the point of what a language like php is about.
>> 
>> Thanks for your help and my apologies if this is the worst question of the
>> week.
>> 
>> Tim Rogers
> 

--- End Message ---
--- Begin Message ---
The answer to your question is the relational model of databases.
So instead of one big table, you have to use 2. Say first table is employee and the 
second - companies.
in the employee we have some fields and one of them is company_id,
this id corresponds to a single row in the companies table. companies table contains 
several fields nut one of them is company_id.
company_id is a foreign key (the link you ask).

How to get all employees from single company:
select employee.* from employee,companies where 
employee.company_id=companies.company_id and companies.company_name='Some Ltd.
Inc.';
or better
select employee.* from employee left join companies using(company_id) where 
company_name='Some Ltd Inc.';

I do not have links to literature about relational model but I remember that on 
www.phpbuilder.com there is/are some info on it.I
think from y.2000.

Regards,
Andrey Hristov

Andrey Hristov
Web Developer
----- Original Message -----
From: "sg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 06, 2002 7:26 PM
Subject: [PHP-DB] PHP/MySql - address book


> Hi,
>
> I'm trying to do a sort of address book where I'd put all information about
> anybody or any company from which I receive informtation (friend, people
> from work, hotels, places...)
>
> An entry starts with a name, then I can have any type of information. The
> table I'm using has a lot of fields, but I display via PHP only those that
> are not empty.
>
> I'm now facing a problem many must have already faced. A lot of people work
> for the same company, and I'd like to have a separate table or storage area
> to put that data, so that I don't have to write the same company addresse
> twice, and if that information changes, I won't have to go through ten or
> twenty people's entries to modify it.
>
> So how would I link a company's information to a person's entry?
>
> I know it may sound easy or ridiculous a question, but though I know HTML
> very well I'm still a beginner (learning on my own) et PHP and MySql.
>
> So far I have a neat rendering of the database I've created, but I feel I
> should look further into DB use.
>
> Software I'm using:
>
> EasyPHP (latest version)
> PHP 4
> MySql
> PhpMyAdmin
>
> on Windows Me
>
> Main question, I repeat is : how would I link a company's information to a
> person's entry?
>
> Cheers
>
> Sébastien
>
>
>
> --
> 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 Message ---
--- Begin Message ---
array_keys(array_count_values($foo));

--


Best regards,
George Nicolae
IT Manager
___________________
X-Playin - Professional Web Design
www.x-playin.f2s.com



"Kancha ." <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> An array contains various values eg: list of fruits.
> Now i want to retrieve only unique fruits from the
> array. The array may contain duplicate names. How can
> i achieve this?
>
> __________________________________________________
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/


--- End Message ---
--- Begin Message ---
Hello,

I need to set a cookie to store a username, password, and passcode forever
(never expires).  I don't really know how to use the setcookie() function.
Could someone show me the proper way to use the setcookie() function to do
this?

Thanks,
Tyler

--- End Message ---
--- Begin Message ---
man first of all look in the manual. there it is very clear...

http://www.php.net/manual/en/function.setcookie.php

--


Best regards,
George Nicolae
IT Manager
___________________
X-Playin - Professional Web Design
www.x-playin.f2s.com



"Tyler Longren" <[EMAIL PROTECTED]> wrote in message
000901c196e7$71df35b0$0101a8c0@nightengale">news:000901c196e7$71df35b0$0101a8c0@nightengale...
> Hello,
>
> I need to set a cookie to store a username, password, and passcode forever
> (never expires).  I don't really know how to use the setcookie() function.
> Could someone show me the proper way to use the setcookie() function to do
> this?
>
> Thanks,
> Tyler
>


--- End Message ---
--- Begin Message ---
Here's a compilation of some recent conclusions I've gotten from the same 
discussion:

This is how I chose to set the variables:

// $username and $password are passed from a previous page's form.
$time = mktime()+1800;
$date = gmdate("D, d-M-Y H:i:s", ($time));
$password = md5 ($password);

header ('Set-Cookie: username='.$username.'; expires='.$date.' GMT; path=/; 
domain='.$SERVER_ADDR);
header ('Set-Cookie: password='.$password.'; expires='.$date.' GMT; path=/; 
domain='.$SERVER_ADDR);

Produces:

Set-Cookie: username=Rasmus; expires=Wed, 12-Dec-2001 21:58:55 GMT; path=/;
domain=www.php.net
Set-Cookie: password=d41d8cd98f00b204e9800998ecf8427e;
expires=Wed, 12-Dec-2001 21:58:55 GMT; path=/; domain=www.php.net

Whereas these two calls (per Rasmus Lerdorf):

SetCookie('username',$username,time()+1800,'/',$SERVER_ADDR);
SetCookie('password',$password,time()+1800,'/',$SERVER_ADDR);

Produce:

Set-Cookie: username=Rasmus; expires=Wed, 12-Dec-01 21:58:55 GMT; path=/;
domain=www.php.net
Set-Cookie: password=d41d8cd98f00b204e9800998ecf8427e;
expires=Wed, 12-Dec-01 21:58:55 GMT; path=/; domain=www.php.net

Putting them side by side to make it easier to compare:

Set-Cookie: username=Rasmus; expires=Wed, 12-Dec-2001 21:58:55 GMT; path=/;
domain=www.php.net
Set-Cookie: username=Rasmus; expires=Wed, 12-Dec-01 21:58:55 GMT; path=/; 
domain=www.php.net

Ramsus wrote:
> They are identical except for the PHP SetCookie() version using a 2-digit
> year (which can be changed in your php.ini file with the y2k directive).

-- 
Casey Allen Shobe
[EMAIL PROTECTED]

'Why do people with closed minds always open their mouths?'
--- End Message ---
--- Begin Message ---
I have checked the manual.  A few times actually.

I have setcookie("usename", "$username");
Will that cookie never expire?  Or will it expire at the end of the browsing
session?  I couldn't find any details on that in the manual.

Tyler

----- Original Message -----
From: "George Nicolae" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 06, 2002 2:03 PM
Subject: [PHP] Re: setcookie()


> man first of all look in the manual. there it is very clear...
>
> http://www.php.net/manual/en/function.setcookie.php
>
> --
>
>
> Best regards,
> George Nicolae
> IT Manager
> ___________________
> X-Playin - Professional Web Design
> www.x-playin.f2s.com
>
>
>
> "Tyler Longren" <[EMAIL PROTECTED]> wrote in message
> 000901c196e7$71df35b0$0101a8c0@nightengale">news:000901c196e7$71df35b0$0101a8c0@nightengale...
> > Hello,
> >
> > I need to set a cookie to store a username, password, and passcode
forever
> > (never expires).  I don't really know how to use the setcookie()
function.
> > Could someone show me the proper way to use the setcookie() function to
do
> > this?
> >
> > Thanks,
> > Tyler
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>

--- End Message ---
--- Begin Message ---
On Sun, 2002-01-06 at 16:01, Tyler Longren wrote:
> I have checked the manual.  A few times actually.
> 
> I have setcookie("usename", "$username");
> Will that cookie never expire?  Or will it expire at the end of the browsing
> session?  I couldn't find any details on that in the manual.
> 
> Tyler

Tyler, the manual pages appear to have changed sometime recently.  They
used to state that the cookie would expire if no time was passed to it
when the browser was closed.  I do not see that statement there any
longer.

However, note the remarks about older versions of some browsers not
setting cookies properly unless the time is specified.  I have not
concerned myself with that on my sites, but it may be a factor to you.

Billy

--- End Message ---
--- Begin Message ---
Newbie question:

Is there any performance hit on a page with muliple PHP tags inserted
throughout HTML, compared with trying to concatenate all of the PHP
scripting into one set of tags?

Thanks for any advice!

Marvin


--- End Message ---
--- Begin Message ---
There may be a difference but even if it is, it's so small you shouldn't
consider it. Imagine how much it takes for a (generally) cached document to
be checked for "<?" or "<?php" or whatever you're using... Don't bother with
this one!

Bogdan

Marvin Sanders wrote:

> Newbie question:
>
> Is there any performance hit on a page with muliple PHP tags inserted
> throughout HTML, compared with trying to concatenate all of the PHP
> scripting into one set of tags?
>
> Thanks for any advice!
>
> Marvin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
That means the sql is not correct and the mysql_query()(mysql at all) didn't succeded 
to execute it
Check you sql statement.


Regards,
Andrey Hristov
----- Original Message ----- 
From: "Gurhan Ozen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 06, 2002 9:52 PM
Subject: [PHP-DB] mysql_num_rows


>   Hi everyone,
>  I have a problem with mysql connectivety which is making me nuts. If the
> query is "select blah, blah from table" (i.e. without where clause)
> mysql_num_rows returns the right number, but when i put in a query with
> where clause, although there are rows returned, PHP is giving:
> "Warning: Supplied argument is not a valid MySQL result resource" error..
> Can anyone point me to any direction about this?
>   Thanks.
> 
> Gurhan
> 
> 
> -- 
> 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 Message ---
--- Begin Message ---
You could use the following preg statement:

preg_match_all( "/<table>(.*(?=<\/table>))/", $string, $output,
PREG_SET_ORDER );

This would put all matches of <table>some code, text, whatever</table> into
the $output array.  however you would start to have problems when you come
across nested tables.  You'd need something to count how deep your nested if
you have nested table containers.

Regards

Matt.

----- Original Message -----
From: "Alawi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 06, 2002 7:47 AM
Subject: [PHP] take links from url


I want to take string between <table></table> tags in put it
in variable
How can I do that ?


--- End Message ---
--- Begin Message ---
Can you not just delete the ScriptAlias line?
What does that line actually do apart from create an Alias?

LJ

"David" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Wow!, i tried it and it really works, this is serious man! is there a fix
around it without safe mode like GED suggested?
>
> >Folks running Apache/Win32 should read this:
> >
> >http://www.securiteam.com/windowsntfocus/5ZP030U60U.html
> >
> >If you run in CGI mode you likely have a line similar to >the
> >following in your httpd.conf:
> >ScriptAlias /php/ \"C:php\"
> >
> >Also, if you run SAPI mode (apache plugin mode) and used
> >to run CGI, make sure that that line is commented out.
> >
> >Has someone else got an idea for a workaround, without >having
> >to go into safe-mode? Would safe-mode be able to prevent >this?
> >
> >-GED
> >
> >Northern.CA ===--
> >http://www.northern.ca
> >Canada\'s Search Engine
> >


--- End Message ---
--- Begin Message ---
 I tried playing with ScriptAlias settings, but i given up. I now use the the Apache 
module instead of cgi.

To change over to the Apache module:
copy php4ts.dll to the windows/system(win9x/Me) or winnt/system32(winNT/2000/XP) 
directory.

then inside httpd.conf:
LoadModule php4_module c:/php/sapi/php4apache.dll 
AddType application/x-httpd-php .php .phtml 

remember to comment out the most important part after converting:

#       ScriptAlias /php4/ \"C:/php/\"
#       Action application/x-httpd-php4 \"/php4/php.exe\"
#       AddType application/x-httpd-php4 .php

folks who are using PHP as a CGI under apache for win32, please read this:
http://www.securiteam.com/windowsntfocus/5ZP030U60U.html
http://www.hackers.com/new/currentnews.php?nid=5
--- End Message ---
--- Begin Message ---
This is probably not what you want but I found at
http://www.php.net/manual/en/install.configure.php something like that:

--with-ibm-db2[=DIR]
Include IBM DB2 support. DIR is the DB2 base install directory, defaults to
/home/db2inst1/sqllib.

Maybe you can make use of it, I don't run IBM DB2.

Maciek

> -----Original Message-----
> From: Jerry [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 02, 2002 2:14 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: [PHP] Connect to IBM DB2

> Now, how to connect to a DB2 database server without ODBC ?

--- End Message ---
--- Begin Message ---
Use IBMs DB2 Connect client and compile php --with-db2.  I use the server and 
the client on linux platforms and have never been so happy with database work 
;).

I've alse used iODBC with the db2 libraries to talk to DB2 with no real 
performance change.

- Casey

On Wednesday 02 January 2002 08:13 am, Jerry wrote:
> Now, how to connect to a DB2 database server without ODBC ?

-- 
Casey Allen Shobe
[EMAIL PROTECTED]

'Why do people with closed minds always open their mouths?'
--- End Message ---
--- Begin Message ---
Austin,
Thanks for your input regarding the date(z) question.  I did try
ceil(date(z)) but the output using 'z' is an integer.  I just used date(z)+1
and moved on.
Thanks again,
Hugh
----- Original Message -----
From: Austin Gonyou <[EMAIL PROTECTED]>
To: Hugh Danaher <[EMAIL PROTECTED]>
Sent: Saturday, January 05, 2002 11:43 PM
Subject: Re: [PHP] Can't get accurate day of year



--- End Message ---
--- Begin Message ---
Is there a way I can * download * emails and save them to disk (as
individual emails) with PHP?  I know I can send (SMTP) -- but has anyone
written a PHP program that receives emails?

Thanks.
Jason



--- End Message ---
--- Begin Message ---
You may check out IMP for a program. The functions you're looking for are
listed in the documentation under IMAP mail (it's a generic set of functions
for both IMAP and POP).

Bogdan

Jason Caldwell wrote:

> Is there a way I can * download * emails and save them to disk (as
> individual emails) with PHP?  I know I can send (SMTP) -- but has anyone
> written a PHP program that receives emails?
>
> Thanks.
> Jason
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Yoep wrote:

> I use this one too... its just 20$ or so though, and is a very great and
> convient editor. I do all my PHP coding in it.


ACK. phil


--- End Message ---
--- Begin Message ---
Hi

I need a user to be able to enter submit HTML code (also perhaps containing 
PHP code) via a web form, which will then be entered into a database.

The data is typed in to a textarea, which is then posted to my script. I 
notice that some special characters come out of this process escaped, but the 
escaping sequence does not appear to be entirely compatible with the SQL 
query I'm using to insert it into a table.

Can anyone tell me the correct way to convert the output from the form into a 
format that PostgreSQL will accept, and then how to convert it back so that 
it's identical to what the user entered before being escaped by post (so that 
I can just use print to print it out)?

Thanks.

--jaa

--- End Message ---
--- Begin Message ---
I've used a combination of addslashes() and stripslashes() along with 
htmlspecialchars() to perform just that sort of thing, though I used MySQL 
instead of PostreSQL.

Does anyone know, by the way, if there's a port of PostreSQL to Windows 
2000?  Or can I run it in Cygwin?


At 03:45 PM 1/6/2002, James Arthur wrote:
>Hi
>
>I need a user to be able to enter submit HTML code (also perhaps containing
>PHP code) via a web form, which will then be entered into a database.
>
>The data is typed in to a textarea, which is then posted to my script. I
>notice that some special characters come out of this process escaped, but the
>escaping sequence does not appear to be entirely compatible with the SQL
>query I'm using to insert it into a table.
>
>Can anyone tell me the correct way to convert the output from the form into a
>format that PostgreSQL will accept, and then how to convert it back so that
>it's identical to what the user entered before being escaped by post (so that
>I can just use print to print it out)?
>
>Thanks.
>
>--jaa
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


Sliante,
Richard S. Crawford

http://www.mossroot.com
AIM: Buffalo2K   ICQ: 11646404  Y!: rscrawford
MSN: [EMAIL PROTECTED]

"It is only with the heart that we see rightly; what is essential is 
invisible to the eye."  --Antoine de Saint Exupéry

"Push the button, Max!"

--- End Message ---
--- Begin Message ---
Hello,

James Arthur wrote:
> 
> Hi
> 
> I need a user to be able to enter submit HTML code (also perhaps containing
> PHP code) via a web form, which will then be entered into a database.
> 
> The data is typed in to a textarea, which is then posted to my script. I
> notice that some special characters come out of this process escaped, but the
> escaping sequence does not appear to be entirely compatible with the SQL
> query I'm using to insert it into a table.
> 
> Can anyone tell me the correct way to convert the output from the form into a
> format that PostgreSQL will accept, and then how to convert it back so that
> it's identical to what the user entered before being escaped by post (so that
> I can just use print to print it out)?

If you really need to store and retrive amounts of data of arbitrary
size, you need to use large object fields (LOBs). The usage of this type
of fields varies a lot with the type of database that you are using.

You may want to try Metabase which is a database abstraction package
that provides a database independent API to let you access to
information stored in SQL databases. One of the aspects that Metabase
handles for you with a single set of functions that does not depend on
the database is creating, storing and retrieving data from tables with
large object fields (LOBs).

Take a look here, where you will find Metabase classes and also
comprehensive reference documentation and a tutorial that not only tells
you how to use Metabase capabilities, but also provides a good
introduction to Large Object fields among other not so trivial to use
database features, like transactions, prepared queries, etc...

http://phpclasses.UpperDesign.com/browse.html/package/20

Regards,
Manuel Lemos
--- End Message ---
--- Begin Message ---
> Does anyone know, by the way, if there's a port of PostreSQL to Windows
> 2000?  Or can I run it in Cygwin?

I've seen it in the package list for Cygwin, there may be a full port as
well, check Postgres' web site.

-Adam

--- End Message ---
--- Begin Message ---
hi,
   A text file has been formatted ,how to read/write form/into certain place in a text file.
For example,read form letter 5 to 10 in line 4 ,and after some procedure ,write into the same place.
  Another question is that if a user has opened the file to read and write ,what will happen if another one will open and write the same file?
  Thank you in advance.
 
Leon
--- End Message ---
--- Begin Message ---
Hi all,

I'm a newbie to PHP and mySQL and I'm currently running PHP+mySQL on my
Linux 2.2.16 kernel. Every time I try to connect to mySQL from a php page, I
get this error message:

ERROR 2002: Can't connect to local MySQL server through socket
'/var/lib/mysql/mys
ql.sock' (111)

FYI: mysqld was running, and I use the following function
in the php script to access mysql database
$db = mysql_connect("localhost","username","password");

What does that mean and how do I go about solving it?

Thanks in advance for your directions and have a great new year.

Best regards,



--- End Message ---
--- Begin Message ---
Hello, - for something a little different...

Does anyone have experience using Javascript on remote server html delivered
pages to capture data in a PHP MySQL database resident at my domain.

I would like to build a customer profile database for a customer using a
permanent cookie on a visitor's browser client to ID them and track their
visits by page over time.  This is similar to a live or remote web
statistics process for a session but posting to a mysql database by some
mapped category by page in addition to the web stats.  I'd like to track
both the session and by posting to a visitor database, long term trends as
well.

Any suggestions would be appreciated.

Thanks, Rick
[EMAIL PROTECTED]



--- End Message ---
--- Begin Message ---
Greetings !

Is Bcc supported in PHP?

Looking forward to hearing from you.

Warm Regards,
DT

--- End Message ---
--- Begin Message ---
Does anyone have experience using Javascript on remote pages to capture data
in a PHP MySQL database. I would like to build a customer profile database
for a customer using a permanent cookie on a site visitor's machine to ID
them and track their usage.

Any suggestions would be appreciated.

Moderator:  I don't seem to be able to get the automated system to accept my
email address, please enroll me in this group.

Thanks,...

Rick

[EMAIL PROTECTED]





--- End Message ---
--- Begin Message ---
Note: Please disregard this message as it was restated and resent recently.
================================================

"Richard Spangenberg" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Does anyone have experience using Javascript on remote pages to capture
data
> in a PHP MySQL database. I would like to build a customer profile database
> for a customer using a permanent cookie on a site visitor's machine to ID
> them and track their usage.
>
> Any suggestions would be appreciated.
>
> Moderator:  I don't seem to be able to get the automated system to accept
my
> email address, please enroll me in this group.
>
> Thanks,...
>
> Rick
>
> [EMAIL PROTECTED]
>
>
>
>
>


--- End Message ---

Reply via email to