RE: [PHP] ssh command in php script

2003-11-11 Thread Warren Vail
Don't know if this will help, but I worked on one implementation that
involved writing a daemon (we used perl, but php would work as well) which
runs as a user privileged script (started from cron), and waits for a
connection from my web app, and verifies that the request is coming from the
proper server and script, executes the ssh, and returns the controlled
result to the web app.  We also used this daemon to fork some processes and
create multi-threaded collection process (but that's another nut).

In my case the apache web server tasks ran as a user named nobody, which
had no system privileges at all, a common safeguard, on RH Linux.

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED]
Sent: Monday, November 10, 2003 10:38 PM
To: tirumal b
Cc: PHP-General
Subject: Re: [PHP] ssh command in php script


On Tue, 2003-11-11 at 01:34, tirumal b wrote:
 Hello All

 I have written the following command in PHP script
 echo `ssh ipaddr command`. I have the remote ip
 addr as trusted, dont ask for the password at all.
 when the execute the php file from the browser it does
 not go to the remote ip at all though this command
 works fine in a normal bash script. what is the
 problem. Thanks in advance.

Shell commands run from the browser inherit the browser's user -- this
is usually httpd or apache.

Cheers,
Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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

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



[PHP] Re: ssh within PHP

2003-11-11 Thread tirumal b
Hello All,

 Its enough if i have the apache privileges. Can i
login to apache user and to remote computer apache
user with public key authentication and run some
command there.

thank you


 On Tue, 2003-11-11 at 01:34, tirumal b wrote:
  Hello All
  
  I have written the following command in PHP script
  echo `ssh ipaddr command`. I have the remote
ip
  addr as trusted, dont ask for the password at all.
  when the execute the php file from the browser it
does
  not go to the remote ip at all though this command
  works fine in a normal bash script. what is the
  problem. Thanks in advance.
 
 Shell commands run from the browser inherit the
browser's user -- 
this
 is usually httpd or apache.

Correct: doesn't inherit the browser's user, but
inherit's the web
server's user.

Cheers,
Rob.
-- 


__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

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



Re: [PHP] Re: ssh within PHP

2003-11-11 Thread Eugene Lee
On Mon, Nov 10, 2003 at 11:05:02PM -0800, tirumal b wrote:
: 
:  Its enough if i have the apache privileges. Can i
: login to apache user and to remote computer apache
: user with public key authentication and run some
: command there.

Usually, the user that Apache runs under does not have a real shell.
And ssh by default (and for good security reasons) is configured to
disallow logins for users that do not have a real shell.

If you need a web-based method to run a program as a specific user,
consider suexec:

http://httpd.apache.org/docs/suexec.html

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



[PHP] Share Folder...

2003-11-11 Thread D. Jame
Hi, 

I have three machine 1, 2, 3. all online  have unique IP. one of them (no. 3) running 
web server which configured with PHP, 
now my problem is  
I want to show share directory on Web page to my users. when they enter IP of machine 
1 or  2...
anyone to know...plz help me..


jame




[PHP] Reset auto_increment field

2003-11-11 Thread Christian Ista
Hello,

It's not really a PHP question, sorry.

How reset a MySQL auto_incrment field ?

Thanks,

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



Re: [PHP] Reset auto_increment field

2003-11-11 Thread Pavel Jartsev
Christian Ista wrote:
How reset a MySQL auto_incrment field ?

ALTER TABLE table_name AUTO_INCREMENT = value

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


Re: [PHP] Reset auto_increment field

2003-11-11 Thread Eugene Lee
On Tue, Nov 11, 2003 at 10:34:17AM +0100, Christian Ista wrote:
: 
: It's not really a PHP question, sorry.
: 
: How reset a MySQL auto_incrment field ?

There are several suggestions in the User Comments of MySQL's online
documentation.  You should check them out.

http://www.mysql.com/doc/en/example-AUTO_INCREMENT.html

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



[PHP] get method http 1.1 eror

2003-11-11 Thread QT
Dear Sirs,

I am using following method for GET but I am getting this error from server;

HTTP/1.1 505 HTTP Version Not Supported Content-Type: text/plain Date: Tue,
11 Nov 2003 10:08:44 GMT Server: Apache Coyote/1.0 Connection: close

?php
$fp = fsockopen (www.example.com, 80, $errno, $errstr, 30);
if (!$fp) {
echo $errstr ($errno)br\n;
} else {
fputs ($fp, GET / HTTP/1.0\r\nHost: www.example.com\r\n\r\n);
while (!feof($fp)) {
echo fgets ($fp,128);
}
fclose ($fp);
}
?What should I do? I can't find any solutionBest Regards

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



[PHP] HTML2PDF on the fly

2003-11-11 Thread K. Praveen Kumar
Hi all,
 Can anybody tell me how can I convert the HTML to PDF on the fly. I
have a HTML form which should be converted into PDF after filling and
submitting it. Please give me your valuable suggestions. I have been
using HTMLDOC-1.8.23.

executing the below code giving error.This code is given in HTMLDOC.

?php

function topdf($filename, $options = ) {
# Write the content type to the client...
header(Content-Type: application/pdf);
flush();
# Run HTMLDOC to provide the PDF file to the user...
passthru(htmldoc --no-localfiles --no-compression -t pdf14 --quiet
--jpeg --webpage .$options $filename);
}


//
// 'bad_url()' - See if the URL contains bad characters...
//

function bad_url($url) {
// See if the URL starts with http: or https:...
if (strncmp($url, http://;, 7) != 0 
strncmp($url, https://;, 8) != 0) {
return 1;
}

// Check for bad characters in the URL...
$len = strlen($url);
for ($i = 0; $i  $len; $i ++) {
if (!strchr(~_*()/:%?+-@;=,$., $url[$i]) 
!ctype_alnum($url[$i])) {
return 1;
}
}

return 0;
}

//
// MAIN ENTRY - Pass the trailing path info in to HTMLDOC...
//

global $SERVER_NAME;
global $SERVER_PORT;
global $PATH_INFO;
global $QUERY_STRING;

if ($QUERY_STRING != ) {
$url = ${QUERY_STRING};
//$url=http://${SERVER_NAME}:${SERVER_PORT}${PATH_INFO}?${QUERY_STRING}
} else {
$url = http://${SERVER_NAME}:${SERVER_PORT}$PATH_INFO;;
}

if (bad_url($url)) {
  print(HTMLHEADTITLEBad URL/TITLE/HEAD\n
   .BODYH1Bad URL/H1\n
   .PThe URL BTT$url/TT/B is bad./P\n
   ./BODY/HTML\n);
} else {
  topdf($url);
}
?
-- 
Thanks  Regards
Praveen Kumar
SoftPro Systems Ltd

---SOFTPRO DISCLAIMER--

Information contained in this E-MAIL and any attachments are
confidential being  proprietary to SOFTPRO SYSTEMS  is 'privileged'
and 'confidential'.

If you are not an intended or authorised recipient of this E-MAIL or
have received it in error, You are notified that any use, copying or
dissemination  of the information contained in this E-MAIL in any
manner whatsoever is strictly prohibited. Please delete it immediately
and notify the sender by E-MAIL.

In such a case reading, reproducing, printing or further dissemination
of this E-MAIL is strictly prohibited and may be unlawful.

SOFTPRO SYSYTEMS does not REPRESENT or WARRANT that an attachment
hereto is free from computer viruses or other defects. 

The opinions expressed in this E-MAIL and any ATTACHEMENTS may be
those of the author and are not necessarily those of SOFTPRO SYSTEMS.


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



Re: [PHP] get method http 1.1 eror

2003-11-11 Thread Marek Kilimajer
QT wrote:
Dear Sirs,

I am using following method for GET but I am getting this error from server;

HTTP/1.1 505 HTTP Version Not Supported Content-Type: text/plain Date: Tue,
11 Nov 2003 10:08:44 GMT Server: Apache Coyote/1.0 Connection: close
Weird. Use HTTP/1.1 then. And add Connection: close header.

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


Re: [PHP] HTML2PDF on the fly

2003-11-11 Thread Burhan Khalid
K. Praveen Kumar wrote:
Hi all,
 Can anybody tell me how can I convert the HTML to PDF on the fly. I
have a HTML form which should be converted into PDF after filling and
submitting it. Please give me your valuable suggestions. I have been
using HTMLDOC-1.8.23.
http://www.fpdf.org
http://www.php.net/pdf
executing the below code giving error.This code is given in HTMLDOC.
What error?

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
---
Documentation is like sex: when it is good,
 it is very, very good; and when it is bad,
 it is better than nothing.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] displaying numbers up to 2 places of decimal.

2003-11-11 Thread Burhan Khalid
Binay wrote:

Hi all !

I want to display numbers(integer,float,double) up to 2 places of decimal i.e if number is interger say 10, then i want to display it like 10.00.
STFA this question comes up one every 2 days.

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
---
Documentation is like sex: when it is good,
 it is very, very good; and when it is bad,
 it is better than nothing.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] HTML2PDF on the fly

2003-11-11 Thread K. Praveen Kumar
This is the error I am getting while executing the script.

File does not begin with '%PDF-'.

-- 
Thanks  Regards
Praveen Kumar
SoftPro Systems Ltd
On Tue, 2003-11-11 at 16:29, Burhan Khalid wrote:
 K. Praveen Kumar wrote:
  Hi all,
   Can anybody tell me how can I convert the HTML to PDF on the fly. I
  have a HTML form which should be converted into PDF after filling and
  submitting it. Please give me your valuable suggestions. I have been
  using HTMLDOC-1.8.23.
 
 http://www.fpdf.org
 http://www.php.net/pdf
 
  executing the below code giving error.This code is given in HTMLDOC.
 
 What error?


---SOFTPRO DISCLAIMER--

Information contained in this E-MAIL and any attachments are
confidential being  proprietary to SOFTPRO SYSTEMS  is 'privileged'
and 'confidential'.

If you are not an intended or authorised recipient of this E-MAIL or
have received it in error, You are notified that any use, copying or
dissemination  of the information contained in this E-MAIL in any
manner whatsoever is strictly prohibited. Please delete it immediately
and notify the sender by E-MAIL.

In such a case reading, reproducing, printing or further dissemination
of this E-MAIL is strictly prohibited and may be unlawful.

SOFTPRO SYSYTEMS does not REPRESENT or WARRANT that an attachment
hereto is free from computer viruses or other defects. 

The opinions expressed in this E-MAIL and any ATTACHEMENTS may be
those of the author and are not necessarily those of SOFTPRO SYSTEMS.


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



Re: [PHP] DW Php update record form with menu from another table

2003-11-11 Thread Burhan Khalid
Robb Kerr wrote:

I'm using Dreamweaver's Update Record form wizard to create a record
update page. Most of the fields are text, one is file and I want one of
them to be a menu. The menu field should be populated with the fields
of another table.
Here's the problem... If I leave all of the fields as text input fields,
the form works fine. But, as soon as I change the manufacturers field to
a drop-down menu populated with entries from another table, I get the
following error when accessing the page...
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in
/home/s/k/user992816/html/RobesonWeb/admin/adminEditSpecials.php on line
106
Please also post line 103, 104, 105 and 107,108,109

line 106 reads...

option value=?php echo $row_rs_RobesonWebManufacturer['manufacturer']?
?php if (!(strcmp($row_rs_RobesonWebManufacturer['manufacturer'],
$row_rs_RobesonWebSpecials[\'manufacturer\']))) {echo SELECTED;}
??php echo $row_rs_RobesonWebManufacturer['manufacturer']?/option
Try

?php if (!(strcmp($row_rs_RobesonWebManufacturer['manufacturer'],
 $row_rs_RobesonWebSpecials['manufacturer']))) {echo SELECTED;}
Needless to say, this line is embedded in this Php code to create the
drop-down menu...
select name=manufacturer
?php 
 do {  
 ?
  option value=?php echo
$row_rs_RobesonWebManufacturer['manufacturer']? ?php if
(!(strcmp($row_rs_RobesonWebManufacturer['manufacturer'],
$row_rs_RobesonWebSpecials[\'manufacturer\']))) {echo SELECTED;}
??php echo $row_rs_RobesonWebManufacturer['manufacturer']?/option
 ?php
   } while ($row_rs_RobesonWebManufacturer = mysql_fetch_assoc
$rs_RobesonWebManufacturer));
?
/select

What's up? These drop-downs from another table work fine in Add forms.
They just seem to crap out in Update forms. It was suggested that I
needed to create recordsets for both the menu and the rest of the form. I
did that and the form still doesn't work. Attached is the entire page
for consulting.
Please don't send attachments with your messages.  If you need to show a 
lot of code, post it online somwhere ( www.pastebin.com for example )

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
---
Documentation is like sex: when it is good,
 it is very, very good; and when it is bad,
 it is better than nothing.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] help create community newbie guide to security

2003-11-11 Thread Lawrence Kennon


Chris Shiflett wrote:

 In some cases, the developer may want certain 
 HTML elements interpreted rather than escaped 
 in this way. Perhaps you could mention that 
 something like str_replace() can be used to 
 convert specific HTML entities back to their 
 original form. This method should filter any 
 unwanted elements.

For a BBS I would like to let users post links to various resources. They 'post' a 
message to the BBS via a form and that is stored in a MySQL db, then the content of 
their 'post' is available to other users on the BBS. Currently I strip out all 
PHP/HTML with the strip_tags() function. What I would really like to do is allow a 
limited set of HTML tags (like the anchor a tag) but at the same time implement 
reasonable protection.

In regards specifically to the HTML anchor tag a, are their guidelines for what 
should, and should not be allowed? In other words if I simply allow all of these tags 
(implementing the algorithim you mentioned above) are their potential problems with 
that? Or are there specific things I should be looking for with tags?

Thanks for your comments,

Lawrence Kennon
www.theNewAgeSite.com

 


-
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard

Re: [PHP] \n and br

2003-11-11 Thread Burhan Khalid
Chris Shiflett wrote:

--- Eugene Lee [EMAIL PROTECTED] wrote:

Warning: nl2br() is not safe because it emits br / tags which do
not always work on all browsers (especially browsers not explicitly
advertised to be XHTML-compliant).


Can you name a single browser that cannot properly render a br / tag?
I know NN 4.x has problems with br/ /found this out the hard way/ but 
I don't know of any browser that can't render br /.

Although I would love to be proved wrong here :P

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
---
Documentation is like sex: when it is good,
 it is very, very good; and when it is bad,
 it is better than nothing.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Dose this exist?

2003-11-11 Thread Burhan Khalid
Dave Carrera wrote:

Hi List,

Is there such a tool that will generate a form and relevant code when given
the mysql db-table-fields to update, select, insert etc ?
I ask as hand coding forms and the relevant php code is becoming very time
consuming and I need to speed up this operation.
Any URL's would be useful.
On reflection, maybe what you were looking for is something like 
codecharge? [ http://www.codecharge.com ]

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
---
Documentation is like sex: when it is good,
 it is very, very good; and when it is bad,
 it is better than nothing.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] HTML2PDF on the fly

2003-11-11 Thread Marek Kilimajer
Save the file and look at its content, you might have php errors in it.

K. Praveen Kumar wrote:
This is the error I am getting while executing the script.

File does not begin with '%PDF-'.

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


Re: [PHP] First test release of BTportal made!!!!

2003-11-11 Thread Burhan Khalid
Bas wrote:

It's avaiable on:

http://members.home.nl/famde.jong/portalBT-0.0.1.zip
Get your own list. php.general is not your personal announcement list.

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
---
Documentation is like sex: when it is good,
 it is very, very good; and when it is bad,
 it is better than nothing.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] mysql_list_fields() bug?

2003-11-11 Thread Jay Blanchard
[snip]
Ok, this ended up working well. I'm still wondering why in my example
function two() works, without needing to provide the resource identifier
to mysql_query(), how can mysql_query() pick up the resource identifier
automatically while mysql_list_fields does not?
[/snip]

From http://www.php.net/mysql_query

mysql_query() sends a query to the currently active database on the
server that's associated with the specified link identifier. --If
link_identifier isn't specified, the last opened link is assumed.-- If
no link is open, the function tries to establish a link as if
mysql_connect() was called with no arguments, and use it. The result of
the query is buffered.

mysql_list_fields() does not automagically use the last opened link

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



Re: [PHP] Share Folder...

2003-11-11 Thread Raditha Dissanayake
what os?

D. Jame wrote:

Hi, 

I have three machine 1, 2, 3. all online  have unique IP. one of them (no. 3) running web server which configured with PHP, 
now my problem is  
I want to show share directory on Web page to my users. when they enter IP of machine 1 or  2...
anyone to know...plz help me..

jame



 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] CDONTS Mail problem

2003-11-11 Thread PHPLover
Dear all,

I am not able to attach file using CDONTs component.
Could any one trace out what the problem is ??

The code I use is given below and I run on IIS on Windows 2000

@$CDONTS = new COM(CDONTS.NewMail);
@$CDONTS-From = [EMAIL PROTECTED];
@$CDONTS-To = [EMAIL PROTECTED];
@$CDONTS-BodyFormat = 0;
@$CDONTS-MailFormat = 0;
@$CDONTS-AttachFile(c:\test.txt) or die(cannot attach file);   
@$CDONTS-Subject = Satyam Mail Alert;
@$CDONTS-Body = body of mail;
@$CDONTS-Send();
@$CDONTS-Close();

Would be happy if anyone could suggest a different component.

Thanks  Regards, 
___ 
Vijay 
Corporate Communications 
Satyam Computer Services Limited 
TSR Towers, Rajbhavan Road 
Somajiguda, Hyderabad-500 082 
INDIA 

*  : +91 (40) 23306767 Extn 7825
*  : [EMAIL PROTECTED] 

Göd döësn't pläy dícë. 
- Älbërt Ëínstëín



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

[PHP] Delete Temporary Internet Files

2003-11-11 Thread Joe Mack
I am trying to use PHP to delete temporary internet files in IE6.  I would
also like to access other Internet Options functions.  Any assistance
would be appreciated.

Thanks.

Joe

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



[PHP] PHP, Java, a strange number...

2003-11-11 Thread Dom S
Hi,
I am having problems trying to get PHP to return a Java .jar file.
Basically, the jar is reported as corrupted by Opera, or any browser and
Java 1.3. I have tracked this down to a strange number at the start of the
message body:
If I access the jar file directly (no PHP), I get (viewed by packet
sniffing)

Header stuff,
Content Type: text/html; charset=ISO-8859-1
CRLF CRLF 190 CRLF
 jar file 

When I use:

?php
 header(Content-Type: text/html; charset=ISO-8859-1);
 readfile(tj.jar);
?


I get:
Header stuff,
Content Type: text/html; charset=ISO-8859-1
 jar file 

and it doesn't work.
So I tried adding:

?php
 header(Content-Type: text/html; charset=ISO-8859-1);
 header(\n\n190\n);
 readfile(../_JAVARES/car/jammer.jar);
?

and it works again, in ANY browser and ANY java version. So what is the
'190' at the start of the message all about?
It gets wierder though. My real PHP script has a session. and when I use:

?php
 session_start();
 header(Content-Type: text/html; charset=ISO-8859-1);
 readfile(tj.jar);
?

I now get:

Header stuff, including lots of cache-limiting bits
Content Type: text/html; charset=ISO-8859-1
CRLF CRLF 2000 CRLF
 jar file 

The '190' is now '2000', and this fails to load in Opera  Java 1.3, but
works with IE6  Java 1.1 or Java 1.3. So why is PHP changing this number to
2000? Is there a way to stop it?
Thank you for your time,

Dom

-- 

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



Re: [PHP] Delete Temporary Internet Files

2003-11-11 Thread Marek Kilimajer
Joe Mack wrote:

I am trying to use PHP to delete temporary internet files in IE6.  I would
also like to access other Internet Options functions.  Any assistance
would be appreciated.
PHP is server side, it cannot mess with browser this way. As on another 
list.

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


Re: [PHP] CDONTS Mail problem

2003-11-11 Thread Marek Kilimajer
PHPLover wrote:

Dear all,

I am not able to attach file using CDONTs component.
Could any one trace out what the problem is ??
The code I use is given below and I run on IIS on Windows 2000

@$CDONTS = new COM(CDONTS.NewMail);
@$CDONTS-From = [EMAIL PROTECTED];
@$CDONTS-To = [EMAIL PROTECTED];
@$CDONTS-BodyFormat = 0;
@$CDONTS-MailFormat = 0;
@$CDONTS-AttachFile(c:\test.txt) or die(cannot attach file);
@$CDONTS-Subject = Satyam Mail Alert;
@$CDONTS-Body = body of mail;
@$CDONTS-Send();
@$CDONTS-Close();
Would be happy if anyone could suggest a different component.
Not a COM component but plain old php class:
www.phpclasses.org/mimemessage
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] problem with mssql_query

2003-11-11 Thread bob pillford
Hi all i have the following code which isnt working correctly and i cant work out why. 
Any help would be greatly appreciated as its sending me crazy!

$query = select refno from campaign where appdate between 'nov 07 2003' and 'nov 08 
2003' ; 
$result=mssql_query($query,$numero);
$numrows=mssql_num_rows($result);
$row=mssql_fetch_row($result);
echo $numrows;
print_r($row);


Now this returns: 23
Array ( [0] = 1044998 ) 

which is 23 for number of rows the query returns but it only ever stores the 1st 
element of the returned array in $row.. Can someone tell me where i am going wrong as 
i need access to the other 22 rows that this query returns I have echoed the query 
and run the out put under freetds tsql and get the correct result (this is what i use 
to access the ms sql server 2000).

Any help would be greatly appreciated.!

Cheers

Bob



Re: [PHP] get method http 1.1 eror

2003-11-11 Thread Chris Shiflett
--- QT [EMAIL PROTECTED] wrote:
 I am using following method for GET but I am getting this error from
 server;
 
 HTTP/1.1 505 HTTP Version Not Supported

This means that the version of HTTP that you are using is not supported by
the server you are sending your request to.

 fputs ($fp, GET / HTTP/1.0\r\nHost: www.example.com\r\n\r\n);

Since you are sending the Host header, this is a valid HTTP/1.1 request,
so you can just go ahead and change your HTTP/1.0 to HTTP/1.1.

Hope that helps.

Chris

=
My Blog
 http://shiflett.org/
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



Re: [PHP] help create community newbie guide to security

2003-11-11 Thread Chris Shiflett
--- Lawrence Kennon [EMAIL PROTECTED] wrote:
 For a BBS I would like to let users post links to various resources.
 They 'post' a message to the BBS via a form and that is stored in a
 MySQL db, then the content of their 'post' is available to other users
 on the BBS. Currently I strip out all PHP/HTML with the strip_tags()
 function. What I would really like to do is allow a limited set of HTML
 tags (like the anchor a tag) but at the same time implement reasonable
 protection.

I prefer htmlentities() to strip_tags() in cases like this, because by
stripping tags, you eliminate the chance that your users can talk about
code. If you use htmlentities() instead, their code will appear exactly as
they typed it. You may not want this, but I thought I'd mention it.

 In regards specifically to the HTML anchor tag a, are their guidelines
 for what should, and should not be allowed?

Any tag like anchor is more difficult to deal with, because you have
attributes whose values can be anything. For something like a bold tag, on
the other hand, you can simply replace lt;bgt; with b and do the same
for the closing tag.

With tags like anchor, you want to determine two things:

1. Which attributes you want to allow, stripping all others (or the entire
anchor tag if this rule is broken). For example, you may want to begin by
only allowing href.
2. What the acceptable format is of each of the attributes you allow. For
example, with the href attribute, you probably want to only allow valid
URLs. If you allow anything, someone might be able to use some client-side
scripting trickery to do something you did not intend. It's better to be
safe.

I don't have any sample code to give you, but maybe someone else can pitch
in.

Hope that helps.

Chris

=
My Blog
 http://shiflett.org/
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



[PHP] Re: PHP, Java, a strange number...

2003-11-11 Thread Dom S
Please ignore - now posted to bug newsgroup

Dom S [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,
 I am having problems trying to get PHP to return a Java .jar file.
 Basically, the jar is reported as corrupted by Opera, or any browser and
 Java 1.3. I have tracked this down to a strange number at the start of the
 message body:
 If I access the jar file directly (no PHP), I get (viewed by packet
 sniffing)

 Header stuff,
 Content Type: text/html; charset=ISO-8859-1
 CRLF CRLF 190 CRLF
  jar file 

 When I use:

 ?php
  header(Content-Type: text/html; charset=ISO-8859-1);
  readfile(tj.jar);
 ?


 I get:
 Header stuff,
 Content Type: text/html; charset=ISO-8859-1
  jar file 

 and it doesn't work.
 So I tried adding:

 ?php
  header(Content-Type: text/html; charset=ISO-8859-1);
  header(\n\n190\n);
  readfile(../_JAVARES/car/jammer.jar);
 ?

 and it works again, in ANY browser and ANY java version. So what is the
 '190' at the start of the message all about?
 It gets wierder though. My real PHP script has a session. and when I use:

 ?php
  session_start();
  header(Content-Type: text/html; charset=ISO-8859-1);
  readfile(tj.jar);
 ?

 I now get:

 Header stuff, including lots of cache-limiting bits
 Content Type: text/html; charset=ISO-8859-1
 CRLF CRLF 2000 CRLF
  jar file 

 The '190' is now '2000', and this fails to load in Opera  Java 1.3, but
 works with IE6  Java 1.1 or Java 1.3. So why is PHP changing this number
to
 2000? Is there a way to stop it?
 Thank you for your time,

 Dom

 --

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



Re: [PHP] \n and br

2003-11-11 Thread Brian V Bonini
On Mon, 2003-11-10 at 20:21, Eugene Lee wrote:
 On Mon, Nov 10, 2003 at 04:05:07PM -0800, Chris Shiflett wrote:
 : 
 : --- Eugene Lee [EMAIL PROTECTED] wrote:
 : 
 :  Warning: nl2br() is not safe because it emits br / tags which do
 :  not always work on all browsers (especially browsers not explicitly
 :  advertised to be XHTML-compliant).
 : 
 : Can you name a single browser that cannot properly render a br / tag?
 
 There were rendering problems discovered with one popular web forum
 software called vBulletin.

So just change it

$string = nl2br($content-page_content);
$string = eregi_replace(br /, br, $string);


In light of this perhaps something like:

nl2br(string, int)

would be a nice addition where int is 1 or 2 for xhtml or html tags.
Although it's odd that this would break anything as it's purpose is
backward compatibility.

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



[PHP] Need OSC guru for some overflow...

2003-11-11 Thread Brian V Bonini
I've got some overflow work that requires some modifications to the
functionality of OSC. Would prefer to work with someone who's already
VERY VERY familiar with OSC, don't want to pay for learning time. Please
contact me @ [EMAIL PROTECTED]dotcom (remove 'dot' obviously) if
interested with 'OSC Guru' in the subject. 

Thanks!

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



Re: [PHP] help create community newbie guide to security

2003-11-11 Thread Adam i Agnieszka Gasiorowski FNORD
Chris W. Parker wrote:
 
 10. Use htmlentities() on data that will be put through a SQL query to
 prevent XSS attacks. http://php.net/htmlentities

How is it going to interact with MySQL FULLTEXT 
 search SQL queries, where the characters  and 
 are in use as modifiers?

-- 
Seks, seksi, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info  { iWanToDie }   WiNoNa)   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne ksztaty... http://www.opera.com 007

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



Re: [PHP] help create community newbie guide to security

2003-11-11 Thread Chris Shiflett
--- Adam i Agnieszka Gasiorowski FNORD [EMAIL PROTECTED] wrote:
 Chris W. Parker wrote:
  10. Use htmlentities() on data that will be put through a SQL query to
  prevent XSS attacks. http://php.net/htmlentities
 
   How is it going to interact with MySQL FULLTEXT 
  search SQL queries, where the characters  and 
  are in use as modifiers?

His suggestion was just that, a suggestion. You are the expert of your own
applications, so you know when it is best to follow a suggestion or ignore
it. Guidelines like this are mostly about exposing people to certain ideas
that make them open their eyes. If you understand the risk and can
mitigate it through other means, that is fine.

In your case, it might be best to use something like htmlentities() prior
to displaying the data to a user rather than prior to storage. Some data
filtering is still a good idea, of course, and you might want to consider
the data in the database tainted if your data filtering prior to storage
is incomplete whether by necessity or design.

The most common approach is to cleanse data as soon as possible, but this
isn't always best.

Hope that helps.

Chris

=
My Blog
 http://shiflett.org/
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



[PHP] Passing header info for use in downloading files...?

2003-11-11 Thread Tristan . Pretty
I have a page where the user clicks a link to download a file, but the 
file is out side of the root DIR.
passing certain variables in the link, (type, file_name) I call the 
correct file...
However, it's stopped working?
My code below shows how I select the correct mime info to pass to the 
header.. but I keep getting promted to download an HTML file all the 
time...

if ($type == 'pdf') {$mimeinfo = application/pdf;} else
if ($type == 'doc') {$mimeinfo = application/msword;} else
if ($type == 'exe') {$mimeinfo = application/octet-stream;} else
if ($type == 'ppt') {$mimeinfo = application/vnd.ms-powerpoint;} 
else
if ($type == 'xls') {$mimeinfo = application/vnd.ms-excel;} else
if ($type == 'xml') {$mimeinfo = text/xml;} else
if ($type == 'zip') {$mimeinfo = application/zip;}

header(Content-Disposition: attachment; filename=$file);
header(Content-Length:  . filesize($path));
header(Content-Type: $mimeinfo);
readfile($path);

My problem page is:
http://www.risk.sungard.com/download/?id=12617
click in the link 'Settlements ' and you'll see what I mean, it says 
it's a pdf, but when you have to specify the download location, it saves 
simply the html page?
can anyone spot my probably stupid error?

Tris...

*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***



[PHP] shell_exec with pipes

2003-11-11 Thread Mario Ohnewald
Hello List!
I have tried to get this command working with php for about 2Weeks now, and
i would like you to try to get this thing working.

This shell command:
/usr/local/bin/mplayer -identify -frames 0 /tmp/pitstop.mpeg 2/dev/null|
grep ID_LENGTH | cut -d = -f 2

gives me the result 16 back, the LENGHT of the filename.

$var=shell_exec(/usr/local/bin/mplayer -identify -frames 0
/tmp/pitstop.mpeg 2/dev/null| grep ID_LENGTH | cut -d = -f 2);

just wont for some reason! $var ist just empty.
I was playing around with stderr and stdout and stuff, but i dont know why
php wont deal with it as shell does.

$var=shell_exec(ls -al); 
for examle works just fine!

Could someone please give it a try, cause i have spent hours in irc channels
and googeling around to get this solved :/



Thanks a LOT!!

Mario

-- 
NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse für Mail, Message, More! +++

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



Re: [PHP] shell_exec with pipes

2003-11-11 Thread Aaron Gould
Have you tried escaping the pipes and quotes?  Try this:

$var=shell_exec(/usr/local/bin/mplayer -identify -frames 0 
/tmp/pitstop.mpeg 2/dev/null\| grep ID_LENGTH \| cut -d \=\ -f 2);

Mario Ohnewald wrote:

$var=shell_exec(/usr/local/bin/mplayer -identify -frames 0
/tmp/pitstop.mpeg 2/dev/null| grep ID_LENGTH | cut -d = -f 2);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] getaddrinfo failed in fsockopen()

2003-11-11 Thread Manuel Rodríguez Cayetano
Hi,

I am having problems while executing this simple
php script:

?
$fp = fsockopen (www.example.com, 80, $errno, $errstr, 30);
  if (!$fp)
{
  echo $errstr ($errno)br\n;
}
  else
{
  fputs ($fp, GET / HTTP/1.0\r\nHost: www.example.com\r\n\r\n);
  while (!feof($fp))
{
  echo fgets ($fp,128);
}
fclose ($fp);
}
?

The error message is:

---
Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name
does not resolv to supplied parameters; neither nodename nor servname were
passed. in /imports/home/gbien/ait/manrod/public_html/prueba_fsockopen.php
on line 2

Warning: fsockopen(): unable to connect to www.example.com:80 in
/imports/home/gbien/ait/manrod/public_html/prueba_fsockopen.php on line 2
Not owner (1)br
--

but DNS on the server is running. PHP version is 4.3.4, running on dec
alpha with True64 Unix V5.1 and configure options:

/configure' '--prefix=/usr/local/packages/php-4.3.4'
'--exec-prefix=/usr/local/packages/php-4.3.4/alpha-dec-osf5.1'
'--with-config-file-path'
'--with-apxs=/usr/local/packages/apache_1.3.29/alpha-dec-osf5.1/bin/apxs'
'--enable-force-cgi-redirect' '--enable-track-vars' '--with-gettext'
'--with-openssl' '--with-zlib' '--with-bz2' '--with-jpeg-dir'
'--with-tiff-dir' '--with-png-dir' '--with-xpm-dir' '--with-pgsql'
'--with-mm'

The same script executed in a Sparc server with Solaris 2.7, and the same
php version and configuration (but without postgresql support) gives no
errors...

Any help would be greatly appreciated. Thanks.

Manuel

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



[PHP] LDAP and PHP

2003-11-11 Thread Dave Dash
I'm having trouble getting LDAP to work with PHP.  ldap_connect results in:

 Fatal error: Call to undefined function: ldap_connect() in
/home/davedash/public_html/ldap.php on line 3

and when I compiled I enabled --enable-ldap.

Am I missing something else here?  I've got openldap installed as well.

Thanks for any help :)

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



Re: [PHP] shell_exec with pipes

2003-11-11 Thread Mario Ohnewald
 Have you tried escaping the pipes and quotes?  Try this:
 
 $var=shell_exec(/usr/local/bin/mplayer -identify -frames 0 
 /tmp/pitstop.mpeg 2/dev/null\| grep ID_LENGTH \| cut -d \=\ -f 2);

nope, still get nothing back.

 
 Mario Ohnewald wrote:
 
  $var=shell_exec(/usr/local/bin/mplayer -identify -frames 0
  /tmp/pitstop.mpeg 2/dev/null| grep ID_LENGTH | cut -d = -f 2);
 

-- 
NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse für Mail, Message, More! +++

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



Re: [PHP] Passing header info for use in downloading files...?

2003-11-11 Thread John Nichel
[EMAIL PROTECTED] wrote:

I have a page where the user clicks a link to download a file, but the 
file is out side of the root DIR.
passing certain variables in the link, (type, file_name) I call the 
correct file...
However, it's stopped working?
My code below shows how I select the correct mime info to pass to the 
header.. but I keep getting promted to download an HTML file all the 
time...

if ($type == 'pdf') {$mimeinfo = application/pdf;} else
if ($type == 'doc') {$mimeinfo = application/msword;} else
if ($type == 'exe') {$mimeinfo = application/octet-stream;} else
if ($type == 'ppt') {$mimeinfo = application/vnd.ms-powerpoint;} 
else
if ($type == 'xls') {$mimeinfo = application/vnd.ms-excel;} else
if ($type == 'xml') {$mimeinfo = text/xml;} else
if ($type == 'zip') {$mimeinfo = application/zip;}
Don't know if this is the problem, but I would code this differently...

if ($type == 'pdf') {
$mimeinfo = application/pdf;
} elseif ($type == 'doc') {
$mimeinfo = application/msword;
} elseif ($type == 'exe') {
$mimeinfo = application/octet-stream;
} elseif ($type == 'ppt') {
$mimeinfo = application/vnd.ms-powerpoint;
} elseif ($type == 'xls') {
$mimeinfo = application/vnd.ms-excel;
} elseif ($type == 'xml') {
$mimeinfo = text/xml;
} elseif ($type == 'zip') {
$mimeinfo = application/zip;
}
But that's only if I had to use if/elsepersonally, I'd put all that 
in a switch statement.

header(Content-Disposition: attachment; filename=$file);
header(Content-Length:  . filesize($path));
header(Content-Type: $mimeinfo);
And here, again, don't know if it's the problem, but...I'd move the 
variable outside of the quotes

header(Content-Type:  . $mimeinfo);

Just personal preference I guessYRMV.

readfile($path);

My problem page is:
http://www.risk.sungard.com/download/?id=12617
click in the link 'Settlements ' and you'll see what I mean, it says 
it's a pdf, but when you have to specify the download location, it saves 
simply the html page?
can anyone spot my probably stupid error?

Tris...

*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***




--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] imagejpeg

2003-11-11 Thread Egil Berntsen
My site need to create some images on-the-fly(with user data) for every user
but I have some problem with the creating of the jpeg-image. I put these
images in my MySQL database for later use. This have to do somthing with
write protection because this is not a problem when I'm working on
localhost. The problem comes on .com.

I'm trying this:
$image = imagecreate(100,100);
{some drawing}
$fname=filename.jpg;
ImageJPEG($image, $fname);
{database}
ImageDestroy($image);
unlink($filename);

And get this:
Warning: imagejpeg(): Unable to open 'filename.jpg' for writing in ...

egil

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



Re: [PHP] imagejpeg

2003-11-11 Thread Marek Kilimajer
Egil Berntsen wrote:

My site need to create some images on-the-fly(with user data) for every user
but I have some problem with the creating of the jpeg-image. I put these
images in my MySQL database for later use. This have to do somthing with
write protection because this is not a problem when I'm working on
localhost. The problem comes on .com.
And get this:
Warning: imagejpeg(): Unable to open 'filename.jpg' for writing in ...
Web server needs write permission to the directory where you want to 
create the image. You should make a temp directory and not write to the 
one where your scripts are located.

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


RE: [PHP] Passing header info for use in downloading files...?

2003-11-11 Thread Erik Osterman
Look's correct... you could consider adding
Header(Content-transfer-encoding: binary);

But I highly doubt that would fix things. It would help much more if you
pasted the output by the server... 

The link you pasted us is not sending any of the headers you set. Maybe you
already expired this url... but that surely won't help us in debugging!

These are the headers returned by your script...

200 OK
Cache-Control: private, no-cache
Connection: close
Date: Tue, 11 Nov 2003 17:05:43 GMT
Pragma: no-cache
Server: Apache/1.3.28 (Unix) mod_auth_passthrough/1.8 mod_jk/1.2.0
mod_log_bytes/1.2 mod_bwlimited/1.2 PHP/4.3.3 FrontPage/5.0.2.2634
mod_ssl/2.8.15 OpenSSL/0.9.6bContent-Type: text/html
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Client-Date: Tue, 11 Nov 2003 17:05:49 GMT
Client-Peer: 69.57.134.79:80
Set-Cookie: PHPSESSID=ffa3f76470f259ca96fb630dbbc1307d; path=/
X-Powered-By: PHP/4.3.3


The content returned by your script is HTML not PDF!

It start's off with...

HTML
HEAD
TITLESunGard Trading and Risk Systems - Download page/TITLE



Here is the example output of a working binary download that we use. See the
difference.

 HEAD http://localhost/dl.php

HTTP/1.1 200 OK
Date: Tue, 11 Nov 2003 16:58:03 GMT
Server: Apache/1.3.27 (Unix) PHP/4.1.2
Content-disposition: attachment; filename=app.exe
Content-transfer-encoding: binary
Content-length: 208670
Connection: close
Content-Type: application/octet-stream


There is clearly something else broken with your script and it's not in the
part of code you sent us. Not only are the headers not what you set, the
file isn't what your passing. Hope this helps.


Also, stylistically I would use a switch(..) statement. It lends itself
perfectly for the kind of thing you're trying to do...

switch($type)
{
  case 'pdf': $mimeinfo = application/pdf; break;
  case 'doc': $mimeinfo = application/msword;  break;
  default:$mimeinfo = application/octet-stream;
}
 

Regards,

Erik Osterman
http://osterman.com/


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 11, 2003 7:57 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Passing header info for use in downloading files...?

I have a page where the user clicks a link to download a file, but the 
file is out side of the root DIR.
passing certain variables in the link, (type, file_name) I call the 
correct file...
However, it's stopped working?
My code below shows how I select the correct mime info to pass to the 
header.. but I keep getting promted to download an HTML file all the 
time...

if ($type == 'pdf') {$mimeinfo = application/pdf;} else
if ($type == 'doc') {$mimeinfo = application/msword;} else
if ($type == 'exe') {$mimeinfo = application/octet-stream;} else
if ($type == 'ppt') {$mimeinfo = application/vnd.ms-powerpoint;} 
else
if ($type == 'xls') {$mimeinfo = application/vnd.ms-excel;} else
if ($type == 'xml') {$mimeinfo = text/xml;} else
if ($type == 'zip') {$mimeinfo = application/zip;}

header(Content-Disposition: attachment; filename=$file);
header(Content-Length:  . filesize($path));
header(Content-Type: $mimeinfo);
readfile($path);

My problem page is:
http://www.risk.sungard.com/download/?id=12617
click in the link 'Settlements ' and you'll see what I mean, it says 
it's a pdf, but when you have to specify the download location, it saves 
simply the html page?
can anyone spot my probably stupid error?

Tris...

*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***

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



RE: [PHP] shell_exec with pipes

2003-11-11 Thread Jay Blanchard
[snip]
 $var=shell_exec(/usr/local/bin/mplayer -identify -frames 0 
 /tmp/pitstop.mpeg 2/dev/null\| grep ID_LENGTH \| cut -d \=\ -f 2);
[/snip]

$var=shell_exec(/usr/local/bin/mplayer -identify -frames 0
/tmp/pitstop.mpeg 2/dev/null | grep ID_LENGTH | cut -d \=\ -f 2);

Try just escaping the quotes, pipes should be OK IIRC.

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



Re: [PHP] help create community newbie guide to security

2003-11-11 Thread John W. Holmes
Lawrence Kennon wrote:
For a BBS I would like to let users post links to 
various resources. They 'post' a message to the BBS 
via a form and that is stored in a MySQL db, then the 
content of their 'post' is available to other users on 
the BBS. Currently I strip out all PHP/HTML with the 
strip_tags() function. What I would really like to do 
is allow a limited set of HTML tags (like the anchor 
a tag) but at the same time implement reasonable protection.
Get yourself a bbcode parser from phpclasses.org so you can use things 
like [b] [/b], and [url=] [/url], etc. This is safer than trying to deal 
with actual HTML, imo. Then use htmlentities() on the data instead of 
strip_tags(), so the users can actually write something like grin and 
not have it stripped.

In regards specifically to the HTML anchor tag a, 
are their guidelines for what should, and should not be 
allowed? In other words if I simply allow all of these 
tags (implementing the algorithim you mentioned above) 
are their potential problems with that? Or are there 
specific things I should be looking for with tags?
The problem is with deciding what attributes to allow in tags. If you 
use strip_tags() and decide to use the second parameter to allow b 
tags, I can write a b onmouseover=... tag that'll execute some 
javascript for me. It's easy enough to stop that on a b tag, but what 
about an img or a tag where you have to allow certain attributes and 
you never know what order they'll be in? That's why a bbcode solution is 
the best, imo, and use htmlentities() on everything else.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


[PHP] _GET arguments question

2003-11-11 Thread Duncan
Hi,

just a quick question:
I'm writing a script, where arguments get added to a dynamicaly created URL.
The only problem is that if there are no arguments in the URL already I 
get the following:
http://localhost/dir_to_my_script/test.php?arg1=1arg2=2
notice the ? bit.
I'm just curious, since it's working just fine in any major browser, are 
there any known problems which could occur by using the  right after 
the ? character?

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


RE: [PHP] Passing header info for use in downloading files...?

2003-11-11 Thread Chris Shiflett
--- Erik Osterman [EMAIL PROTECTED] wrote:
 Look's correct... you could consider adding
 Header(Content-transfer-encoding: binary);

Because Content-transfer-encoding is not a valid HTTP header, this will
have no effect. Content-Encoding and Transfer-Encoding are valid headers,
but binary is not a valid value for either of those.

See RFC 2616 section 19.4.5 for more information.

Hope that helps.

Chris

=
My Blog
 http://shiflett.org/
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



[PHP] configure hangs on pwrite

2003-11-11 Thread John Nichel
Hi,

  Trying to get php 4.3.4 to configure on a Fedora 1 box, and the 
configure script keeps hanging on checking whether pwrite works...

I've tried it with and without mm support for sessions, but to no avail 
(it's checking for pwrite right after is does the session check).  Can 
anyone lend a few brain cells?

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] _GET arguments question

2003-11-11 Thread Chris Shiflett
--- Duncan [EMAIL PROTECTED] wrote:
 The only problem is that if there are no arguments in the URL already I 
 get the following:
 http://localhost/dir_to_my_script/test.php?arg1=1arg2=2
 notice the ? bit.

Rather than trying to see whether this might work on most browser, you
should try to make it right.

When constructing a query string, all you need to do is delimit pairs with
an ampersand:

var1=val1var2=val2var3=val3

Don't write your logic in such a way that you construct a string and
always prefix every new addition with an ampersand. This is what leads to
problems like you are experiencing. It's the wrong approach, even though
it can be fixed by distinguishing between the first pair and all others.

In PHP, constructing a proper query string is painfully easy, thanks to
things like implode() and all of the array functions. Once you have a
proper query string, you simply prefix it with a question mark prior to
appending it to the rest of the URL. Just keep in mind that fragments go
at the end.

Hope that helps.

Chris

=
My Blog
 http://shiflett.org/
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



RE: [PHP] Passing header info for use in downloading files...?

2003-11-11 Thread Erik Osterman
Didn't know that it's RFC 1521 specific header and not valid in HTTP. =)

Thanks,

Erik Osterman
http://osterman.com/



-Original Message-
From: Chris Shiflett [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 11, 2003 9:21 AM
To: Erik Osterman; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: RE: [PHP] Passing header info for use in downloading files...?

--- Erik Osterman [EMAIL PROTECTED] wrote:
 Look's correct... you could consider adding
 Header(Content-transfer-encoding: binary);

Because Content-transfer-encoding is not a valid HTTP header, this will
have no effect. Content-Encoding and Transfer-Encoding are valid headers,
but binary is not a valid value for either of those.

See RFC 2616 section 19.4.5 for more information.

Hope that helps.

Chris

=
My Blog
 http://shiflett.org/
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

-- 
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] help create community newbie guide to security

2003-11-11 Thread Lowell Allen
 Lawrence Kennon wrote:
 For a BBS I would like to let users post links to
 various resources. They 'post' a message to the BBS
 via a form and that is stored in a MySQL db, then the
 content of their 'post' is available to other users on
 the BBS. Currently I strip out all PHP/HTML with the
 strip_tags() function. What I would really like to do
 is allow a limited set of HTML tags (like the anchor
 a tag) but at the same time implement reasonable protection.
 
 Get yourself a bbcode parser from phpclasses.org so you can use things
 like [b] [/b], and [url=] [/url], etc. This is safer than trying to deal
 with actual HTML, imo. Then use htmlentities() on the data instead of
 strip_tags(), so the users can actually write something like grin and
 not have it stripped.

[snip]

I have a best practice question related to this thread. I usually store
data in MySQL without any translation, then use htmlspecialchars() before
displaying as HTML. This works well for a content management system where
administrators are entering data in forms and storing, but perhaps it's not
appropriate for storing information from website visitors. If that
information should be translated before storing, then I'd have some stuff
that needs htmlspecialchars() applied before displaying, and some stuff that
does not.

My question is, are there any disadvantages to always following the
procedure described below?

- Use htmlentities() on everything before storing in the database
- Retrieve and display in cms forms without any translation
- Retrieve and translate mnemonic codes (like [b] [eb] to strong
/strong) before displaying as HTML
- Retrieve and use html_entity_decode() if needed for non-HTML use (like for
plain text email), or if I actually *WANT* to use stored HTML code (like for
HTML-formatted email)

TIA

--
Lowell Allen

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



[PHP] How to adpated a javascrip with php...

2003-11-11 Thread Payne
Hi,

I have a Javascript that I like to use with PHP/MYSQL, But I don't know 
how to mix the two...



SCRIPT LANGUAGE = JavaScript
bName = navigator.appName;
bVer = parseInt(navigator.appVersion);
   if ((bName == Netscape  bVer = 3) ||

   (bName == Microsoft Internet Explorer  bVer = 4)) br = n3;

   else br = n2;

   if (br == n3) {

   boardNum = 0;
   boardSpeed = 4000;
   billboards = new Array();
   billboards[0] = new Image();
   billboards[0].src = $x;
   billboards[1] = new Image();
   billboards[1].src = $x;
   billboards[2] = new Image();
   billboards[2].src = $x;
   billboards[3] = new Image();
   billboards[3].src = $x;
   billboards[4] = new Image();
   billboards[4].src = $x;
   billboards[5] = new Image();
   billboards[5].src = $x;
   billboards[6] = new Image();
   billboards[6].src = $x;
   billboards[7] = new Image();
   billboards[7].src = $x;
   }
[I like to make $x to be called from the database...]

function rotateBoard() {

 document.billboard.src = billboards[boardNum].src;

 if (boardNum  billboards.length - 1) {

   boardNum++;

 } else {

   boardNum = 0;

 }

}

function jumpBillboard() {

window.location.href = url[boardNum];
}
/SCRIPT
Thanks for any help you can give...

Payne

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


Re: [PHP] configure hangs on pwrite

2003-11-11 Thread John Nichel
John Nichel wrote:

Hi,

  Trying to get php 4.3.4 to configure on a Fedora 1 box, and the 
configure script keeps hanging on checking whether pwrite works...

I've tried it with and without mm support for sessions, but to no avail 
(it's checking for pwrite right after is does the session check).  Can 
anyone lend a few brain cells?

The section of 'configure' that I believe this is coming from is

  echo $ac_n checking whether pwrite works... $ac_c 16
echo configure:73730: checking whether pwrite works 5
if eval test \`echo '$''{'ac_cv_pwrite'+set}'`\ = set; then
  echo $ac_n (cached) $ac_c 16
else
But most of that is greek to me.  Does anyone understand what that's 
doing?  What it might be looking for, and what might be causing it to 
hang?  Thanks.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] \n and br

2003-11-11 Thread Marek Kilimajer
Brian V Bonini wrote:
So just change it

$string = nl2br($content-page_content);
$string = eregi_replace(br /, br, $string);
Why not directly
str_replace(array(\r\n,\r,\n), 'br', $content-page_content);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Philadelphia PHP Users Group

2003-11-11 Thread Edward Dudlik
From all that I've gathered, the greater Philadelphia, PA, area is
woefully lacking in a PHP Users Group.  Last I checked, we were still one
of the ten largest cities in the country, so to quote Chris Rock, That
ain't right!

I have already done some legwork, but before I dive too deeply into this,
I should probably find out if anyone is interested.  If you are and/or
know someone who may be, please contact me off-list.

Thanks a lot.

Edward Dudlik
Those who say it cannot be done
should not interrupt the person doing it.

wishy washy | www.amazon.com/o/registry/EGDXEBBWTYUU

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



Re: [PHP] \n and br

2003-11-11 Thread Brian V Bonini
On Tue, 2003-11-11 at 14:51, Marek Kilimajer wrote:
 Brian V Bonini wrote:
  So just change it
  
  $string = nl2br($content-page_content);
  $string = eregi_replace(br /, br, $string);
  
 
 Why not directly
 str_replace(array(\r\n,\r,\n), 'br', $content-page_content);

You say tomato I say ;-)

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



Re: [PHP] location= Construct Doc

2003-11-11 Thread Mark
--- Lee Stewart [EMAIL PROTECTED] wrote:
 It's version 4.0.3
 Lee

In v4.3.2, it throws a Parse error: parse error, unexpected '=' in
/path/to/file/test.php on line 23.

 
 Chris Shiflett wrote:
  --- Lee Stewart [EMAIL PROTECTED] wrote:
  
 Here's a *working* section of code...  Note the
 location = browse.php;
 on line 23
  
  
  How does that not generate a parse error? I must be missing
 something.
  
  It seems to me that either a dollar sign is missing, or the line
 is
  intended to define a constant (although I prefer my constants to
 be
  uppercase), in which case the wrong syntax is being used.
  
  What version of PHP are you using that does not generate a parse
 error?
  
  Chris
  
  =
  My Blog
   http://shiflett.org/
  HTTP Developer's Handbook
   http://httphandbook.org/
  RAMP Training Courses
   http://www.nyphp.org/ramp
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a right unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

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



[PHP] whois api's

2003-11-11 Thread Rolf Brusletto
Hey all -

I'm currently working on a project which requires domain name 
information. Has anybody used, or can anybody suggest php tools to get 
whois information regarding any domain name? I'm trying to check out all 
options before having to register as a registrar for get access to a 
paid api.

Rolf Brusletto

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


RE: [PHP] How to adpated a javascrip with php...

2003-11-11 Thread Martin Towell
 I have a Javascript that I like to use with PHP/MYSQL, But I 
 don't know 
 how to mix the two...
 
 SCRIPT LANGUAGE = JavaScript
 bName = navigator.appName;
 bVer = parseInt(navigator.appVersion);
 
 if ((bName == Netscape  bVer = 3) ||
 
 (bName == Microsoft Internet Explorer  bVer = 
 4)) br = n3;
 
 else br = n2;
 
 if (br == n3) {
 
 boardNum = 0;
 boardSpeed = 4000;
 
 billboards = new Array();
 billboards[0] = new Image();
 billboards[0].src = $x;
 billboards[1] = new Image();
 billboards[1].src = $x;
 billboards[2] = new Image();
 billboards[2].src = $x;
 billboards[3] = new Image();
 billboards[3].src = $x;
 billboards[4] = new Image();
 billboards[4].src = $x;
 billboards[5] = new Image();
 billboards[5].src = $x;
 billboards[6] = new Image();
 billboards[6].src = $x;
 billboards[7] = new Image();
 billboards[7].src = $x;
 }
 
 [I like to make $x to be called from the database...]
 
 
 function rotateBoard() {
 
   document.billboard.src = billboards[boardNum].src;
 
   if (boardNum  billboards.length - 1) {
 
 boardNum++;
 
   } else {
 
 boardNum = 0;
 
   }
 
 }
 
 function jumpBillboard() {
 
 window.location.href = url[boardNum];
 }
 /SCRIPT


Try something like this

 billboards = new Array();
?
  $cursor = sql query here
  $i = 0;
  while ($something from database)
  {
?
 billboards[?=$i?] = new Image();
 billboards[?=$i?].src = ?=$something?;
?
$i++;
  }
?

Martin

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



[PHP] Miami User Group

2003-11-11 Thread Cesar Cordovez
And talking about user groups, is anybody interested in creating a 
Miami/Fort  Lauderdale/Palm Beaches PHP user group?

Contact me, off the list please.

Cesar

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


Re: [PHP] How to adpated a javascrip with php...

2003-11-11 Thread Burhan Khalid
Payne wrote:

Hi,

I have a Javascript that I like to use with PHP/MYSQL, But I don't know 
how to mix the two...
Here is an example.

?php

   /* do php stuff here, like set a value to $x */
   $x = 3;
?
script
  funtion x() { var foo = ?php echo $x; ?; alert(foo); }
/script
--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
---
Documentation is like sex: when it is good,
 it is very, very good; and when it is bad,
 it is better than nothing.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] location= Construct Doc

2003-11-11 Thread Eugene Lee
On Tue, Nov 11, 2003 at 01:46:33PM -0800, Mark wrote:
:  
:   --- Lee Stewart [EMAIL PROTECTED] wrote:
:   
:  Here's a *working* section of code...  Note the
:location = browse.php;
:  on line 23
: 
: In v4.3.2, it throws a Parse error: parse error, unexpected '=' in
: /path/to/file/test.php on line 23.

It'd be helpful to see the rest of the code snippet.  But it kinda looks
as if it should be:

$location = browse.php;

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



RE: [PHP] whois api's

2003-11-11 Thread Vail, Warren
I believe network solutions and all other sources of this kind of
information have been tightening access to more than the IP address,
because, it seems, some unscrupulous individuals have been using the
information to spam domain owners.  Since it appears that you are not a
domain registrar, or you would already have access, I can't help but wonder
how you plan to use this information that wouldn't meet with a lot of
flak

somewhat curious,

Warren Vail

-Original Message-
From: Rolf Brusletto [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 11, 2003 2:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP] whois api's


Hey all -

I'm currently working on a project which requires domain name 
information. Has anybody used, or can anybody suggest php tools to get 
whois information regarding any domain name? I'm trying to check out all 
options before having to register as a registrar for get access to a 
paid api.

Rolf Brusletto


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

2003-11-11 Thread Dimitri Marshall
Hi there,
Here's my situation:

I'm making a message board and I've decided the best way to go about the
structure is to have 3 tables, two of them will be Posts and Replys.
Now, in order for this ti work, each post has to have a UniqueID - same with
the replys. Looking at another program, I can see that one way to do this is
to do it by rows (ie. count how many rows, add 1, then that is the ID). It
would be unique because no two rows would be 1 for example.

The problem I can see is that the database would become incredibly huge
(size wise I mean). I want to delete the posts after 30 days, and if I
delete the row, then that would mess up the row system.

Any suggestions?

Dimitri Marshall

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



Re: [PHP] Unique ID

2003-11-11 Thread Marek Kilimajer
Dimitri Marshall wrote:
Hi there,
Here's my situation:
I'm making a message board and I've decided the best way to go about the
structure is to have 3 tables, two of them will be Posts and Replys.
Now, in order for this ti work, each post has to have a UniqueID - same with
the replys. Looking at another program, I can see that one way to do this is
to do it by rows (ie. count how many rows, add 1, then that is the ID). It
would be unique because no two rows would be 1 for example.
The problem I can see is that the database would become incredibly huge
(size wise I mean). I want to delete the posts after 30 days, and if I
delete the row, then that would mess up the row system.
Any suggestions?
Have you heard about auto_increment? Read on:
http://www.mysql.com/doc/en/example-AUTO_INCREMENT.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Unique ID

2003-11-11 Thread Javier Muniz
auto_increment is not in the SQL standard, and not everyone uses MySQL.  To
be cross-compatible between databases use a Sequence:
http://pear.php.net/manual/en/package.database.db.intro-sequences.php
provides a brief introduction, the PEAR::DB class allows you to use
sequences easily.

Neither auto-increment nor sequences allow you to do what you're asking for
though, which is like database garbage collection.  If you really need
something like this you should implement it in a cron job that runs during
non-peak hours as it will be quite an expensive operation on a large table
(the best way I can think of would be to iterate over all table rows and
look for gaps in the table, and for each gap take the record with the
highest ID and change the ID to fill the gap, then update all replys to
match the new ID, after everything is finished reset the sequence to the
highest id in the modified table and you're done).  

Note from the MySQL manual for you auto_increment fans out there:

Posted by Jim Martin on Tuesday October 1 2002, @11:57am  

Just in case there's any question, the
AUTO_INCREMENT field /DOES NOT WRAP/. Once you
hit the limit for the field size, INSERTs generate
an error. (As per Jeremy Cole)

And the comment a few beyond that regarding being able to drop the index and
renumber doesn't help here, as there is an exterior resource (the reply
table) that will be broken as soon as the ids change.

If anyone has a better suggestion on how to do this I'd love to hear it :) 

-Javier

 -Original Message-
 From: Marek Kilimajer [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, November 11, 2003 3:30 PM
 To: Dimitri Marshall
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Unique ID
 
 
 Dimitri Marshall wrote:
  Hi there,
  Here's my situation:
  
  I'm making a message board and I've decided the best way to 
 go about 
  the structure is to have 3 tables, two of them will be Posts and 
  Replys. Now, in order for this ti work, each post has to have a 
  UniqueID - same with the replys. Looking at another 
 program, I can see 
  that one way to do this is to do it by rows (ie. count how 
 many rows, 
  add 1, then that is the ID). It would be unique because no two rows 
  would be 1 for example.
  
  The problem I can see is that the database would become incredibly 
  huge (size wise I mean). I want to delete the posts after 
 30 days, and 
  if I delete the row, then that would mess up the row system.
  
  Any suggestions?
 
 Have you heard about auto_increment? Read on: 
 http://www.mysql.com/doc/en/example- AUTO_INCREMENT.html
 
 -- 
 
 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] Time problem

2003-11-11 Thread Erin
Hi All,
Sorry if this has been asked a 1000 times and if its easy to find in the
php manual but i cant seam to solve this.

How do i convert a timestamp in to a normal readable time  date ie

2003155023

into

11th November 2003 @ 15:50:23


Many thanks, thought id ask someone is bound to have a snippet for this.



Regards

All



Erin

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



Re: [PHP] Unique ID

2003-11-11 Thread Boyan Nedkov
Dimitri Marshall wrote:
Hi there,
Here's my situation:
I'm making a message board and I've decided the best way to go about the
structure is to have 3 tables, two of them will be Posts and Replys.
Now, in order for this ti work, each post has to have a UniqueID - same with
the replys. Looking at another program, I can see that one way to do this is
to do it by rows (ie. count how many rows, add 1, then that is the ID). It
would be unique because no two rows would be 1 for example.
The problem I can see is that the database would become incredibly huge
(size wise I mean). I want to delete the posts after 30 days, and if I
delete the row, then that would mess up the row system.
Any suggestions?

Dimitri Marshall

A standard solution in this case is to use one common table for all messages, 
both 'posts' and 'replays', distinguishing them by 'type' (TypeID, say 1 for 
post, 2 for replay), and then build a parent/child relationship between both 
type of messages in that table. In this way each message will have unique id. 
When you need all or some 'post' messages, use a query for selecting TypeID = 1, 
resp. TypeID = 2 for 'replay' messages.

Concerning the deletion of a message (post or replay), you should write a query 
which will recursively delete the message selected as well as all child messages 
assigned to that (parent) message. The easiest way to do this is to use 
triggers, but that depends on the database you work with.

To get closer to this approach and to find some nice examples, check out the 
following resources:

http://www.sqlmag.com/Articles/Index.cfm?ArticleID=8826
http://www.sqlteam.com/item.asp?ItemID=8866
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/acdata/ac_8_qd_14_5yk3.asp
http://www.yafla.com/papers/sqlhierarchies/sqlhierarchies.htm
HTH,

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


Re: [PHP] Unique ID

2003-11-11 Thread John W. Holmes
Marek Kilimajer wrote:
Dimitri Marshall wrote:
I'm making a message board and I've decided the best way to go about the
structure is to have 3 tables, two of them will be Posts and Replys.
Now, in order for this ti work, each post has to have a UniqueID - 
same with
the replys. Looking at another program, I can see that one way to do 
this is
to do it by rows (ie. count how many rows, add 1, then that is the 
ID). It
would be unique because no two rows would be 1 for example.

The problem I can see is that the database would become incredibly huge
(size wise I mean). I want to delete the posts after 30 days, and if I
delete the row, then that would mess up the row system.
Any suggestions?
Have you heard about auto_increment? Read on:
http://www.mysql.com/doc/en/example-AUTO_INCREMENT.html
Keep reading about database design, too. You'll only need one table and 
a parent-child relationship. The initial post will have a parent of 
zero and child posts under it will have a parent column relating 
back to the original post.

I may not have explained that the best way, but there are plenty of 
articles out there about it. Have fun. :)

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


Re: [PHP] Time problem

2003-11-11 Thread Chris Shiflett
--- Erin [EMAIL PROTECTED] wrote: 
 How do i convert a timestamp in to a normal readable time  date ie
 
 2003155023
 
 into
 
 11th November 2003 @ 15:50:23

That's not a timestamp, first of all. It looks to me like you just need to
use substr() to parse out the elements however you want. You can see if
strtotime() can do anything with it, but I doubt it.

If you want to convert it to a real timestamp, look at the mktime()
function. Once you have a timestamp, it's very easy to work with, and you
can use date() to format it however you want.

Hope that helps.

Chris

=
My Blog
 http://shiflett.org/
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



RE: [PHP] Time problem

2003-11-11 Thread Vail, Warren
Not sure how others would tackle this, but I would use something like

$readabledate = date(dS F Y @ H:i:s,
strtotime(substr($timestamp,0,4).-
 .substr($timestamp,4,2).-
 .substr($timestamp,6,2). 
 .substr($timestamp,8,2).:
 .substr($timestamp,10,2).:
 .substr($timestamp,12,2)));

Not sure this is bug free, but it should change your timestamp (yes it is a
database timestamp) into the readable format you described.  It's yours to
debug.

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

Good luck,

Warren Vail

-Original Message-
From: Erin [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 11, 2003 4:00 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Time problem


Hi All,
Sorry if this has been asked a 1000 times and if its easy to find in the
php manual but i cant seam to solve this.

How do i convert a timestamp in to a normal readable time  date ie

2003155023

into

11th November 2003 @ 15:50:23


Many thanks, thought id ask someone is bound to have a snippet for this.



Regards

All



Erin

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

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



[PHP] Re: whois api's

2003-11-11 Thread Al
There is a PEAR Project that does exactly what you want:

http://pear.php.net/package/Net_Whois

Al

Rolf Brusletto [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hey all -

 I'm currently working on a project which requires domain name
 information. Has anybody used, or can anybody suggest php tools to get
 whois information regarding any domain name? I'm trying to check out all
 options before having to register as a registrar for get access to a
 paid api.

 Rolf Brusletto


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



[PHP] sorting files by date

2003-11-11 Thread Justin French
Hi,

I have a dir of files saved in the following format: -MM-DD.mp4.  I 
know how to get the file names into an array, but I don't know how to 
sort the array so that the files appear in date order.  My guess was to 
use strtotime() to get the date into a timestamp, then sort on the 
timestamp, but there MUST be an easier way :)

I've read through most of the array part of the manual, but can't see 
what I need.

Justin

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


RE: [PHP] sorting files by date

2003-11-11 Thread Martin Towell
surely sort() would do the trick?

Martin

 -Original Message-
 From: Justin French [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, 12 November 2003 12:13 PM
 To: php
 Subject: [PHP] sorting files by date
 
 
 Hi,
 
 I have a dir of files saved in the following format: 
 -MM-DD.mp4.  I 
 know how to get the file names into an array, but I don't know how to 
 sort the array so that the files appear in date order.  My 
 guess was to 
 use strtotime() to get the date into a timestamp, then sort on the 
 timestamp, but there MUST be an easier way :)
 
 I've read through most of the array part of the manual, but can't see 
 what I need.
 
 
 Justin
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 __ Information from NOD32 1.552 (20031107) __
 
 This message was checked by NOD32 for Exchange e-mail monitor.
 http://www.nod32.com
 
 
 
 

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



Re: [PHP] Time problem

2003-11-11 Thread John W. Holmes
Erin wrote:

Hi All,
Sorry if this has been asked a 1000 times and if its easy to find in the
php manual but i cant seam to solve this.
How do i convert a timestamp in to a normal readable time  date ie

2003155023

into

11th November 2003 @ 15:50:23
IFF the timestamp is coming from MySQL (which has that format), then 
you should use DATE_FORMAT() in your query to do the formatting.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


Re: [PHP] sorting files by date

2003-11-11 Thread David T-G
Justin --

...and then Justin French said...
% 
% Hi,

Hi!


% 
% I have a dir of files saved in the following format: -MM-DD.mp4.  I 

OK.  So what are you filming? :-)


% know how to get the file names into an array, but I don't know how to 
% sort the array so that the files appear in date order.  My guess was to 

If the filename has anything to do with the date, then just sort it.  MM
is numeric and not alphabetic, right?


% use strtotime() to get the date into a timestamp, then sort on the 
% timestamp, but there MUST be an easier way :)

Um, yeah :-)

If the filenames are *not* related to the actual dates, then just stat()
each file and sort based on those results.


% 
% I've read through most of the array part of the manual, but can't see 
% what I need.

I bet it's sort() :-)


% 
% 
% Justin


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Miami User Group

2003-11-11 Thread David T-G
Hi, all --

[Yes, this is intended to be a new thread.]

...and then Cesar Cordovez said...
% 
% And talking about user groups, is anybody interested in creating a 
% Miami/Fort  Lauderdale/Palm Beaches PHP user group?

Or US-GA-Atlanta :-)


% 
% Contact me, off the list please.

Same here.


Thanks  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] I meant 'PHP Atlanta user group'...

2003-11-11 Thread David T-G
Hi again --

...and then David T-G said...
% 
% [Yes, this is intended to be a new thread.]

GRRR...  It would help if I remembered to change the Subject: line, too.

Anyway, I'd like to see more PHP in Atlanta.


HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP] Execute Background Process

2003-11-11 Thread apur kurub ver.1
dear all

i will execute background process like
$program 
is there posible in php to process that statement? and return to php
immediately;
---
rgds

[xm]
http://ilkomerz36.blogspot.com
http://geocities.com/amadarum

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



[PHP] nusoap

2003-11-11 Thread Larry Brown
Does anyone here have any solid experience with nusoap?  Their list has
low volume and I am finding it difficult to find any useable examples or
descriptions of real life uses and how to configure the server/client.

In particular I'm currently trying to figure out the correct syntax to
produce wsdl using $server-wsdl-addComplexType(... to describe an
array of the form...

array([0]=343454[1]=SMITH[2]=BOB[3]=1969-03-17[4]=234343444[5]2003-11-11 13:23:02)

where data types are string,string,string,date,string,datetime

It appears that the complexType would be a struct although this is
actually an array.  I just need someone who has had experience with this
toolkit for a couple of issues.

Thanks for any assistance,

Larry

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



[PHP] Pear

2003-11-11 Thread Gary
I have recently up graded to 4.3.4 and now my links to pear have quite 
working. I have tried replace pear with go-pear and it is not working. 
What am I doing wrong?

Old
ini_set('include_path', 'C:/php/pear/');
require_once 'PEAR.php';
require_once 'DB.php';
TIA
Gary
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Help with scripts to add records to a database

2003-11-11 Thread Mark
I am following the tutorial at
http://www.freewebmasterhelp.com/tutorials/phpmysql/
The source code is on the website on the left hand side
http://www.freewebmasterhelp.com/static/tutorials/phpmysql/example.zip


My software:
PHP version 4.3.4 on Windows 2000
MYSQL version 4.0.16 on Windows 2000
Apache version 1.3.29 on Windows 2000

The problem is I cannot get the database to add a new records aside from
the auto-increment field. All the other fields are left blank when the
add.html is subitted. 

I have the add.html with the following code exactly the same as the
source code.

form action=insert.php method=post
First Name: input type=text name=firstbr
Last Name: input type=text name=lastbr
Phone: input type=text name=phonebr
Mobile: input type=text name=mobilebr
Fax: input type=text name=faxbr
E-mail: input type=text name=emailbr
Web: input type=text name=webbr
input type=Submit
/form


The insert.php
?
include(dbinfo.inc.php);
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( Unable to select database); 

$query = INSERT INTO contacts VALUES
('','$first','$last','$phone','$mobile','$fax','$email','$web');
mysql_query($query);

mysql_close();
? 



Any help would be much appreciated.

Regards,
Mark

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



[PHP] Can sudo be used for apache

2003-11-11 Thread tirumal b
hello All,

  Can i use sudo to assign certain privileges for the
apache account as the webserver is running on that
account. Will it be possible.

Thank you

Tirumal 

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

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



RE: [PHP] Help with scripts to add records to a database

2003-11-11 Thread Mark
Sorry guys, I have tried all the suggestions so far with no luck.

Regards,
Mark



try to include field name:
$query = INSERT INTO contacts(first,$last,phone,mobile,fax,email,web)
VALUES ('$first','$last','$phone','$mobile','$fax','$email','$web');
mysql_query($query);
___
rgds
[xm]


 I am following the tutorial at 
 http://www.freewebmasterhelp.com/tutorials/phpmysql/
 The source code is on the website on the left hand side 
 http://www.freewebmasterhelp.com/static/tutorials/phpmysql/example.zip


 My software:
 PHP version 4.3.4 on Windows 2000
 MYSQL version 4.0.16 on Windows 2000
 Apache version 1.3.29 on Windows 2000

 The problem is I cannot get the database to add a new records aside 
 from the auto-increment field. All the other fields are left blank 
 when the add.html is subitted.

 I have the add.html with the following code exactly the same as the 
 source code.

 form action=insert.php method=post
 First Name: input type=text name=firstbr
 Last Name: input type=text name=lastbr
 Phone: input type=text name=phonebr
 Mobile: input type=text name=mobilebr
 Fax: input type=text name=faxbr
 E-mail: input type=text name=emailbr
 Web: input type=text name=webbr
 input type=Submit
 /form


 The insert.php
 ?
 include(dbinfo.inc.php); 
 mysql_connect(localhost,$username,$password);
 @mysql_select_db($database) or die( Unable to select database);

 $query = INSERT INTO contacts VALUES 
 ('','$first','$last','$phone','$mobile','$fax','$email','$web');
 mysql_query($query);

 mysql_close();
 ?



 Any help would be much appreciated.

 Regards,
 Mark

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



Re: [PHP] Help with scripts to add records to a database

2003-11-11 Thread Rolf Brusletto
Mark wrote:

Sorry guys, I have tried all the suggestions so far with no luck.

Regards,
Mark


try to include field name:
$query = INSERT INTO contacts(first,$last,phone,mobile,fax,email,web)
VALUES ('$first','$last','$phone','$mobile','$fax','$email','$web');
mysql_query($query);
___
rgds
[xm]
 

I am following the tutorial at 
http://www.freewebmasterhelp.com/tutorials/phpmysql/
The source code is on the website on the left hand side 
http://www.freewebmasterhelp.com/static/tutorials/phpmysql/example.zip

My software:
PHP version 4.3.4 on Windows 2000
MYSQL version 4.0.16 on Windows 2000
Apache version 1.3.29 on Windows 2000
The problem is I cannot get the database to add a new records aside 
from the auto-increment field. All the other fields are left blank 
when the add.html is subitted.

I have the add.html with the following code exactly the same as the 
source code.

form action=insert.php method=post
First Name: input type=text name=firstbr
Last Name: input type=text name=lastbr
Phone: input type=text name=phonebr
Mobile: input type=text name=mobilebr
Fax: input type=text name=faxbr
E-mail: input type=text name=emailbr
Web: input type=text name=webbr
input type=Submit
/form
The insert.php
?
include(dbinfo.inc.php); 
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( Unable to select database);

$query = INSERT INTO contacts VALUES 
('','$first','$last','$phone','$mobile','$fax','$email','$web');
mysql_query($query);

mysql_close();
?


Any help would be much appreciated.

Regards,
Mark
   

 

Mark - After the mysql_query($query); line add the following line

echo mysql_error();

run the script and try to add something again, if there is an error, it 
will tell you via mysql_error(); echo it out to the browser, and get 
back to me :)

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


Re: [PHP] Help with scripts to add records to a database

2003-11-11 Thread zhuravlev alexander
On Tue, Nov 11, 2003 at 07:44:58PM -0800, Mark wrote:
 I am following the tutorial at
 http://www.freewebmasterhelp.com/tutorials/phpmysql/
 The source code is on the website on the left hand side
 http://www.freewebmasterhelp.com/static/tutorials/phpmysql/example.zip
 
 
 My software:
 PHP version 4.3.4 on Windows 2000
 MYSQL version 4.0.16 on Windows 2000
 Apache version 1.3.29 on Windows 2000
 
 The problem is I cannot get the database to add a new records aside from
 the auto-increment field. All the other fields are left blank when the
 add.html is subitted. 
 
 I have the add.html with the following code exactly the same as the
 source code.
 
 form action=insert.php method=post
 First Name: input type=text name=firstbr
 Last Name: input type=text name=lastbr
 Phone: input type=text name=phonebr
 Mobile: input type=text name=mobilebr
 Fax: input type=text name=faxbr
 E-mail: input type=text name=emailbr
 Web: input type=text name=webbr
 input type=Submit
 /form
 
 
 The insert.php
 ?
 include(dbinfo.inc.php);
 mysql_connect(localhost,$username,$password);
 @mysql_select_db($database) or die( Unable to select database); 
 
 $query = INSERT INTO contacts VALUES
 ('','$first','$last','$phone','$mobile','$fax','$email','$web');

http://ru3.php.net/manual/en/security.registerglobals.php

try 
$query = insert into contacts values 
('',.$_POST['first'].,.$_POST['last'].,.$_POST['phone'].,.$_POST['mobile'],,.$_POST['fax'].,.$_POST['email'].,.$_POST['web'].);

and so on ... 

 mysql_query($query);
 
 mysql_close();
 ? 
 
 
 
 Any help would be much appreciated.
 
 Regards,
 Mark
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

 -- zhuravlev alexander
   u l s t u  n o c
 ([EMAIL PROTECTED])

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