[PHP] Constants

2004-03-22 Thread Jakes
The bug server looks like its down, so I will just post the bug here, and
hopefully someone
will spot it

PHP version: 5RC1

displayFoo();
?>

The results should display "hello world", but it prints out MY_FOO.

Thanks

Jakes

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



RE: [PHP] mysql_connect error

2004-03-22 Thread php-general
T,

You also need to load the php_mysql rpm (Assuming you loaded via rpm)

Till We Meet Again...

Clifford W. Hansen
Operations Support Developer
Aspivia (Pty) Ltd.

+27 (0) 11 259-1150 (Switchboard)
+27 (0) 11 259-1019 (Fax)
+27 (0) 83 761-0240 (Mobile)
[EMAIL PROTECTED] (EMail)
http://chansen.aspivia.com (Web)

Registered Linux user number 343424 on http://counter.li.org/

"We have seen strange things today!" Luke 5:26

This message contains information intended for the perusal, and/or use (if
so stated), of the stated addressee(s) only. The information is confidential
and privileged. If you are not an intended recipient, do not peruse, use,
disseminate, distribute, copy or in any manner rely upon the information
contained in this message (directly or indirectly). The sender and/or the
entity represented by the sender shall not be held accountable in the event
that this prohibition is disregarded.

If you receive this message in error, notify the sender immediately by
e-mail, fax or telephone and return and/or destroy the original message.

The views or representations contained in this message, whether express or
implied, are those of the sender only, unless that sender expressly states
them to be the views or representations of an entity or person, who shall be
named by the sender and who the sender shall state to represent. No
liability shall otherwise attach to any other entity or person.

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



[PHP] Re: an if statement

2004-03-22 Thread Evgeny Pedya
Hello, Andy!
You wrote  on Mon, 22 Mar 2004 22:59:02 -0500:

 AB> was just wondering if the statement:
 AB> if(!$name || !$comments){
 AB> /*whatever here*/ }

 AB> would be interpreted as : if either $name or $comments doesn't exist
 AB> then

 AB> or how would the if statement be?? i need to check if the $name and
 AB> $comments are empty/null because both $name and $comments are
 AB> required to continue in the site (to make a post)..
Maybe?..

if (!isset($name) || !isset($comments))
{
 /*whatever here*/
}

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



[PHP] mysql_connect error

2004-03-22 Thread T UmaShankari

Hello,

 Here i am facing one problem. i have installed the following in my pc in 
linux platform. i am getting this error when try to execute file. Can any 
one tell me why this error due to ?


Version :
mysql-3.32.41-1
php-4.2.2-17
apache httpd-2.0.40-21

Error :
Call to undefined function mysql_connect() on line no 6.

Regards,
Uma

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



[PHP] re: an if statement

2004-03-22 Thread Andy B
> although that'll generally "work", why not use
>
> if(empty($name) || empty($comments))
> { dosomething(); }
>
> -- 
> ---John Holmes...


because for some odd reason on any of the versions of php i am writing for
(4.0.6-4.1.3) it always fails

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



[PHP] Ticketing system

2004-03-22 Thread daniel
Hi there, ok i am asking now, but be assured that I have googled already. I
am looking for a good customisable ticketing system in PHP, i had a look at
request tracker, but it doesnt look customisable and its in Perl.

I am trying to find if there are solutions to what we want before i go and
build it from scratch, let me know thanks.

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



[PHP] Unable connect to ORACLE

2004-03-22 Thread Timotius
Hi all, I'm newbie in PHP. 

I found message when I connect to ORACLE. Here you are :

Warning: odbc_connect(): SQL error: 
[Oracle][ODBC][Ora]ORA-12154: TNS:could not resolve 
service name , SQL state 08004 in SQLConnect in c:\program 
files\apache group\apache\htdocs\connectdb.php on line 2

and here is my PHP script:


$query = "SELECT cust_vendor_id, cv_name FROM 
dbsoe.cust_vendor where
cv_name like 'ANU%'";

?>

But when I connect using another Database Explorer through 
the same ODBC, it works. user id and password are correct. 
I've checked it. Can you tell me why ? 

thanks a million. 
Timotius
===
Netkuis Instan untuk Divre 3 - SD,SMP,SMA berhadiah asuransi pendidikan puluhan juta rupiah... periode I dimulai 1 April 2004
===

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


Re: [PHP] an if statement

2004-03-22 Thread John W. Holmes
Andy B wrote:
was just wondering if the statement:
if(!$name || !$comments){
/*whatever here*/ }
would be interpreted as : if either $name or $comments doesn't exist then

or how would the if statement be?? i need to check if the $name and $comments are empty/null because both $name and $comments are required to continue in the site (to make a post)..


although that'll generally "work", why not use

if(empty($name) || empty($comments))
{ dosomething(); }
--
---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] an if statement

2004-03-22 Thread Andy B
was just wondering if the statement:
if(!$name || !$comments){
/*whatever here*/ }

would be interpreted as : if either $name or $comments doesn't exist then

or how would the if statement be?? i need to check if the $name and $comments are 
empty/null because both $name and $comments are required to continue in the site (to 
make a post)..



Re: [PHP] PHP5 Release

2004-03-22 Thread Yann Larrivee
RC's should never be used in production area, you can use them to teste
the new feautres and your software.


Yann

On Mon, 2004-03-22 at 20:45, [EMAIL PROTECTED] wrote:
> Hi there i noticed RC1 is released, it states not for critical use, does
> that mean for development purposes still ?

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



Re: [PHP] RE:[PHP] sessions...how to use not clear?

2004-03-22 Thread trlists
On 22 Mar 2004 Andy B wrote:

> so the theory is: if i require that the session be named after the persons
> login name there is probably 1 out of 2 million chances that it will mess up
> the names and get confused (specially if there are only a few users
> allowed)...

If the login name is unique and you don't allow multiple simultaneous 
logins then the chanve of a mixup is exactly zero.

If you are talking about session IDs, I believe they are 128 bits which 
translates to a chance of duplication of 1 in 
340,282,366,920,938,463,463,374,607,431,768,211,456 [the result from 
bcpow(2, 128, 0)].  Should be good enough :-).

--
Tom

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



RE: [PHP] SQL Injection check (mysql)

2004-03-22 Thread trlists
On 23 Mar 2004 Michael Rasmussen wrote:

> The idea is exactly not to do any queries dynamically generated based on
> user input! In the rare cases where this is needed you should not
> allow any unparsed input. 

There are some applications for which queries based on typed user input 
are rare.  But there are others for which those queries are the basis 
of the whole application!  Almost any kind of site where users are 
creating accounts and other data records (or their equivalents) will be 
like this, and that's a very common kind of web application.

I agree that in these cases the input should be validated, I think that 
was the original topic of the thread.  But I don't think you can call 
this "rare" as a general rule.

--
Tom

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



Re: [PHP] Re: Passing by conditional IF statement...why?

2004-03-22 Thread Ryan A
Hey John,
Yep, this is just for one row as I need to know which file before I force a
download.
This is for people selling ebooks, MP3s etc

I usually use a while loop if I need multiple rows returned.

Cheers,
-Ryan

On 3/23/2004 3:07:14 AM, [EMAIL PROTECTED] wrote:
> Ryan A wrote:
>
> > if(($r = mysql_fetch_row($res)) >=1)
>
> if($r = mysql_fetch_row($res))
>
> will work fine if you only have one row being returned. If you have more
> than one that you need to loop through, then:
>
> if($r = mysql_fetch_row($res))
> {
> do
> {
>
> }while($r = mysql_fetch_row($res));
> }
>
> Now you have the added efficiency of not having to call mysql_num_rows()
> (if you don't need that value).
>
> --
> ---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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Image Storage

2004-03-22 Thread Michal Migurski
>I am creating a system to allow users to upload images to the site.
>Would it be better to store the images in a MySQL table, or having it
>save the images to a directory on the server?  Anyone have any
>suggestions on this? Pros? Cons?

Depends on the details of your situation - I've generally preferred to
store image in the filesystem. A few hosts I've used have administrative
limits on the size of a BLOB field, so storing images in the filesystem
was mandatory.

If those images are stored within the docroot, you can also just refer to
them by URI and let Apache handle all the appropriate headers and such, or
if you're strapped for CPU you can even use a completely different
webserver (thttpd, apache without PHP, etc.) to serve them.

If they're stored in the database or outside the docroot, you can control
access to them more easily. Keeping them in the database also means that
you don't have to worry about various filesystem considerations, like
keeping a world-writeable directory or potential undesired access from
others users in a shared hosting environment.

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



[PHP] Image Storage

2004-03-22 Thread Matt Palermo
I am creating a system to allow users to upload images to the site.  Would
it be better to store the images in a MySQL table, or having it save the
images to a directory on the server?  Anyone have any suggestions on this?
Pros? Cons?

Thanks,

Matt
http://sweetphp.com/

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



Re: [PHP] Re: Passing by conditional IF statement...why?

2004-03-22 Thread John W. Holmes
Ryan A wrote:

if(($r = mysql_fetch_row($res)) >=1)
if($r = mysql_fetch_row($res))

will work fine if you only have one row being returned. If you have more 
than one that you need to loop through, then:

if($r = mysql_fetch_row($res))
{
  do
  {
  }while($r = mysql_fetch_row($res));
}
Now you have the added efficiency of not having to call mysql_num_rows() 
(if you don't need that value).

--
---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] PHP installation problem in FreeBSD OS.

2004-03-22 Thread Filip de Waard
On Mar 22, 2004, at 7:59 PM, Naveen Glore wrote:

Hello All,
I am not sure if this is the right place to post this problem. I tried 
with FreeBSD mailing list but could not get much help.
No, it isn't. There is a specific installation list 
([EMAIL PROTECTED]).
I am having hard time in installing php4  using portupgrade in FreeBSD.
Try installing from source. There are dozens of tutorials on the net 
which will help you.

Regards,

Filip de Waar

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


Re: [PHP] Re: Passing by conditional IF statement...why?

2004-03-22 Thread Ryan A
> "Ryan A" <[EMAIL PROTECTED]> wrote in message
>
news:[EMAIL PROTECTED]
> > Hi,
> > I have this simple code in my php script:
> >
> > * * * * *
> > $res = mysql_query("SELECT product_id, now()-1
> FROM ".$tc."_prods where
> > cno=$cno AND product_id='$product_id' LIMIT 1");
> >
> > if($res)
> >  {
> >  $r = mysql_fetch_row($res);
> >  $product_id2   = $r[0];
> >  $th_pres= $r[1];
> > echo "debug echo";
> >  }else {echo "No results, sorry";}
> > * * * * *
> >
> > its working great when the data actually exists
> but when there are no
> > matches it still executes the "if($res)" part
> instead of
> > displaying "No results, sorry".
> > Why is that? or am I using the syntax wrong?
> >
> > Thanks,
> > -Ryan

Thanks guys,
I'm now using:

if(($r = mysql_fetch_row($res)) >=1)

and its working fine, if the above approach has some problems, feel free to
write and tell me.

Cheers,
-Ryan

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



[PHP] PHP5 Release

2004-03-22 Thread daniel
Hi there i noticed RC1 is released, it states not for critical use, does
that mean for development purposes still ?

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



Re: [PHP] Re: Passing by conditional IF statement...why?

2004-03-22 Thread Daniel Guerrier
if(mysql_num_rows($res))

returns count of rows returned.
if it 0 is false so it shouldn't execute the
conditional code
--- Ligaya Turmelle <[EMAIL PROTECTED]> wrote:
> I think it is because the query ran successfully and
> returns an empty set.
> So the pointer is still good.
> 
> Respectfully,
> Ligaya Turmelle
> 
> 
> "Ryan A" <[EMAIL PROTECTED]> wrote in message
>
news:[EMAIL PROTECTED]
> > Hi,
> > I have this simple code in my php script:
> >
> > * * * * *
> > $res = mysql_query("SELECT product_id, now()-1
> FROM ".$tc."_prods where
> > cno=$cno AND product_id='$product_id' LIMIT 1");
> >
> > if($res)
> >  {
> >  $r = mysql_fetch_row($res);
> >  $product_id2   = $r[0];
> >  $th_pres= $r[1];
> > echo "debug echo";
> >  }else {echo "No results, sorry";}
> > * * * * *
> >
> > its working great when the data actually exists
> but when there are no
> > matches it still executes the "if($res)" part
> instead of
> > displaying "No results, sorry".
> > Why is that? or am I using the syntax wrong?
> >
> > Thanks,
> > -Ryan
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

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



Re: [PHP] Any Ideas?

2004-03-22 Thread John W. Holmes
Matthew Oatham wrote:

Bit rough at the moment but I have come up with the following - it doesn't
rename the file using the new ID yet but I am more concerned about my method
for creating the new ID - can anyone see any potential problems such as
database problems, i.e duplicate keys, bad coding practices etc... cheers
matt
if(!empty($_FILES["cr"])) {
$uploaddir = "cr/"; // set this to wherever
//copy the file to some permanent location
if (move_uploaded_file($_FILES["cr"]["tmp_name"], $uploaddir .
$_FILES["cr"]["name"])) {
echo("file uploaded\n");
echo(generateCrId(insertChangeRequest()));
} else {
echo ("error!");
}
}
function insertChangeRequest() {

$sql = mysql_query("INSERT INTO dis_status(status, description)
VALUES('status1', 'status1 description')") or die (mysql_error());
return mysql_insert_id();
}
function generateCrId($key) {

$crId = sprintf("CR-%03d", $key);

return $crId;
}
Looks fine. Just realize that you don't have to insert $crId into the 
database as you can just "recreate" it when you need to know the file 
name. You just retrieve the "id" and add the "CR-" to it.

--
---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] Re: Passing by conditional IF statement...why?

2004-03-22 Thread Ligaya Turmelle
I think it is because the query ran successfully and returns an empty set.
So the pointer is still good.

Respectfully,
Ligaya Turmelle


"Ryan A" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
> I have this simple code in my php script:
>
> * * * * *
> $res = mysql_query("SELECT product_id, now()-1 FROM ".$tc."_prods where
> cno=$cno AND product_id='$product_id' LIMIT 1");
>
> if($res)
>  {
>  $r = mysql_fetch_row($res);
>  $product_id2   = $r[0];
>  $th_pres= $r[1];
> echo "debug echo";
>  }else {echo "No results, sorry";}
> * * * * *
>
> its working great when the data actually exists but when there are no
> matches it still executes the "if($res)" part instead of
> displaying "No results, sorry".
> Why is that? or am I using the syntax wrong?
>
> Thanks,
> -Ryan

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



[PHP] PHP installation problem in FreeBSD OS.

2004-03-22 Thread Naveen Glore
Hello All,
I am not sure if this is the right place to post this problem. I tried with FreeBSD 
mailing list but could not get much help. 
 
I am having hard time in installing php4  using portupgrade in FreeBSD.

First i have updated the port directory using cvsup. I am doing fresh installation of 
php so i gave the following command.
 
portupgrade -NPRri mod_php4.
 
I noticed mysql3.23.51 got updated to mysql3.23.58_2. All the other dependencies also 
had no problem in updating. However the php installation was not successful. At the 
end of installation i got the following errors.
 
Command failed [exit code 1] /usr/bin/script -qa /tmp/portupgrade23698.1 make
 
mysql-client-3.23.58 is already installed or may be older version blah blah blah... 
you can uninstall and reinstall mysql blah blah blah ...to install correctly. If you 
really want to override without deleting use FORCE_PICG_REGISTER blah blah
 
I also tried to install php after doing "make clean" in 
/usr/ports/databases/mysql323-client but it did not help me.
Any pointer would be very helpful. Thanks in advace.
 
Thanks,
Naveen.

Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.

Re: [PHP] Any Ideas?

2004-03-22 Thread Robert Cummings
On Mon, 2004-03-22 at 19:25, John W. Holmes wrote:
> Robert Cummings wrote:
> 
> > On Mon, 2004-03-22 at 18:51, Matthew Oatham wrote:
> > 
> >>Hi,
> >>
> >>are there any functions that retrieve the last primary key created in
> >>the MySQL table?
> > 
> > 
> > http://www.php.net/manual/en/function.mysql-insert-id.php
> 
> If you read the whole question, though, the poster wanted to use the ID 
> in the same query, just in another column. mysql_insert_id() or 
> LAST_INSERT_ID() wouldn't help in this case.

Actually I did read the entire question. The poster includes mention of
using insert, then update, or possibly locking the table. This logically
implies that he does not necessarily care whether the construction of
the ID occurs in the original query or not.

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



RE: [PHP] receiving ndr for each email sent to list

2004-03-22 Thread Chris W. Parker
ok so does anyone know why this is happening (no theories please. unless
it's correct. in which case it's ok. :)? is there something a list
moderator can do about it?



chris.

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



RE: [PHP] Any Ideas?

2004-03-22 Thread Chris W. Parker
Matthew Oatham 
on Monday, March 22, 2004 4:56 PM said:

> can anyone see any
> potential problems such as database problems, i.e duplicate keys, bad
> coding practices etc... cheers matt
> 
> if(!empty($_FILES["cr"])) {
> $uploaddir = "cr/"; // set this to wherever
> //copy the file to some permanent location
> if (move_uploaded_file($_FILES["cr"]["tmp_name"], $uploaddir .
> $_FILES["cr"]["name"])) {
> echo("file uploaded\n");
> echo(generateCrId(insertChangeRequest()));
> } else {
> echo ("error!");
> }
> }

yeah i see a few already. the following is better:

if(!empty($_FILES["cr"]))
{
// code
}
else
{
// other code
}

:P


chris.

p.s. no rebuttals please. there's nothing to say. kthxbye.

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



Re: [PHP] Any Ideas?

2004-03-22 Thread Matthew Oatham
Bit rough at the moment but I have come up with the following - it doesn't
rename the file using the new ID yet but I am more concerned about my method
for creating the new ID - can anyone see any potential problems such as
database problems, i.e duplicate keys, bad coding practices etc... cheers
matt

if(!empty($_FILES["cr"])) {
$uploaddir = "cr/"; // set this to wherever
//copy the file to some permanent location
if (move_uploaded_file($_FILES["cr"]["tmp_name"], $uploaddir .
$_FILES["cr"]["name"])) {
echo("file uploaded\n");
echo(generateCrId(insertChangeRequest()));
} else {
echo ("error!");
}
}

function insertChangeRequest() {

$sql = mysql_query("INSERT INTO dis_status(status, description)
VALUES('status1', 'status1 description')") or die (mysql_error());

return mysql_insert_id();
}

function generateCrId($key) {

$crId = sprintf("CR-%03d", $key);

return $crId;
}


- Original Message - 
From: "John W. Holmes" <[EMAIL PROTECTED]>
To: "Robert Cummings" <[EMAIL PROTECTED]>
Cc: "Matthew Oatham" <[EMAIL PROTECTED]>; "PHP-General"
<[EMAIL PROTECTED]>
Sent: Tuesday, March 23, 2004 12:25 AM
Subject: Re: [PHP] Any Ideas?


> Robert Cummings wrote:
>
> > On Mon, 2004-03-22 at 18:51, Matthew Oatham wrote:
> >
> >>Hi,
> >>
> >>are there any functions that retrieve the last primary key created in
> >>the MySQL table?
> >
> >
> > http://www.php.net/manual/en/function.mysql-insert-id.php
>
> If you read the whole question, though, the poster wanted to use the ID
> in the same query, just in another column. mysql_insert_id() or
> LAST_INSERT_ID() wouldn't help in this case.
>
> -- 
> ---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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Any Ideas?

2004-03-22 Thread Raditha Dissanayake
Matthew Oatham wrote:

The idea was that the user uploads a file and I insert details about the
file into the mysql table and rename the file using the generated id.
 

Even with this scenario you probably can do with out the extra column as 
John has suggested.

so if the next primary key is 4 I generate the file id CR-004 and rename the
uploaded file to CR-004 whilst also storing CR-004 in the table.
 

You are still following a pattern. COuld you perhaps clarify if CR is 
common for all users or do you choose a different prefix for different 
users. If you do use different combinations of letters yes you might 
need a different field and then the solution would be what Robert 
suggested mysql_insert_id() you will need to use an update an update 
query where the condition has the insert id returned by this call.

Thanks for your ideas so far - very useful! How do you get to know about all
these useful functions?
 

by RTFM. :-)

Cheers

Matt
-
--
Raditha Dissanayake.
-
http://www.radinks.com/print/upload.php
SFTP, FTP and HTTP File Upload solutions 

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


RE: [PHP] SQL Injection check (mysql)

2004-03-22 Thread Michael Rasmussen
On Mon, 22 Mar 2004 14:36:44 -0800, Pablo Gosse wrote:

> 
> Huh?  How does this accommodate for a dynamically generated query which is
> based upon user input?
> 
Have you read my arguments? A prepared statement cannot be dynamically
generated!

> 
> It is validated and its type set before it is inserted into the query, so
> how does what you state above deal with this?
> 
The idea is exactly not to do any queries dynamically generated based on
user input! In the rare cases where this is needed you should not
allow any unparsed input. 

-- 
Hilsen/Regards
Michael Rasmussen
--
You have a will that can be influenced by all with whom you come in contact.

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



Re: [PHP] RE:[PHP] sessions...how to use not clear?

2004-03-22 Thread John W. Holmes
Andy B wrote:

> you've already got that unique identifier. it's the username. the
> username will stay unique visit to visit, therefore you don't need to go
> against the design of the session id. the session id is not meant to
> keep uniqueness across multiple visits, only the current visit.
> 
> are we/me misunderstanding you?
Please quote your messages or put a divider between the original content 
(above) and what you write (below).

yes the username is a thing different from anybody elses login but how will
you collect preferences and the like in variables and dump them into a sql
table without using a session to define them from everybody elses??
figure this:

1. if you just used a login page and sql table to verify the existance of a
username/pwd and once "logged in" you had this code:

now somebody else logges in:
$color="yellow";
$show_time="1";
(both users are logged in at the same time)?? theory is the variables will
conflict with each other...
You're confused here. $color loaded from a database in one script is not 
going to change when another script is run and $color is loaded for 
another user. The variable is unique to the request.

2. using sessions:



will be totally different from user1.
This is true and how you want to do it, but using $user inside of 
session_name() is unecessary. They'll be different because each user has 
a different session_id by design and that's what's used to identify one 
users $_SESSION['color'] from anther user's $_SESSION['color'].

--
---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] Any Ideas?

2004-03-22 Thread Matthew Oatham
The idea was that the user uploads a file and I insert details about the
file into the mysql table and rename the file using the generated id.

so if the next primary key is 4 I generate the file id CR-004 and rename the
uploaded file to CR-004 whilst also storing CR-004 in the table.

Thanks for your ideas so far - very useful! How do you get to know about all
these useful functions?

Cheers

Matt
- Original Message - 
From: "John W. Holmes" <[EMAIL PROTECTED]>
To: "Robert Cummings" <[EMAIL PROTECTED]>
Cc: "Matthew Oatham" <[EMAIL PROTECTED]>; "PHP-General"
<[EMAIL PROTECTED]>
Sent: Tuesday, March 23, 2004 12:25 AM
Subject: Re: [PHP] Any Ideas?


> Robert Cummings wrote:
>
> > On Mon, 2004-03-22 at 18:51, Matthew Oatham wrote:
> >
> >>Hi,
> >>
> >>are there any functions that retrieve the last primary key created in
> >>the MySQL table?
> >
> >
> > http://www.php.net/manual/en/function.mysql-insert-id.php
>
> If you read the whole question, though, the poster wanted to use the ID
> in the same query, just in another column. mysql_insert_id() or
> LAST_INSERT_ID() wouldn't help in this case.
>
> -- 
> ---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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Passing by conditional IF statement...why?

2004-03-22 Thread Martin Towell
Ryan

Because you are actually getting a result, a result with no records...
Might be better to use
http://au2.php.net/manual/en/function.mysql-num-rows.php instead

Martin

> -Original Message-
> From: Ryan A [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, 23 March 2004 11:37 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Passing by conditional IF statement...why?
> 
> 
> Hi,
> I have this simple code in my php script:
> 
> * * * * *
> $res = mysql_query("SELECT product_id, now()-1 FROM 
> ".$tc."_prods where
> cno=$cno AND product_id='$product_id' LIMIT 1");
> 
> if($res)
>  {
>  $r = mysql_fetch_row($res);
>  $product_id2   = $r[0];
>  $th_pres= $r[1];
> echo "debug echo";
>  }else {echo "No results, sorry";}
> * * * * *
> 
> its working great when the data actually exists but when there are no
> matches it still executes the "if($res)" part instead of
> displaying "No results, sorry".
> Why is that? or am I using the syntax wrong?
> 
> Thanks,
> -Ryan

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



RE: [PHP] Passing by conditional IF statement...why?

2004-03-22 Thread Pablo Gosse
Ryan A wrote:
> Hi,
> I have this simple code in my php script:
> 
> * * * * *
> $res = mysql_query("SELECT product_id, now()-1 FROM ".$tc."_prods
> where cno=$cno AND product_id='$product_id' LIMIT 1"); 
> 
> if($res)
>  {
>  $r = mysql_fetch_row($res);
>  $product_id2   = $r[0];
>  $th_pres= $r[1];
> echo "debug echo";
>  }else {echo "No results, sorry";}
> * * * * *
> 
> its working great when the data actually exists but when there are no
> matches it still executes the "if($res)" part instead of displaying
> "No results, sorry". Why is that? or am I using the syntax wrong?  
> 
> Thanks,
> -Ryan

You need to test the number of records being returned.

By just using "if ($res)" you're simply ensuring that it is returning a
valid resource.

It is, but it's just that the resource has zero rows.

Change the test such that it check the number of results to be >= 1 and
it should work.

Cheers,
Pablo

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



Re: [PHP] RE:[PHP] sessions...how to use not clear?

2004-03-22 Thread John W. Holmes
Andy B wrote:

[snip]
If you give the session a custom name, then, yes, you'll have to use that
name on every page. $name can be something that in an include file or a
constant, etc, though. Again, you don't _have_ to give a name, though.
There's no real advantage to using another name, though, as it's going to be
sent to the user in a cookie or the URL, anyhow.
[end snip]
well this is true but in the event that the server creates a default name
for that particular session (very large random strings). I am trying to
avoid running into the same session being used twice by 2 seperate people at
the same time.
I think you're confusing session_name and session_id. session_name is 
(generally) the same for everyone and is the name PHP uses in the cookie 
or URL to store the session_id. The session_id is a 128 bit, 32 
character code that uniquely (sp?) identifies your individual session. 
You do not have to worry about two users getting the same session_id 
unless you just have a tremendous amount of traffic or have extended the 
session life.

so the theory is: if i require that the session be named after the persons
login name there is probably 1 out of 2 million chances that it will mess up
the names and get confused (specially if there are only a few users
allowed)...
I think I get what you're saying here. In the very remote chance that 
two people get the same session_id, you're saying that at least they'll 
have different session_names, so there won't be any contention? I don't 
think so, though, as the default session handler for PHP bases the name 
of the file to hold the session data on the session_id. It doesn't use 
the session_name for anything knowing what cookie or URL variable to 
retrieve the session_id from.

--
---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] Passing by conditional IF statement...why?

2004-03-22 Thread Ryan A
Hi,
I have this simple code in my php script:

* * * * *
$res = mysql_query("SELECT product_id, now()-1 FROM ".$tc."_prods where
cno=$cno AND product_id='$product_id' LIMIT 1");

if($res)
 {
 $r = mysql_fetch_row($res);
 $product_id2   = $r[0];
 $th_pres= $r[1];
echo "debug echo";
 }else {echo "No results, sorry";}
* * * * *

its working great when the data actually exists but when there are no
matches it still executes the "if($res)" part instead of
displaying "No results, sorry".
Why is that? or am I using the syntax wrong?

Thanks,
-Ryan

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



Re: [PHP] RE:[PHP] sessions...how to use not clear?

2004-03-22 Thread John W. Holmes
Andy B wrote:

WHy do we need to have a session name for that?
because eventually i want to take the user name (session name/variables/user
info) and create a preferences section of the website im doing and that
would require a constant session name from visit to visit
Ummm... that's why you set a $_SESSION['username'] value. You really
don't need to worry about the name or id of the session (other than 
resetting it upon login to prevent Session Fixation Attacks).

Sessions are for the current visit, page to page, not to "remember" 
things across multiple visits. Cookies are used for that (but be aware 
of security issues there, also, depending on how you implement them).

--
---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] Any Ideas?

2004-03-22 Thread John W. Holmes
Robert Cummings wrote:

On Mon, 2004-03-22 at 18:51, Matthew Oatham wrote:

Hi,

are there any functions that retrieve the last primary key created in
the MySQL table?


http://www.php.net/manual/en/function.mysql-insert-id.php
If you read the whole question, though, the poster wanted to use the ID 
in the same query, just in another column. mysql_insert_id() or 
LAST_INSERT_ID() wouldn't help in this case.

--
---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] What is the best way to backup a MySQL Database

2004-03-22 Thread Brian V Bonini
On Mon, 2004-03-22 at 14:35, Elliot J. Balanza wrote:
> Hi
> 
> I've been trying to use MySQL dump with a php query (since we dont have like
> a mysql_dump function) but it's not working.
> 
> Can anyone please point me to a page so i can read a method to backup MySQL
> databases to an .sql file using php?
> 

Will exec() with mysqldump work? Do you need to get tabel structure as
well or are you just after the data?

You can do SELECT * INTO OUTFILE 'file_name' FROM tbl_name if your just
after data.

-- 
BrianGnuPG -> KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu
==
gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
Key Info: http://gfx-design.com/keys
Linux Registered User #339825 at http://counter.li.org

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



Re: [PHP] RE:[PHP] sessions...how to use not clear?

2004-03-22 Thread John W. Holmes
Andy B wrote:

as long as your usernames are unique you should never have a problem.
(assuming everything else works as planned.)
it should...

i want to use sessions for a login system and stuff too but i want it to
check to see if the person is logged in before going to the login section...
if the session isnt valid then require a login...
is this code valid??

if that does work then all i need to do is figure out how to do a
session_distroy() to delete it after logged out...
You shouldn't rely on whether a valid session exists to determine if 
user is logged in. You should depend upon a certain variable within the 
session. session_start(), with or without $name, is going to be TRUE 
because it just starts a session. If a session did not exist, it'll 
start one. When a use logs in correctly, start a session and set a 
$_SESSION['loggedin'] = TRUE, variable.

Then on any page you want "protected", simply check for the variable

if(isset($_SESSION['loggedin']))
{ //person is logged in }
else
{ //person is not logged in }
When the person wants to log out, simply unset() or set to FALSE the 
$_SESSION['loggedin'] variable. Now you force them to log in again. Even 
if they keep the same session name, it doesn't matter b/c that variable 
is not set.

--
---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] Session_destroy() questions

2004-03-22 Thread John W. Holmes
Elliot J. Balanza wrote:

Ok, I know that session_destroy wont delete all my session data, but just
delete the variables with it... but for instance the session_id() will be
the same.
So my question is how can i make it so that let's say one people enter my
site, and then decides to leave... but doesn't closes the browser window,
then come back right in and wants to do other functions in the site but with
a different session_id()?
Why do they need a different session id? It shouldn't matter whether 
they come back with the same session ID or not, as the session will be 
empty (you should clear it when they log out... no real need to 
"destroy" it).

That being said, it is a good idea to set the session ID from within 
your program after a successful login to prevent Session Fixation 
Attacks. This is where a malicious user will include a link to your site 
with the session_name in the URL. If you then start a session, PHP will 
use the value passed in the URL. Now, instead of the session ID being a 
one-in-two-million ID, they've fixed what it should be. It's now easy 
for them to hijack the session and pretend to be the other person (a 
little work involved in that, but you get the idea, I hope).

--
---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] Backup of a MySQL database.

2004-03-22 Thread Filip de Waard
On Mar 23, 2004, at 1:10 AM, Chris W. Parker wrote:

Elliot J. Balanza 
on Monday, March 22, 2004 3:05 PM said:
I was looking something more like a MySQL dump class or function...
this may not be as robust a solution as you require but can you not
simply backtick the mysqldump command from within php?


  $date = date();

  $output = `mysqldump --opt --quote-names -u root --password=daword
database > file_$date.dump`;
?>

or even create a shell script that does all the dumping and handling of
dump files and then just execute that.
I thought of that to, but I would prefer to write some PHP code to do 
this (like I suggested in my previous message). That is indeed a little 
more robust and works on windows to.

I'm sure that there are pre-written functions on the net that do it 
using PHP code inside of mysqldump, so it's not necessary to chose this 
solution when you need a easy way out.

Regards,

Filip de Waard

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


[PHP] RE:[PHP] sessions...how to use not clear?

2004-03-22 Thread Andy B
you've already got that unique identifier. it's the username. the
username will stay unique visit to visit, therefore you don't need to go
against the design of the session id. the session id is not meant to
keep uniqueness across multiple visits, only the current visit.

are we/me misunderstanding you?

yes the username is a thing different from anybody elses login but how will
you collect preferences and the like in variables and dump them into a sql
table without using a session to define them from everybody elses??

figure this:

1. if you just used a login page and sql table to verify the existance of a
username/pwd and once "logged in" you had this code:

http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Any Ideas?

2004-03-22 Thread Geir Pedersen - Activio AS

Matt,

this is not a direct answer to your question, more a tip on how
you design your database: You should avoid storing the same
information twice. You only risk inconsistencies. In your case
I suggest you compute the textual ID from the primary key value
using the PHP sprintf function whenever you need it, e.g
sprintf ( "CR %03d", $primaryKey ). sprintf is the function to
use for the type of number to text conversion you are looking
for.

---

Geir Pedersen
http://www.activio.com/

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



Re: [PHP] Any Ideas?

2004-03-22 Thread John W. Holmes
Matthew Oatham wrote:

I have a MySQL table which uses a auto_increment 
int as the primary key - when I do an insert I want 
to create another id based on the primary key and 
insert this into the same table i.e. if I do an 
insert and the primary key is 3 I want to generate 
the ID CR-003, if the primary key was 34 I would 
want to generate the id CR-034. So I guess I need 
to know the following. 
You don't want or need to do this. You're just repeating data. The "34" 
is already there in one column, why repeat it (especially if the "CR" 
bit never changes).

Just select out when you need in the query or use PHP to make the 
combination.

SELECT CONCAT('CR-',id) AS formatted_number FROM table WHERE ...

Or use PHP, where $id is the primary key

$formatted_number = 'CR-' . $id;

You can use a ZEROFILL attribute on your column to ensure the leading 
zeros get returned or use sprintf() in PHP to format the number.

Even if the "CR" changes, then just put that bit in another column and 
join them together later.

--
---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] Any Ideas?

2004-03-22 Thread Robert Cummings
On Mon, 2004-03-22 at 18:51, Matthew Oatham wrote:
> Hi,
> 
> are there any functions that retrieve the last primary key created in
> the MySQL table?

http://www.php.net/manual/en/function.mysql-insert-id.php

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



RE: [PHP] Backup of a MySQL database.

2004-03-22 Thread Chris W. Parker
Elliot J. Balanza 
on Monday, March 22, 2004 3:05 PM said:

> I was looking something more like a MySQL dump class or function...

this may not be as robust a solution as you require but can you not
simply backtick the mysqldump command from within php?

 file_$date.dump`;

?>

or even create a shell script that does all the dumping and handling of
dump files and then just execute that.


hth,
chris.

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



RE: [PHP] RE:[PHP] sessions...how to use not clear?

2004-03-22 Thread Chris W. Parker
Andy B 
on Monday, March 22, 2004 3:49 PM said:

> because eventually i want to take the user name (session
> name/variables/user info) and create a preferences section of the
> website im doing and that would require a constant session name from
> visit to visit

yeah you're right. except that you're missing a key point.

you've already got that unique identifier. it's the username. the
username will stay unique visit to visit, therefore you don't need to go
against the design of the session id. the session id is not meant to
keep uniqueness across multiple visits, only the current visit.

are we/me misunderstanding you?


chris.

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



[PHP] RE: Randomly expired session cookies

2004-03-22 Thread Ben Ford
I have noticed behavior like yours with our server setup.  It is not a locally 
run (or owned) server so I cannot poke around to much.  

The session is timing out Randomly, causing our users to have to login again.
It doesn't happen all the time either.  In a rare case, less than a minute 
after login, I'll be forced to login again.

Just to be sure I've set the following HUGE timeouts:
session_set_cookie_params( 21600 ); 
session_cache_expire( 21600 );

This is ridicules I know, but I left it just for kicks.

I don't know the load averages of the server and I'm very curious to find out 
if this is part of the issue.

The server has PHP Version 4.2.3 installed on Linux w/ Apache.
I'm not sure what version of Apache is installed.

One last tidbit. I run the same site ( a mirror) locally while developing, and 
It never times out.

Disclaimer: I'm not an expert (yet) so my problem could be caused by some 
completely unrelated setting.  If someone knows of this mystery setting, 
please let me know.

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



[PHP] Any Ideas?

2004-03-22 Thread Matthew Oatham
Hi,

Sorry to ask this question, I am fairly new to PHP and wanted to ask for some help 
with the following.

I have a MySQL table which uses a auto_increment int as the primary key - when I do an 
insert I want to create another id based on the primary key and insert this into the 
same table i.e. if I do an insert and the primary key is 3 I want to generate the ID 
CR-003, if the primary key was 34 I would want to generate the id CR-034. So I guess I 
need to know the following. 

are there any functions that retrieve the last primary key created in the MySQL table?
are there any math functions that will turn 1 into 001 or 34 into 034 or keep 213 as 
213 etc...
what would be the best implementation i.e. do an insert, get the primary key then do 
an update or lock the table use a function to get the next availible primary key 
generate the additional key and then do 1 insert? Guess this implementation depends on 
how / if I can lock the MySQL table.

Sorry its a long one! 

Cheers

Matt


RE: [PHP] RE:[PHP] sessions...how to use not clear?

2004-03-22 Thread Chris W. Parker
Andy B 
on Monday, March 22, 2004 3:43 PM said:

> as long as your usernames are unique you should never have a problem.
> (assuming everything else works as planned.)
> 
> it should...

it will. a unique value is a unique value.

> is this code valid??
>  if(session_start($name)) {/*do whatever if person is logged in
> already*/ }
> else {
> /*do whatever if session doesnt exist*/
> }
> 
> if that does work then all i need to do is figure out how to do a
> session_distroy() to delete it after logged out...
> 
> any ideas?

personally i've never named a session (let alone knew that it was
possible) so i don't know if that code is valid as i don't know what, if
anything, session_start returns.

that code assumes session_start() returns a value at all. i suggest you
read the manual. try www.php.net/session_start and it will tell you what
that function returns if anything. you can work from there.



chris.

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



RE: [PHP] RE:[PHP] sessions...how to use not clear?

2004-03-22 Thread Chris W. Parker
Elliot J. Balanza 
on Monday, March 22, 2004 3:43 PM said:

> What are the chances of two people getting the same session number in
> a thousends of day operation?
> When you down the size of that to a couple hundeed a day...
> 
> WHy do we need to have a session name for that?

gah.

what i was trying to say (although maybe i should have elaborated a
little) is that if within his database his usernames are unique, he
won't have any problems at all.

i don't think the op should be concerned with duplicating session id's
as there are an almost infinite number of them. much more than 2mil.



chris.

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



[PHP] RE:[PHP] sessions...how to use not clear?

2004-03-22 Thread Andy B
What are the chances of two people getting the same session number in a
thousends of day operation?
When you down the size of that to a couple hundeed a day...

WHy do we need to have a session name for that?
because eventually i want to take the user name (session name/variables/user
info) and create a preferences section of the website im doing and that
would require a constant session name from visit to visit

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



[PHP] RE:[PHP] sessions...how to use not clear?

2004-03-22 Thread Andy B
as long as your usernames are unique you should never have a problem.
(assuming everything else works as planned.)

it should...

i want to use sessions for a login system and stuff too but i want it to
check to see if the person is logged in before going to the login section...
if the session isnt valid then require a login...

is this code valid??
http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] RE:[PHP] sessions...how to use not clear?

2004-03-22 Thread Elliot J. Balanza
What are the chances of two people getting the same session number in a
thousends of day operation?
When you down the size of that to a couple hundeed a day...

WHy do we need to have a session name for that?

Vamp


"Chris W. Parker" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
Andy B 
on Monday, March 22, 2004 3:19 PM said:

> so the theory is: if i require that the session be named after the
> persons login name there is probably 1 out of 2 million chances that
> it will mess up the names and get confused (specially if there are
> only a few users allowed)...

as long as your usernames are unique you should never have a problem.
(assuming everything else works as planned.)



chris.

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



RE: [PHP] RE:[PHP] sessions...how to use not clear?

2004-03-22 Thread Chris W. Parker
Andy B 
on Monday, March 22, 2004 3:19 PM said:

> so the theory is: if i require that the session be named after the
> persons login name there is probably 1 out of 2 million chances that
> it will mess up the names and get confused (specially if there are
> only a few users allowed)...

as long as your usernames are unique you should never have a problem.
(assuming everything else works as planned.)



chris.

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



Re: [PHP] Backup of a MySQL database.

2004-03-22 Thread Elliot J. Balanza
I was looking something more like a MySQL dump class or function...

I think since i can't do any phpmyadmin or anything like that, that i will
simply write my own code... yuk i was hoping to save 1-2 days work... thanks

vamp

"Filip De Waard" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> On Mar 22, 2004, at 11:34 PM, Elliot J. Balanza wrote:
>
> > Can anyone post a link to a good reference material on how to do
> > this...
> > evidentely mysqldump is not working here... and i need to do this via
> > php
> > programming.
>
> I'm sure you will find prewritten scripts with Google and I know
> phpmyadmin does it to.
>
> Without giving it much though my first reaction to your question is
> pretty straigtforward: use SHOW TABLES to find out which tables are in
> the DB and then just do SHOW COLUMNS FROM table for each table. Then
> you can query the table using SELECT * FROM table and create the insert
> using the knowledge you have gained about the columns in that table.
>
> However, I would like to suggest looking for a prewritten solution,
> since it's probably not necessary to reinvent the wheel here...
>
> Regards,
>
> Filip de Waard

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



[PHP] RE:[PHP] sessions...how to use not clear?

2004-03-22 Thread Andy B
[snip]
If you give the session a custom name, then, yes, you'll have to use that
name on every page. $name can be something that in an include file or a
constant, etc, though. Again, you don't _have_ to give a name, though.
There's no real advantage to using another name, though, as it's going to be
sent to the user in a cookie or the URL, anyhow.
[end snip]

well this is true but in the event that the server creates a default name
for that particular session (very large random strings). I am trying to
avoid running into the same session being used twice by 2 seperate people at
the same time.

so the theory is: if i require that the session be named after the persons
login name there is probably 1 out of 2 million chances that it will mess up
the names and get confused (specially if there are only a few users
allowed)...

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



Re: [PHP] fsockopen to spit out the HTTP's Location...

2004-03-22 Thread Chris Shiflett
--- Scott Fletcher <[EMAIL PROTECTED]> wrote:
> I haven't found the right wording to spit out the HTTP scripts to
> the web browser through the fsockopen.

I feel certain that I can help you, but unfortunately I can't seem to
understand your question at all. Please understand that I'm not trying to
criticize your question, but there are some things that confuse me.

For example, HTTP is a protocol, and I must assume that you mean HTTP
headers (rather than scripts). More importantly, unless you really know
what you're doing and have a very specific environment, there is no way
you can connect to the user using fsockopen().

> In this case, the "Location: " script. I can not use the php
> header() function because of the FPDF strict checking.

Can you explain this? Why can you not use header()? I think your
assumption is wrong.

I can't erally make out the rest of your message, but I think that if you
can explain these statements, the rest might make more sense.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



RE: [PHP] What is the best way to backup a MySQL Database

2004-03-22 Thread Pablo Gosse
Elliot J. Balanza wrote:
> Hi
> 
> I've been trying to use MySQL dump with a php query (since we dont
> have like a mysql_dump function) but it's not working. 
> 
> Can anyone please point me to a page so i can read a method to backup
> MySQL databases to an .sql file using php? 
> 
> thanks.
> 
> Vamp

Why can't you use mysqldump?  If you don't have command-line access, how
are you managing your DB (I would assume PHPMyAdmin or MySQL-Front)?  I
haven't used any of the PHPMyAdmin or PHPPGAdmin (or MySQL-Front) for
some time now, but there should be a way to back up your database within
them.

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



[PHP] What is the best way to backup a MySQL Database

2004-03-22 Thread Elliot J. Balanza
Hi

I've been trying to use MySQL dump with a php query (since we dont have like
a mysql_dump function) but it's not working.

Can anyone please point me to a page so i can read a method to backup MySQL
databases to an .sql file using php?

thanks.

Vamp

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



[PHP] fsockopen to spit out the HTTP's Location...

2004-03-22 Thread Scott Fletcher
Hi!

I haven't found the right wording to spit out the HTTP scripts to the
web browser through the fsockopen.  In this case, the "Location: "
script.  I can not use the php header() function because of the FPDF strict
checking.  (Freeware PDF).  All I did was to create a PDF and put it on the
webserver with nothing being outputted but FPDF have no way of knowing this
and think I'm spitting out the PDF data because I'm using hte "Location:
", so I'm using fsockopen() instead.   For now, when I tried to spit out
the "Location: " from fsockopen(), nothing happen.  So, what exactly
should the HTTP script be??

Thanks,
 FletchSOD

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



RE: [PHP] receiving ndr for each email sent to list

2004-03-22 Thread Chris W. Parker
Elliot J. Balanza 
on Monday, March 22, 2004 2:33 PM said:

> Actually there is another funny part to it.
> The reazon you are getting this is because some of the people on the
> list, bounces mail... that is fact, hence you can get all kind of
> notifications that the mail wasn't deliverable... and it was true.

actually i don't think that's true. if that were the case i should be
getting the bounces from the individuals and not the php servers (just
like with our friend(s) @hanmir.com). AND another thing, if that were
the case i should be receiving multiple bounces per message since there
are 100's of subscribers to this list and if there's one person bouncing
there has also go to be at least one more.

but if with your take-for-granted-genius you can explain to me what's
happening i would appreciate it much.


thanks,
chris.

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



Re: [PHP] Backup of a MySQL database.

2004-03-22 Thread Filip de Waard
On Mar 22, 2004, at 11:34 PM, Elliot J. Balanza wrote:

Can anyone post a link to a good reference material on how to do 
this...
evidentely mysqldump is not working here... and i need to do this via 
php
programming.
I'm sure you will find prewritten scripts with Google and I know 
phpmyadmin does it to.

Without giving it much though my first reaction to your question is 
pretty straigtforward: use SHOW TABLES to find out which tables are in 
the DB and then just do SHOW COLUMNS FROM table for each table. Then 
you can query the table using SELECT * FROM table and create the insert 
using the knowledge you have gained about the columns in that table.

However, I would like to suggest looking for a prewritten solution, 
since it's probably not necessary to reinvent the wheel here...

Regards,

Filip de Waard

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


[PHP] Re: Clearing Post Data with IE

2004-03-22 Thread Scott Fletcher
Using "Pragma: private" instead of no-cache would elminate that message
about cache expired and asking if you want to resubmit.   However, based on
your questions.  It's not the answer you're looking for.  So, there is a
better way around.  Just do Webpage #1 for form and submit it to Webpage #2
for processing the form like the database or session for example, then use
the header("Location: ") to get to Webpage #3 where you can display the
result.  That way, Webpage #2 was never reached to the web-browser and was
never cached.

FletchSOD

"Chris Thomas" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hey,
> Im writing a script for a poll, and im trying to figure out how to clear
the
> _post.
> Right now  i post the response that the user selected from the poll, back
to
> the poll page, which then displays the results
>
> The way it works right now, if i try to refresh the page, IE will pop a
> dialog back asking me if i want to resubmit the post.
>
> Is there a way to get it so that i can clear _post and get it so they
arent
> in the header??
>
> Chris

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



Re: [PHP] receiving ndr for each email sent to list

2004-03-22 Thread Chris Shiflett
--- "Elliot J. Balanza" <[EMAIL PROTECTED]> wrote:
> Actually there is another funny part to it. The reazon you are
> getting this is because some of the people on the list, bounces
> mail... that is fact, hence you can get all kind of notifications
> that the mail wasn't deliverable... and it was true.
> 
> But I thought anyone would know that... once again, i often tend
> to think people knows a lot of shit i just take for granted...
> 
> Your mail did bring a smile to my face. TWICE
> 
> LOL Vamp

1. Chris (Parker) asks if anyone else's messages to this list are getting
bounced.
2. You assume this is because he doesn't know that people can bounce
messages (this assumption makes no sense, otherwise he wouldn't know to
ask about it).
3. This is funny.

My sense of humor must be turned off today. :-)

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] Session_destroy() questions

2004-03-22 Thread Chris Shiflett
--- "Elliot J. Balanza" <[EMAIL PROTECTED]> wrote:
> how can i make it so that let's say one people enter my site, and
> then decides to leave... but doesn't closes the browser window,
> then come back right in and wants to do other functions in the site
> but with a different session_id()?

http://www.php.net/session_regenerate_id

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



RE: [PHP] SQL Injection check (mysql)

2004-03-22 Thread Pablo Gosse

> The reason is security. A prepared statement cannot comprimize the
> security of our database because all sql-statements are precompiled
> in the DBMS. An example using pear:  
> 
> $res = & DB:connect('mysql://someuser:[EMAIL PROTECTED]/thedb');
> $sth = $res->prepare('select * from sometable where id > ?');
> $sth->execute(10); 
> 
> As the example demonstrates the request is hardcoded which means it
> cannot be manipulated by any user supplied input. A beneficial side
> effect is that all characters which need exscaping is automatically
> handled by the DBMS. E.g the string O'leary would not cause any
> problems.


Huh?  How does this accommodate for a dynamically generated query which
is based upon user input?

For example,

$query  = 'select p.name, a.location, p.editable ';
$query .= 'from cms_pages p, cms_areas a ';
$query .= 'where p.p_id = '.$p_id.' and p.a_id = a.a_id';

In this query the value against which p_id is tested would have to be
supplied by the user and as such would not be hard coded as in your
example above.

It is validated and its type set before it is inserted into the query,
so how does what you state above deal with this?

Cheers and TIA.

Pablo

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



Re: [PHP] sessions...how to use not clear?

2004-03-22 Thread John W. Holmes
From: "Andy B" <[EMAIL PROTECTED]>


> From what I understand about sessions you can
> give a session a particular name like doing:
> session_start("SessionName");

You can give it a name, but you don't have to. PHP will use the default name
if you don't and you'll just need to use session_start();

> So in practicle means I can do this:
>  session_start($name);
> $_SESSION[name]=$name;
> $_SESSION[email]=$email;
> /*.*/
> ?>
>
> now my question is this: will i have to declare
> session_start($name); at the top of every file that
> needs to use that session name?

If you give the session a custom name, then, yes, you'll have to use that
name on every page. $name can be something that in an include file or a
constant, etc, though. Again, you don't _have_ to give a name, though.
There's no real advantage to using another name, though, as it's going to be
sent to the user in a cookie or the URL, anyhow.

---John Holmes...

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



[PHP] Backup of a MySQL database.

2004-03-22 Thread Elliot J. Balanza
Can anyone post a link to a good reference material on how to do this...
evidentely mysqldump is not working here... and i need to do this via php
programming.

thanks

vamp

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



Re: [PHP] receiving ndr for each email sent to list

2004-03-22 Thread Elliot J. Balanza
Actually there is another funny part to it.
The reazon you are getting this is because some of the people on the list,
bounces mail... that is fact, hence you can get all kind of notifications
that the mail wasn't deliverable... and it was true.

But I thought anyone would know that... once again, i often tend to think
people knows a lot of shit i just take for granted...

Your mail did bring a smile to my face.  TWICE

LOL Vamp



"Jay Blanchard" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
[snip]
> [snip]
> i imagine other people are experiencing this also but i'm receiving
> the following email every time i send a message to the list.
> [/snip]
>
> ROFL! Sorry Chris...had to laugh. :)

hey i like a good laugh just like anyone else... but i don't have any
idea what you're talking about!! :(
[/snip]

You imagine this is happening to others, know it is happening to you and
you send out an e-mail which will cause it to undoubtedly to do it
again. Just caught me funny I guess..

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



[PHP] Session_destroy() questions

2004-03-22 Thread Elliot J. Balanza
Ok, I know that session_destroy wont delete all my session data, but just
delete the variables with it... but for instance the session_id() will be
the same.
So my question is how can i make it so that let's say one people enter my
site, and then decides to leave... but doesn't closes the browser window,
then come back right in and wants to do other functions in the site but with
a different session_id()?

vamp

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



[PHP] sessions...how to use not clear?

2004-03-22 Thread Andy B
>From what I understand about sessions you can give a session a particular name like 
>doing:
session_start("SessionName");

So in practicle means I can do this: 


now my question is this: will i have to declare session_start($name); at the top of 
every file that needs to use that session name? or  how does that work exactly (the 
docs didnt quite explain how to carry session names from file to file very well)..

tnx


[PHP] Clearing Post Data with IE

2004-03-22 Thread Chris Thomas
Hey,
Im writing a script for a poll, and im trying to figure out how to clear the
_post.
Right now  i post the response that the user selected from the poll, back to
the poll page, which then displays the results

The way it works right now, if i try to refresh the page, IE will pop a
dialog back asking me if i want to resubmit the post.

Is there a way to get it so that i can clear _post and get it so they arent
in the header??

Chris

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



RE: [PHP] receiving ndr for each email sent to list

2004-03-22 Thread Jay Blanchard
[snip]
> [snip]
> i imagine other people are experiencing this also but i'm receiving
> the following email every time i send a message to the list.
> [/snip]
> 
> ROFL! Sorry Chris...had to laugh. :)

hey i like a good laugh just like anyone else... but i don't have any
idea what you're talking about!! :(
[/snip]

You imagine this is happening to others, know it is happening to you and
you send out an e-mail which will cause it to undoubtedly to do it
again. Just caught me funny I guess..

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



RE: [PHP] receiving ndr for each email sent to list

2004-03-22 Thread Chris Shiflett
--- "Chris W. Parker" <[EMAIL PROTECTED]> wrote:
> > ROFL! Sorry Chris...had to laugh. :)
> 
> hey i like a good laugh just like anyone else... but i don't have
> any idea what you're talking about!! :(

That makes two of us. :-)

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming mid-2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



[PHP] Transparent Image Help

2004-03-22 Thread Nick Hird
I am trying to create an image in php. I need a little better description 
then whats in the manual. Anyone know a good tutorial / article on creating 
transparent images in PHP. Using another picture and adding text would be 
helpful as well. Go gentle, i am sorta new to php.

Nick Hird
[EMAIL PROTECTED]
_
Get rid of annoying pop-up ads with the new MSN Toolbar – FREE! 
http://clk.atdmt.com/AVE/go/onm00200414ave/direct/01/

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


Re: [PHP] SQL Injection check (mysql)

2004-03-22 Thread Michael Rasmussen
On Sun, 21 Mar 2004 18:39:39 -0800, Chris Shiflett wrote:

> 
> Can you explain that (and defend it)?
> 
The reason is security. A prepared statement cannot comprimize the
security of our database because all sql-statements are precompiled in the
DBMS. An example using pear:

$res = & DB:connect('mysql://someuser:[EMAIL PROTECTED]/thedb');
$sth = $res->prepare('select * from sometable where id > ?');
$sth->execute(10);

As the example demonstrates the request is hardcoded which means it cannot
be manipulated by any user supplied input. A beneficial side effect is
that all characters which need exscaping is automatically handled by the
DBMS. E.g the string O'leary would not cause any problems.

Another argument is, that it theoretically should run faster.

-- 
Hilsen/Regards
Michael Rasmussen
--
Be careful!  Is it classified?

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



Re: [PHP] Bogus headers returned by firewalls

2004-03-22 Thread John W. Holmes
From: "Pablo Gosse" <[EMAIL PROTECTED]>

> Hi folks.

Hi.

> Has anyone out there ever had any issues with a user's
> personal firewall munging up the HTTP_REFERER for a page?

Yes. Some firewalls will do this for "privacy" reasons so you can't tell
where they came from. You can't do anything about it, but the user may be
able to turn the feature on or off (if they have control of the firewall).

---John Holmes...

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



Re: [PHP] receiving ndr for each email sent to list

2004-03-22 Thread Red Wingate
Same here, but even without replying :-/

Chris W. Parker wrote:

Jay Blanchard 
on Monday, March 22, 2004 10:51 AM said:

[snip]
i imagine other people are experiencing this also but i'm receiving
the following email every time i send a message to the list.
[/snip]
ROFL! Sorry Chris...had to laugh. :)


hey i like a good laugh just like anyone else... but i don't have any
idea what you're talking about!! :(
oh and on a separate note, i don't get the *exact* same email each time.
it has the same subject each time, but is always in regards to what
thread i just responded to.


chris.

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


[PHP] read file help ....

2004-03-22 Thread Mooki
I am trying to read a file from a remote server using a URL. I have done 
this :

* $html = implode('', file($url));
* echo $html
the $url is the address

with some pages like www.mooki.de/index.html ist works without a problem 
but with the address that i intend to use it only reads about 30 lines 
or so and then nothing. It is as if the file ends there but it does't.

the URL is ==
$url = 
'http://myplanetside.station.sony.com/outfit.jsp?outfitId=6607&worldId=21';

I am trying to get the list of players on that site for a private homepage.

I tried the funtion fopen and using streams but it always stopps at the 
same line.

I am thankfull for all the help :)

mfG Mooki

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


[PHP] Bogus headers returned by firewalls

2004-03-22 Thread Pablo Gosse
Hi folks.  Has anyone out there ever had any issues with a user's
personal firewall munging up the HTTP_REFERER for a page?

I've got a mailer script which is accessed from a few domains within our
network of sites, and sometimes users have been getting an error which
informs them the script has been illegally accessed from outside of our
domain.  The error occurs when the string 'unbc.ca' is not found in the
HTTP_REFERER.

However, after adding some checking I've found that for users who
encounter this error when on a valid form, there is no HTTP_REFERER in
the $_SERVER array and instead there is an HTTP_WEFERER:

HTTP_WEFERERNQEMSFDULHPQQWOYIYZUNNYCGPKYLEJGDGVCJVTLBXFGGMEPYOQKED

I've googled this and this was the most informative piece I came up
with:

http://lists.evolt.org/archive/Week-of-Mon-20030901/147671.html

It seems from this post and the links to the norton site within it that
it is the firewall that is munging up the headers and that there is no
way for me to avoid this.

Am I mistaken in thinking this?  Does anyone out there have any
knowledge as to whether this can be dealt with?

Cheers and TIA,

Pablo

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



RE: [PHP] receiving ndr for each email sent to list

2004-03-22 Thread Chris W. Parker
Jay Blanchard 
on Monday, March 22, 2004 10:51 AM said:

> [snip]
> i imagine other people are experiencing this also but i'm receiving
> the following email every time i send a message to the list.
> [/snip]
> 
> ROFL! Sorry Chris...had to laugh. :)

hey i like a good laugh just like anyone else... but i don't have any
idea what you're talking about!! :(

oh and on a separate note, i don't get the *exact* same email each time.
it has the same subject each time, but is always in regards to what
thread i just responded to.



chris.

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



RE: [PHP] receiving ndr for each email sent to list

2004-03-22 Thread Jay Blanchard
[snip]
i imagine other people are experiencing this also but i'm receiving the
following email every time i send a message to the list.
[/snip]

ROFL! Sorry Chris...had to laugh. :) 

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



[PHP] receiving ndr for each email sent to list

2004-03-22 Thread Chris W. Parker
hey everyone,

i imagine other people are experiencing this also but i'm receiving the
following email every time i send a message to the list.

==

Subject: Undeliverable: Delivery Report (failure) for
[EMAIL PROTECTED]
Message:

Your message did not reach some or all of the intended recipients.

  Subject:  RE: [PHP] Simple: Whats wrong with this?
  Sent: 3/17/2004 9:44 AM

The following recipient(s) could not be reached:

  [EMAIL PROTECTED] on 3/22/2004 10:07 AM
Could not deliver the message in the time limit specified.
Please retry or contact your administrator.
< mta dswu231-hme1 in /ADMD= /C=WW/ #4.4.7 Reason 1
(Unable-To-Transfer); Diagnostic 5 (Maximum-Time-Expired)>

==

anyone else receiving these and can anyone tell me a solution to
stopping these or do i just need to block them?



thanks,
chris.

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



Re: [PHP] Zend Optimiser -- wide spread??

2004-03-22 Thread Richard Čepas
It isn't on most hosts, though it isn't difficult to install it on request.  You may 
also look at alternatives:
http://turck-mmcache.sourceforge.net/#bench

On Monday 22 March 2004 02:16, Justin French <[EMAIL PROTECTED]> wrote:
> Hi all,
> 
> I'm close to releasing my first widely distributed (I hope) PHP 
> application, and I wish to protect the source with Zend Encoder.  Seems 
> easy enough.
> 
> However, this is a low-cost app that was intended to work on basic 
> installs of PHP, running on almost any server -- it uses no external 
> libraries, and required no special compiles.
> 
> Is Zend Optimiser (required to run encoded PHP files) part of a base 
> installation, or at the very least, is it widely spread in use 
> (available on most hosts)?
> 
> Seems like there's no point encoding if only half of the servers out 
> there can run the scripts.  I know optimiser is available on *my* host, 
> but that's not enough in this case!
> 
> 
> ---
> Justin French
> http://indent.com.au
> 

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



[PHP] eregi for alpha-numeric, punctuation & whitespace?

2004-03-22 Thread Jas
Not sure how to accomplish this, and not completely familiar with all 
the options available with regular expressions.

I need to sanitize input data by only allowing alpha-numeric characters, 
whitespace, punctuation (,.;:) and of course carrige returns.

here is what I have so far...
eregi("^[0-9a-zA-Z]{1,40}$",$_POST['input'])
Any help is appreciated, right now anything with a space, period, comma 
etc gets flagged.

Jas

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


Re: [PHP] building CLI version only

2004-03-22 Thread Jason Wong
On Monday 22 March 2004 19:25, neko wrote:

> A server I'm using has PHP compiled into Apache, and I want to leave
> that alone and just build a CLI version of php. Can I get away with just
> going:
>
> ./configure --with-mysql --prefix=/some/home/dir
> make
> make install
>
> ? I dont' want to upset the existing apache installation of PHP or
> anything, just want a CLI exe in my home dir to do some stuff with.

If you only want the CLI version then use:

  --disable-cgi --enable-cli ...

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
QOTD:
"He's on the same bus, but he's sure as hell got a different
ticket."
*/

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



Re: [PHP] Problems compiling PHP with ImageMagick

2004-03-22 Thread Jason Wong
On Monday 22 March 2004 23:11, Paul Hopkins wrote:

> Next prob: I'm trying to recompile PHP 4.3.4 (on Redhat 7.3) with
> ImageMagick support. I've installed ImageMagick 5.5.7 and the PECL imagick
> package (0.9.8). I'm running Apache 1.3.29 with PHP compiled as a module.
>
> These are the steps I've been following:
>
> 1. cd to the Apache dir
> make clean

Try:
  make distclean 

>
> 2. cd to the PHP dir
> make clean

Ditto ...

> All appears to run OK, but the PHP installation I end up with seems to be
> exactly the same as what I started out with - phpinfo() shows my original
> build date and configure line from months ago, and the imagick_* functions
> aren't available.
>
> I ran across the file config.cache in my PHP directory and tried removing
> it - no difference.

... better still, remove the original source directory and untar a fresh one.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
If Microsoft built cars, the oil, gas, and alternator warning lights would
be replaced by a single "general car fault" warning light.
*/

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



[PHP] Unit test

2004-03-22 Thread Andres Ferrando
Hi!

which Unit Test tool for PHP do you recomend?

bye

--
Andrés Ferrando <[EMAIL PROTECTED]>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] outputting php file

2004-03-22 Thread Ryan A
Hey John,

> Same as you write any other file, fopen, fwrite, fclose, etc, then send
> the
> appropriate headers to trigger a download of the file (discussed on
> here
> plenty of times).

Yep, I got the working code to force a download from the list itself, but
was outputting
a file via readfile..

> 
> $fp = fopen('config.php');
>
> fwrite(" $somevalue2 . ";\n?>");
> // etc... (add in quotes around strings, of course)
>
> fclose($fp);

Cool, got it.


> You don't even have to actually write the file if you're just going to
> send
> them the data. You can send the download headers and then echo out what
you
>would have written to the file. The end result to the user will look like
>they're downloading a file, although one never really existed on the
server.

Great, didnt think of that, will try it and post code back here if I run
into problems.

Thanks again,
-Ryan

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



Re: [PHP] outputting php file

2004-03-22 Thread John W. Holmes
From: "Ryan A" <[EMAIL PROTECTED]>

> I have a set of scripts that read off a config_inc.php file (eg: database,
> username,password, admin_username,admin_pass etc), instead of the client
> manually making the changes (with mistakes sometimes) I have made a form
> where the client can pick most of the values via a drop down box and then
> submits the form and the config file gets built...
>
> I have gotten as far as building the HTML form and according to the input,
> set the variables, how do I create the php file and force a download so
the
> client simply downloads the file, then uploads it to the programs
directory?

Same as you write any other file, fopen, fwrite, fclose, etc, then send the
appropriate headers to trigger a download of the file (discussed on here
plenty of times).

");
// etc... (add in quotes around strings, of course)

fclose($fp);

You don't even have to actually write the file if you're just going to send
them the data. You can send the download headers and then echo out what you
would have written to the file. The end result to the user will look like
they're downloading a file, although one never really existed on the server.

---John Holmes...

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



[PHP] outputting php file

2004-03-22 Thread Ryan A
Hi,
I have a set of scripts that read off a config_inc.php file (eg: database,
username,password, admin_username,admin_pass etc), instead of the client
manually making the changes (with mistakes sometimes) I have made a form
where the client can pick most of the values via a drop down box and then
submits the form and the config file gets built...

I have gotten as far as building the HTML form and according to the input,
set the variables, how do I create the php file and force a download so the
client simply downloads the file, then uploads it to the programs directory?

Anybody have any prewritten code you are willing to share?
if not, links, suggestions,references to the manual and comments would be
appreciated.

Thanks,
-Ryan

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



[PHP] Re: Problems compiling PHP with ImageMagick

2004-03-22 Thread Paul Hopkins
I wrote:
>First, cheers to Mike Ward for the quick response to my maiden post this
>morning (about floating point vars).

Second, apologies for getting Mike Ford's name wrong in my second-to-maiden
post... :(

Paul

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



[PHP] Problems compiling PHP with ImageMagick

2004-03-22 Thread Paul Hopkins
First, cheers to Mike Ward for the quick response to my maiden post this
morning (about floating point vars).

Next prob: I'm trying to recompile PHP 4.3.4 (on Redhat 7.3) with
ImageMagick support. I've installed ImageMagick 5.5.7 and the PECL imagick
package (0.9.8). I'm running Apache 1.3.29 with PHP compiled as a module.

These are the steps I've been following:

1. cd to the Apache dir
make clean
./configure

2. cd to the PHP dir
make clean
./configure --with-sablot --with-mysql=/usr/local/mysql --with-gd --enable-t
rack-vars --with-xml --with-dom --with-zlib --with-jpeg-dir --with-png-dir -
-with-apache=../apache_1.3.29 --enable-ftp --with-imap --with-curl --with-xs
lt --with-ssl --enable-wddx --with-imagick=/usr/local/src/php-4.3.4/ext/imag
ick (same configure line as original install but with adding the last bit
for imagick)
make
make install

3. cd to the Apache dir
rm src/modules/php4/libphp4.a
./configure --activate-module=src/modules/php4/libphp4.a
make
make install

4. Restart Apache


All appears to run OK, but the PHP installation I end up with seems to be
exactly the same as what I started out with - phpinfo() shows my original
build date and configure line from months ago, and the imagick_* functions
aren't available.

I ran across the file config.cache in my PHP directory and tried removing
it - no difference.

I changed the path to imagick in the configure line to a non-existent path,
and added a nonsensical option, --with- ; no complaints, which I suppose
indicates that there's some more deep-seated problem which has nowt to do
with the ImageMagick-specific stuff.

I'm sure I'm missing something pretty obvious, but just can't put my finger
on what it is - anyone got any ideas?

Cheers,
Paul

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



[PHP] Re: Problems with PHP5 RC1

2004-03-22 Thread memoimyself
On 19 Mar 2004 at 19:23, Lester Caine wrote:

> [EMAIL PROTECTED] wrote:
> 
> > I'm trying to run PHP5 RC1 on a Windows 2000 test server with Apache 2.0.47.
> 
> Mines 2.0.48, but no problem.
> 
> > Upon installation, when I first started Apache again, I got an error message to 
> > the effect 
> > that php4ts.dll could not be found in the c:\winnt\system32 directory. This is 
> > curious for 
> > two reasons: first and foremost, if anything is missing, it should be php5ts.dll, 
> > not 
> > php4ts.dll; second, php4ts.dll never used to be in the system32 directory and that 
> > never 
> > caused any problems. But it's no use cursing PHP5, so I copied php4ts.dll to the 
> > system32 directory and stopped getting the error message. Not a pretty solution, 
> > though.
> 
> First - you did change httpd.conf to point at the new module?
> Second option, is there something 'extra' in your setup that 
> is from PHP4?

Yes, certainly, to the first question, and no to the second. I went over httpd.conf 
very 
carefully a couple of times to make sure nothing else in the file refers to PHP 4 or 
to an 
old directory.


On 19 Mar 2004 at 20:28, Red Wingate wrote:  

> I'm running RC1 on Win2k 2.0.47 without any problems. Make sure u updated
> your PATH settings as some folders got renamed or moved. Add /path/to/php
> and /path/to/php/dlls to your PATH setup. Switch 'extensions' to 'ext' in your
> php.ini as well if you still have an old version from an old PHP5 beta or PHP4
> release.

I simply copy all needed DLLs to my system32 directory, so there's no need to add 
anything to my system paths. Also, I went over php.ini with ExamDiff to make sure I 
wouldn't miss any changes; the "extensions" directory is properly set.
 
> Otherwise consult the updated install.txt for more information

As I said, the installation instructions haven't changed much. Mostly, it seems that 
PHP5 was simply substituted for PHP4 in the text. There's even a bit about it not 
being 
safe to use PHP as a module because it's "new", which is later contradicted by the 
statement "Now that version 4.1 introduces a safer sapi module, we recommend that 
you configure PHP as a module in Apache". I'm not complaining because of course 
these instructions are provided free of charge etc, but you can't really rely on them 
as 
being accurate for the latest release of PHP.

Thanks anyway,

Erik

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



RE: [PHP] what can be wrong here?{OT}

2004-03-22 Thread Jay Blanchard
[snip]
In CSS file all links are black:
/* Part from CSS file  */
a:link{color:#00; text-decoration: none;} /*unvisited link*/
a:visited{color:#00; text-decoration: none;} /*visited link*/
a:hover {color:#00; text-decoration: none;} /*mouse over link*/
a:active { color:#00}
[/snip]

Actually the is a CSS question and how it affects differewnt browsers.
Your PHP code is OK. This is OT, but it has to do with the order of your
a: statements in the CSS code (an issue that first cropped up a couple
of years ago IIRC). I do not remember the order exactly, but I think
that 'visited' must be first and 'hover' second. You will probably have
to play around with it.

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



Re: [PHP] what can be wrong here?

2004-03-22 Thread Richard Davey
Hello Mike,

Monday, March 22, 2004, 1:45:24 PM, you wrote:

MM> Hello

MM> In CSS file all links are black:
MM> /* Part from CSS file  */
MM> a:link{color:#00; text-decoration: none;} /*unvisited link*/
MM> a:visited{color:#00; text-decoration: none;} /*visited link*/
MM> a:hover {color:#00; text-decoration: none;} /*mouse over link*/
MM> a:active { color:#00}

MM> On the page also all links are black (visited or unvisited). In the PHP code
MM> I print the image and link to medium image:
MM> $thumb = " href=\"showPictures.php?image_id=$id&image_size=$medium\"> src=$image_small border=1>";
MM> In the Mozilla the Image frame/border is black but on IE it is (blue unvisit
MM> and red  visit).

MM> When I try to print just image
MM> echo "";
MM> The image frame is black on IE and Mozilla. Any ideas why the image frame is
MM> blue or red when I print
MM> $thumb = " href=\"showPictures.php?image_id=$id&image_size=$medium\"> src=$image_small border=1>";
MM> I want to make the image fram "black";

This isn't a PHP question.

(Although, it's a simple solution - you are not setting the border
colour in your CSS a:hover attribute, you're setting the text colour.
Just add "border: 1px solid black" to it. Note this will apply to any
link now though, so perhaps creating a new "ImageLink" class with a
hover state would be more sensible.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



[PHP] what can be wrong here?

2004-03-22 Thread Mike Mapsnac
Hello

In CSS file all links are black:
/* Part from CSS file  */
a:link{color:#00; text-decoration: none;} /*unvisited link*/
a:visited{color:#00; text-decoration: none;} /*visited link*/
a:hover {color:#00; text-decoration: none;} /*mouse over link*/
a:active { color:#00}
On the page also all links are black (visited or unvisited). In the PHP code
I print the image and link to medium image:
$thumb = "";
In the Mozilla the Image frame/border is black but on IE it is (blue unvisit 
and red  visit).

When I try to print just image
echo "";
The image frame is black on IE and Mozilla. Any ideas why the image frame is 
blue or red when I print
$thumb = "";
I want to make the image fram "black";
Thanks

_
FREE pop-up blocking with the new MSN Toolbar – get it now! 
http://clk.atdmt.com/AVE/go/onm00200415ave/direct/01/

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


[PHP] Thanks : Re: [PHP] String Length ??

2004-03-22 Thread gordon stewart

--- Filip de Waard <[EMAIL PROTECTED]> wrote:
> strlen() is the correct function to use here. Use it
> like:
> 
> echo strlen($_POST['input_name']);
> 
> Where $_POST['input_name'] should be replaced by the
> variable you want 
> to check. strlen() is always right, but it counts
> the actual charactars 
> of the string (which may differ from those who are
> shown in the 
> browser, please look at the HTML source instead).

Thanks - Yep - Lots of spaces in  my output...

Ive added a small regex & its got rid of the lines :)

$pattern = "/\s+/i";
$replacement = " ";
$texta= preg_replace($pattern, $replacement, $texta);

G



__
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

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



Re: [PHP] Question for PHP.net

2004-03-22 Thread Burhan Khalid
Florian Hoenl wrote:
Dear PHP.net,
I have got a question!!!
I`ll develop a new PHP Site and threr is a problem with Hyperlinks!!!
How can I use  "index?nav=Webmaster"??

Whats the source code for this funktion
Florian :

  1. Please don't end all lines with multiple puncuation marks. !!! is 
not necessary, and will trigger spam filters.

  2. If the problem is with HTML, then check your HTML source, and the 
functions that are outputting HTML code. Hyperlinks are part of HTML, 
and thusly, if you have a problem with hyperlinks, it is not something 
that PHP caused.

  3. Please read the manual first, and search the archives of this list 
(http://www.google.com/groups?as_ugroup=php.general). Most questions 
like yours have already been answered more than once.

  4. Please use a more descriptive subject. Question for PHP.net. I 
thought your question was about the php.net website.

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


  1   2   >