php-general Digest 3 Apr 2006 12:10:08 -0000 Issue 4050

2006-04-03 Thread php-general-digest-help

php-general Digest 3 Apr 2006 12:10:08 - Issue 4050

Topics (messages 233091 through 233112):

Re: microsoft PHP ?
233091 by: Chris Shiflett
233092 by: Joe Wollard
233093 by: Matt Richards
233094 by: Matt Richards
233095 by: Joe Wollard
233108 by: Ryan A

Looping information into a table
233096 by: benifactor
233097 by: Chris

Best authentication method for user
233098 by: Alain Roger
233099 by: Chris
233100 by: Alain Roger
233102 by: Chris
233105 by: Ligaya Turmelle
233107 by: Alain Roger
233110 by: Chris
233111 by: Alain Roger

Re: return path of mail function
233101 by: sub.drewpydraws.com
233103 by: Chris
233104 by: sub.drewpydraws.com

QUARANTINED: Mail System Error - Returned Mail
233106 by: WorkgroupMail Content Filter

PHP AJAX Framework - Suggestions Please
233109 by: andreil1.starlett.lv

Re: MySQL close connection, what's the purpose?
233112 by: tedd

Administrivia:

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

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

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---

Joe Wollard wrote:

I made fun of Chris and Rasmus specifically because I
know they're on this list.


I appreciate being considered important enough to make fun of.

Thanks! :-)

Chris
---End Message---
---BeginMessage---
Just as long as everyone knows that everything I said was all in good fun.
Next time I'll be sure to use sarcasam just to be sure nothing is taken
the wrong way ;-)

On 4/2/06, Chris Shiflett [EMAIL PROTECTED] wrote:

 Joe Wollard wrote:
  I made fun of Chris and Rasmus specifically because I
  know they're on this list.

 I appreciate being considered important enough to make fun of.

 Thanks! :-)

 Chris

---End Message---
---BeginMessage---

quote:
Joe Wollard wrote:
  Just as long as everyone knows that everything I said was all in good 
fun./sarcasam
  Next time I'll be sure to use sarcasam just to be sure nothing is 
taken the wrong way ;-)


Joe Wollard wrote:
Just as long as everyone knows that everything I said was all in good 
fun. Next time I'll be sure to use sarcasam just to be sure nothing 
is taken the wrong way ;-)


On 4/2/06, *Chris Shiflett* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


Joe Wollard wrote:
 I made fun of Chris and Rasmus specifically because I
 know they're on this list.

I appreciate being considered important enough to make fun of.

Thanks! :-)

Chris


---End Message---
---BeginMessage---

oops forgot the first sarcasam .. oh well! :(

Matt Richards wrote:

quote:
Joe Wollard wrote:
  Just as long as everyone knows that everything I said was all in 
good fun./sarcasam
  Next time I'll be sure to use sarcasam just to be sure nothing is 
taken the wrong way ;-)


Joe Wollard wrote:
Just as long as everyone knows that everything I said was all in good 
fun. Next time I'll be sure to use sarcasam just to be sure nothing 
is taken the wrong way ;-)


On 4/2/06, *Chris Shiflett* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


Joe Wollard wrote:
 I made fun of Chris and Rasmus specifically because I
 know they're on this list.

I appreciate being considered important enough to make fun of.

Thanks! :-)

Chris




---End Message---
---BeginMessage---
el-oh-el. See, I forgot already. Good lookin' out Matt!

On 4/2/06, Matt Richards [EMAIL PROTECTED] wrote:

 oops forgot the first sarcasam .. oh well! :(

 Matt Richards wrote:
  quote:
  Joe Wollard wrote:
Just as long as everyone knows that everything I said was all in
  good fun./sarcasam
Next time I'll be sure to use sarcasam just to be sure nothing is
  taken the wrong way ;-)
 
  Joe Wollard wrote:
  Just as long as everyone knows that everything I said was all in good
  fun. Next time I'll be sure to use sarcasam just to be sure nothing
  is taken the wrong way ;-)
 
  On 4/2/06, *Chris Shiflett* [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
 
  Joe Wollard wrote:
   I made fun of Chris and Rasmus specifically because I
   know they're on this list.
 
  I appreciate being considered important enough to make fun of.
 
  Thanks! :-)
 
  Chris
 
 
 


---End Message---
---BeginMessage---
Hey,
 Just as long as everyone knows that everything I said was all in good
 fun. Next time I'll be sure to use sarcasam just to be sure nothing
 is taken the wrong way ;-)Its quite strange actually how touchy so many
people have gotten... becauseas I read the whole comeback joke I thought
it was pretty damn funny anddidnt think anyone would misunderstand it as
anything other than a joke, didnt really think there is/was a need for
sarcasm tags either, if you're on the listfor some time you see 

Re: [PHP] Best authentication method for user

2006-04-03 Thread Alain Roger
ok, but how to make a non-logged user executes some stored procedures or
Queries ?
MySQL will need some login and password for that.

so, that's why i've asked such question...how and where to store this
non-logged user's info (login, password) to not make physical user type them
? (this must be secured enough)

thanks a lot,
Alain

On 4/3/06, Ligaya Turmelle [EMAIL PROTECTED] wrote:


  For that i was thinking to use session and register his login and
 password
  as session variable.

  What do you think about that ?
 
 I personally would only hold a password for as long as it is needed to
 log them in.  Then I'd set a session var that they have logged in and
 another session var for their level of access.

 But that's me.


 --

 life is a game... so have fun.





Re: [PHP] microsoft PHP ?

2006-04-03 Thread Ryan A
Hey,
 Just as long as everyone knows that everything I said was all in good
 fun. Next time I'll be sure to use sarcasam just to be sure nothing
 is taken the wrong way ;-)Its quite strange actually how touchy so many
people have gotten... becauseas I read the whole comeback joke I thought
it was pretty damn funny anddidnt think anyone would misunderstand it as
anything other than a joke, didnt really think there is/was a need for
sarcasm tags either, if you're on the listfor some time you see that
Chris/Rasmus and nearly everyone else has a sense ofhumour...they take the
time to help us lowly php problem thread starters dont they? Maybe its all
stress... take it easy guysCheers!

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



[PHP] PHP AJAX Framework - Suggestions Please

2006-04-03 Thread [EMAIL PROTECTED]

Hi,

Anyone can suggest me which PHP AJAX framework you are using, for what
reason(s), what are pros and cons of your particular choice.

I found many, and now facing difficult choice.

BTW, how do you pass session id between calls to PHP from JavaScript  
(cookies

or explicit foo.php?PHPSESSSIONID=blahblahblah)?

Thanks in advance for any suggestion(s).

Andrei


PS. Posted this question before, but got only one suggestion so far  
from Greg Beaver (PEAR_HTMP_AJAX). Would be very pleased to get an  
insight for more alternatives, like AJASON, for example.


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



Re: [PHP] Best authentication method for user

2006-04-03 Thread chris smith
On 4/3/06, Alain Roger [EMAIL PROTECTED] wrote:
 ok, but how to make a non-logged user executes some stored procedures or
 Queries ?
 MySQL will need some login and password for that.

 so, that's why i've asked such question...how and where to store this
 non-logged user's info (login, password) to not make physical user type them
 ? (this must be secured enough)

A config file:

?php
define('DB_USER', 'xxx');
..
?

You don't want to make your users know your database details!

 On 4/3/06, Ligaya Turmelle [EMAIL PROTECTED] wrote:
 
 
   For that i was thinking to use session and register his login and
  password
   as session variable.
 
   What do you think about that ?
  
  I personally would only hold a password for as long as it is needed to
  log them in.  Then I'd set a session var that they have logged in and
  another session var for their level of access.
 
  But that's me.
 
 
  --
 
  life is a game... so have fun.
 
 
 




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

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



Re: [PHP] Best authentication method for user

2006-04-03 Thread Alain Roger
I suppose that this config file should be included in all PHP file via
include command.
is it true ?

On 4/3/06, chris smith [EMAIL PROTECTED] wrote:

 On 4/3/06, Alain Roger [EMAIL PROTECTED] wrote:
  ok, but how to make a non-logged user executes some stored procedures or
  Queries ?
  MySQL will need some login and password for that.
 
  so, that's why i've asked such question...how and where to store this
  non-logged user's info (login, password) to not make physical user type
 them
  ? (this must be secured enough)

 A config file:

 ?php
 define('DB_USER', 'xxx');
 ..
 ?

 You don't want to make your users know your database details!

  On 4/3/06, Ligaya Turmelle [EMAIL PROTECTED] wrote:
  
  
For that i was thinking to use session and register his login and
   password
as session variable.
  
What do you think about that ?
   
   I personally would only hold a password for as long as it is needed to
   log them in.  Then I'd set a session var that they have logged in and
   another session var for their level of access.
  
   But that's me.
  
  
   --
  
   life is a game... so have fun.
  
  
  
 
 


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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-03 Thread tedd

chris said:


Time. Opening a db connection is time consuming. There are many levels
involved (making the connection, authentication, etc).. Even worse if
the connection is over tcp/ip because that overhead comes in on top as
well.


I replied:


Have you timed it?

Maybe I'll do that tomorrow.


Okay, I performed a test that made 100 queries, and found that it 
took about four times as long to open a dB connection each time and 
get the data as it did to open it once. In other words, if your 
script pulls data from a dB 100 times, then making a connection to 
the dB once, pulling the data, and then closing the dB is four times 
as fast as opening the dB, pulling the data, and closing the dB in 
sequence one hundred times.


Now, that sounds like you should open your dB at the start of your 
script and just leave it open until the your script quits (as the 
original poster suggested), but there's a few thing to consider here.


1. The total time difference shown in the above test is a little over 
a tenth of a second.


2. By keeping the dB open, you're actually tying up the resources of 
the server more than necessary. After all, your script will always 
run longer than the query, right?


3. Most scripts (I'm guess here) don't access the dB 100 times or 
more -- so doing is less, means less of a difference.


4. And lastly, by closing the dB in your script when you're done with 
it, allows the server to use it's resources to clean-up quicker and 
have more time to be responsive to other queries.


So, not that you implied otherwise, I still don't see any convincing 
argument as to why one should open a dB at the start of a script and 
not close it as the original poster asked. Furthermore, not that I'm 
anyone special, but if I was overlooking someone's code who did that, 
I wouldn't think favorably of the technique -- it would appear as 
sloppy programming to me.


tedd

--

http://sperling.com

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



Re: [PHP] Looping information into a table

2006-04-03 Thread tedd
i am creating a forum and i am having trouble getting the database 
information in to an html table


i believe it has somthing to do with the placement of the while 
loops because they repeat the segment of code over untill the 
statment returns false, thus adding extra html.. you guys are the 
experts so if you could help i would appreaciate it. i will give you 
the code and an example of how its shows up and then how i need it 
to show up and if you could point me in the right direction it would 
be awsome...




Try something more simple, like:

http://www.weberdev.com/get_example-5.html

tedd
--

http://sperling.com

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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-03 Thread chris smith
On 4/3/06, tedd [EMAIL PROTECTED] wrote:
 chris said:

 Time. Opening a db connection is time consuming. There are many levels
 involved (making the connection, authentication, etc).. Even worse if
 the connection is over tcp/ip because that overhead comes in on top as
 well.

 I replied:

 Have you timed it?
 
 Maybe I'll do that tomorrow.

 Okay, I performed a test that made 100 queries, and found that it
 took about four times as long to open a dB connection each time and
 get the data as it did to open it once. In other words, if your
 script pulls data from a dB 100 times, then making a connection to
 the dB once, pulling the data, and then closing the dB is four times
 as fast as opening the dB, pulling the data, and closing the dB in
 sequence one hundred times.

 Now, that sounds like you should open your dB at the start of your
 script and just leave it open until the your script quits (as the
 original poster suggested), but there's a few thing to consider here.

 1. The total time difference shown in the above test is a little over
 a tenth of a second.

 2. By keeping the dB open, you're actually tying up the resources of
 the server more than necessary. After all, your script will always
 run longer than the query, right?

 3. Most scripts (I'm guess here) don't access the dB 100 times or
 more -- so doing is less, means less of a difference.

 4. And lastly, by closing the dB in your script when you're done with
 it, allows the server to use it's resources to clean-up quicker and
 have more time to be responsive to other queries.

 So, not that you implied otherwise, I still don't see any convincing
 argument as to why one should open a dB at the start of a script and
 not close it as the original poster asked. Furthermore, not that I'm
 anyone special, but if I was overlooking someone's code who did that,
 I wouldn't think favorably of the technique -- it would appear as
 sloppy programming to me.

Just out of interest, could you re-run the test using persistent connections?

change mysql_connect to mysql_pconnect..

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

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



Re: [PHP] Best authentication method for user

2006-04-03 Thread chris smith
On 4/3/06, Alain Roger [EMAIL PROTECTED] wrote:
 I suppose that this config file should be included in all PHP file via
 include command.
 is it true ?

Yes.

I'd actually use 'require' not 'include' since you always want it to be there.

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

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



[PHP] Re: PHP AJAX Framework - Suggestions Please

2006-04-03 Thread Manuel Lemos
Hello,

on 04/01/2006 12:00 PM Andrei Verovski (aka MacGuru) said the following:
 Anyone can suggest me which PHP AJAX framework you are using, for what 
 reason(s), what are pros and cons of your particular choice.
 
 I found many, and now facing difficult choice.
 
 BTW, how do you pass session id between calls to PHP from JavaScript (cookies 
 or explicit foo.php?PHPSESSSIONID=blahblahblah)?
 
 Thanks in advance for any suggestion(s).

Regardless of the framework you choose, note that AJAX solutions based
on XMLHttpRequest objects are problematic for reasons listed in this
blog post below. Despite it is an older technology, for most purposes
people want to use AJAX, IFrame based solutions are more capable and
reliable.

* Browser compatibility

* Browser security constraints

* Single JavaScript base code

* Response speed

* File form upload


http://www.phpclasses.org/blog/post/51-PHPClasses-20-Beta-AJAX-XMLHttpRequest-x-IFrame.html


As for AJAX solutions, I use this forms generation class also mentioned
in the post, which has a plug-in form submiting and processing forms in
the background using IFrame based AJAX requests.

http://www.phpclasses.org/formsgeneration


-- 

Regards,
Manuel Lemos

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

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

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



[PHP] curl http file upload post

2006-04-03 Thread webmaster
I am trying to upload a file to a remote server using curl and post method 
here is what I have:

$file = $dir..$dbfile[0];
$this-invoiceno = $dbfile[1];
$uploadpath = http://www.website.com;
$postvar = array ();
$postvar['cboFileType'] = 837;
$postvar['txtDesc']  = Invoice No. .$this-invoiceno;
$postvar['btnSave']  = Upload File;
$postvar['FILE1']   = @$file;
$postvar['UPLOADING']  = true;

$this-postvariables = 
txtUserName=.$this-user.txtPassword=.$this-password.btnLogin=Log 
In;

// login first
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this-login_post);
curl_setopt($ch, CURLOPT_USERAGENT, $this-agent);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $this-postvariables);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, $this-reffer);
curl_setopt($ch, CURLOPT_COOKIEFILE, $this-cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $this-cookie_file_path);
$results = curl_exec ($ch);
// upload file
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$postvar);
curl_setopt ( $ch, CURLOPT_URL, $uploadpath);
$uploaded = curl_exec ( $ch );
echo $uploaded;

I think my problem is that the file I need to upload is not in the same 
directory on the server as this script. I am setting $file = 
/var/www/include/upload/test.txt and this is what seems to be causing the 
problem. I can find very little information on this topic on google so I 
need your help. Do I need to copy the file to the same directory that the 
script is in or is there something else I am missing? If I just set $file = 
test.txt how would the server know where to find the file? 

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



Re: [PHP] Re: PHP AJAX Framework - Suggestions Please

2006-04-03 Thread Ruben Rubio Rey

The best and simplest for me is prototype.js

Is much more than ajax ! 100% cross browser! ang GPL!

http://www.sergiopereira.com/articles/prototype.js.html

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



[PHP] connection error on file upload

2006-04-03 Thread Kenn
Greetings.

I'm having a problem with my upload handler.  If I send small files
(under 1M or so), it works fine.  if I send larger files, I get the
following error in Firefox:

The connection was reset.
The connection to the server was reset while the page was loading.

When using Internet Explorer, the error is simply
The Page cannot be displayed.
The page you are looking for is currently unavailable. The Web site
might be experiencing technical difficulties, or you may need to adjust
your browser settings

Do I have a problem with my php.ini settings?  I've tried a few
adjustments but can't find the magic solution.  I've just rebuilt the
box from scratch, and I must be overlooking something -- nothing I've
tried so far works.

Any ideas?

Thanks in advance.

Kenn

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



RE: [PHP] connection error on file upload

2006-04-03 Thread Jay Blanchard
[snip]
The connection was reset.
The connection to the server was reset while the page was loading.
[/snip]

Script timeout
Max upload size

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



[PHP] MSSQL Server 2005

2006-04-03 Thread Mike Smith
I am currently working on a project using SQL Server 2000. I don't
think there would be a big advantage to switching to sql server 2005
for this project, but is anyone using 2005 (or one of the Express
versions) with PHP? Looks like it only uses the native client?

--
Thanks,
Mike Smith

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



[PHP] utf8 problem

2006-04-03 Thread Merlin

Hi there,

I am trying to encode output with php with uft8_encode(); and then output it to 
an xml file. Unfortunatelly this does not work as the string that has been 
encoded by utf8_encode is not valid utf8?!


Merlin

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



Re: [PHP] connection error on file upload

2006-04-03 Thread Kenn
That was my first thought, but two things:  1.  the error occurs
IMMEDIATELY, and 2.  the max_execution_time = 6000 so I would think that
arbitrarily high number would prevent that error?



Jay Blanchard wrote:
 [snip]
 The connection was reset.
 The connection to the server was reset while the page was loading.
 [/snip]

 Script timeout
 Max upload size

   

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



Re: [PHP] connection error on file upload

2006-04-03 Thread Kenn
neglected to mention:

upload_max_filesize = 200M

post_max_size = 250M

Kenn wrote:
 That was my first thought, but two things:  1.  the error occurs
 IMMEDIATELY, and 2.  the max_execution_time = 6000 so I would think that
 arbitrarily high number would prevent that error?



 Jay Blanchard wrote:
   
 [snip]
 The connection was reset.
 The connection to the server was reset while the page was loading.
 [/snip]

 Script timeout
 Max upload size

   
 

   


[PHP] Here is a silly question

2006-04-03 Thread Mace Eliason

Hi,

This is come thing that I have struggled with now and again.  I usaually 
us php code to make it work, but was wondering how others deal with this


I use includes in most of the web applications that I work on to include 
the header, footer, menu etc.


The problem that I always run into as a project gets bigger is my links 
to  pages.  If all the files are in the root directory theres no problem.


If I have some files in a folder and call my menu for example ? 
include(../menu.php); ?  I have to call if from the parent 
directory.  But then of course

all the links are wrong.  Root becomes the calling directory.

I usually use a php variable to place the ../ if its needed.

How does everyone else deal with this type of problem.  I have a times 
places an extra copy of the footer, menu, header etc in each directory 
but it is a pain to change links

when you have multiple locations to do it in.

Thanks for any suggestions.

I would be nice to have a simple way to have my include files in a 
common place that works and keeps the links right.


Scandog

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



Re: [PHP] Here is a silly question

2006-04-03 Thread Sudheer S
Hello,

I refer to the target file like this:

?php
include $_SERVER['DOCUMENT_ROOT'] . '/menu_dir/menu.php';
?

Solves the problem.

Sudheer. S

On Mon, 2006-04-03 at 09:54 -0600, Mace Eliason wrote:
 Hi,
 
 This is come thing that I have struggled with now and again.  I usaually 
 us php code to make it work, but was wondering how others deal with this
 
 I use includes in most of the web applications that I work on to include 
 the header, footer, menu etc.
 
 The problem that I always run into as a project gets bigger is my links 
 to  pages.  If all the files are in the root directory theres no problem.
 
 If I have some files in a folder and call my menu for example ? 
 include(../menu.php); ?  I have to call if from the parent 
 directory.  But then of course
 all the links are wrong.  Root becomes the calling directory.
 
 I usually use a php variable to place the ../ if its needed.
 
 How does everyone else deal with this type of problem.  I have a times 
 places an extra copy of the footer, menu, header etc in each directory 
 but it is a pain to change links
 when you have multiple locations to do it in.
 
 Thanks for any suggestions.
 
 I would be nice to have a simple way to have my include files in a 
 common place that works and keeps the links right.
 
 Scandog
 

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



Re: [PHP] Here is a silly question

2006-04-03 Thread Wolf
I tend to stick /nav/header.php in for my includes, since I control
the server.

As long as the site translates root to the main directory of your
website and not somewhere else, you can always have your links be
/menu.php as server-speak / means rootme.

I also use / in my href links in my menus and such so that no matter
where the script is called from, it always works.

Robert

Mace Eliason wrote:
 Hi,
 
 This is come thing that I have struggled with now and again.  I usaually
 us php code to make it work, but was wondering how others deal with this
 
 I use includes in most of the web applications that I work on to include
 the header, footer, menu etc.
 
 The problem that I always run into as a project gets bigger is my links
 to  pages.  If all the files are in the root directory theres no problem.
 
 If I have some files in a folder and call my menu for example ?
 include(../menu.php); ?  I have to call if from the parent
 directory.  But then of course
 all the links are wrong.  Root becomes the calling directory.
 
 I usually use a php variable to place the ../ if its needed.
 
 How does everyone else deal with this type of problem.  I have a times
 places an extra copy of the footer, menu, header etc in each directory
 but it is a pain to change links
 when you have multiple locations to do it in.
 
 Thanks for any suggestions.
 
 I would be nice to have a simple way to have my include files in a
 common place that works and keeps the links right.
 
 Scandog
 

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



Re: [PHP] Here is a silly question

2006-04-03 Thread Philip Thompson

On Apr 3, 2006, at 10:54 AM, Mace Eliason wrote:


Hi,

This is come thing that I have struggled with now and again.  I  
usaually us php code to make it work, but was wondering how others  
deal with this


I use includes in most of the web applications that I work on to  
include the header, footer, menu etc.


The problem that I always run into as a project gets bigger is my  
links to  pages.  If all the files are in the root directory theres  
no problem.


If I have some files in a folder and call my menu for example ?  
include(../menu.php); ?  I have to call if from the parent  
directory.  But then of course

all the links are wrong.  Root becomes the calling directory.

I usually use a php variable to place the ../ if its needed.

How does everyone else deal with this type of problem.  I have a  
times places an extra copy of the footer, menu, header etc in each  
directory but it is a pain to change links

when you have multiple locations to do it in.

Thanks for any suggestions.

I would be nice to have a simple way to have my include files in a  
common place that works and keeps the links right.


Scandog



Ok, I this may only help part of your problem. Within your menu.php  
file, you could make all the links absolute:


a href=/root/to/a/location.phpPlace A/a
a href=/root/to/somewhere.phpPlace B/a

instead of relative:

a href=location.phpPlace A/a
a href=somewhere.phpPlace B/a

That means you can use only 1 menu.php file and all the links will  
work from wherever. Of course, this does not fix this issue:


? include (../../menu.php); ? or
? include (menu.php); ? or
? include (../somewhere/menu.php); ?

for each of your files that includes the menu. Maybe another clever  
person has an idea.


~Philip

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



Re: [PHP] connection error on file upload

2006-04-03 Thread Kenn


Jay Blanchard wrote:
 [snip]
 Jay Blanchard wrote:
   
 [snip]
 That was my first thought, but two things:  1.  the error occurs
 IMMEDIATELY, and 2.  the max_execution_time = 6000 so I would think
 
 that
   
 arbitrarily high number would prevent that error?
 [/snip]

 If it occurs immediately does your upload form look like this;

 !-- The data encoding type, enctype, MUST be specified as below --
 form enctype=multipart/form-data action=__URL__ method=POST
 !-- MAX_FILE_SIZE must precede the file input field --
 input type=hidden name=MAX_FILE_SIZE value=3
 
 /
   
 LOOK
 !-- Name of input element determines name in $_FILES array --
 Send this file: input name=userfile type=file /
 input type=submit value=Send File /
 /form

 From http://www.php.net/manual/en/features.file-upload.php

 In your php.ini what is the max upload size?
   
 

 My looks pretty much the same, except for the omission of the hidden
 field for max_file_size, which is defined in the php.ini as

 upload_max_filesize = 200M

 post_max_size = 250M



 Well, there it is then. You MUST include that hidden field.
   

I just added that line, but the results haven't changed.  STILL get the
error.  any other ideas about what I'm doing wrong?

thanks in advance.




Re: [PHP] Here is a silly question

2006-04-03 Thread Philip Thompson
I'm not exactly sure... but I think that include() may not work this  
way:


? include (/menu.php); ?

I don't think it knows to go to the root and then look for menu.php.  
That's why you have to tell it exactly where the menu.php is found -  
1 level back:


? include (../menu.php); ?

Maybe it should be labeled as a bug? Hehehe! ;)

~Philip


On Apr 3, 2006, at 11:18 AM, Mace Eliason wrote:


Okay I gave it a try and this is one thing I ran into.

in my menu file I changed all the links to a href=/ 
index.phpHome/a


then in a file in another directory I added this ? include(/ 
menu.php); ?  This didn't work


if I changed it to
? include(../menu.php); ?  This worked and the links work fine.

Seems strange the first include didn't work.  Shouldn't it goto the  
root of the website and look from there?





Philip Thompson wrote:

On Apr 3, 2006, at 10:54 AM, Mace Eliason wrote:


Hi,

This is come thing that I have struggled with now and again.  I  
usaually us php code to make it work, but was wondering how  
others deal with this


I use includes in most of the web applications that I work on to  
include the header, footer, menu etc.


The problem that I always run into as a project gets bigger is my  
links to  pages.  If all the files are in the root directory  
theres no problem.


If I have some files in a folder and call my menu for example ?  
include(../menu.php); ?  I have to call if from the parent  
directory.  But then of course

all the links are wrong.  Root becomes the calling directory.

I usually use a php variable to place the ../ if its needed.

How does everyone else deal with this type of problem.  I have a  
times places an extra copy of the footer, menu, header etc in  
each directory but it is a pain to change links

when you have multiple locations to do it in.

Thanks for any suggestions.

I would be nice to have a simple way to have my include files in  
a common place that works and keeps the links right.


Scandog



Ok, I this may only help part of your problem. Within your  
menu.php file, you could make all the links absolute:


a href=/root/to/a/location.phpPlace A/a
a href=/root/to/somewhere.phpPlace B/a

instead of relative:

a href=location.phpPlace A/a
a href=somewhere.phpPlace B/a

That means you can use only 1 menu.php file and all the links will  
work from wherever. Of course, this does not fix this issue:


? include (../../menu.php); ? or
? include (menu.php); ? or
? include (../somewhere/menu.php); ?

for each of your files that includes the menu. Maybe another  
clever person has an idea.


~Philip


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



Re: [PHP] microsoft PHP ?

2006-04-03 Thread Matt Richards
I wonder how long this is gonna go on for, its ironic that the name 
'Microsoft' seems to spread through this mailing list just like it 
spreads through peoples computers ...
humm another thing that implies the same rule is a virus ! derm derm 
drm...


Ryan A wrote:

Hey,
  

Just as long as everyone knows that everything I said was all in good
fun. Next time I'll be sure to use sarcasam just to be sure nothing
is taken the wrong way ;-)Its quite strange actually how touchy so many


people have gotten... becauseas I read the whole comeback joke I thought
it was pretty damn funny anddidnt think anyone would misunderstand it as
anything other than a joke, didnt really think there is/was a need for
sarcasm tags either, if you're on the listfor some time you see that
Chris/Rasmus and nearly everyone else has a sense ofhumour...they take the
time to help us lowly php problem thread starters dont they? Maybe its all
stress... take it easy guysCheers!

  


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



Re: [PHP] Here is a silly question

2006-04-03 Thread Wolf
?php include(/nav/menu.html) ? works like a charm for me, but your
mileage may vary depending on who has set up your website and what
server it is being run on.

FYI: I build my menu's with HTML and javascript, hence the .html call,
but it should be fine as php as well.

Robert

Philip Thompson wrote:
 I'm not exactly sure... but I think that include() may not work this way:
 
 ? include (/menu.php); ?
 
 I don't think it knows to go to the root and then look for menu.php.
 That's why you have to tell it exactly where the menu.php is found - 1
 level back:
 
 ? include (../menu.php); ?
 
 Maybe it should be labeled as a bug? Hehehe! ;)
 
 ~Philip
 
 
 On Apr 3, 2006, at 11:18 AM, Mace Eliason wrote:
 
 Okay I gave it a try and this is one thing I ran into.

 in my menu file I changed all the links to a href=/index.phpHome/a

 then in a file in another directory I added this ?
 include(/menu.php); ?  This didn't work

 if I changed it to
 ? include(../menu.php); ?  This worked and the links work fine.

 Seems strange the first include didn't work.  Shouldn't it goto the
 root of the website and look from there?




 Philip Thompson wrote:
 On Apr 3, 2006, at 10:54 AM, Mace Eliason wrote:

 Hi,

 This is come thing that I have struggled with now and again.  I
 usaually us php code to make it work, but was wondering how others
 deal with this

 I use includes in most of the web applications that I work on to
 include the header, footer, menu etc.

 The problem that I always run into as a project gets bigger is my
 links to  pages.  If all the files are in the root directory theres
 no problem.

 If I have some files in a folder and call my menu for example ?
 include(../menu.php); ?  I have to call if from the parent
 directory.  But then of course
 all the links are wrong.  Root becomes the calling directory.

 I usually use a php variable to place the ../ if its needed.

 How does everyone else deal with this type of problem.  I have a
 times places an extra copy of the footer, menu, header etc in each
 directory but it is a pain to change links
 when you have multiple locations to do it in.

 Thanks for any suggestions.

 I would be nice to have a simple way to have my include files in a
 common place that works and keeps the links right.

 Scandog


 Ok, I this may only help part of your problem. Within your menu.php
 file, you could make all the links absolute:

 a href=/root/to/a/location.phpPlace A/a
 a href=/root/to/somewhere.phpPlace B/a

 instead of relative:

 a href=location.phpPlace A/a
 a href=somewhere.phpPlace B/a

 That means you can use only 1 menu.php file and all the links will
 work from wherever. Of course, this does not fix this issue:

 ? include (../../menu.php); ? or
 ? include (menu.php); ? or
 ? include (../somewhere/menu.php); ?

 for each of your files that includes the menu. Maybe another clever
 person has an idea.

 ~Philip
 
 --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] Here is a silly question

2006-04-03 Thread Tom Chubb
I'm very interested to see the best option for this.
Currently I set 2 variables in the include file (header.inc)

$siteurl = http://www.yourdomain.com/ http://www.yourdomain.com/psp/;
$pathto = /home/location_on_server/public_html/;

Then for includes I do something like:
include($pathto.functions.php);

And for images, links, etc.
img src=?php echo $siteurl; ?nav/images/image.jpg

Hope this helps, but I'm sure there's another way?!?




On 03/04/06, Wolf [EMAIL PROTECTED] wrote:

 ?php include(/nav/menu.html) ? works like a charm for me, but your
 mileage may vary depending on who has set up your website and what
 server it is being run on.

 FYI: I build my menu's with HTML and javascript, hence the .html call,
 but it should be fine as php as well.

 Robert

 Philip Thompson wrote:
  I'm not exactly sure... but I think that include() may not work this
 way:
 
  ? include (/menu.php); ?
 
  I don't think it knows to go to the root and then look for menu.php.
  That's why you have to tell it exactly where the menu.php is found - 1
  level back:
 
  ? include (../menu.php); ?
 
  Maybe it should be labeled as a bug? Hehehe! ;)
 
  ~Philip
 
 
  On Apr 3, 2006, at 11:18 AM, Mace Eliason wrote:
 
  Okay I gave it a try and this is one thing I ran into.
 
  in my menu file I changed all the links to a
 href=/index.phpHome/a
 
  then in a file in another directory I added this ?
  include(/menu.php); ?  This didn't work
 
  if I changed it to
  ? include(../menu.php); ?  This worked and the links work fine.
 
  Seems strange the first include didn't work.  Shouldn't it goto the
  root of the website and look from there?
 
 
 
 
  Philip Thompson wrote:
  On Apr 3, 2006, at 10:54 AM, Mace Eliason wrote:
 
  Hi,
 
  This is come thing that I have struggled with now and again.  I
  usaually us php code to make it work, but was wondering how others
  deal with this
 
  I use includes in most of the web applications that I work on to
  include the header, footer, menu etc.
 
  The problem that I always run into as a project gets bigger is my
  links to  pages.  If all the files are in the root directory theres
  no problem.
 
  If I have some files in a folder and call my menu for example ?
  include(../menu.php); ?  I have to call if from the parent
  directory.  But then of course
  all the links are wrong.  Root becomes the calling directory.
 
  I usually use a php variable to place the ../ if its needed.
 
  How does everyone else deal with this type of problem.  I have a
  times places an extra copy of the footer, menu, header etc in each
  directory but it is a pain to change links
  when you have multiple locations to do it in.
 
  Thanks for any suggestions.
 
  I would be nice to have a simple way to have my include files in a
  common place that works and keeps the links right.
 
  Scandog
 
 
  Ok, I this may only help part of your problem. Within your menu.php
  file, you could make all the links absolute:
 
  a href=/root/to/a/location.phpPlace A/a
  a href=/root/to/somewhere.phpPlace B/a
 
  instead of relative:
 
  a href=location.phpPlace A/a
  a href=somewhere.phpPlace B/a
 
  That means you can use only 1 menu.php file and all the links will
  work from wherever. Of course, this does not fix this issue:
 
  ? include (../../menu.php); ? or
  ? include (menu.php); ? or
  ? include (../somewhere/menu.php); ?
 
  for each of your files that includes the menu. Maybe another clever
  person has an idea.
 
  ~Philip
 
  --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




--
Tom Chubb
[EMAIL PROTECTED]
07915 053312


[PHP] Form to form variables

2006-04-03 Thread Bill Whitacre

I wonder if I may trouble you'all for some advice.

I'm having a problem bringing along text variables with more than one
word in them from form to form.

The project is an on-line baseball score  pitching log submission
form that I'm trying to make a little more automated.

The first form asks the user what league  team they represent.  For
example:

Your Team:

select name=yourteam
option value=- Select a team -
option value=+ Juniors +
option value=LCCMBLCCMB
option value=FannonFannon
option value=Avalon BayAvalon Bay
option value=BeiroBeiro
option value=Pioneer RoofingPioneer Roofing
option value=FannonFannon

This gets picked up on the next form and is used to feed a SELECT
statment that gets records associated with the particular league  team.

This works just fine to capture the posted values and give them a name:

$team = $_POST['yourteam'];
$league = $_POST['yourleague'];

Further down on this page, I pass these variables off to the next form:

while ($thearray = mysql_fetch_array($res)) {
  printf(FORM ACTION = scoreForm_last.php METHOD = POST
  input type = hidden name = IDFIELD value = $thearray[id]
  input type = hidden name = yourleague value = $league
  input type = hidden name = yourteam value = $team

I pick them up on the next page like this:

$ID = $_POST['IDFIELD'];
$yourleague = $_POST['yourleague'];
$yourteam = $_POST['yourteam'];

This passes the record ID, the league and team along just fine to the
next form, BUT only the first word of each team comes through!

Avalon Bay becomes Avalon, etc.

Is there any obvious reason for this to be happening that you can see?
Or am I approaching this all wrong?

I'm using a similar approach to an umpire scheduling database and it
works just fine.

Thanks for any hints!

bw

---
Bill Whitacre
[EMAIL PROTECTED]

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



Re: [PHP] Form to form variables

2006-04-03 Thread Wolf
You aren't encapsulating your data with quotes, so it is thinking the
next word is another variable.

   input type = hidden name = IDFIELD value = $thearray[id]
   input type = hidden name = yourleague value = $league
   input type = hidden name = yourteam value = $team

should become
input type=\hidden\ name=\IDFIELD\ value=\$thearray[id]\
input type=\hidden\ name=\yourleague\ value=\$league\
input type=\hidden\ name=\yourteam\ value=\$team\

HTH,
Wolf

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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-03 Thread tedd

chris said:


Just out of interest, could you re-run the test using persistent connections?

change mysql_connect to mysql_pconnect..


In doing so, the overall results dropped from a tenth of a second 
difference between both methods to three-one-hundredths of a second 
difference. In other words, using mysql_pconnect is three times 
faster for multiple open/closes.


However, this only improved the connect/get-data/close sequence. The 
open once and keep open showed no improvement.


Thanks -- does the persistent connection thing hold the server up 
until released? How does that work?


tedd
--

http://sperling.com

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



[PHP] GD

2006-04-03 Thread Horányi Gergő

Hi!


I have a very big problem with GD.
I want to make a picture which includes two pictures. And anybody can 
download it by right click and save as.

How can i do this?

Please help!

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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-03 Thread Richard Lynch
On Mon, April 3, 2006 1:33 pm, tedd wrote:
Just out of interest, could you re-run the test using persistent
 connections?

change mysql_connect to mysql_pconnect..

 In doing so, the overall results dropped from a tenth of a second
 difference between both methods to three-one-hundredths of a second
 difference. In other words, using mysql_pconnect is three times
 faster for multiple open/closes.

 However, this only improved the connect/get-data/close sequence. The
 open once and keep open showed no improvement.

 Thanks -- does the persistent connection thing hold the server up
 until released? How does that work?

What persistent connection REALLY means is:

Ask MySQL to keep the connection laying around handy for re-use.

So it's not really persistent from PHP's point-of-view -- It's more
like re-usable from PHP's point-of-view.  The actual persistence
happens on the MySQL side of things, mostly.

Note, however, that for security reasons, the re-use can only be done
if the SAME MySQL user is asking for a connection.  You wouldn't want
to risk the data left over from a 'power' user to leak out to a
'normal' user, if you have multiple MySQL users with multiple levels
of access, and the connection to be re-used was previously a 'power'
user one, but now a 'normal' user is asking to use it.

There are more constraints on this re-use which I forget...

What they boil down to, though, is that EACH Apache child process will
end up having a connection allocated to itself, for each username that
you use in your application.

In /etc/httpd.conf (or wherever your httpd.conf file is) you have
something like MaxServers to define the maximum number of Apache
children that can exist.

So you need to edit /etc/my.cnf (or wherever yours is installed, or
your MySQL expects it to be installed, based on compile-time settings)
and make sure you have that number of connections PLUS A FEW EXTRA
ONES.

The few extra ones are needed in case of a server melt-down, so that
even if every Apache child is running, sucking down a MySQL
connection, you can STILL connect from the shell as 'root' and do
something useful, like shutdown MySQL safely.

If your MySQL # of connections are ALL taken up by Apache children
thrashing away, then you CANNOT connect using mysql_admin to shut down
MySQL and you're in big trouble.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] utf8 problem

2006-04-03 Thread tedd

At 5:39 PM +0200 4/3/06, Merlin wrote:

Hi there,

I am trying to encode output with php with uft8_encode(); and then 
output it to an xml file. Unfortunatelly this does not work as the 
string that has been encoded by utf8_encode is not valid utf8?!


Merlin


Merlin:

I'm not sure as to what you are saying, but you might want to review:

http://www.weberdev.com/utf8-encode

http://www.weberdev.com/utf8-decode

as well as comments on:

http://php.net/utf8-encode and decode


tedd

--

http://sperling.com

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



Re: [PHP] connection error on file upload

2006-04-03 Thread tedd

At 10:20 AM -0500 4/3/06, Kenn wrote:

Greetings.

I'm having a problem with my upload handler.  If I send small files
(under 1M or so), it works fine.  if I send larger files, I get the
following error


If nothing else works, send smaller segments. Nothing wrong with 
appending to a file, is there?


tedd
--

http://sperling.com

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



[PHP] Re: mysql_fecth_array() and function call as parameter

2006-04-03 Thread Jon Drukman

Paul Goepfert wrote:


function determineDay ()
{
$return = ;
$query1 = mysql_query(SELECT months FROM Month WHERE m_id =
month(curdate()));
$query2 = mysql_query(SELECT dayNum FROM Days WHERE dayNum =
day(curdate()));
$query3 = mysql_query(SELECT year FROM Year WHERE year = 
year(curdate()));


always Always ALWAYS check the error return!!!

$query1 = mysql_query(SELECT months FROM Month WHERE m_id = 
month(curdate())) or die(query1 failed:  . mysql_error());


do this religiously on every single mysql_query.  in fact, write a 
wrapper function to do it for you - that's what i do.



If anyone can find my error please let me know.  I have looked at this
for about an hour and I can't figure it out.


you probably could have saved an hour by checking the error code.

-jsd-

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



Re: [PHP] Here is a silly question

2006-04-03 Thread David Tulloh
I put all the generic include files such as the header and menu in their
own directory.  Then I put that directory in the include_path ini
variable.  I would normally set it in the virtualhost file but .htaccess
should work as well, you can even set it in the script.

This means I can simply include the file using:
?php include(menu.php); ?


David


Mace Eliason wrote:
 Hi,
 
 This is come thing that I have struggled with now and again.  I usaually
 us php code to make it work, but was wondering how others deal with this
 
 I use includes in most of the web applications that I work on to include
 the header, footer, menu etc.
 
 The problem that I always run into as a project gets bigger is my links
 to  pages.  If all the files are in the root directory theres no problem.
 
 If I have some files in a folder and call my menu for example ?
 include(../menu.php); ?  I have to call if from the parent
 directory.  But then of course
 all the links are wrong.  Root becomes the calling directory.
 
 I usually use a php variable to place the ../ if its needed.
 
 How does everyone else deal with this type of problem.  I have a times
 places an extra copy of the footer, menu, header etc in each directory
 but it is a pain to change links
 when you have multiple locations to do it in.
 
 Thanks for any suggestions.
 
 I would be nice to have a simple way to have my include files in a
 common place that works and keeps the links right.
 
 Scandog
 

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



Re: [PHP] Here is a silly question

2006-04-03 Thread tedd

At 9:54 AM -0600 4/3/06, Mace Eliason wrote:

Hi,

This is come thing that I have struggled with now and again.  I 
usaually us php code to make it work, but was wondering how others 
deal with this


I use includes in most of the web applications that I work on to 
include the header, footer, menu etc.


The problem that I always run into as a project gets bigger is my 
links to  pages.  If all the files are in the root directory theres 
no problem.


If I have some files in a folder and call my menu for example ? 
include(../menu.php); ?  I have to call if from the parent 
directory.  But then of course

all the links are wrong.  Root becomes the calling directory.

I usually use a php variable to place the ../ if its needed.

How does everyone else deal with this type of problem.  I have a 
times places an extra copy of the footer, menu, header etc in each 
directory but it is a pain to change links

when you have multiple locations to do it in.

Thanks for any suggestions.

I would be nice to have a simple way to have my include files in a 
common place that works and keeps the links right.


Scandog



Mace:

I do it like you do and live with it.

I keep all my common includes in one include folder. If I move a 
project folder down a level, then I change all my includes in it like 
-- 'include( includes/opendb.php)' to 'include( 
../includes/opendb.php)' .


However, I have given it some thought about changing it to an 
absolute url like --


$_SERVER['DOCUMENT_ROOT'] . /includes/opendb.php

-- and that way then it doesn't matter how deep you go with your projects.

So, now that you mentioned it -- I think I'll change it. I can do an 
entire site find/replace in GoLive.


Thanks for asking.

tedd
--

http://sperling.com

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



Re: [PHP] GD

2006-04-03 Thread Richard Collyer



I have a very big problem with GD.
I want to make a picture which includes two pictures. And anybody can 
download it by right click and save as.

How can i do this?

Please help!


Please go away and re-write the question so that we have an idea of what 
you are after. Without more information we cannot help you as we have no 
idea of what you are after.


Richard

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



Re: [PHP] Here is a silly question

2006-04-03 Thread Peter Hoskin

Nobody else has mentioned it, so I thought I would.

http://smarty.php.net - PHP Templating Engine

Mace Eliason wrote:

Hi,

This is come thing that I have struggled with now and again.  I 
usaually us php code to make it work, but was wondering how others 
deal with this


I use includes in most of the web applications that I work on to 
include the header, footer, menu etc.


The problem that I always run into as a project gets bigger is my 
links to  pages.  If all the files are in the root directory theres no 
problem.


If I have some files in a folder and call my menu for example ? 
include(../menu.php); ?  I have to call if from the parent 
directory.  But then of course

all the links are wrong.  Root becomes the calling directory.

I usually use a php variable to place the ../ if its needed.

How does everyone else deal with this type of problem.  I have a times 
places an extra copy of the footer, menu, header etc in each directory 
but it is a pain to change links

when you have multiple locations to do it in.

Thanks for any suggestions.

I would be nice to have a simple way to have my include files in a 
common place that works and keeps the links right.


Scandog



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



[PHP] Strtodate() bug?

2006-04-03 Thread Jay Paulson
Hello,

I've got some weird behavior using PHP 4.3.9.  I use the function of
strtotime(last Sunday); and it's returning the timestamp for last
Saturday.  However, if I use strtotime(-1 day); (I'm running this program
on a Monday) it returns the correct timestamp for Sunday.

Is this a bug in PHP 4.3.9?

Thanks.

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



Re: [PHP] Strtodate() bug?

2006-04-03 Thread Philip Hallstrom

I've got some weird behavior using PHP 4.3.9.  I use the function of
strtotime(last Sunday); and it's returning the timestamp for last
Saturday.  However, if I use strtotime(-1 day); (I'm running this program
on a Monday) it returns the correct timestamp for Sunday.

Is this a bug in PHP 4.3.9?


Probably.  5.1.2 says:

$x = strtotime(last Sunday);
print ( date('r', $x) );
Sun, 02 Apr 2006 00:00:00 -0800

4.3.9 is *really* old.

-philip

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



[PHP] GD No.2

2006-04-03 Thread Horányi Gergő

Ok. I'm sorry.
I will try to explain my problem in a better way.

I wan't to make a page which can makes secret writting. It would 
translate the normal characters into my special characters.

And I want to put the result into one JPG file.

So. I want to join together some JPEGs.
And this is my problem. I can't do this. I think i could do this with 
GD. Is that true?


Please help!

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



RE: [PHP] GD No.2

2006-04-03 Thread Jay Blanchard
[snip]
Ok. I'm sorry.
I will try to explain my problem in a better way.

I wan't to make a page which can makes secret writting. It would 
translate the normal characters into my special characters.
And I want to put the result into one JPG file.

So. I want to join together some JPEGs.
And this is my problem. I can't do this. I think i could do this with 
GD. Is that true?
[/snip]

Yes, that is true. Have you RTFM http://www.php.net/gd ?

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



Re: [PHP] Here is a silly question

2006-04-03 Thread tedd

At 5:56 AM +1000 4/4/06, Peter Hoskin wrote:

Nobody else has mentioned it, so I thought I would.

http://smarty.php.net - PHP Templating Engine




And that goes somewhere?

tedd
--

http://sperling.com

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



[PHP] Searching for Duplicated records..

2006-04-03 Thread Alberto Ferrer
Hello all, how i search duplicates records on a TXT file ?

Thanks in Advance.

--
bet0x

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



Re: [PHP] Searching for Duplicated records..

2006-04-03 Thread John Nichel

Alberto Ferrer wrote:

Hello all, how i search duplicates records on a TXT file ?

Thanks in Advance.



Use your imagination.  Try starting with the filesystem functions.

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

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



Re: [PHP] Here is a silly question

2006-04-03 Thread Peter Hoskin

Site must be down... search google for site:smarty.php.net

Believe me, it does exist.

tedd wrote:

At 5:56 AM +1000 4/4/06, Peter Hoskin wrote:

Nobody else has mentioned it, so I thought I would.

http://smarty.php.net - PHP Templating Engine




And that goes somewhere?

tedd


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



Re: [PHP] Here is a silly question

2006-04-03 Thread Wolf
Well, it did, looks like someone's having server issues or forgot to pay
the bill.

Anyways, here's Google's cache of it:
http://72.14.203.104/search?q=cache:cFUJ1uuABpkJ:smarty.php.net/+php+SMARTYhl=engl=usct=clnkcd=1client=firefox-a


tedd wrote:
 At 5:56 AM +1000 4/4/06, Peter Hoskin wrote:
 Nobody else has mentioned it, so I thought I would.

 http://smarty.php.net - PHP Templating Engine

 
 
 And that goes somewhere?
 
 tedd

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



RE: [PHP] GD No.2

2006-04-03 Thread Jay Blanchard
[snip]
Yeah. I read that.
But I don't want to learn the whole GD. I thought someone could help me. 
Someone, who knows GD.
[/snip]

Someone can help you, but they probably will not write your code for you. You 
have only asked general questions, and so you have gotten general answers. If 
you are more specific you will get better help.

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



[PHP] Re: PHP AJAX Framework - Suggestions Please

2006-04-03 Thread Andrei Verovski (aka MacGuru)
Hi,

Many thanks for everyone who have replied. Its seems Manuel's suggestion 
regarding iFrame sounds really good. BTW, I am using Savant as template 
engine, and integrate it with Manuel Forms Generation and Validation would be 
a good idea (there is a Smarty plugin for this class, but I am using Savant). 

Basically, I have a problem porting my own FileMaker database with many 
multi-page forms (plus large tables and big drop-down lists, displaying 
thousands of items). Things made quickly with native GUI tools often very 
difficult to port to Web-based GUI.


On Monday 03 April 2006 16:13, you wrote:
 Hello,

 on 04/01/2006 12:00 PM Andrei Verovski (aka MacGuru) said the following:
  Anyone can suggest me which PHP AJAX framework you are using, for what
  reason(s), what are pros and cons of your particular choice.
 
  I found many, and now facing difficult choice.
 
  BTW, how do you pass session id between calls to PHP from JavaScript
  (cookies or explicit foo.php?PHPSESSSIONID=blahblahblah)?
 
  Thanks in advance for any suggestion(s).

 Regardless of the framework you choose, note that AJAX solutions based
 on XMLHttpRequest objects are problematic for reasons listed in this
 blog post below. Despite it is an older technology, for most purposes
 people want to use AJAX, IFrame based solutions are more capable and
 reliable.

 * Browser compatibility

 * Browser security constraints

 * Single JavaScript base code

 * Response speed

 * File form upload


 http://www.phpclasses.org/blog/post/51-PHPClasses-20-Beta-AJAX-XMLHttpReque
st-x-IFrame.html


 As for AJAX solutions, I use this forms generation class also mentioned
 in the post, which has a plug-in form submiting and processing forms in
 the background using IFrame based AJAX requests.

 http://www.phpclasses.org/formsgeneration

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



Re: [PHP] return path of mail function

2006-04-03 Thread Curt Zirzow
On Sun, Apr 02, 2006 at 10:34:48PM -0700, [EMAIL PROTECTED] wrote:
 The same as before:
 
 Return-path: [EMAIL PROTECTED]
 Envelope-to: [EMAIL PROTECTED]
 Delivery-date: Mon, 03 Apr 2006 00:35:34 -0500
 Received: from nobody by amsterdam.servershost.net with local (Exim 4.52)
 
Exim probably isn't allowing it for security reasons.

 ...
 the
   code as below:
  
   $return=test@test.com;
   $orig_sendmail_from = ini_get('sendmail_from');
   ini_set('sendmail_from', $return);

You are better off using the 5th paramater to mail() instead..

 mail($to, $sub, $msg, $headers, -f $return);


The return-path shouldn't nor will be allowed in your standard
$headers var.


Curt.
-- 
cat .signature: No such file or directory

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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-03 Thread Jasper Bryant-Greene

tedd wrote:

chris said:

Just out of interest, could you re-run the test using persistent 
connections?


change mysql_connect to mysql_pconnect..



[snip]


Thanks -- does the persistent connection thing hold the server up 
until released? How does that work?


MySQL is threaded so will not be held up by any connection. Obviously 
the more connections the more of certain resources it will be using, but 
it doesn't block for every connection.


The exception, of course, being if you have something going on at the 
MySQL protocol level such as LOCK TABLES or a transaction. That will 
hold up certain other queries. But that's at a whole other layer.


--
Jasper Bryant-Greene
General Manager
Album Limited

http://www.album.co.nz/ 0800 4 ALBUM
[EMAIL PROTECTED]  021 708 334

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



[PHP] ID-tags from picture?

2006-04-03 Thread Gustav Wiberg

Hi guys!

If I've got this right, there will be some kind of tag that is saved in a 
picture (hidden). Is it possible to retrieve this information from PHP and 
what it is called? Any ideas / suggestions would be approciated!


/Gustav Wiberg 


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



[PHP] Re: PHP AJAX Framework - Suggestions Please

2006-04-03 Thread Manuel Lemos
Hello,

on 04/03/2006 06:25 PM Andrei Verovski (aka MacGuru) said the following:
 Many thanks for everyone who have replied. Its seems Manuel's suggestion
 regarding iFrame sounds really good. BTW, I am using Savant as template
 engine, and integrate it with Manuel Forms Generation and Validation
would be
 a good idea (there is a Smarty plugin for this class, but I am using
Savant).

I think it would not be hard to implement a plug-in for Savant, if there
is enough interest for do it. I developed the Smarty plug-in but I do
not use it myself because I do not use Smarty. It is very popular though.


 Basically, I have a problem porting my own FileMaker database with many
 multi-page forms (plus large tables and big drop-down lists, displaying
 thousands of items). Things made quickly with native GUI tools often very
 difficult to port to Web-based GUI.

If you have select inputs with long lists of options picked from a
database, you can always split the list according to database query
condition criteria and use multiple linked selects with another plug-in
of the same forms class that can switch the options of a select input
when the value of another linked input changes. It can pick the new
options list from a database (anyone you use) without reloading the page.

Here is an example:

http://www.phpclasses.org/browse/view/html/file/9879/name/test_linked_select_page.html

http://www.phpclasses.org/formsgeneration

-- 

Regards,
Manuel Lemos

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

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

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



[PHP] Multidimentional array problems

2006-04-03 Thread Mace Eliason
Hi, 

I am trying to read form a database and place everything in a 
multi-dimentional array


This is what I am doing and the output (for testing) seems correct
while($row=mysql_fetch_array($result))
{
 $banner= array($arrayIndex = $row);

 echo $banner[$arrayIndex][image]. br;
 echo $banner[$arrayIndex][url]. br;
 echo $banner[$arrayIndex][display_type]. br;
 $arrayIndex++;
}


When I try and use
$value=0;
while($value  $number_of_banners_db )
{
   echo $banner[$value][url]. br;
   echo $banner[$value][image]. br;
   echo $banner[$value][display_type]. br;
}

I only get the last set of values that where entered into the array.  I 
want to be able to pull all the values out


$banner[0]['url']
$banner[1]['url']
$banner[2]['url']  etc.

I don't use arrays much and I have been going thru my books but I still 
can't seem to get it to work.


Thanks

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



Re: [PHP] Multidimentional array problems

2006-04-03 Thread Philip Hallstrom
I am trying to read form a database and place everything in a 
multi-dimentional array


This is what I am doing and the output (for testing) seems correct
while($row=mysql_fetch_array($result))
{
$banner= array($arrayIndex = $row);

echo $banner[$arrayIndex][image]. br;
echo $banner[$arrayIndex][url]. br;
echo $banner[$arrayIndex][display_type]. br;
$arrayIndex++;
}


What are you setting $arrayIndex to initially (before the while loop 
starts?)



When I try and use
$value=0;
while($value  $number_of_banners_db )
{
  echo $banner[$value][url]. br;
  echo $banner[$value][image]. br;
  echo $banner[$value][display_type]. br;
}

I only get the last set of values that where entered into the array.  I want 
to be able to pull all the values out


$banner[0]['url']
$banner[1]['url']
$banner[2]['url']  etc.

I don't use arrays much and I have been going thru my books but I still can't 
seem to get it to work.


Try a print_r($banner) and see what it looks like

-philip

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



[PHP] Re: mysql_fecth_array() and function call as parameter

2006-04-03 Thread Paul Goepfert
I included the or die function on the end of my query statement.  When
I tested this on my web page I got the following error

Query2 Failed: You have an error in your SQL syntax near '(curdate())' at line 1

When this code executed:

$query2 = mysql_query(SELECT dayNum FROM Days WHERE dayNum = day(curdate())) ;

I can't see where the error is.  Can anyone see the error?

The table name is correct because I have another drop down box that
gets all dates in the table and outputs it with no error.  I also
tested the above SQL statement on a local copy of mysql (version
5.0.18-nt) and it worked with out any errors.  And this code works on
a different web server. Mysql client version 3.23.49.  However it does
not work on mysql client version 3.23.54.  Also both php versions are
the same.

Thanks
Paul

On 4/3/06, Jon Drukman [EMAIL PROTECTED] wrote:
 Paul Goepfert wrote:

  function determineDay ()
{
$return = ;
$query1 = mysql_query(SELECT months FROM Month WHERE m_id =
  month(curdate()));
$query2 = mysql_query(SELECT dayNum FROM Days WHERE dayNum =
  day(curdate()));
$query3 = mysql_query(SELECT year FROM Year WHERE year = 
  year(curdate()));

 always Always ALWAYS check the error return!!!

 $query1 = mysql_query(SELECT months FROM Month WHERE m_id =
 month(curdate())) or die(query1 failed:  . mysql_error());

 do this religiously on every single mysql_query.  in fact, write a
 wrapper function to do it for you - that's what i do.

  If anyone can find my error please let me know.  I have looked at this
  for about an hour and I can't figure it out.

 you probably could have saved an hour by checking the error code.

 -jsd-


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



Re: [PHP] Re: mysql_fecth_array() and function call as parameter

2006-04-03 Thread Joe Wollard
Paul,

Try TO_DAYS(curdate()) instead - if not you can't say we didn't try! ;-)

If that doesn't work you may want to try a MySQL list.

- Joe



On 4/3/06, Paul Goepfert [EMAIL PROTECTED] wrote:

 I included the or die function on the end of my query statement.  When
 I tested this on my web page I got the following error

 Query2 Failed: You have an error in your SQL syntax near '(curdate())' at
 line 1

 When this code executed:

 $query2 = mysql_query(SELECT dayNum FROM Days WHERE dayNum =
 day(curdate())) ;

 I can't see where the error is.  Can anyone see the error?

 The table name is correct because I have another drop down box that
 gets all dates in the table and outputs it with no error.  I also
 tested the above SQL statement on a local copy of mysql (version
 5.0.18-nt) and it worked with out any errors.  And this code works on
 a different web server. Mysql client version 3.23.49.  However it does
 not work on mysql client version 3.23.54.  Also both php versions are
 the same.

 Thanks
 Paul

 On 4/3/06, Jon Drukman [EMAIL PROTECTED] wrote:
  Paul Goepfert wrote:
 
   function determineDay ()
 {
 $return = ;
 $query1 = mysql_query(SELECT months FROM Month WHERE
 m_id =
   month(curdate()));
 $query2 = mysql_query(SELECT dayNum FROM Days WHERE
 dayNum =
   day(curdate()));
 $query3 = mysql_query(SELECT year FROM Year WHERE year
 = year(curdate()));
 
  always Always ALWAYS check the error return!!!
 
  $query1 = mysql_query(SELECT months FROM Month WHERE m_id =
  month(curdate())) or die(query1 failed:  . mysql_error());
 
  do this religiously on every single mysql_query.  in fact, write a
  wrapper function to do it for you - that's what i do.
 
   If anyone can find my error please let me know.  I have looked at this
   for about an hour and I can't figure it out.
 
  you probably could have saved an hour by checking the error code.
 
  -jsd-
 

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




RE: [PHP] Re: mysql_fecth_array() and function call as parameter

2006-04-03 Thread Chrome
Maybe try NOW() or CURRENT_DATE()?

Just a guess and sorry if it's already been mentioned

Dan

 
---
http://chrome.me.uk
 

-Original Message-
From: Joe Wollard [mailto:[EMAIL PROTECTED] 
Sent: 04 April 2006 00:38
To: Paul Goepfert
Cc: Jon Drukman; php-general@lists.php.net
Subject: Re: [PHP] Re: mysql_fecth_array() and function call as parameter

Paul,

Try TO_DAYS(curdate()) instead - if not you can't say we didn't try! ;-)

If that doesn't work you may want to try a MySQL list.

- Joe



On 4/3/06, Paul Goepfert [EMAIL PROTECTED] wrote:

 I included the or die function on the end of my query statement.  When
 I tested this on my web page I got the following error

 Query2 Failed: You have an error in your SQL syntax near '(curdate())' at
 line 1

 When this code executed:

 $query2 = mysql_query(SELECT dayNum FROM Days WHERE dayNum =
 day(curdate())) ;

 I can't see where the error is.  Can anyone see the error?

 The table name is correct because I have another drop down box that
 gets all dates in the table and outputs it with no error.  I also
 tested the above SQL statement on a local copy of mysql (version
 5.0.18-nt) and it worked with out any errors.  And this code works on
 a different web server. Mysql client version 3.23.49.  However it does
 not work on mysql client version 3.23.54.  Also both php versions are
 the same.

 Thanks
 Paul

 On 4/3/06, Jon Drukman [EMAIL PROTECTED] wrote:
  Paul Goepfert wrote:
 
   function determineDay ()
 {
 $return = ;
 $query1 = mysql_query(SELECT months FROM Month WHERE
 m_id =
   month(curdate()));
 $query2 = mysql_query(SELECT dayNum FROM Days WHERE
 dayNum =
   day(curdate()));
 $query3 = mysql_query(SELECT year FROM Year WHERE year
 = year(curdate()));
 
  always Always ALWAYS check the error return!!!
 
  $query1 = mysql_query(SELECT months FROM Month WHERE m_id =
  month(curdate())) or die(query1 failed:  . mysql_error());
 
  do this religiously on every single mysql_query.  in fact, write a
  wrapper function to do it for you - that's what i do.
 
   If anyone can find my error please let me know.  I have looked at this
   for about an hour and I can't figure it out.
 
  you probably could have saved an hour by checking the error code.
 
  -jsd-
 

 --
 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] Multidimentional array problems

2006-04-03 Thread Tom Rogers
Hi,

Tuesday, April 4, 2006, 8:37:18 AM, you wrote:
ME Hi, 

ME I am trying to read form a database and place everything in a 
ME multi-dimentional array

ME This is what I am doing and the output (for testing) seems correct
ME while($row=mysql_fetch_array($result))
ME {
ME   $banner= array($arrayIndex = $row);

ME   echo $banner[$arrayIndex][image]. br;
ME   echo $banner[$arrayIndex][url]. br;
ME   echo $banner[$arrayIndex][display_type]. br;
ME   $arrayIndex++;
ME }


ME When I try and use
ME $value=0;
ME  while($value  $number_of_banners_db )
ME  {
ME echo $banner[$value][url]. br;
ME echo $banner[$value][image]. br;
ME echo $banner[$value][display_type]. br;
ME  }

ME I only get the last set of values that where entered into the array.  I 
ME want to be able to pull all the values out

ME $banner[0]['url']
ME $banner[1]['url']
ME $banner[2]['url']  etc.

ME I don't use arrays much and I have been going thru my books but I still 
ME can't seem to get it to work.

ME Thanks

You are creating a new $banner each time it loops.
It should be like this:

$banner = array();
$arrayIndex = 0;
while($row=mysql_fetch_array($result))
{
  $banner[$arrayIndex] = $row;

  echo $banner[$arrayIndex][image]. br;
  echo $banner[$arrayIndex][url]. br;
  echo $banner[$arrayIndex][display_type]. br;
  $arrayIndex++;
}

-- 
regards,
Tom

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



Re: [PHP] Re: PHP AJAX Framework - Suggestions Please

2006-04-03 Thread Miles Thompson

At 06:25 PM 4/3/2006, Andrei Verovski (aka MacGuru) wrote:


Hi,

Many thanks for everyone who have replied. Its seems Manuel's suggestion
regarding iFrame sounds really good. BTW, I am using Savant as template
engine, and integrate it with Manuel Forms Generation and Validation would be
a good idea (there is a Smarty plugin for this class, but I am using Savant).

Basically, I have a problem porting my own FileMaker database with many
multi-page forms (plus large tables and big drop-down lists, displaying
thousands of items). Things made quickly with native GUI tools often very
difficult to port to Web-based GUI.

snip

Andrei,

Had to do the same thing a couple of years ago, one of the fields involved 
European phone numbers. No matter what native export method I tried, the 
phone numbers ended up getting converted to exponential notation.


IIRC when dumping the data FileMaker saw that field as numbers and treated 
it accordingly. So I dumped it, sucked it into FoxPro, opened up the .dbf 
header and changed the field to character, and saved it. Then it could be 
imported into Access ( which was what the customer wanted.)


Hope this is helpful - Miles 



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.385 / Virus Database: 268.3.4/299 - Release Date: 3/31/2006

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



Re: [PHP] Best authentication method for user

2006-04-03 Thread Ligaya Turmelle

Alain Roger wrote:

ok, but how to make a non-logged user executes some stored procedures or
Queries ?
MySQL will need some login and password for that.

so, that's why i've asked such question...how and where to store this
non-logged user's info (login, password) to not make physical user type them
? (this must be secured enough)

thanks a lot,
Alain

On 4/3/06, Ligaya Turmelle [EMAIL PROTECTED] wrote:




For that i was thinking to use session and register his login and


password


as session variable.



What do you think about that ?



I personally would only hold a password for as long as it is needed to
log them in.  Then I'd set a session var that they have logged in and
another session var for their level of access.

But that's me.


--

life is a game... so have fun.






Are you talking about the level of mysql access or the level of access 
to a site?  They are 2 completely separate things.


A site can use 1 or multiple mysql users depending upon the level of 
privileges you want to give them.  You could always link the level of 
site access to the mysql user in your authentification area...


off the top of my head
(guest = 1, user = 5, super = 9)
  switch ($_SESSION['level']
  {
case 1:
  $db_user = 'site_guest';
  break;
case 5:
  $db_user = 'site_user';
  break;
case 9:
  $db_user = 'site_super';
  break;
default:
  $db_user = 'site_guest';
  }

In a config file you would have the various usernames and their matching 
passwords... and yes I would require it on all pages.


And on the page itself display various parts (or not) based on their 
$_SESSION['level'] of access...


if($_SESSION['level']1
{
  // display something a user or super would only see
}

In the DB you have a site_user who has GRANTS on SELECT, site_user who 
has GRANTS on SELECT, UPDATE, INSERT, DELETE, EXECUTE for specific 
tables (maybe content tables) and stored procedures on them, and 
site_super that has the full DB access for the tables associated with 
the site.


/off the top of my head

--

life is a game... so have fun.

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

Re: [PHP] curl http file upload post

2006-04-03 Thread Chris

webmaster wrote:
I am trying to upload a file to a remote server using curl and post method 
here is what I have:


$file = $dir..$dbfile[0];
$this-invoiceno = $dbfile[1];
$uploadpath = http://www.website.com;
$postvar = array ();
$postvar['cboFileType'] = 837;
$postvar['txtDesc']  = Invoice No. .$this-invoiceno;
$postvar['btnSave']  = Upload File;
$postvar['FILE1']   = @$file;
$postvar['UPLOADING']  = true;

$this-postvariables = 
txtUserName=.$this-user.txtPassword=.$this-password.btnLogin=Log 
In;


// login first
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this-login_post);
curl_setopt($ch, CURLOPT_USERAGENT, $this-agent);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $this-postvariables);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, $this-reffer);
curl_setopt($ch, CURLOPT_COOKIEFILE, $this-cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $this-cookie_file_path);
$results = curl_exec ($ch);
// upload file
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$postvar);
curl_setopt ( $ch, CURLOPT_URL, $uploadpath);
$uploaded = curl_exec ( $ch );
echo $uploaded;

I think my problem is that the file I need to upload is not in the same 
directory on the server as this script. I am setting $file = 
/var/www/include/upload/test.txt and this is what seems to be causing the 
problem. I can find very little information on this topic on google so I 
need your help. Do I need to copy the file to the same directory that the 
script is in or is there something else I am missing? If I just set $file = 
test.txt how would the server know where to find the file? 



You need the full filepath on the server - /path/to/test.txt.

from this page:

http://www.php.net/manual/en/function.curl-setopt.php

looks like you need to add a curl_setopt call:

CURLOPT_UPLOAD

If that doesn't work, put verbose mode on and see what's going on:

CURLOPT_VERBOSE

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

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



[PHP] proc_open and unix pty support

2006-04-03 Thread Jon
Has anyone worked with ptys using proc_open?  I want to try it out but 
it appears to be disabled at the source level and I don't know how to 
re-enable it.  Any info at all is appreciated.


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



[PHP] PHP/Dreamweaver CSS issue

2006-04-03 Thread The Doctor
I am trying to modularize a Web Page using one of Dremweaver's CSSes.

It works in Firefox but it falls about in IE.

Is IE at fault or the modularization?

-- 
Member - Liberal International  
This is [EMAIL PROTECTED]   Ici [EMAIL PROTECTED]
God Queen and country! Beware Anti-Christ rising!
Canada's New CONservatives - Same old Tory.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


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



Re: [PHP] proc_open and unix pty support

2006-04-03 Thread Chris

Jon wrote:
Has anyone worked with ptys using proc_open?  I want to try it out but 
it appears to be disabled at the source level and I don't know how to 
re-enable it.  Any info at all is appreciated.


Stupid question - you're using php5 right? It should already be there:

http://php.net/proc_open

PHP 5 introduces pty support for systems with Unix98 ptys.

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

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



[PHP] parse a Makefile

2006-04-03 Thread Benjamin D Adams
I'm trying to parse a Makefile, (FreeBSD Ports)
I plan on dumping the Makefile vars to a MySQL Database.

Would I parse the make file like a ini file?
Or would I have to use something different?

Maybe someone knows a tool that can do this for me?

Thanks
Ben

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



Re: [PHP] utf8 problem

2006-04-03 Thread Chris

Merlin wrote:

Hi there,

I am trying to encode output with php with uft8_encode(); and then 
output it to an xml file. Unfortunatelly this does not work as the 
string that has been encoded by utf8_encode is not valid utf8?!


Depending on the string you might also need to htmlspecialchars it (to 
encode  and  type characters).


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

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



Re: [PHP] Best authentication method for user

2006-04-03 Thread Grant Young

Hi Alain.

On the authentication front, you can use HTTP basic authentication for 
this kind of thing too - and it means you're not having to re-invent the 
wheel in a lot of ways.  The Auth_HTTP PEAR module makes this pretty 
simple to implement:

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

You can integrate you're own authentication mechanisms (i.e. DB stored 
passwords, LDAP authentication, whatever you like really) quite easily.


Permissions systems are harder to implement.  The PEAR LiveUser package 
is attempting to make this a bit easier too:

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

HTH. Grant

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



Re: [PHP] return path of mail function

2006-04-03 Thread sub

 You are better off using the 5th paramater to mail() instead..
  mail($to, $sub, $msg, $headers, -f $return);


And what if that doesn't work? Is there a 3rd way of doing it that might
work?

~Drew

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



Re: [PHP] return path of mail function

2006-04-03 Thread Chris

[EMAIL PROTECTED] wrote:

You are better off using the 5th paramater to mail() instead..
mail($to, $sub, $msg, $headers, -f $return);




And what if that doesn't work? Is there a 3rd way of doing it that might
work?


Ask your host if they allow you to change it on the fly. Explain what 
you're trying to do.


As Curt said, they might not let you in their exim config. Not much we 
can do if that's the case..



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

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



Re: [PHP] Here is a silly question

2006-04-03 Thread Chris

Mace Eliason wrote:

Hi,

This is come thing that I have struggled with now and again.  I usaually 
us php code to make it work, but was wondering how others deal with this


I use includes in most of the web applications that I work on to include 
the header, footer, menu etc.


The problem that I always run into as a project gets bigger is my links 
to  pages.  If all the files are in the root directory theres no problem.


If I have some files in a folder and call my menu for example ? 
include(../menu.php); ?  I have to call if from the parent 
directory.  But then of course

all the links are wrong.  Root becomes the calling directory.

I usually use a php variable to place the ../ if its needed.

How does everyone else deal with this type of problem.  I have a times 
places an extra copy of the footer, menu, header etc in each directory 
but it is a pain to change links

when you have multiple locations to do it in.

Thanks for any suggestions.

I would be nice to have a simple way to have my include files in a 
common place that works and keeps the links right.


Scandog



I didn't see anybody else mention this, so:

$mydir = dirname(__FILE__);
include($mydir . '/../nav/menu.php');

works every time and you don't have to rely on document_root being set 
properly etc.


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

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



Re: [PHP] PHP/Dreamweaver CSS issue

2006-04-03 Thread Peter Hoskin

Lack of information means no answer for you.

More to the point, this is a CSS question... not a PHP one. There is a 
difference.


The Doctor wrote:

I am trying to modularize a Web Page using one of Dremweaver's CSSes.

It works in Firefox but it falls about in IE.

Is IE at fault or the modularization?

  


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



Re: [PHP] ID-tags from picture?

2006-04-03 Thread Chris

Gustav Wiberg wrote:

Hi guys!

If I've got this right, there will be some kind of tag that is saved in 
a picture (hidden). Is it possible to retrieve this information from PHP 
and what it is called? Any ideas / suggestions would be approciated!


Depends on what information you are after.

Some images may have exif info, but not all.

http://www.php.net/exif

Possibly IPTC information too (but only applies to jpegs apparently):

http://www.php.net/iptcparse

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

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



Re: [PHP] parse a Makefile

2006-04-03 Thread Peter Hoskin

Makefile's are not ini files.

ini files have the structure
[section]
variable=value
[section2]
variable2=value2

Makefiles have the structure
variable=value

Benjamin D Adams wrote:

I'm trying to parse a Makefile, (FreeBSD Ports)
I plan on dumping the Makefile vars to a MySQL Database.

Would I parse the make file like a ini file?
Or would I have to use something different?

Maybe someone knows a tool that can do this for me?

Thanks
Ben

  


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



Re: [PHP] parse a Makefile

2006-04-03 Thread Kevin Kinsey

Benjamin D Adams wrote:


I'm trying to parse a Makefile, (FreeBSD Ports)
I plan on dumping the Makefile vars to a MySQL Database.

Would I parse the make file like a ini file?
Or would I have to use something different?

Maybe someone knows a tool that can do this for me?

Thanks
Ben
 



Try file() and ereg() or preg_match.  If the Makefile
has standard format you're looking for

FOOBAR=some string here

so reading the file into an array (the file() call) and
using a regular expression conditional (to determine
if you're looking at a variable or something else)
might be quite enough to do the trick.

HTH,

Kevin Kinsey

--
A pedestal is as much a prison as any small, confined space.
-- Gloria Steinem

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



Re: [PHP] Re: PHP AJAX Framework - Suggestions Please

2006-04-03 Thread Rasmus Lerdorf

Ruben Rubio Rey wrote:

The best and simplest for me is prototype.js

Is much more than ajax ! 100% cross browser! ang GPL!

http://www.sergiopereira.com/articles/prototype.js.html


Note that quite a few people who know a lot about Javascript really 
don't like the fact that prototype.js extends the basic Array type. 
This means that if you have any Javascript that isn't prototype.js 
aware, chances are pretty good that it will break because, for example, 
you can't iterate over the elements of an Array anymore.  It also 
doesn't namespace any of its symbols which again means it doesn't play 
nice with others.  And my last real gripe is that it is a single 
monolithic library.  It's all or nothing.


I am of course rather biased, but I strongly prefer the Yahoo! User 
Interface Library.  You can read about it here:


  http://developer.yahoo.com/yui/

It is a set of tiny standalone components that won't in any way 
interfere with any other Javascript code you might have and you can pick 
and choose just the things you need.


-Rasmus

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



[PHP] How to get a timestamp in error log?

2006-04-03 Thread John Hicks
My RHES4 configuration omits the timestamp when generating a PHP error 
message in the (Apache) error log.


But regular apache errors *do* have a timestamp.

Is this normal?

How can I get the timestamp for the PHP errors as well?

Thanks,

John

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



[PHP] Re: mysql_fecth_array() and function call as parameter

2006-04-03 Thread Jon Drukman

Paul Goepfert wrote:


I included the or die function on the end of my query statement.  When
I tested this on my web page I got the following error

Query2 Failed: You have an error in your SQL syntax near '(curdate())' at line 1

When this code executed:

$query2 = mysql_query(SELECT dayNum FROM Days WHERE dayNum = day(curdate())) ;

I can't see where the error is.  Can anyone see the error?



that query works fine here.  what version mysql are you using?  (server, 
not client).


-jsd-

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