[PHP] pdf

2006-06-29 Thread weetat

Hi all ,

 I am using PHP 4.3.2 and MYSQL database.

 I need to convert the sql query to Adobe PDF format.
 Any one have any suggestion how to do this?

 I have search phpclasses , found SQL2PdfReport classes , however it 
gave error message as shown below :


  Error in opening pdf 

Lookup the code in the SQL2Report class , it did not support pdf 7.0 and 
above.


Thanks

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



Re: [PHP] pdf

2006-06-29 Thread Jyry Kuukkanen

Hello


On Thu, 29 Jun 2006, weetat wrote:

 Hi all ,
 
   I am using PHP 4.3.2 and MYSQL database.
 
   I need to convert the sql query to Adobe PDF format.
   Any one have any suggestion how to do this?


I have used fpdf (http://www.fpdf.org/) in order to create PDF documents 
with PHP and it has worked fine for me.


Cheers,
--jq




   I have search phpclasses , found SQL2PdfReport classes , however it 
 gave error message as shown below :
 
Error in opening pdf 
 
 Lookup the code in the SQL2Report class , it did not support pdf 7.0 and 
 above.
 
 Thanks
 
 

-- 
Hienoja terveisiä
--Jyry
C|:-(C|:-/C|8-OC|8-/C|:-(

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



Re: [PHP] pdf

2006-06-29 Thread Paul Novitski

At 11:50 PM 6/28/2006, weetat wrote:

 I am using PHP 4.3.2 and MYSQL database.

 I need to convert the sql query to Adobe PDF format.
 Any one have any suggestion how to do this?



I'm enjoying using the PHP class FPDF http://www.fpdf.org/

It's not a one-step conversion utility, it's a PHP class you invoke 
from your code to build the PDF document incrementally.  If you've 
got a clear idea of how you want the query results rendered, FPDF can 
make it nearly as easy to output to PDF as to HTML.


Paul 


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



[PHP] FTP - moving/copying files

2006-06-29 Thread James Nunnerley
I'm setting up an ftp manager which allows a user to connect to their space
on an external server.

 

All the php-ftp functions work fine - after I'd realized how to use the
passive functionality - see previous email to list!

 

I've also got working the download and upload functionality, which is quite
nice, but annoying - it doesn't allow you to download the file without
creating a temporary version (whereas if it were a local copy you'd be able
to copy it to a variable, then echo it out...

 

Finally, what I now need to do it be able to move/copy files within the FTP
space.  The standard FTP commands (mv  cp or copy) are not featured in
php-ftp functions.  Does anyone have any suggestions bar copying the whole
lot to a local drive then upload in the new space?

 

Cheers

Nunners



RE: [PHP] Multiple if() statements

2006-06-29 Thread Ford, Mike
On 29 June 2006 01:03, David Tulloh wrote:


 I'm also going to throw in an elseif for fun, to get this (hopefully)
 improved version: 
 
 if($row[1] == none) {
print(tr);
print(td$row[0] $row[2]/td);
print(/tr);
 } elseif($row[1] == $row[2]) {
print(tr);
print(td$row[0] $row[2]/td);
print(/tr);
 } else {
print(tr);
print(td$row[0] ($row[1]) $row[2]/td);
print(/tr);
 }

This still seems overly complex to me -- there are 3 identical occurrences of 
some items.

When constructing an if() sequence, I think it's always important to isolate 
the parts that genuinely differ, so my effort would go like this:

echo tr;
echo td$row[0] ;
if ($row[1] != none  $row[1] != $row[2]) {
   echo ($row[1]) ;
}
echo $row[2]/td;
echo /tr;


Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



[PHP] running number in paging

2006-06-29 Thread weetat

Hi all ,

 I have using PEAR:Pager , to do paging .
 Everthing are ok . Except the running no will always start from 1 to 10 .
 Anyway to increase the running number when user click next page for 
example Page 1 : 1 to 10,

Page 2 : 11 to 20, and so on

Thanks

below is the code , the running number is the variable k.

?php

while (list($name, $value) = each($chassisresult)) {
$model = $value['chasis_model'];
$serialno = $value['serial_no'];
$hostname = $value['host_name'];
$country = $value['country'];
$city = $value['city'];
$building = $value['building'];
$other = $value['other'];
$chasis_user_field_1 = $value['chasis_user_field_1'];
$chasis_user_field_2 = $value['chasis_user_field_2'];
$chasis_user_field_3 = $value['chasis_user_field_3'];
$status = $value['status'];
$chasiseos = $value['chasis_eos'];
$chasiseol = $value['chasis_eol'];

$countrynamestr = $serialno . country[];
$citynamestr = $serialno . city[];
$buildingnamestr = $serialno . building[];
$othernamestr = $serialno . other[];
$hostnamestr = $serialno . hostname[];
$modelnamestr = $serialno . model[];
$userfield1name = $serialno . userfield1[];
$userfield2name = $serialno . userfield2[];
$userfield3name = $serialno . userfield3[];
$statusname = $serialno . status[];
$eosname = $serialno . eos[];
$eolname = $serialno . eol[];
$checkboxname = selected[];

?
tr
td align=center class=std1input name=?php echo 
$checkboxname? type=checkbox value=?php echo $i ?/td
td align=center class=std1?php echo $k += 1 ?input 
name=?php echo $countrynamestr? type=hidden value=?php echo 
$country ?/td
td class=std2?php echo $country == '' ? 'nbsp;' : $country 
?input name=?php echo $citynamestr? type=hidden value=?php 
echo $city ?/td
td class=std2 ?php echo $city == '' ? 'nbsp;' : $city ?input 
name=?php echo $buildingnamestr? type=hidden value=?php echo 
$building ?/td
td class=std2?php echo $building == '' ? 'nbsp;' : $building 
?input name=?php echo $othernamestr? type=hidden value=?php 
echo $other ?/td

td class=std2?php echo $other == '' ? 'nbsp;' : 
$other ?/td
td class=std2?php echo $hostname == '' ? 'nbsp;' : $hostname 
?input name=?php echo $hostnamestr? type=hidden value=?php 
echo $hostname ?/td
td class=std2 ?php echo $model == '' ? 'nbsp;' : $model 
?input name=?php echo $modelnamestr? type=hidden value=?php 
echo $model ?/td
td class=std2?php echo $serialno ?input name=Serialno[] 
type=hidden value=?php echo $serialno ?/td

td class=std2nbsp;/td
td class=std2nbsp;/td
td class=std2nbsp;/td
td class=std2?php echo $chasiseos == '' ? 'nbsp;' : 
dateconvert($chasiseos,2) ?input name=?php echo $eosname? 
type=hidden value=?php echo $chasiseos ?/td
td class=std2?php echo $chasiseol == '' ? 'nbsp;' : 
dateconvert($chasiseol,2) ?input name=?php echo $eolname? 
type=hidden value=?php echo $chasiseol ?/td
td class=std2?php echo $chasis_user_field_1 == '' ? 'nbsp;' : 
$chasis_user_field_1 ?input name=?php echo $userfield1name? 
type=hidden value=?php echo $chasis_user_field_1 ?/td
td class=std2 ?php echo $chasis_user_field_2 == '' ? 'nbsp;' : 
$chasis_user_field_2 ?input name=?php echo $userfield2name? 
type=hidden value=?php echo $chasis_user_field_2 ?/td
td class=std2 ?php echo $chasis_user_field_3 == '' ? 'nbsp;' : 
$chasis_user_field_3 ?input name=?php echo $userfield3name? 
type=hidden value=?php echo $chasis_user_field_3 ?/td
input name=?php echo $statusname? type=hidden value=?php 
echo $status ?

/tr
   ?php
$i += 1;
}

?

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



[PHP] Re: pdf

2006-06-29 Thread Jo�o C�ndido de Souza Neto
How can i see, everyon here use that class.

I use it too. It always worked fine to me.

weetat [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]
 Hi all ,

  I am using PHP 4.3.2 and MYSQL database.

  I need to convert the sql query to Adobe PDF format.
  Any one have any suggestion how to do this?

  I have search phpclasses , found SQL2PdfReport classes , however it gave 
 error message as shown below :

   Error in opening pdf 

 Lookup the code in the SQL2Report class , it did not support pdf 7.0 and 
 above.

 Thanks 

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



Re: [PHP] Programming question - New to PHP

2006-06-29 Thread Dave Goodchild

On 29/06/06, Chris [EMAIL PROTECTED] wrote:


Russbucket wrote:
 I took an example  of a script from the PHP documentation and try to
connect
 to my database.   If I leave in the or die part of line 3, I get
nothing, if
 I comment out that part I get the echo message on line 4.

 ?php
 // Connecting and selecting the database
 $conn = mysql_connect ('localhost', 'finemanruss', 'XXXl') or die
('Could
 not connect :  '  . mysql_error());
 echo 'Connected successfully';
 mysql_select_db (Lions, $conn);

 // Preform SQL query
 $query = 'SELECT * FROM Moses_Lake_Lions';
 $result = mysql_query ($query) or die ( 'Query failed;   '  .
mysql_error());
 ?

 I know line three works without the or die part since I have a 2nd
script that
 is almost the same (no or die) and it retrieves info from my DB.

Try it the same as the php manual page:

$conn = mysql_connect('');
if (!$conn) {
   die(Could not connect:  . mysql_error());
}

You may be logging the errors. Tty echoing the value of the resource
($conn) - it should be an integer.





--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk


[PHP] image upload problem

2006-06-29 Thread suresh kumar
Hi,
 This is the code i am using for image upload.
  if ($_FILES['ufile']['name'] != NULL)
 {

  $FlName= $_FILES['ufile']['name'];
  if(!is_uploaded_file($_FILES['ufile']['tmp_name'])){

 print Script type=\text/javascript\
alert(\Error! The expected file wasn't loaded\);
   
/script;

exit();
  }
  
  $uploadfile = $_FILES['ufile']['tmp_name'];
  $uploadname = $_FILES['ufile']['name'];
  $uploadtype = $_FILES['ufile']['type'];
  $tempfile = fopen($uploadfile, 'rb');
  
  $filedata = addslashes(fread($tempfile,filesize($uploadfile)));
 $UpdateAdQuery = update . $thisAdTableName. set
   LocalImageName=' . $PostLocalCopy . ',
ImageData=' . $filedata . ',
ImageName=' . time() . _.$uploadname .',
mimetype =' . $uploadtype . '
where ID= . $mID ;
  $ok = @mysql_query($UpdateAdQuery);
  }
   
  The Code is running properly.But I dont Know Where The uploaded image is 
Stored in the server.I checked /tmp directory,but image is  not there,is 
there any function where i can specify the location of the server where my 
image is to be stored i also tired move_uploaded_image() function .but its not 
working .I am waiting reply from any one


-
 Yahoo! India Answers: Share what you know. Learn something new Click here
Catch all the FIFA World Cup 2006 action on Yahoo! India Click here

Re: [PHP] FTP - moving/copying files

2006-06-29 Thread Jochem Maas
James Nunnerley wrote:
 I'm setting up an ftp manager which allows a user to connect to their space
 on an external server.
 
  
 
 All the php-ftp functions work fine - after I'd realized how to use the
 passive functionality - see previous email to list!
 
  
 
 I've also got working the download and upload functionality, which is quite
 nice, but annoying - it doesn't allow you to download the file without
 creating a temporary version (whereas if it were a local copy you'd be able
 to copy it to a variable, then echo it out...
 
  
 
 Finally, what I now need to do it be able to move/copy files within the FTP
 space.  The standard FTP commands (mv  cp or copy) are not featured in
 php-ftp functions.  Does anyone have any suggestions bar copying the whole
 lot to a local drive then upload in the new space?

what about: http://php.net/manual/en/function.ftp-rename.php ?

 
  
 
 Cheers
 
 Nunners
 
 

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



RE: [PHP] image upload problem

2006-06-29 Thread Jay Blanchard
[snip]
  The Code is running properly.But I dont Know Where The uploaded image
is Stored in the server.I checked /tmp directory,but image is  not
there,is there any function where i can specify the location of the
server where my image is to be stored i also tired move_uploaded_image()
function .but its not working .I am waiting reply from any one
[/snip]

http://www.php.net/move_uploaded_file

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



[PHP] Re: image upload problem

2006-06-29 Thread Jo�o C�ndido de Souza Neto
Please, check that: 
http://br.php.net/manual/pt_BR/function.move-uploaded-file.php

suresh kumar [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]
 Hi,
 This is the code i am using for image upload.
  if ($_FILES['ufile']['name'] != NULL)
 {

  $FlName= $_FILES['ufile']['name'];
  if(!is_uploaded_file($_FILES['ufile']['tmp_name'])){

 print Script type=\text/javascript\
alert(\Error! The expected file wasn't loaded\);

/script;

exit();
  }

  $uploadfile = $_FILES['ufile']['tmp_name'];
  $uploadname = $_FILES['ufile']['name'];
  $uploadtype = $_FILES['ufile']['type'];
  $tempfile = fopen($uploadfile, 'rb');

  $filedata = addslashes(fread($tempfile,filesize($uploadfile)));
 $UpdateAdQuery = update . $thisAdTableName. set
   LocalImageName=' . $PostLocalCopy . ',
ImageData=' . $filedata . ',
ImageName=' . time() . _.$uploadname .',
mimetype =' . $uploadtype . '
where ID= . $mID ;
  $ok = @mysql_query($UpdateAdQuery);
  }

  The Code is running properly.But I dont Know Where The uploaded image is 
 Stored in the server.I checked /tmp directory,but image is  not there,is 
 there any function where i can specify the location of the server where my 
 image is to be stored i also tired move_uploaded_image() function .but its 
 not working .I am waiting reply from any one


 -
 Yahoo! India Answers: Share what you know. Learn something new Click here
 Catch all the FIFA World Cup 2006 action on Yahoo! India Click here 

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



Re: [PHP] Multiple if() statements

2006-06-29 Thread tedd
At 8:15 PM -0400 6/28/06, Robert Cummings wrote:
On Wed, 2006-06-28 at 20:02, David Tulloh wrote:
 Grae Wolfe - PHP wrote:
  ...
   want.  Any help would be great!


-snip- if/elseif -snip-


holy war id=opinion

Whenever you need a elseif, then it's time to consider a switch -- like thus:

print( tr );

switch $row[1]
{
case: none;
print( td$row[0] $row[2]/td );
break;

case: $row[2];
print( td$row[0] $row[2]/td );
break;

default:
print( td$row[0] ($row[1]) $row[2]/td );
break;
}

print( /tr );

humor id=mine

 /* Please note the humor tags, smiley and apology beforehand.
No offense meant to anyone -- insert  apology where needed -- and appropriate.
Your mileage may vary, Take only as prescribed by doctor's advice. No hablo 
inglés */

To me, the switch statement is so much simpler -- what's with you guys and 
these long-ass and confusing if/elseif structures?  :-)

/humor id=mine

/holy war id=opinion

tedd limping off to his bear cave awaiting fallout/.

--

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] [NEWBIE] PHP General List Guide Other Good Stuff

2006-06-29 Thread Jay Blanchard
Recommended reading

http://zirzow.dyndns.org/php-general/NEWBIE
http://phpsec.org/
http://www.php.net/manual/en/security.php

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



Re: [PHP] pdf

2006-06-29 Thread Kim Steinhaug
 Hi all ,
 
   I am using PHP 4.3.2 and MYSQL database.
 
   I need to convert the sql query to Adobe PDF format.
   Any one have any suggestion how to do this?
 
   I have search phpclasses , found SQL2PdfReport classes , however it 
 gave error message as shown below :
 
Error in opening pdf 
 
 Lookup the code in the SQL2Report class , it did not support pdf 7.0 and 
 above.
 
 Thanks
 

I would recommend you looking into pdflib, this is a professional package
which supports all versions of PDF, and really whatever you need. The other
class people mentions are free, but far from as advanced as pdflib.

Grab it here : http://www.pdflib.com/

regards,
Kim Steinhaug
http://www.steinhaug.no/

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



[PHP] Documentation software

2006-06-29 Thread Mathieu Dumoulin
This is not a php specific question but more a programming question. I'd 
like to know names of software that help in creating documentation like 
the microsoft style of documentation when you visit the MSDN library. I 
can also see that often one some sites like the VBCORLIB web site.


I'm sure there is something out there, i'd like mostly a web based one 
and open source or free obviously...


Waiting for your input, thanks

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



RE: [PHP] Programming question - New to PHP

2006-06-29 Thread Jeremy Schreckhise
Try
$link = mysql_connect('localhost',$youruser,$yourpassword) or die();
mysql_select_db('yourdb'); 

$query = 'SELECT * FROM Moses_Lake_Lions';
if(!$result = mysql_query ($query,$link))
{
// do error checking here
}

Jeremy Schreckhise, M.B.A.  

-Original Message-
From: Russbucket [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 28, 2006 6:58 PM
To: PHP General
Subject: [PHP] Programming question - New to PHP

I took an example  of a script from the PHP documentation and try to connect

to my database.   If I leave in the or die part of line 3, I get nothing, if

I comment out that part I get the echo message on line 4. 

?php
// Connecting and selecting the database $conn = mysql_connect ('localhost',
'finemanruss', 'XXXl') or die ('Could not connect :  '  .
mysql_error()); echo 'Connected successfully'; mysql_select_db (Lions,
$conn);

// Preform SQL query
$query = 'SELECT * FROM Moses_Lake_Lions';
$result = mysql_query ($query) or die ( 'Query failed;   '  .
mysql_error());
?

I know line three works without the or die part since I have a 2nd script
that is almost the same (no or die) and it retrieves info from my DB.

Can anyone point me to some tips or solutions to the or die problem? This
script is located in the mysql ref section of the php manual. I'm using php5
on SUSE Linux 10.0 with a mysql database.

Thanks in advance.
--
Russ

--
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] Update site through email

2006-06-29 Thread Rodrigo de Oliveira Costa

Hy guys I'd like to know if there is a way to update a site through
sending an email. Something like this, you send an email and the body
of the email substitutes a text you use in your site. Igreat apreciate
any help since I couldn't find anything on this topic.

Thanks,
doRodrigo

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



RE: [PHP] Update site through email

2006-06-29 Thread Jim Moseby
 
 Hy guys I'd like to know if there is a way to update a site through
 sending an email. Something like this, you send an email and the body
 of the email substitutes a text you use in your site. Igreat apreciate
 any help since I couldn't find anything on this topic.

How much time did you spend looking?  A good place to start might be:
http://us2.php.net/manual/en/ref.imap.php

Where there's a will, theres a way.  I imagine it would be fairly easy to
do.

JM

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



[PHP] creating a threaded message system--sorting messages

2006-06-29 Thread Ben Liu

This question might deviate from PHP into the domain of MySQL but I
thought best to post here first. I'm building a message board system
with PHP/MySQL. I'm trying to present the messages to the users in
threaded order rather than flat. I'm having a lot of trouble figuring
out how to sort the posts so they appear in the correct threaded
order. I don't think I can do this purely with a SQL query. If it can
be done this way, please suggest how and I'll take this question to
the MySQL list.

I think I have figured out the basic logic, I just have no idea how to
translate it into code. Also, I may have the logic wrong. Anyhow this
is what I have so far:

relevant data structure loosely:

post_id (unique, autoincrement, primary index)
parent_id (if the post is a child, this field contains the post_id of
its parent)
...
1) Query the database for all messages under a certain topic, sort by
parent_id then post_id

2) Somehow resort the data so that each group of children is directly
after their parent. Do this in order of ascending parent_id.

Can this be done with usort() and some programatic logic/algorithm?
How do you sort groups of items together rather than comparing each
array element to the next array element (ie: sorting one item at a
time)? Should this be done with a recursive algorithm?

Anyone with experience writing code for this type of message board, or
implementing existing code? Thanks for any help in advance.

- Ben

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



Re: [PHP] Update site through email

2006-06-29 Thread KermodeBear
Hello,

At my last job there were several companies that would send us text invoices
by email. These email accounts were on a Linux box, and when the mail would
come in the message was sent to scripts via STDIN. I'm not sure HOW it was
done but I know that it CAN be done.

I would be concerned about security in this case. The From: header can be
spoofed, as can any other header, so before you do this make sure you have
some kind of authentication scheme. Wouldn't want some lamer finding the
email address and spamming it with v14gr4 email.

-K.Bear

 Hy guys I'd like to know if there is a way to update a site through
 sending an email. Something like this, you send an email and the body
 of the email substitutes a text you use in your site. Igreat apreciate
 any help since I couldn't find anything on this topic.

 Thanks,
 doRodrigo

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



Re: [PHP] Update site through email

2006-06-29 Thread John Nichel

Jim Moseby wrote:

Hy guys I'd like to know if there is a way to update a site through
sending an email. Something like this, you send an email and the body
of the email substitutes a text you use in your site. Igreat apreciate
any help since I couldn't find anything on this topic.


How much time did you spend looking?  A good place to start might be:
http://us2.php.net/manual/en/ref.imap.php

Where there's a will, theres a way.  I imagine it would be fairly easy to
do.



And or knowing how your mail system works (even if you don't have imap 
set up).  Take like qmail for instance; it's trivial to trigger a script 
when an email arrives:


.qmail-email_address (file)
---
|/your/path/here/script.php

And when you send an email to '[EMAIL PROTECTED]' it will 
inject the contents of that email into your script.


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Update site through email

2006-06-29 Thread John Nichel

Nathanael Merrill wrote:
I will be on vacation from June 26th through July 17th. 
I will have limited access to email and will get back to you as soon as I

can. Thank you.

- nathanael merrill



You just made the list Nathanael.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



[PHP] Re: Update site through email

2006-06-29 Thread Mathieu Dumoulin
How i'd do it is not simple, i'm sure there is an easier method but here 
goes for mine.


First you have to setup an inbox that you can read, it can be POP3 or 
IMAP, as long as your PHP script can read it it's fine.


Second, create a script that can actually connect to that inbox and read 
for a new message periodically. You can use a CRONJOB or a Scheduled 
Task if it's available, else, you'll have to check the mailbox from time 
to time when your page launches from a web browser (Try not to do it all 
the time or your page will suffer from this process if it is launched 
all the time).


That script will have to read the emails in the inbox, finds the 
appropriate email and stores the content the way you want, database or 
file, your choice.


Then, your web page will have to read from that stored source of your 
choice and echo the content at it's right place.


As you can see, it CAN be done, it's just a strange way of doing it.

Furthermore i see problems to that. You can probably get very easily 
hacked using this method. Its easy to read the incoming data in the 
server, find the email address used to update the content and then send 
a mail yourself. There is nothing you can do to stop that except encrypt 
your email using SSL... But thats a bit hardcore and there are much 
simpler ways than using SSL encrypted email to update a page ;)


Math

Rodrigo de Oliveira Costa wrote:

Hy guys I'd like to know if there is a way to update a site through
sending an email. Something like this, you send an email and the body
of the email substitutes a text you use in your site. Igreat apreciate
any help since I couldn't find anything on this topic.

Thanks,
doRodrigo


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



Re: [PHP] Re: Update site through email

2006-06-29 Thread Dan McCullough

There are several blog software packages and cms packages that do
something like this you might want to download and take a peek.

Wordpress one that comes to mind.

On 6/29/06, Mathieu Dumoulin [EMAIL PROTECTED] wrote:

How i'd do it is not simple, i'm sure there is an easier method but here
goes for mine.

First you have to setup an inbox that you can read, it can be POP3 or
IMAP, as long as your PHP script can read it it's fine.

Second, create a script that can actually connect to that inbox and read
for a new message periodically. You can use a CRONJOB or a Scheduled
Task if it's available, else, you'll have to check the mailbox from time
to time when your page launches from a web browser (Try not to do it all
the time or your page will suffer from this process if it is launched
all the time).

That script will have to read the emails in the inbox, finds the
appropriate email and stores the content the way you want, database or
file, your choice.

Then, your web page will have to read from that stored source of your
choice and echo the content at it's right place.

As you can see, it CAN be done, it's just a strange way of doing it.

Furthermore i see problems to that. You can probably get very easily
hacked using this method. Its easy to read the incoming data in the
server, find the email address used to update the content and then send
a mail yourself. There is nothing you can do to stop that except encrypt
your email using SSL... But thats a bit hardcore and there are much
simpler ways than using SSL encrypted email to update a page ;)

Math

Rodrigo de Oliveira Costa wrote:
 Hy guys I'd like to know if there is a way to update a site through
 sending an email. Something like this, you send an email and the body
 of the email substitutes a text you use in your site. Igreat apreciate
 any help since I couldn't find anything on this topic.

 Thanks,
 doRodrigo

--
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] Programming question - New to PHP

2006-06-29 Thread Russbucket
On Thursday 29 June 2006 06:29, Jeremy Schreckhise wrote:
snip
 Try
   $link = mysql_connect('localhost',$youruser,$yourpassword) or die();
   mysql_select_db('yourdb');

   $query = 'SELECT * FROM Moses_Lake_Lions';
   if(!$result = mysql_query ($query,$link))
   {
   // do error checking here
   }

 Jeremy Schreckhise, M.B.A.

 -Original Message-
 From: Russbucket [mailto:[EMAIL PROTECTED]
Thanks I'll try that.
-- 
Russ

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



[PHP] Re: modify xml before parse

2006-06-29 Thread Adam Zey

Yeo Wee Tat wrote:

Hi Adam,

  I can modify the xml file without any error , however when I tried to
unserializer the xml file using PEAR:XML , it gave the error message below.
I have attached my code for your perusal. 

Any ideas ? thanks 


?php
ini_set('display_errors', E_ALL);
require_once '../library/config.php';
require_once '../library/class.XMLUtil.php';

$xmlfile = /home/gvintranet/datacraft/htdocs/uploads/cisco.xml;

$xml = preg_replace(/!\\[CDATA\\[.+?\\]\\]/, ![CDATA[ignore_this]],
$xml);
$filehandle = fopen($xmlfile, 'wb');
$ok = fwrite($filehandle,$xml);
echo ok.$ok;

$options = array(complexType = object);
$xml_util = new XMLUtil($xmlfile, $options);
$xml_util-unserializer_XML(true);
$data = $xml_util-getUnserializedData();
echo print_r($data);

?

error message:

pear_error Object ( [error_message_prefix] = [mode] = 1 [level] = 1024
[code] = 151 [message] = No unserialized data available. Use
XML_Unserializer::unserialize() first. [userinfo] = [backtrace] = Array (
[0] = Array ( [file] = /usr/share/pear/PEAR.php [line] = 566 [function]
= pear_error [class] = pear_error [type] = - [args] = Array ( [0] = No
unserialized data available. Use XML_Unserializer::unserialize() first. [1]
= 151 [2] = 1 [3] = 1024 [4] = ) ) [1] = Array ( [file] =
/usr/share/pear/XML/Unserializer.php [line] = 489 [function] = raiseerror
[class] = xml_unserializer [type] = - [args] = Array ( [0] = No
unserialized data available. Use XML_Unserializer::unserialize() first. [1]
= 151 ) ) [2] = Array ( [file] =
/home/gvintranet/datacraft/htdocs/library/class.XMLUtil.php [line] = 54
[function] = getunserializeddata [class] = xml_unserializer [type] = -
[args] = Array ( ) ) [3] = Array ( [file] =
/home/gvintranet/datacraft/htdocs/admin/test_regex.php [line] = 43
[function] = getunserializeddata [class] = xmlutil [type] = - [args] =
Array ( ) ) ) [callback] = ) 1

Yeo Wee Tat 
Tel: +65-62730049   Fax: +65-62734934

Cxrus Solutions Pte Ltd (Singapore . Thailand)
1003 Bukit Merah Central #05-20 Singapore 159836
System Integration . Business Solutions . Linux Simplified
  
I must admit, I've never used Pear for anything (I stick to SimpleXML 
myself). Perhaps it doesn't like the new cdata tag you're writing? Have 
you tried replacing the entire cdata tag with an empty string, or trying 
another XML parser (like SimpleXML) just to see if the trouble is with 
your XML or Pear?


Regards, Adam.

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



[PHP] Re: creating a threaded message system--sorting messages

2006-06-29 Thread Adam Zey

Ben Liu wrote:

This question might deviate from PHP into the domain of MySQL but I
thought best to post here first. I'm building a message board system
with PHP/MySQL. I'm trying to present the messages to the users in
threaded order rather than flat. I'm having a lot of trouble figuring
out how to sort the posts so they appear in the correct threaded
order. I don't think I can do this purely with a SQL query. If it can
be done this way, please suggest how and I'll take this question to
the MySQL list.

I think I have figured out the basic logic, I just have no idea how to
translate it into code. Also, I may have the logic wrong. Anyhow this
is what I have so far:

relevant data structure loosely:

post_id (unique, autoincrement, primary index)
parent_id (if the post is a child, this field contains the post_id of
its parent)
...
1) Query the database for all messages under a certain topic, sort by
parent_id then post_id

2) Somehow resort the data so that each group of children is directly
after their parent. Do this in order of ascending parent_id.

Can this be done with usort() and some programatic logic/algorithm?
How do you sort groups of items together rather than comparing each
array element to the next array element (ie: sorting one item at a
time)? Should this be done with a recursive algorithm?

Anyone with experience writing code for this type of message board, or
implementing existing code? Thanks for any help in advance.

- Ben


Just throwing an idea out there, but you can do the sorting entirely in 
the SQL query. The trick is to figure out the best way.


The first idea that came to mind (and it sucks, but it works), is a text 
field with padded numbers separated by dots, and the number is the 
position in relation to the parent. So, with this:


Post 1
 Post 3
  Post 5
  Post 6
 Post 4
  Post 7
Post 2
 Post 8

Now, to the helper field would contain this for each post:

Post 1: 1
Post 2: 2
Post 3: 1.1
Post 4: 1.2
Post 5: 1.1.1
Post 6: 1.1.2
Post 7: 1.2.1
Post 8: 2.1

Now, by pure ascii sorting in that field, that would sort out to:

Post 1: 1
Post 3: 1.1
Post 5: 1.1.1
Post 6: 1.1.2
Post 4: 1.2
Post 7: 1.2.1
Post 2: 2
Post 8: 2.1

Which is the correct sort order. The depth of the post (how far to 
indent it?) could be told in PHP by counting the number of periods, or 
storing it in the database.


Now, how to figure out what to put in that field for each post? We need 
to do two things. First, each post needs to store the number of 
children. Next, when a new post is made, we do three things (Keeping in 
mind that in real life I'd pad each entry in the sort helper field 
with zeros on the left up to some large number):


1) Get the sort helper field of the parent and the parent's child count 
field
2) Take the parent's sort help field, and add on a period and the 
parent's child count plus one, insert the child.

3) Update the parent's child count.

OK, now, this method sucks. It's slow, and limits the number of child 
posts to whatever you pad (In itself, not a big issue, if each post can 
only have, say, a thousand direct childs (which each themselves can have 
a thousand childs), not a huge issue). The slow part from ascii sorting 
everything is the problem, I'd think.


I've never done threaded anything before, so I assume there's a better 
solution. I'm just saying that the job CAN be done entirely with SQL 
sorting. And probably faster than your proposed method of resorting 
everything once PHP gets ahold of it. It should be noted that you'd need 
each post to have a sort of superparent field that stored the topmost 
parent so that you could do something simple like selecting ten 
superparents and all their children.


Regards, Adam.

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



RE: [PHP] running system()

2006-06-29 Thread Mark Steudel
I'm trying to use gpgp to encrypt and decrypt files. I can get it to work if
it's a scheduled task, as the user that's running the task isn't the web
user, but I was just wondering if there was a way to safely enable system
for a shared environment.

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 28, 2006 8:01 PM
To: Mark Steudel
Cc: php-general@lists.php.net
Subject: Re: [PHP] running system()

Mark Steudel wrote:
 So I'm trying to run some system commands on the windows box I am working
 on. And I am getting Unable to fork errors. So after some googling I see
 that its because the internet guest user needs access to cmd.exe, my
 question is how safe is it to enable this on a production/shared
 environment? Anyways pointers to securely setting this up?

If it's enabled, it's enabled for everyone.

If you're calling system, make sure you use escapeshellarg and 
escapeshellcmd in the relevant places.

That's not going to protect you from other peoples bad code though..

What are you trying to use system() for? Maybe there's a built in 
function or another way to do what you need.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] Re: Re: creating a threaded message system--sorting messages

2006-06-29 Thread Ben Liu

On 6/29/06, Adam Zey [EMAIL PROTECTED] wrote:


Just throwing an idea out there, but you can do the sorting entirely in
the SQL query. The trick is to figure out the best way.

The first idea that came to mind (and it sucks, but it works), is a text
field with padded numbers separated by dots, and the number is the
position in relation to the parent. So, with this:

Post 1
  Post 3
   Post 5
   Post 6
  Post 4
   Post 7
Post 2
  Post 8

Now, to the helper field would contain this for each post:

Post 1: 1
Post 2: 2
Post 3: 1.1
Post 4: 1.2
Post 5: 1.1.1
Post 6: 1.1.2
Post 7: 1.2.1
Post 8: 2.1

Now, by pure ascii sorting in that field, that would sort out to:

Post 1: 1
Post 3: 1.1
Post 5: 1.1.1
Post 6: 1.1.2
Post 4: 1.2
Post 7: 1.2.1
Post 2: 2
Post 8: 2.1

Which is the correct sort order. The depth of the post (how far to
indent it?) could be told in PHP by counting the number of periods, or
storing it in the database.


The indentation part I've already sort of figured out--it uses some
php to create a divs-within-divs structure, then using some simple CSS
I can get the appropriate level of indentation.


Now, how to figure out what to put in that field for each post? We need
to do two things. First, each post needs to store the number of
children. Next, when a new post is made, we do three things (Keeping in
mind that in real life I'd pad each entry in the sort helper field
with zeros on the left up to some large number):

1) Get the sort helper field of the parent and the parent's child count
field
2) Take the parent's sort help field, and add on a period and the
parent's child count plus one, insert the child.
3) Update the parent's child count.

OK, now, this method sucks. It's slow, and limits the number of child
posts to whatever you pad (In itself, not a big issue, if each post can
only have, say, a thousand direct childs (which each themselves can have
a thousand childs), not a huge issue). The slow part from ascii sorting
everything is the problem, I'd think.

I've never done threaded anything before, so I assume there's a better
solution. I'm just saying that the job CAN be done entirely with SQL
sorting. And probably faster than your proposed method of resorting
everything once PHP gets ahold of it. It should be noted that you'd need
each post to have a sort of superparent field that stored the topmost
parent so that you could do something simple like selecting ten
superparents and all their children.



Regards, Adam.



Thanks for the help Adam, I'll try to wrap my head around your response...

- Ben

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



RE: [PHP] Re: Re: creating a threaded message system--sorting messages

2006-06-29 Thread KermodeBear
Sounds like that darn Hierarchial Data again. Give this a read and see if it
helps you out at all. In particular, you may find the area 'Finding the
Depth of the Nodes' helpful.

http://dev.mysql.com/tech-resources/articles/hierarchical-data.html

Hope it helps,
-K.Bear

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



Re: [PHP] working on a template system...

2006-06-29 Thread Charlene Wroblewski

*joining the fray a little late*

What is the difference between this, Smarty and template.inc? 

I have found Smarty to be unusable in my situation where a graphic 
designer needs to be able to edit the html and is easily confused by 
non-html.


So, I am using template.inc which is apparently old (PHP 3) but seems to 
work great even with PHP 4.1.  Another question is whether it will work 
with PHP 5?


Charlene

sempsteen wrote:


hi, i'm working on a template system. Basically i'm building raw
contents in arrays and then put them in templates by some special
tags.

for loop systems my basic array structure is like this:
$array['key'][]['keyword'] = ...

for example, for a bulletin board system, array structure for
categories is something like this:
$array['categories'][]['text_category_name'] = ...

it is looped through database recordset, so final array for 2 
categories can be:

$array['categories'][0]['text_category_name'] = 'programming'
$array['categories'][1]['text_category_name'] = 'life'

template file structure for loops is something like this (ex, 
categories):

!-- loop|categories:bof --
tr
  td[$text_category_name$]/td
/tr
!-- loop|categories:eof --

i can easily loop this template and replace [$text_category_name] for
every category set in the array. after removing the comment tags i get
the final content:

tr
  tdprogramming/td
/tr
tr
  tdlife/td
/tr

But i'm stuck with nested loops. For example i want to put related
forums after each categories.

array structure is:
$array['categories'][0]['text_category_name'] = programming
$array['categories'][0]['forums'][0]['text_forum_name'] = php
$array['categories'][0]['forums'][1]['text_forum_name'] = ruby

$array['categories'][1]['text_category_name'] = life
$array['categories'][1]['forums'][0]['text_forum_name'] = music
$array['categories'][1]['forums'][1]['text_forum_name'] = sports

template structure is:
!-- loop|categories:bof --
tr
  td[$text_category_name$]/td
/tr
!-- loop|forums:bof --
tr
  td[$text_forum_name$]/td
/tr
!-- loop|forums:eof --
!-- loop|categories:eof --

i've written some functions, used them recursively but it didn't work.
actually i couldn't find the true logic. note that it isn't a limited
array. it can have messages under each forums, peoples under each
messages, so on..

help me find the true approach to handle this. thank you.



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



[PHP] design?

2006-06-29 Thread Sjef
Hi there,

I am starting a new, very small project. A simple question and answering 
form. In one screen, question and answer can be typed, the strings will be 
saved in a database table questions which holds question and answer (as 
there is only one answer to a question). There will be a webpage displaying 
all the questions, clickable to the webpage of the answer to the question 
clicked.

I want to create a class Question for dealing wiht the questions and a class 
answer for the answers. Each could contain an array with the their part of 
the content of the database table. The class Question manages the class 
Answer, so when instantiating the Question, the Answer will follow.
Beside of this I want to create a 'visual' component class that creates the 
lists as displayed on the webpage.

Is this a good idea? Or should I not bother, and just create one class 
Question that also deals with the Answers.

Thanxs!
Sjef 

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



[PHP] Re: Update site through email

2006-06-29 Thread Manuel Lemos
Hello,

on 06/29/2006 10:54 AM Rodrigo de Oliveira Costa said the following:
 Hy guys I'd like to know if there is a way to update a site through
 sending an email. Something like this, you send an email and the body
 of the email substitutes a text you use in your site. Igreat apreciate
 any help since I couldn't find anything on this topic.

Sure, you can send a message attaching the files you want to update in
your site to an address with a POP3 mailbox and then use a POP3 client
to retrieve and parse the message to extract the files to be updated.

You may want to try this POP3 client class that you can use for that
purpose.

It provides a cool feature that lets you retrieve messages from POP3
mailbox using PHP fopen or file_get_contents functions like this:

file_get_contents('pop3://user:[EMAIL PROTECTED]/1');

http://www.phpclasses.org/pop3class

You can also use this message parser class that lets you process your
messages and extract any files easily.

http://www.phpclasses.org/mimeparser

Take a look at this example that demonstrates how to integrate both
classes easily to parse your message structure:

http://www.phpclasses.org/browse/file/14695.html

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] image upload problem

2006-06-29 Thread Jochem Maas
suresh kumar wrote:
 Hi,

hi ([EMAIL PROTECTED]([EMAIL PROTECTED]([EMAIL PROTECTED](*%([EMAIL 
PROTECTED]([EMAIL PROTECTED]@#

 I am waiting reply from any one

do we have someone here called 'any one'? how about you reply to one
of the people who answer your questions.

PS - the tmp file is removed at the end of the request.
PPS - ?php echo it is temporarily stored at {$_FILES['ufile']['tmp_name']}; 
?

 
   
 -
  Yahoo! India Answers: Share what you know. Learn something new Click here
 Catch all the FIFA World Cup 2006 action on Yahoo! India Click here

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



Re: [PHP] Documentation software

2006-06-29 Thread Jochem Maas
Mathieu Dumoulin wrote:
 This is not a php specific question but more a programming question. I'd

oh we'll answer Q's on anything from ASP to STDs on this list ;-)

 like to know names of software that help in creating documentation like
 the microsoft style of documentation when you visit the MSDN library. I

MSDN is documentation hell in terms of navigation AND content (jmho).

you could try this: http://www.phpdoc.org/
note that phpDocumentor is aimed primarily at API documentation

alternatively maybe this gives you a few options:
http://www.google.com/search?q=php+documentation+tool

 can also see that often one some sites like the VBCORLIB web site.
 
 I'm sure there is something out there, i'd like mostly a web based one
 and open source or free obviously...
 
 Waiting for your input, thanks
 

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



[PHP] Re: Update site through email

2006-06-29 Thread Adam Zey

Manuel Lemos wrote:

Hello,

on 06/29/2006 10:54 AM Rodrigo de Oliveira Costa said the following:

Hy guys I'd like to know if there is a way to update a site through
sending an email. Something like this, you send an email and the body
of the email substitutes a text you use in your site. Igreat apreciate
any help since I couldn't find anything on this topic.


Sure, you can send a message attaching the files you want to update in
your site to an address with a POP3 mailbox and then use a POP3 client
to retrieve and parse the message to extract the files to be updated.

You may want to try this POP3 client class that you can use for that
purpose.

It provides a cool feature that lets you retrieve messages from POP3
mailbox using PHP fopen or file_get_contents functions like this:

file_get_contents('pop3://user:[EMAIL PROTECTED]/1');

http://www.phpclasses.org/pop3class

You can also use this message parser class that lets you process your
messages and extract any files easily.

http://www.phpclasses.org/mimeparser

Take a look at this example that demonstrates how to integrate both
classes easily to parse your message structure:

http://www.phpclasses.org/browse/file/14695.html



I've had to have a perl script reacting to emails and acting on them. I 
did it using RetchMail (http://open.nit.ca/wiki/?page=RetchMail), which 
is mindnumbingly fast when you need to download a bunch of emails. As 
the page says, stupidly fast. As a disclaimer, it's an opensource app 
maintained by people at my workplace. Still, it's probably the fastest 
POP3 mail fetcher out there.


Regards, Adam Zey.

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



[PHP] Re: Re: creating a threaded message system--sorting messages

2006-06-29 Thread Ben Liu

SOLVED, almost. I read the article suggested by K.Bear and found the
recommended solution to be a bit more complicated than I wanted to
implement. I then found another way to do this using the existing
Adjacency List Model through a recursive function. So basically, you
query the database for the post_id of the very first post in the
discussion. You then call a function that displays that post, searches
for all children of that post and then calls itself recursively on
each of the children it discovers. This works great for spitting out
the posts in the proper order. Now I'm trying to figure out how to
make sure the indenting looks right in the browser.

- Ben

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



[PHP] Find out cookies on a computer?

2006-06-29 Thread Peter Lauri
Is it possible to some how find out all cookies on a specific computer and
their name and value? I assume not :)

 

/Peter

 

 

 



[PHP] Re: creating a threaded message system--sorting messages

2006-06-29 Thread Adam Zey

Ben Liu wrote:

SOLVED, almost. I read the article suggested by K.Bear and found the
recommended solution to be a bit more complicated than I wanted to
implement. I then found another way to do this using the existing
Adjacency List Model through a recursive function. So basically, you
query the database for the post_id of the very first post in the
discussion. You then call a function that displays that post, searches
for all children of that post and then calls itself recursively on
each of the children it discovers. This works great for spitting out
the posts in the proper order. Now I'm trying to figure out how to
make sure the indenting looks right in the browser.

- Ben


Wouldn't that involve a separate SQL query for every post? Avoid that at 
all costs. That's insanely slow and wasteful. Recursive functions have 
no business using SQL queries. I'd suggest you start looking for a more 
sane method of doing this.


Regards, Adam.

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



[PHP] RE: Find out cookies on a computer?

2006-06-29 Thread Peter Lauri
Is the question dumb? Why you answer it then? It is very interesting in a
security manner. I have very low knowledge about them, so therefore the
question. And if you think this question is unethical, and the rest of the
society does that, we would probably not have as secure technology regarding
cookies _as you state it is_. Rethink you answer a bit...

As a developer I would like to know if someone can view the cookies that are
not authorized to do so. Sorry for wanting to learn more...


-Original Message-
From: Adam Zey [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 30, 2006 4:32 AM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: Find out cookies on a computer?

Peter Lauri wrote:
 Is it possible to some how find out all cookies on a specific computer and
 their name and value? I assume not :)
 
  
 
 /Peter
 

No, because you don't OWN them, therefore you have no right (either 
technologically or ethically) to see them. Asking such unethical 
questions on this list is, well, pretty dumb.

Regards, Adam.

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



[PHP] Re: Find out cookies on a computer?

2006-06-29 Thread Adam Zey

Peter Lauri wrote:

Is it possible to some how find out all cookies on a specific computer and
their name and value? I assume not :)

 


/Peter



No, because you don't OWN them, therefore you have no right (either 
technologically or ethically) to see them. Asking such unethical 
questions on this list is, well, pretty dumb.


Regards, Adam.

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



[PHP] Re: Find out cookies on a computer?

2006-06-29 Thread Michael Rasmussen
On Fri, 30 Jun 2006 04:23:51 +0700, Peter Lauri wrote:

 Is it possible to some how find out all cookies on a specific computer
 and their name and value? I assume not :)
The global array $_COOKIE should hold any cookie which is available to you

-- 
Hilsen/Regards
Michael Rasmussen
http://keyserver.veridis.com:11371/pks/lookup?op=getsearch=0xE3E80917

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



RE: [PHP] Re: creating a threaded message system--sorting messages

2006-06-29 Thread KermodeBear
Hello,

As Adam pointed out, this can be deadly to your database, especially as the
number of posts grows. If you want to go that route, I would recommend
selecting all the posts in that particular thread and sorting the data out
in PHP somehow. No need to slam your database with (potentially) hundreds of
queries to display a discussion. Multiply that by several page views at
once...

If you don't mind the extra work and investigation, I would recommend
downloading some PHP forum software that supports threaded discussion and
see how they implement it. I found several listed in DMOZ:
http://dmoz.org/Computers/Programming/Languages/PHP/Scripts/Forums/

Let us know what you come up with! I'd like to see how you work this out.
This is a good computer science type of problem with practical application -
the kind of stuff they should have taught me in school but never did. ~(o:

Best of luck,

-K.Bear

 SOLVED, almost. I read the article suggested by K.Bear and found the
 recommended solution to be a bit more complicated than I wanted to
 implement. I then found another way to do this using the existing
 Adjacency List Model through a recursive function. So basically, you
 query the database for the post_id of the very first post in the
 discussion. You then call a function that displays that post, searches
 for all children of that post and then calls itself recursively on
 each of the children it discovers. This works great for spitting out
 the posts in the proper order. Now I'm trying to figure out how to
 make sure the indenting looks right in the browser.
 
 - Ben

 Wouldn't that involve a separate SQL query for every post?

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



RE: [PHP] Re: Find out cookies on a computer?

2006-06-29 Thread Peter Lauri
snip
The global array $_COOKIE should hold any cookie which is available to you
/snip

Yes, but that is just for the ones available for me. Like Google, they set a
cookie if you click on one of their adwords ads and then use them in the
tracking of the customer conversion.

Cookies like this are interesting to use. One of my clients want to track a
little deeper the adwords and the conversion of them, and to get that
cookie would be awesome.

But I am loosing hope that it can be done now :)

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



RE: [PHP] Re: Find out cookies on a computer?

2006-06-29 Thread Jay Blanchard
[snip]
But I am loosing hope that it can be done now :)
[/snip]

I will go ahead and remove all hope. If you do not own the cookie, you
cannot see it or use it. It is a rule of this jungle that has been in
place for years.

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



RE: [PHP] Re: Find out cookies on a computer?

2006-06-29 Thread Michael Rasmussen
On Fri, 30 Jun 2006 05:06:33 +0700, Peter Lauri wrote:

 
 Yes, but that is just for the ones available for me. Like Google, they set
 a cookie if you click on one of their adwords ads and then use them in
 the tracking of the customer conversion.
The place where the cookies are stored is dependant of the users browser
and platform. Try this by having MS IE and FF display all stored cookies -
I bet you would get a different picture.

-- 
Hilsen/Regards
Michael Rasmussen
http://keyserver.veridis.com:11371/pks/lookup?op=getsearch=0xE3E80917

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



Re: [PHP] Re: Find out cookies on a computer?

2006-06-29 Thread Dave Goodchild

On 29/06/06, Jay Blanchard [EMAIL PROTECTED] wrote:


[snip]
But I am loosing hope that it can be done now :)
[/snip]

I will go ahead and remove all hope. If you do not own the cookie, you
cannot see it or use it. It is a rule of this jungle that has been in
place for years.

Yes, let's put this baby to bed. You have access to the $_COOKIE
superglobal array and that is it. Period, Full stop. End.





--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk


Re: [PHP] RE: Find out cookies on a computer?

2006-06-29 Thread Richard Collyer

Peter Lauri wrote:

Is the question dumb? Why you answer it then? It is very interesting in a
security manner. I have very low knowledge about them, so therefore the
question. And if you think this question is unethical, and the rest of the
society does that, we would probably not have as secure technology regarding
cookies _as you state it is_. Rethink you answer a bit...

As a developer I would like to know if someone can view the cookies that are
not authorized to do so. Sorry for wanting to learn more...


http://en.wikipedia.org/wiki/HTTP_cookie#Privacy_and_third-party_cookies

Cheers
Richard

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



Re: [PHP] Re: creating a threaded message system--sorting messages

2006-06-29 Thread Dan McCullough

I've come into this discussion pretty late so please bear with me if I
go over something that has been ruled out.

You are trying to print out in a threaded method the first post in a
thread followed by each post after that, that is a child/reply to that
post.  Is that correct?

So something like

Example 1

Thread1
 Post1
   Post2
 Post3
   Post4
 .

or

Example 2

Thread1
 Post1
   Post2 - reply to post 1
Post3 - reply to post 2
   Post4 - reply to post 1
   Post5 - reply to post 1
Post6 - reply to post 2
 Post7 - reply to post 3


Example 1 is very common and is the easiest to implement.  From what I
remember you would need a couple of DB tables for post, post_thread,
post_post, thread

So for your question thread isnt very relative but I thought I would
throw it in.

thread {
threadid int(11) auto_increment,
threadname
threadsort
...

thread_post {
threadid int(11)
postid int(11)


post {
postid int(11) auto_increment,
postname
posttext
...

post_post
postid int(11),
postid2 int(11)


Please note I have two kids fighting over the cat, trying to cook
dinner and stave off a flood of water from the rising river so the SQL
structure is for example.

You can get everything in one query from the DB and lay it out based
on the id of the post, if you DB is properly indexed and setup and
queries are optimized you'll hardly notice a blip when the load gets
up.  You do not want to be doing multiple queries on a page when one
well written query will do the trick.

Either way if this is more what you are looking for we can get into
specifics later.

Dan


On 6/29/06, KermodeBear [EMAIL PROTECTED] wrote:

Hello,

As Adam pointed out, this can be deadly to your database, especially as the
number of posts grows. If you want to go that route, I would recommend
selecting all the posts in that particular thread and sorting the data out
in PHP somehow. No need to slam your database with (potentially) hundreds of
queries to display a discussion. Multiply that by several page views at
once...

If you don't mind the extra work and investigation, I would recommend
downloading some PHP forum software that supports threaded discussion and
see how they implement it. I found several listed in DMOZ:
http://dmoz.org/Computers/Programming/Languages/PHP/Scripts/Forums/

Let us know what you come up with! I'd like to see how you work this out.
This is a good computer science type of problem with practical application -
the kind of stuff they should have taught me in school but never did. ~(o:

Best of luck,

-K.Bear

 SOLVED, almost. I read the article suggested by K.Bear and found the
 recommended solution to be a bit more complicated than I wanted to
 implement. I then found another way to do this using the existing
 Adjacency List Model through a recursive function. So basically, you
 query the database for the post_id of the very first post in the
 discussion. You then call a function that displays that post, searches
 for all children of that post and then calls itself recursively on
 each of the children it discovers. This works great for spitting out
 the posts in the proper order. Now I'm trying to figure out how to
 make sure the indenting looks right in the browser.

 - Ben

 Wouldn't that involve a separate SQL query for every post?

--
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] RE: Find out cookies on a computer?

2006-06-29 Thread Peter Lauri
Thank you, great reading :)

-Original Message-
From: Richard Collyer [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 30, 2006 5:01 AM
To: php-general@lists.php.net
Subject: Re: [PHP] RE: Find out cookies on a computer?

Peter Lauri wrote:
 Is the question dumb? Why you answer it then? It is very interesting in a
 security manner. I have very low knowledge about them, so therefore the
 question. And if you think this question is unethical, and the rest of the
 society does that, we would probably not have as secure technology
regarding
 cookies _as you state it is_. Rethink you answer a bit...
 
 As a developer I would like to know if someone can view the cookies that
are
 not authorized to do so. Sorry for wanting to learn more...

http://en.wikipedia.org/wiki/HTTP_cookie#Privacy_and_third-party_cookies

Cheers
Richard

-- 
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] running number in paging

2006-06-29 Thread Chris

weetat wrote:

Hi all ,

 I have using PEAR:Pager , to do paging .


If you have a pear question, ask on the pear mailing list.

http://pear.php.net/support/

We do not know their code or how to use it.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] [NEWBIE] PHP General List Guide Other Good Stuff

2006-06-29 Thread Chris

Jay Blanchard wrote:

Recommended reading

http://zirzow.dyndns.org/php-general/NEWBIE


Should we add a link to the pear support page for pear related questions?

Something as simple as:

If you have a question about any of the pear packages, join the 
appropriate list here: http://pear.php.net/support/lists.php;


--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] [NEWBIE] PHP General List Guide Other Good Stuff

2006-06-29 Thread Scott Heinrichs

This was listed in another thread but I think would be a great tool
and online refference for any one who is programming in PHP and
especially for NEWBIES.
http://www.hudzilla.org/phpbook/

note: This is one of the best reads I have seen, both online and in print.

On 6/29/06, Chris [EMAIL PROTECTED] wrote:

Jay Blanchard wrote:
 Recommended reading

 http://zirzow.dyndns.org/php-general/NEWBIE

Should we add a link to the pear support page for pear related questions?

Something as simple as:

If you have a question about any of the pear packages, join the
appropriate list here: http://pear.php.net/support/lists.php;

--
Postgresql  php tutorials
http://www.designmagick.com/

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

2006-06-29 Thread bruce
hi...

in getting information on xpath/xml.. i thought i'd ask these lists as
well...

i'm trying to find out if there's a tool that i could use to load an HTML
web page into, that would allow me to point to a given item/element within
the Tree/DOM structure and allow me to see what the Xpath statement would be
to generate that given itm/element of the Tree...

i've seen a few tools but none that have exactly what i'm looking for...

has anyone knowledge of any kind of tool/plugin like this? i'd also like to
hear your comments pro/con of the tool if you've actually used it!!

thanks

-bruce

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



Re: [PHP] design?

2006-06-29 Thread David Tulloh
Sjef wrote:
 Hi there,
 
 I am starting a new, very small project. A simple question and answering 
 form. In one screen, question and answer can be typed, the strings will be 
 saved in a database table questions which holds question and answer (as 
 there is only one answer to a question). There will be a webpage displaying 
 all the questions, clickable to the webpage of the answer to the question 
 clicked.
 
 I want to create a class Question for dealing wiht the questions and a class 
 answer for the answers. Each could contain an array with the their part of 
 the content of the database table. The class Question manages the class 
 Answer, so when instantiating the Question, the Answer will follow.
 Beside of this I want to create a 'visual' component class that creates the 
 lists as displayed on the webpage.
 
 Is this a good idea? Or should I not bother, and just create one class 
 Question that also deals with the Answers.
 

You have essentially three pages:
  one that displays a form and inputs the entered data to a database;
  one that gets a list of questions from the database;
  one that displays a specific question/answer pair.

As a ballpark estimate, I'd say that the above should be possible in
under 100 lines of PHP code.

You are looking at creating a Question class, an Answer class and a
Visual/List class.  The net result being that you double the number of
PHP files and considerably increase the amount of code, there isn't much
opportunity for code reuse here.

Now, if the objective is to play with php OOP then go ahead.  I would
even suggest a DB class, a TableRow class, the Question and Answer then
inherit from the TableRow, a TableRows class from which your List class
would inherit.  Maybe throw a few in to control the templates etc. as well.

If the objective is just to get the job done and the site out, I don't
see why you should bother with OOP at all.


David

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



Re: [PHP] Multiple if() statements

2006-06-29 Thread Larry Garfield
On Thursday 29 June 2006 06:51, tedd wrote:
 At 8:15 PM -0400 6/28/06, Robert Cummings wrote:
 On Wed, 2006-06-28 at 20:02, David Tulloh wrote:
  Grae Wolfe - PHP wrote:
   ...
  
want.  Any help would be great!

 -snip- if/elseif -snip-


 holy war id=opinion

 Whenever you need a elseif, then it's time to consider a switch -- like
 thus:

switch is fine if your elseif comparisons are equality based.  If they're not 
equality based, then they don't map to switch as well.

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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



[PHP] Functions

2006-06-29 Thread [EMAIL PROTECTED]

I am trying to create a function to clean up variables that are user
inputted from a form.  I am not getting this script to work.  Can anyone
help.

---Start Script---
function cleaner($var)
{
trim(strip_tags(ucfirst(addslashes($var;
}

$var = abc's;

echo $var;
---End Script---

When I run the above script it produces nothing. Instead of a result of
Abc\'s.


Re: [PHP] creating a threaded message system--sorting messages

2006-06-29 Thread Larry Garfield
On Thursday 29 June 2006 09:11, Ben Liu wrote:

 relevant data structure loosely:

 post_id (unique, autoincrement, primary index)
 parent_id (if the post is a child, this field contains the post_id of
 its parent)
 ...
 1) Query the database for all messages under a certain topic, sort by
 parent_id then post_id

 2) Somehow resort the data so that each group of children is directly
 after their parent. Do this in order of ascending parent_id.

 Can this be done with usort() and some programatic logic/algorithm?
 How do you sort groups of items together rather than comparing each
 array element to the next array element (ie: sorting one item at a
 time)? Should this be done with a recursive algorithm?

 Anyone with experience writing code for this type of message board, or
 implementing existing code? Thanks for any help in advance.

 - Ben

I've written such a system before more than once.  You do the sorting in SQL, 
and then traverse the data recursively in PHP to build the tree.  It's a 
single SQL query.  Check the archives for this list for about 3-4 weeks ago, 
I think.  We were just discussing it, and I showed some basic code 
examples. :-)

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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



Re: [PHP] Multiple if() statements

2006-06-29 Thread John Meyer

Larry Garfield wrote:


switch is fine if your elseif comparisons are equality based.  If they're not 
equality based, then they don't map to switch as well.


In other words, if you look at a logical ladder as the roots of the 
tree, as long as each root has the same number of forks (say each fork 
ends only one way), your fine with a switch.  If you have one, however, 
that has only one condition, and another that has  two, then you need an 
if...elseif logic tree.




--
Online library -- http://pueblonative.110mb.com
138 books and counting.

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



Re: [PHP] Functions

2006-06-29 Thread John Meyer

Two things:
1.  You're not returning anything from the function.
2.  You're not even using the function.

[EMAIL PROTECTED] wrote:

I am trying to create a function to clean up variables that are user
inputted from a form.  I am not getting this script to work.  Can anyone
help.

---Start Script---
function cleaner($var)
{
trim(strip_tags(ucfirst(addslashes($var;
}

$var = abc's;

echo $var;
---End Script---

When I run the above script it produces nothing. Instead of a result of
Abc\'s.




--
Online library -- http://pueblonative.110mb.com
138 books and counting.

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



Re: [PHP] Functions

2006-06-29 Thread Chris

[EMAIL PROTECTED] wrote:

I am trying to create a function to clean up variables that are user
inputted from a form.  I am not getting this script to work.  Can anyone
help.

---Start Script---
function cleaner($var)
{
trim(strip_tags(ucfirst(addslashes($var;
}

$var = abc's;

echo $var;



You need to return the value from the function:

return trim(strip_tags(.)

or pass in a reference:

function cleaner ($var)


--
Postgresql  php tutorials
http://www.designmagick.com/

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