Re: [PHP] READ BEFORE REPLYING TO : Re: [PHP] UNSUBSCRIBE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

2004-10-02 Thread Kevin Waterson
This one time, at band camp, Robert Restad [EMAIL PROTECTED] wrote:

 I am posting, obviously, the 26th message in this thread. (or maybe
 higher). 

Look, he knew what he was getting into when he subscribed. There's no
backing out now. I say, make him stick it out!

Kevin


-
Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote.

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



Re: [PHP] php script run by cron job

2004-10-02 Thread Merlin
Andrew Kreps wrote:
On Fri, 01 Oct 2004 08:18:55 +0200, Merlin [EMAIL PROTECTED] wrote:
Here is the how I did it:
14 8 * * *  root  /usr/local/bin/php /home/www/cron/statistics.php
Does anybody see an error in this?

I'm not familiar with a crontab format that allows you to specify a
username as you have there.  If you'd like the process to run as root,
login as root, do a crontab -e, and paste this in there:
14 8 * * * /usr/local/bin/php /home/www/cron/statistics.php
see if that works for you.
Thank you that solved the problem
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Detecting Mysql server is running

2004-10-02 Thread Marek Kilimajer
barsalou wrote:
I know I can see if php has the ability to talk with the Mysql server,
but is there a way to determine if the Mysql server is running.  In some
cases, I wouldn't have passwords, so a mysql_connect wouldn't work.
I'm sure, at any given time, there is a mysql server running somewhere 
in the world.

If you mean if it is running on your server, run
ps ax |grep mysqld | grep -v grep
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] array sort question

2004-10-02 Thread Jasper Howard
On Fri, 1 Oct 2004 22:44:50 -0400, Paul Bissex [EMAIL PROTECTED] wrote:
 On Fri, 1 Oct 2004 19:12:30 -0700, Ed Lazor [EMAIL PROTECTED] wrote:
  Any ideas on how I could sort this array by Title?
 
  $menu[1][ID] = 5;
 
  $menu[1][Title] = Test 1;
 
  $menu[2][ID] = 3;
 
  $menu[2][Title] = Test 4;
 
 
 uasort() is what you need here.
 
 Also see the usort() documentation page for an example of how to write
 the comparison callback function that you pass to uasort().
 
 pb
 
 --
 paul bissex, e-scribe.com -- database-driven web development
 413.585.8095
 69.55.225.29
 01061-0847
 72°39'71W 42°19'42N
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 



-- 

Jasper Howard - Database Administration
ApexEleven.com
530 559 0107
---

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



Re: [PHP] array sort question

2004-10-02 Thread Jasper Howard
Sorry for the empty reply (miss slide of the finger on my touch pad).
You can use array_multisort(); The code would look something like
this, remember, this is untested code so be warned before any flaming
is done:

//CODE
//You need to restructure your array like this:
$menu[ID][1] = 5;
$menu[Title][1] = Test 1;
$menu[ID][2] = 3;
$menu[Title][2] = Test 4;
//Then run array_multisort
array_multisort($menu['Title'],$menu['ID']);

//END CODE

Like this it will sort alphabetically or numerically (which ever
needed) ascending. You can put tags after the first variable like
this:

array_multisort($menu['Title'],SORT_ASC,SORT_STRING,$menu['ID']);

If there are any more keys in the $menu array you need to list them
after the $menu['ID'] key so they will be sorted according to the
$menu['Title'] key. The first key you put into array_multisort() is
the one that the rest get sorted by.

-Jasper Howard

On Fri, 1 Oct 2004 22:44:50 -0400, Paul Bissex [EMAIL PROTECTED] wrote:
 On Fri, 1 Oct 2004 19:12:30 -0700, Ed Lazor [EMAIL PROTECTED] wrote:
  Any ideas on how I could sort this array by Title?
 
  $menu[1][ID] = 5;
 
  $menu[1][Title] = Test 1;
 
  $menu[2][ID] = 3;
 
  $menu[2][Title] = Test 4;
 
 
 uasort() is what you need here.
 
 Also see the usort() documentation page for an example of how to write
 the comparison callback function that you pass to uasort().
 
 pb
 
 --
 paul bissex, e-scribe.com -- database-driven web development
 413.585.8095
 69.55.225.29
 01061-0847
 72°39'71W 42°19'42N
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 



-- 

Jasper Howard - Database Administration
ApexEleven.com
530 559 0107
---

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



Re: [PHP] Session handlers

2004-10-02 Thread Ewout de Boer

- Original Message - 
From: Shawn McKenzie [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, October 02, 2004 2:11 AM
Subject: [PHP] Session handlers


 Just curious, what is the advantage of using a custom session handler,
 such as saving session data in MySQL?

security !

The default location for php to store session data is the tmp directory of
the host os (like /tmp), and in most cases these files are readable by the
webserver... and by all other scripts it's running. So if you're hosting
your site on a shared server other users can read your session data, that's
fine as long as you don't use it to store critical information like
username, password

some more info on this topic:

http://shiflett.org/talks/phpworks2004-php-session-security/



regards,
Ewout

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



[PHP] Re: Office document upload to website (and inserting in MySQL if possible)

2004-10-02 Thread Phill

Pugi! [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi,

 I would like to upload office-document (doc, xls, ...) using a form to a
 website (apache, php, mysql) in a specific directory and if possible 
 insert
 it into a table (MySQL-db). Is this possible. If yes, how ? You don't have
 to explain it in detail, a link to a website or online manual or example 
 is
 fine.

 Thanks,

 Pugi!



 Please reply to group or to pugilator at yahoo dot com


I think I get what you want to do, do you want to have a form on a webpage, 
where you specify the path of it on that pc, and then be able to upload it 
to a folder on the server. Then, you store the details, such as original 
filename, current filename, location etc. in the database.

I know this is possible, but I've never managed to do it myself. Try looking 
in PHP and MySQL, it's by Larry Ullman and is published by Peachpit Press. 
There is something towards the back of the book about file uploads, and it 
gives an example of a solution like I explained above 

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



Re: [PHP] Session handlers

2004-10-02 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Ewout De Boer wrote:
 
 - Original Message - 
 From: Shawn McKenzie [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, October 02, 2004 2:11 AM
 Subject: [PHP] Session handlers
 
 
 Just curious, what is the advantage of using a custom session handler,
 such as saving session data in MySQL?
 
 security !
 
 The default location for php to store session data is the tmp directory of
 the host os (like /tmp), and in most cases these files are readable by the
 webserver... and by all other scripts it's running. So if you're hosting
 your site on a shared server other users can read your session data, that's
 fine as long as you don't use it to store critical information like
 username, password

If others can read from your session.save_path, i'm pretty sure
they'll be able to read the credentials you use in the scripts to connect the database 
too. Which makes the security argument in this case invalid.


-- 
Met vriendelijke groeten,
Tim Van Wassenhove http://www.timvw.info

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



[PHP] Including function libraries

2004-10-02 Thread Andrew W
Ok, I've got a file called functions.lib which contains the following:
function checkLoggedIn()
{
return (true);
}
function Test ($x)
{
return ($x * $x);
}
and a file called test.php which contains the following:
?php
include 'functions.lib';
if (checkLoggedIn())
{
print Logged in;
}
else
{
print Not logged in;
}

?
They're both stored in a directory called 'test' which Ive uploaded to 
my webserver.  When I call test.php from my browser I get the following 
output:

 function checkLoggedIn() {  return (true); }  function Test ($x) {  
return ($x * $x); }
Fatal error: Call to undefined function: checkloggedin() in 
/home/sites/site116/web/test/test.php on line 5

Why can't I call the function defined in the lib file?
Thanks
AW



[PHP] How to load another php page?

2004-10-02 Thread Arnold
Hi,

How can i load another php file (another.php) directly without an action
(example: clicking on a button)?
I'd like to do in my php script:

if(isset($var1)) {  // load another.php }

It is possible to include the file, but i just want to load the whole
another.php file.
I guess that there should be a php command like load, but i didnt found it
yet.

Who can help me?

Regards, Arnold

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



Re: [PHP] How to load another php page?

2004-10-02 Thread afan
if(isset($var1)) { include 'another.php'; }



 Hi,

 How can i load another php file (another.php) directly without an action
 (example: clicking on a button)?
 I'd like to do in my php script:

 if(isset($var1)) {  // load another.php }

 It is possible to include the file, but i just want to load the whole
 another.php file.
 I guess that there should be a php command like load, but i didnt found
 it
 yet.

 Who can help me?

 Regards, Arnold

 --
 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] Session handlers

2004-10-02 Thread Chris Shiflett
--- Tim Van Wassenhove [EMAIL PROTECTED] wrote:
 If others can read from your session.save_path, i'm pretty sure
 they'll be able to read the credentials you use in the scripts
 to connect the database too. Which makes the security argument
 in this case invalid.

You can store the database access credentials in a file that only root can
read. Because the parent process in the case of Apache typically runs as
root, it can read such a file, but the child processes that serve each
request run as the user nobody, so they can't.

More information is available here:

http://shiflett.org/articles/security-corner-mar2004

Hope that helps.

Chris

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

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming December 2004http://httphandbook.org/

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



RE: [PHP] Including function libraries

2004-10-02 Thread Graham Cossey
Do you have ?php and ? in functions.lib ?

-Original Message-
From: Andrew W [mailto:[EMAIL PROTECTED]
Sent: 02 October 2004 16:52
To: php-gen
Subject: [PHP] Including function libraries


Ok, I've got a file called functions.lib which contains the following:

function checkLoggedIn()
{
return (true);
}


function Test ($x)
{
return ($x * $x);
}

and a file called test.php which contains the following:

?php

include 'functions.lib';

if (checkLoggedIn())
{
print Logged in;
}
else
{
print Not logged in;
}



?

They're both stored in a directory called 'test' which Ive uploaded to 
my webserver.  When I call test.php from my browser I get the following 
output:

  function checkLoggedIn() {  return (true); }  function Test ($x) {  
return ($x * $x); }
Fatal error: Call to undefined function: checkloggedin() in 
/home/sites/site116/web/test/test.php on line 5

Why can't I call the function defined in the lib file?

Thanks
AW

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



Re: [PHP] How to load another php page?

2004-10-02 Thread Arnold
Does an include replace the file who called include?

Arnold

[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 if(isset($var1)) { include 'another.php'; }



  Hi,
 
  How can i load another php file (another.php) directly without an
action
  (example: clicking on a button)?
  I'd like to do in my php script:
 
  if(isset($var1)) {  // load another.php }
 
  It is possible to include the file, but i just want to load the whole
  another.php file.
  I guess that there should be a php command like load, but i didnt
found
  it
  yet.
 
  Who can help me?
 
  Regards, Arnold
 
  --
  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] How to load another php page?

2004-10-02 Thread Arnold
I don't think include replaces the calling php script.
What i mean is that i want exactly the same as what is done by an submit
action but then you have to press a button, whereafter a new phpfile is
loaded and the button-press is what i want to ignore.

Arnold
[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 if(isset($var1)) { include 'another.php'; }



  Hi,
 
  How can i load another php file (another.php) directly without an
action
  (example: clicking on a button)?
  I'd like to do in my php script:
 
  if(isset($var1)) {  // load another.php }
 
  It is possible to include the file, but i just want to load the whole
  another.php file.
  I guess that there should be a php command like load, but i didnt
found
  it
  yet.
 
  Who can help me?
 
  Regards, Arnold
 
  --
  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] How to load another php page?

2004-10-02 Thread Lists
Hmmm, I'm not sure I am following you.  Maybe:
header (Location: page.php);
exit;
So you could do something like: if this condition then go to new page, 
else go to other page?

-dg
On Oct 2, 2004, at 9:44 AM, Arnold wrote:
I don't think include replaces the calling php script.
What i mean is that i want exactly the same as what is done by an 
submit
action but then you have to press a button, whereafter a new phpfile is
loaded and the button-press is what i want to ignore.

Arnold
[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
if(isset($var1)) { include 'another.php'; }

Hi,
How can i load another php file (another.php) directly without an
action
(example: clicking on a button)?
I'd like to do in my php script:
if(isset($var1)) {  // load another.php }
It is possible to include the file, but i just want to load the whole
another.php file.
I guess that there should be a php command like load, but i didnt
found
it
yet.
Who can help me?
Regards, Arnold
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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


Re: [PHP] How to load another php page?

2004-10-02 Thread Jason Davidson
Arnold [EMAIL PROTECTED] wrote: 
 
 Hi,
 
 How can i load another php file (another.php) directly without an action
 (example: clicking on a button)?
 I'd like to do in my php script:
 
 if(isset($var1)) {  // load another.php }
 
 It is possible to include the file, but i just want to load the whole
 another.php file.
 I guess that there should be a php command like load, but i didnt found it
 yet.
 

What is wrong with include or include_once?



 Who can help me?
 
 Regards, Arnold
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



[PHP] Re: stand alone php

2004-10-02 Thread Gerben
search the history.
questions about compiling are already asked before, so search for it. I 
wouldn's know.

Mag [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi,
 Is there any app that converts php to a stand alone
 version?

 like a windows .exe program.


 Just curious.

 Thanks,
 Mag

 =
 --
 - The faulty interface lies between the chair and the keyboard.
 - Creativity is great, but plagiarism is faster!
 - Smile, everyone loves a moron. :-)



 ___
 Do you Yahoo!?
 Declare Yourself - Register online to vote today!
 http://vote.yahoo.com 

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



Re: [PHP] How to load another php page?

2004-10-02 Thread Alex Hogan
[snip]
How can i load another php file (another.php) directly without an action
(example: clicking on a button)?
[/snip]

If you're looking to check a condition and then add another php file
to your existing page then;

if(isset($var1)) { 
include ('another.php'); 
or
include_once('another.php');
}
is what you're looking for.

If you're looking to redirect to another file based on a condition then;

if(isset($var)){
header('Location: another.php');
}

will work.


alex hogan

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



RE: [PHP] array sort question

2004-10-02 Thread Ed Lazor
Thanks for the example using array_multisort.  I'd been wondering how I
could use that function to do what I want.  It looks like it's more flexible
in the long run, but I was able to use Paul's recommendation to do what I
want.  Here's the code I ended up using:

function cmp ($a, $b) { 
   return strcmp($a[Title], $b[Title]); 
} 

uasort($list, cmp);

-Ed



 -Original Message-
 Sorry for the empty reply (miss slide of the finger on my touch pad).
 You can use array_multisort(); The code would look something like
 this, remember, this is untested code so be warned before any flaming
 is done:
 
 //CODE
 //You need to restructure your array like this:
 $menu[ID][1] = 5;
 $menu[Title][1] = Test 1;
 $menu[ID][2] = 3;
 $menu[Title][2] = Test 4;
 //Then run array_multisort
 array_multisort($menu['Title'],$menu['ID']);
 
 //END CODE
 
 Like this it will sort alphabetically or numerically (which ever
 needed) ascending. You can put tags after the first variable like
 this:
 
 array_multisort($menu['Title'],SORT_ASC,SORT_STRING,$menu['ID']);
 
 If there are any more keys in the $menu array you need to list them
 after the $menu['ID'] key so they will be sorted according to the
 $menu['Title'] key. The first key you put into array_multisort() is
 the one that the rest get sorted by.

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



[PHP] Using PHP4 or PHP5

2004-10-02 Thread Michael Lauzon
As I mentioned earlier, I am putting a team together to create a
web-based RPG, different from the one I am currently playing.  Would
it be better to use PHP4 with it's strong developer base, or the new
PHP5 which is more object oriented an in my opinion would be easier to
keep the game up to date?

-- 
Michael Lauzon
P.S. This is the game I am playing, but I have ideas that I think can
be done better than what was done for this game -- but everyone always
says that!:

http://phantasyrpg.com/main.php?view=9898

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



Re: [PHP] How to load another php page?

2004-10-02 Thread Arnold
This (header() function) works only if this is the first output sent to
browser so later in the script this doesnt work anymore, i've tried that.
After that you get error messages like: Warning: Cannot modify header
information - headers already sent by (output started at
D:\Inetpub\wwwroot\xxx.php:5) in D:\Inetpub\wwwroot\xx.php on line
31
So what i want is to go to another php file everywhere in the php script
with something like: if(thisistrue) { load y.php; exit; }

Arnold

Lists [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hmmm, I'm not sure I am following you.  Maybe:

 header (Location: page.php);
 exit;

 So you could do something like: if this condition then go to new page,
 else go to other page?

 -dg

 On Oct 2, 2004, at 9:44 AM, Arnold wrote:

  I don't think include replaces the calling php script.
  What i mean is that i want exactly the same as what is done by an
  submit
  action but then you have to press a button, whereafter a new phpfile is
  loaded and the button-press is what i want to ignore.
 
  Arnold
  [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
  if(isset($var1)) { include 'another.php'; }
 
 
 
  Hi,
 
  How can i load another php file (another.php) directly without an
  action
  (example: clicking on a button)?
  I'd like to do in my php script:
 
  if(isset($var1)) {  // load another.php }
 
  It is possible to include the file, but i just want to load the whole
  another.php file.
  I guess that there should be a php command like load, but i didnt
  found
  it
  yet.
 
  Who can help me?
 
  Regards, Arnold
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 

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



Re: [PHP] Detecting Mysql server is running

2004-10-02 Thread mbox mbarsalou
Thanks to the responses I got.  One of them will surely work for me.

Mike B.

On Sat, 2004-10-02 at 01:35, Marek Kilimajer wrote:
 barsalou wrote:
  I know I can see if php has the ability to talk with the Mysql server,
  but is there a way to determine if the Mysql server is running.  In some
  cases, I wouldn't have passwords, so a mysql_connect wouldn't work.
 
 I'm sure, at any given time, there is a mysql server running somewhere 
 in the world.
 
 If you mean if it is running on your server, run
 
 ps ax |grep mysqld | grep -v grep

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



Re: [PHP] How to load another php page?

2004-10-02 Thread Marek Kilimajer
Arnold wrote:
This (header() function) works only if this is the first output sent to
browser so later in the script this doesnt work anymore, i've tried that.
After that you get error messages like: Warning: Cannot modify header
information - headers already sent by (output started at
D:\Inetpub\wwwroot\xxx.php:5) in D:\Inetpub\wwwroot\xx.php on line
31
So what i want is to go to another php file everywhere in the php script
with something like: if(thisistrue) { load y.php; exit; }
Once again, why cannot you use inlude()?
If include() does not work for you, you have to rethink the logic of 
your script.

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


Re: [PHP] How to load another php page?

2004-10-02 Thread Arnold
I created another php page with html and php code in it. What i want is
exact what is done in an form action when a new php file is loaded, but
without letting the customer pushing a button.
Include works for including php code with functions and the header()
function works if it is the first output sent in the script (otherwise you
get errors like: Warning: Cannot modify header information - headers already
sent by (output started at D:\Inetpub\wwwroot\xx.php:5) in
D:\Inetpub\wwwroot\xx.php on line 31
But what i want is to load another php/html script and stop the running
script. I guess it should be done with the header() function but then i have
to put the test rigth in the beginning of the script?

Arnold


Alex Hogan [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 [snip]
 How can i load another php file (another.php) directly without an action
 (example: clicking on a button)?
 [/snip]

 If you're looking to check a condition and then add another php file
 to your existing page then;

 if(isset($var1)) {
 include ('another.php');
 or
 include_once('another.php');
 }
 is what you're looking for.

 If you're looking to redirect to another file based on a condition then;

 if(isset($var)){
 header('Location: another.php');
 }

 will work.


 alex hogan

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



Re: [PHP] Naming conventions

2004-10-02 Thread Daniel Schierbeck
Jensen, Kimberlee [EMAIL PROTECTED] wrote:
What do you use for your naming conventions for
variables
functions
classes
I'm trying to tell my students what the standard is currently. Are people using
camel case or underscores or both?
I use this:
$a_variable
ClassName
a_function()
aMethod()
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How to load another php page?

2004-10-02 Thread Arnold
Ok, i can live with it, include works but this doesnt replace the whole
running script, only the rest of the script (what is still coming), so if a
few things have been written in a.php, when include('b.php') is executed,
this b.php does not replace all the (allready written) output of a.php.

Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Arnold wrote:
  This (header() function) works only if this is the first output sent to
  browser so later in the script this doesnt work anymore, i've tried
that.
  After that you get error messages like: Warning: Cannot modify header
  information - headers already sent by (output started at
  D:\Inetpub\wwwroot\xxx.php:5) in D:\Inetpub\wwwroot\xx.php on
line
  31
  So what i want is to go to another php file everywhere in the php script
  with something like: if(thisistrue) { load y.php; exit; }
 

 Once again, why cannot you use inlude()?

 If include() does not work for you, you have to rethink the logic of
 your script.

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



Re: [PHP] How to load another php page?

2004-10-02 Thread Marek Kilimajer
Arnold wrote:
Ok, i can live with it, include works but this doesnt replace the whole
running script, only the rest of the script (what is still coming), so if a
few things have been written in a.php, when include('b.php') is executed,
this b.php does not replace all the (allready written) output of a.php.
That's how the life goes. Once you say something, you can't take it 
back. So think first, then open your mouth :) (put your logic before the 
output).

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


[PHP] Re: PHP (anti) crash policy?

2004-10-02 Thread Olaf van der Spek
Manuel Lemos wrote:
AFAIK PHP runs safely in multi-threaded servers. What you can't expect 
is that PHP handles abnormal situations caused by flaws in the external 
libraries that PHP links with.
When I link with the same library in a C app, this 'abnormal situation' 
just results in a normal return from 'gzinflate' with an error value.
So why is it a flaw in code from zlib?

Maybe you should try this script on a multi-threaded webserver. Is this 
also caused by flaws in external libraries?

?php
function f()
{
f();
}
f();
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] How to load another php page?

2004-10-02 Thread Graham Cossey
For my own clarification, would it not be possible to use output buffering
and then either redirect to another script using header() or output the
buffer contents?

?php
  ob_start();

  [php code]

  if ($variable = 1)
header(Location: script1.php);

  if ($variable = 2)
header(Location: script2.php);

  ob_flush();
?

thanks

Graham

-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
Sent: 02 October 2004 21:07
To: Arnold
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] How to load another php page?


Arnold wrote:
 Ok, i can live with it, include works but this doesnt replace the whole
 running script, only the rest of the script (what is still coming), so if
a
 few things have been written in a.php, when include('b.php') is
executed,
 this b.php does not replace all the (allready written) output of
a.php.

That's how the life goes. Once you say something, you can't take it
back. So think first, then open your mouth :) (put your logic before the
output).

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

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



[PHP] PHP5 Type Hints

2004-10-02 Thread Gerard Samuel
Im unable to find documentation on this.
Does one exist?  If so can you point me to it.
Thanks...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How to load another php page?

2004-10-02 Thread Arnold
Hi Graham,

This works fine! Without the ob_start and ob_flush commands, all the
header() commands have to be put before the HTML html tag, otherwise an
error is displayed about header information that was already sent. Now i put
ob_start() on the first line before html and i can put the header()
command everywhere before ob_flush()! Suggestions from others about using
the include command doesnt work fine because the php name in the browser
isnt changed to the new php file and that results in some variables like
$_SERVER['PHP_SELF'] keeps pointing to the old php script.
This works fine, but i'm surprised that this was such a difficult question
(i'm not very experienced in PHP). I expected that there would be some kind
of command like load script.php to call a new script. Without your
solution you have to let some user constantly push a link or button and
define a new php script to that action.
Thanks for your help!

Regards, Arnold

Graham Cossey [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 For my own clarification, would it not be possible to use output buffering
 and then either redirect to another script using header() or output the
 buffer contents?

 ?php
   ob_start();

   [php code]

   if ($variable = 1)
 header(Location: script1.php);

   if ($variable = 2)
 header(Location: script2.php);

   ob_flush();
 ?

 thanks

 Graham

 -Original Message-
 From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
 Sent: 02 October 2004 21:07
 To: Arnold
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] How to load another php page?


 Arnold wrote:
  Ok, i can live with it, include works but this doesnt replace the whole
  running script, only the rest of the script (what is still coming), so
if
 a
  few things have been written in a.php, when include('b.php') is
 executed,
  this b.php does not replace all the (allready written) output of
 a.php.

 That's how the life goes. Once you say something, you can't take it
 back. So think first, then open your mouth :) (put your logic before the
 output).

 --
 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] Including function libraries

2004-10-02 Thread Jasper Howard
it seems possible that this is the problem, you called it,
checkLoggedIn() in your script then tried to call,
checkloggedin(). Notice the caps aren't there when you tried to call
it.


On Sat, 2 Oct 2004 17:20:07 +0100, Graham Cossey [EMAIL PROTECTED] wrote:
 Do you have ?php and ? in functions.lib ?
 
 
 
 -Original Message-
 From: Andrew W [mailto:[EMAIL PROTECTED]
 Sent: 02 October 2004 16:52
 To: php-gen
 Subject: [PHP] Including function libraries
 
 Ok, I've got a file called functions.lib which contains the following:
 
 function checkLoggedIn()
 {
return (true);
 }
 
 function Test ($x)
 {
return ($x * $x);
 }
 
 and a file called test.php which contains the following:
 
 ?php
 
 include 'functions.lib';
 
 if (checkLoggedIn())
 {
print Logged in;
 }
 else
 {
print Not logged in;
 }
 
 ?
 
 They're both stored in a directory called 'test' which Ive uploaded to
 my webserver.  When I call test.php from my browser I get the following
 output:
 
  function checkLoggedIn() {  return (true); }  function Test ($x) {
 return ($x * $x); }
 Fatal error: Call to undefined function: checkloggedin() in
 /home/sites/site116/web/test/test.php on line 5
 
 Why can't I call the function defined in the lib file?
 
 Thanks
 AW
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 



-- 

Jasper Howard - Database Administration
ApexEleven.com
530 559 0107
---

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



[PHP] Re: Using PHP4 or PHP5

2004-10-02 Thread Amit Arora
If you are going to develop the application on a Object Oriented 
Programming, then I would advice you go with PHP 5.

If it is going to a healthy mix of procedural coding and OOP, then I 
recommend using PHP 4 right now but gradually upgrade to PHP 5.

Whatever you choose, keep in mind that PHP 5 is not being used widely on 
commerical servers as production ready. And it may be couple of months 
before that happens. So keep this at the back of your mind as it would 
help in you development cycle.

Amit
www.digitalamit.com
Michael Lauzon wrote:
As I mentioned earlier, I am putting a team together to create a
web-based RPG, different from the one I am currently playing.  Would
it be better to use PHP4 with it's strong developer base, or the new
PHP5 which is more object oriented an in my opinion would be easier to
keep the game up to date?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] RE: [PHP-DB] Re: Office document upload to website (and inserting in MySQL if possible)

2004-10-02 Thread Bastien Koert
here is some code i wrote for a guy.
?php
session_start();
// redefine the user error constants - PHP 4 only
define(FATAL, E_USER_ERROR);
define(ERROR, E_USER_WARNING);
define(WARNING, E_USER_NOTICE);
// set the error reporting level for this script
error_reporting(FATAL);
//Declarations
$myfile   = ;
$article  = ;
$username = ;
$FileFlag = 0;
$DBFlag   = 0;
$ConStartFlag = 0;
$LoggedInFlag = 0;
//
//logon the user on
if (($_SESSION['username']==)(!$_POST['submit']==Log In)){
 logon();   
  //show the logon form
 die();
}

//logon form submitted so check button and logon state
if (($LoggedInFlag==0)($ConStartFlag==0)($_POST['submit']==Log In)){
 confirm_logon();
}
//
//main form code
//handle the data inputs
if (!$_POST['submit']==Submit Entry){
 show_form();
 die();
}else{
 $article = $_POST['article'];
}//end if
 //check for the presence of a file
 $tempfile = $_FILES['userfile']['tmp_name'];   
  //get the temporary file name from the upload dir
 if (is_uploaded_file($tempfile)){
   upload();
 }else{
   $FileFlag = 0;
 }//end if

 //check there is a value for article
 if ($article!=''){
   echo Processing entry.br;
   load_db($article);
 }
 //article submission confirmed and records / files updated uploaded
 if ($DBFlag == 1){
   confirmation();
 }
function show_form()
{
?
 form enctype=multipart/form-data action=? echo 
$_SERVER['PHP_SELF'];? method=post
  tabletrtd valign=top
  Composition:/tdtdtextarea name=article rows=25 
cols=100/textarea/td
  input type=hidden name=MAX_FILE_SIZE value=3 /
  /trtrtd align=center colspan=2Send this file: input 
name=userfile type=file //td
  /trtrtd align=center colspan=2input type=submit 
name=submit id=submit value=Submit Entry / /td/tr/table
 /form

?
}
function upload()
{
 // In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used 
instead
 // of $_FILES.

 global $article, $FileFlag,$myfile;
 $uploaddir  = '../bastien/uploads/';   
 //change to match your dir
 $uploadfile = $uploaddir . $_FILES['userfile']['name'];
 $myfile = $_FILES['userfile']['name'];
 //echo Filename is:.$myfile.br;

 print pre;
 //check the file extension (only doc allowed) and check the mime type of 
the file
 if ($_FILES['userfile']['type']!='application/msword'){
   echo filetype=.strtolower(substr($_FILES['userfile']['name'],-3));

   if (strtolower(substr($_FILES['userfile']['name'],-3))==doc){
 //check the file size
 if ($_FILES['userfile']['size']3){
   if (copy($_FILES['userfile']['tmp_name'], $uploadfile)){ 
  //windows
   //if (move_uploaded_file($_FILES['userfile']['tmp_name'], 
$uploadfile)) {  //unix
  $FileFlag = 1;

   } //end if copy file
 }//end if file size
   }//end if file type
 }else{
   show_form($article);
   die(File is of the wrong format and has been rejected. Please try 
again.);
 }
 print /pre;
}//end function

function load_db($article)
{
 global $DBFlag, $myfile, $FileFlag;
//get the data to load into the db
$sql = ;
$time_out = ;
$time_out = date(Y-m-D H:i:s);
//get the connection info
require(dbconng.php);
 //create and run the query to load the data into the db
 $sql = update contest set article = '$article', time_out = now() ;
 if ($FileFlag == 1){
$sql.=, file_name = '$myfile' ;
 }
 $sql.= where user_id=.$_SESSION['user_id'];
 echo $sql;
 $result = mysql_query($sql,$conn)or die (Can't insert data because 
.mysql_error());

 if (!$result){
   echo There was an error with the database. Hit the back button and try 
again.;
 }else{
   $DBFlag = 1;
 }//end if

}//end function
function confirmation()
{
 global $FileFlag, $DBFlag;
 //show the confirmation screen
 if (($FileFlag == 1)  ($DBFlag ==1)){
   $msg = File and contest entry have been successfully uploaded.br 
/Good luck in the contest;
 }else{
   $msg = Contest entry have been successfully uploaded.br /Good luck in 
the contest;
 }

 echo $msg;
 session_destroy();
} //end function
function logon()
{
 //show the logon form
 echo div style=\position:absolute; top:250; left:300; width:300; 
height:250;\
 centerh2Rich's Writing Club Contest/h2/center
 form name=\logon\ action=\.$_SERVER['PHP_SELF'].\ 
method=\post\
   table
  trtd width=\100\User Name:/tdtdinput type=\text\ 
name=\username\ size=\20\/td/tr
  trtdPassword :/tdtdinput type=\password\ 
name=\pass\ size=\20\/td/tr
  trtd colspan=\2\ align=\center\input type=\submit\ 
name=\submit\ value=\Log In\/td/tr
   /table
 /form
   /div;

}//end function
function confirm_logon()
{
 global $ConStartFlag;
 //get the 

Re: [PHP] PHP5 Type Hints

2004-10-02 Thread Curt Zirzow
* Thus wrote Gerard Samuel:
 Im unable to find documentation on this.
 Does one exist?  If so can you point me to it.

I dont think anything officially exist in the manual, yet. The type
hint can only be an Object, and will cause a fatal error if not the
paticular object isn't passed.

class Foo { };

function bar(Foo $foo) { }
  

$a = new Foo();
foo($a); 


foo('a string'); // Fatal Error


The most useful use with type hinting can/is used is with
exceptions. The catch() requires a type hint of what class of
exception to catch:

try {
  some_code();
}
catch (CustomException $e) {
}
catch (Exception $e) { // if CustomException isn't thrown
}

Curt
-- 
The above comments may offend you. flame at will.

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



[PHP] A problem of installation

2004-10-02 Thread Teng Wang
I met with a problem when installing php5.0.0 on my Federo Core 2.0 system. 

I use the default settings:
./configure
make
make install

Everything is ok, but when I test my phpinfo(),it always shows the
4.3.8 version. Yet, when I type the following command
php -v
to show the version of php, it's 5.0.0

What's the problem? Any kindly help would be appreciated.

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



[PHP] A problem of installation

2004-10-02 Thread Teng Wang
I met with a problem when installing php5.0.0 on my Federo Core 2.0 system.

I use the default settings:
./configure
make
make install

Everything is ok, but when I test my phpinfo(),it always shows the
4.3.8 version. Yet, when I type the following command
php -v
to show the version of php, it's 5.0.0

What's the problem? Any kindly help would be appreciated.

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



Re: [PHP] A problem of installation

2004-10-02 Thread Robert Cummings
On Sun, 2004-10-03 at 00:05, Teng Wang wrote:
 I met with a problem when installing php5.0.0 on my Federo Core 2.0 system.
 
 I use the default settings:
 ./configure
 make
 make install
 
 Everything is ok, but when I test my phpinfo(),it always shows the
 4.3.8 version. Yet, when I type the following command
 php -v
 to show the version of php, it's 5.0.0
 
 What's the problem? Any kindly help would be appreciated.

Where are you loading phpinfo()? If it is in browser then there's a good
chance you've only built the cgi/cli version and not the module. The
module version needs the --with-apxs flage enabled.

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

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



Re: [PHP] PHP5 Type Hints

2004-10-02 Thread Gerard Samuel
Curt Zirzow wrote:
* Thus wrote Gerard Samuel:
Im unable to find documentation on this.
Does one exist?  If so can you point me to it.

I dont think anything officially exist in the manual, yet. The type
hint can only be an Object, and will cause a fatal error if not the
paticular object isn't passed.
Thanks.  I could have sworn, I saw something somewhere,
that led me to believe that arguments can be casted.
I.E.
function foo(int $foo)
{
// $foo will be casted as an integer
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] please ignore

2004-10-02 Thread Jerry M. Howell II
just testing maildrop please ignore :)


Re: [PHP] PHP5 Type Hints

2004-10-02 Thread Aidan Lister
Hi Gerald,

If you did see something like that, it was a mistake in our manual :)

I've documented typehinting now, though it will take a while to show up in 
the manual.
http://php.net/language.oop5.typehinting

Kind Regards,
Aidan


Gerard Samuel [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Curt Zirzow wrote:
 * Thus wrote Gerard Samuel:

Im unable to find documentation on this.
Does one exist?  If so can you point me to it.


 I dont think anything officially exist in the manual, yet. The type
 hint can only be an Object, and will cause a fatal error if not the
 paticular object isn't passed.


 Thanks.  I could have sworn, I saw something somewhere,
 that led me to believe that arguments can be casted.
 I.E.
 function foo(int $foo)
 {
 // $foo will be casted as an integer
 } 

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



Re: [PHP] PHP5 Type Hints

2004-10-02 Thread Gerard Samuel
Aidan Lister wrote:
Hi Gerald,
If you did see something like that, it was a mistake in our manual :)
I've documented typehinting now, though it will take a while to show up in 
the manual.
http://php.net/language.oop5.typehinting

It may have been Example 18-23 at 
http://us2.php.net/manual/en/language.oop5.exceptions.php
Thanks for updating the manual...

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


[PHP] Regular Expression - highlighting

2004-10-02 Thread Aidan Lister
Hello list,

I'm pretty terrible with regular expressions, I was wondering if someone 
would be able to help me with this
http://paste.phpfi.com/31964

The problem is detailed in the above link. Basically I need to match the 
contents of any HTML tag, except a link. I'm pretty sure a lookbehind set is 
needed in the center (%s) bit.

Any suggestions would be appreciated, but it's not quite as simple as it 
sounds - if possible please make sure you run the above script and see if it 
PASSED.

Here's a little gui to make it easier to test:
http://aidan.dotgeek.org/test_hl.php

Thanks in advance,
Aidan 

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