RE: [PHP] Send variable in include()

2004-10-21 Thread Zareef Ahmed


-Original Message-
From: Pete [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 20, 2004 10:36 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Send variable in include()

I'm trying to send a variable an include that is recieve from another
page:

- navi.php-
a href =\'http://www.example.com/view.php?offset=0\;Test/a

- view.php -
I recieve $offset with avalue of 0 nicely, echo ($offset); will
show a 
value.
Now a do this:
include
'http://www.example.com/guestbook.php?option=viewoffset=$offset';
 change your single quotes to double quotes.


- guestbook.php -
$offset gets value $offset instead of 0
$option has correct value, view

How do I write my include so it works?
Would appriciate som help.

Regards,

Pete

-
Zareef Ahmed :: A PHP Developer in Delhi (India)
Homepage :: http://www.zasaifi.com


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.778 / Virus Database: 525 - Release Date: 10/15/2004
 

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



RE: [PHP] Validation problem with array.

2004-10-21 Thread Stuart Felenstein
See below:
--- Graham Cossey [EMAIL PROTECTED] wrote:

 Also, this line :
 foreach($_SESSION['skills'] as $key = $skill)
 could read
 foreach($skills as $key = $skill)
 as you have the line:
 $skills = $_SESSION['skills'];
 Same for skys and slus.
 Graham

Graham, 
I've read this over and over and I must be dense
because Im not totally comprehending it.

Let me show you how I set it all up. Remember it's  a
multi page form:
So the form elements are: skills[], skys[], slus[]
Then on the next page I have to still pass the session
variables, and so:

$_SESSION['skills'] = $_POST['skill']; 
$_SESSION['skys'] = $_POST['sky']; 
$_SESSION['slus'] = $_POST['slu']; 

Now the transcation script:

$skills = $_SESSION['skills'];
$skys = $_SESSION['skys'];
$slus = $_SESSION['slus'];

foreach($_SESSION['skills'] as $key = $skill)
{
$query = INSERT INTO LurkProfiles_Skicerts
(SkicertID, ProfileID, SkilCerts, NumYear, Lused) 
VALUES (null, $LID, '$skill',
{$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]});
//$result = mysql_query($query);
$res6 = run_query($query);
echo $query;
}

I understand that in the insert statement I need not
repeat $_SESSION.
The rest though is fuzzy. 
It was working, now I'm getting some really odd
behaviour, in that, unless i fill in every field in
the form, I get a mysql syntax error.

Stuart

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



Re: [PHP] Validation problem with array.

2004-10-21 Thread Andre Dubuc
Hi Stuart,

I haven't followed your thread too closely, but I did see something that might 
be the cause of your problems:

[snip]

 Let me show you how I set it all up. Remember it's  a
 multi page form:
 So the form elements are: skills[], skys[], slus[]
 Then on the next page I have to still pass the session
 variables, and so:

 $_SESSION['skills'] = $_POST['skill'];
 $_SESSION['skys'] = $_POST['sky'];
 $_SESSION['slus'] = $_POST['slu'];

 Now the transcation script:

 $skills = $_SESSION['skills'];
 $skys = $_SESSION['skys'];
 $slus = $_SESSION['slus'];

 foreach($_SESSION['skills'] as $key = $skill)
^^  ^^  

[snip]

It's my understanding that where I've put  ^^  should be enclosed by braces, 
otherwise you'll get some starnge behaviour. 

I'm puzzled why you reverted to $_SESSION['skills'] when the line above you've 
set $skills = $_SESSION['skills']??

HTH,
Andre

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



[PHP] php sessions question

2004-10-21 Thread Reinhart Viane
in a page checkuser i do this after the user is logged in:
  PHP Code
  // Register some session variables!
  session_register('userid');
  $_SESSION['userid'] = $userid;
  session_register('first_name');
  $_SESSION['first_name'] = $first_name;
  session_register('last_name');
  $_SESSION['last_name'] = $last_name;
  session_register('email_address');
  $_SESSION['email_address'] = $email_address;
  session_register('user_level');
  $_SESSION['user_level'] = $user_level;



Now let's say user 1 logs in, his session is registered (with userid from 
database is 5 and first_name is XXX)
Then another user logs in, again his session is registered (with userid from 
database is 1 and first_name is YYY)

Now user 1 leaves the pages (closes the browser) and user 2 uploads a 
document (with my own script).

When the document is succesfully uploaded i display this:
  PHP Code
  echo ($_SESSION['first_name'])., the document has been succesfully 
added;
  echo ($_SESSION['userid']);



This results in the folowing output:
YYY, the document has been succesfully added
5

Meaning the $_SESSION['first_name'] is correct, but the $_SESSION['userid'] 
is the one of the user who logged out...

Now when using user_id in all places it seems to work correctly...

Is userid something that is defined by the server when making sessions?

If not, i don't have any clue what is going wrong...
Can someone help me on this? So i know what is wrong?

Thx in advance

Pout

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



[PHP] Sessions question

2004-10-21 Thread Reinhart Viane
Hey all, i'm new to this list so forgive me if  i make any huge
mistakes.
I'm in a beginning stage of learning php and i hope you guys can help me
out with this question:

in a file named checkuser i do this when a users logs in:
PHP Code
// Register some session variables!
session_register('userid');
$_SESSION['userid'] = $userid;
session_register('first_name');
$_SESSION['first_name'] = $first_name;
session_register('last_name');
$_SESSION['last_name'] = $last_name;
session_register('email_address');
$_SESSION['email_address'] = $email_address;
session_register('user_level');
$_SESSION['user_level'] = $user_level;



Now let's say user 1 logs in, his session is registered (with userid
from database is 5 and first_name is XXX)
Then another user logs in, again his session is registered (with userid
from database is 1 and first_name is YYY)

Now user 1 leaves the pages (closes the browser) and user 2 uploads a
document (with my own script).

When the document is succesfully uploaded i display this:
PHP Code
echo ($_SESSION['first_name'])., the document has been succesfully
added;
echo ($_SESSION['userid']);



This results in the folowing output:
YYY, the document has been succesfully added
5

Meaning the $_SESSION['first_name'] is correct, but the
$_SESSION['userid'] is the one of the user who logged out...

Now when using user_id in all places it seems to work correctly...

Is userid something that is defined by the server when making sessions?

If not, i don't have any clue what is going wrong...
Can someone help me on this? So i know what is wrong?

Thx in advance

Reinhart Viane

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



Re: [PHP] Validation problem with array.

2004-10-21 Thread Stuart Felenstein
You mean why do i have $_SESSION['skills'] in the
foreach ?

Stuart
--- Andre Dubuc [EMAIL PROTECTED] wrote:

 Hi Stuart,
 
 I haven't followed your thread too closely, but I
 did see something that might 
 be the cause of your problems:
 
 [snip]
 
  Let me show you how I set it all up. Remember it's
  a
  multi page form:
  So the form elements are: skills[], skys[], slus[]
  Then on the next page I have to still pass the
 session
  variables, and so:
 
  $_SESSION['skills'] = $_POST['skill'];
  $_SESSION['skys'] = $_POST['sky'];
  $_SESSION['slus'] = $_POST['slu'];
 
  Now the transcation script:
 
  $skills = $_SESSION['skills'];
  $skys = $_SESSION['skys'];
  $slus = $_SESSION['slus'];
 
  foreach($_SESSION['skills'] as $key = $skill)
   ^^  ^^  
 

 I'm puzzled why you reverted to $_SESSION['skills']
 when the line above you've 
 set $skills = $_SESSION['skills']??
 
 HTH,
 Andre
 

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



RE: [PHP] Validation problem with array.

2004-10-21 Thread Graham Cossey
See inline:

[snip]
 
 Now the transcation script:
 
 $skills = $_SESSION['skills'];
 $skys = $_SESSION['skys'];
 $slus = $_SESSION['slus'];
 
 foreach($_SESSION['skills'] as $key = $skill)
  ^^^
 ($skills as $key = $skill)
 {
if ($skill != '') // Has this skill been entered?
{
  // You may also want to check for sky  slu entries

 $query = INSERT INTO LurkProfiles_Skicerts
 (SkicertID, ProfileID, SkilCerts, NumYear, Lused) 
 VALUES (null, $LID, '$skill',
 {$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]});
   ^^^   ^^^
   $skys[$key]   $slus[$key]

 //$result = mysql_query($query);
 $res6 = run_query($query);
 echo $query;
  ^^^
  What does this output?

}// end if ($skill != '')

 }
 
 I understand that in the insert statement I need not
 repeat $_SESSION.
 The rest though is fuzzy. 
 It was working, now I'm getting some really odd
 behaviour, in that, unless i fill in every field in
 the form, I get a mysql syntax error.


HTH 
Graham

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



RE: [PHP] Validation problem with array.

2004-10-21 Thread Stuart Felenstein
Graham, I'm going to make those changes.  Not sure if
that was creating some crazy behaviour. See inline:

--- Graham Cossey [EMAIL PROTECTED] wrote:


  {
 if ($skill != '') // Has this skill been
 entered?

I don't know if I care if it's been entered.  My main
concern would be to make sure that if a $skill was
entered, then a matching $skys and $slus
should be:
skills[0]-baker skys[0]-7 slus[0]-2002

but wouldn't want
skill[0]-baker skys[1]-7 slus[2]-2002

In other words I need to figure out how to check that
each line is complete.  But~ right now, it is
matching all the values/inputs correctly.  If someone
just chose a slus, seems the database won't take it.

 {
   // You may also want to check for sky  slu
 entries

Not sure why I would want too:

  //$result = mysql_query($query);
  $res6 = run_query($query);
  echo $query;
   ^^^
   What does this output?

It outputs the insert and values string.  
And it seems to print the iteration:

INSERT INTO LurkProfiles_Skicerts (SkicertID,
ProfileID, SkilCerts, NumYear, Lused) VALUES (null,
39, 'a', 2,1)INSERT INTO LurkProfiles_Skicerts
(SkicertID, ProfileID, SkilCerts, NumYear, Lused)
VALUES (null, 39, 'b', 3,2)INSERT INTO
LurkProfiles_Skicerts (SkicertID, ProfileID,
SkilCerts, NumYear, Lused) VALUES (null, 39, 'c',
4,3)INSERT INTO LurkProfiles_Skicerts (SkicertID,
ProfileID, SkilCerts, NumYear, Lused) VALUES (null,
39, 'd', 5,4)INSERT INTO LurkProfiles_Skicerts
(SkicertID, ProfileID, SkilCerts, NumYear, Lused)
VALUES (null, 39, 'e', 6,5)your insertions were
successful

 }// end if ($skill != '')

This probably makes sense to add , perhaps that is why
if I don't use all the elements for input I get a
syntax error.

Stuart

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



Re: [PHP] Sessions question

2004-10-21 Thread Mike Smith
On Thu, 21 Oct 2004 11:39:23 +0200, Reinhart Viane [EMAIL PROTECTED] wrote:
 Hey all, i'm new to this list so forgive me if  i make any huge
 mistakes.
 I'm in a beginning stage of learning php and i hope you guys can help me
 out with this question:
 
 in a file named checkuser i do this when a users logs in:
 PHP Code
 // Register some session variables!
 session_register('userid');
 $_SESSION['userid'] = $userid;
 session_register('first_name');
 $_SESSION['first_name'] = $first_name;
 session_register('last_name');
 $_SESSION['last_name'] = $last_name;
 session_register('email_address');
 $_SESSION['email_address'] = $email_address;
 session_register('user_level');
 $_SESSION['user_level'] = $user_level;
 
 Now let's say user 1 logs in, his session is registered (with userid
 from database is 5 and first_name is XXX)
 Then another user logs in, again his session is registered (with userid
 from database is 1 and first_name is YYY)
 
 Now user 1 leaves the pages (closes the browser) and user 2 uploads a
 document (with my own script).
 
 When the document is succesfully uploaded i display this:
 PHP Code
 echo ($_SESSION['first_name'])., the document has been succesfully
 added;
 echo ($_SESSION['userid']);
 
 This results in the folowing output:
 YYY, the document has been succesfully added
 5
 
 Meaning the $_SESSION['first_name'] is correct, but the
 $_SESSION['userid'] is the one of the user who logged out...
 
 Now when using user_id in all places it seems to work correctly...
 
 Is userid something that is defined by the server when making sessions?
 
 If not, i don't have any clue what is going wrong...
 Can someone help me on this? So i know what is wrong?
 
 Thx in advance
 
 Reinhart Viane
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

Where does the value $userid come from is it the result of a query
i.e.
SELECT userid FROM users WHERE username='$_POST['username']' AND
passwd='$_POST['password']'

 or do you have a form (text/hidden) with that value?

You mention userid and user_id maybe a typo, but those would be different.
You can see all session variables (for testing) by adding:

echo pre\n;
print_r($_SESSION);
echo /pre\n;

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



RE: [PHP] Validation problem with array.

2004-10-21 Thread Graham Cossey
See inline:

[snip]
 
   {
  if ($skill != '') // Has this skill been
  entered?

 I don't know if I care if it's been entered.  My main
 concern would be to make sure that if a $skill was
 entered, then a matching $skys and $slus
 should be:
 skills[0]-baker skys[0]-7 slus[0]-2002

 but wouldn't want
 skill[0]-baker skys[1]-7 slus[2]-2002


So, you want to avoid all of the following:
  skill[0] 'baker'  skys[0] '7'  slus[0] ''
  skill[1] 'baker'  skys[1] ''   slus[1] '2002'
  skill[2] ''   skys[2] '7'  slus[2] '2002'
  skill[3] ''   skys[3] ''   slus[3] ''

You'll need to amend the if within the foreach loop to check for these.

if ($skill != ''  $skys[$key] != ''  $slus[$key] != '')

 In other words I need to figure out how to check that
 each line is complete.  But~ right now, it is
 matching all the values/inputs correctly.  If someone
 just chose a slus, seems the database won't take it.

But is this due to the sql statement being rejected as opposed to being
caught by your validation?


  {
// You may also want to check for sky  slu
  entries

 Not sure why I would want too:

You would want to because of the paragraph above about My main concern...


   //$result = mysql_query($query);
   $res6 = run_query($query);
   echo $query;
^^^
What does this output?

 It outputs the insert and values string.
 And it seems to print the iteration:

 INSERT INTO LurkProfiles_Skicerts (SkicertID,
 ProfileID, SkilCerts, NumYear, Lused) VALUES (null,
 39, 'a', 2,1)INSERT INTO LurkProfiles_Skicerts
 (SkicertID, ProfileID, SkilCerts, NumYear, Lused)
 VALUES (null, 39, 'b', 3,2)INSERT INTO
 LurkProfiles_Skicerts (SkicertID, ProfileID,
 SkilCerts, NumYear, Lused) VALUES (null, 39, 'c',
 4,3)INSERT INTO LurkProfiles_Skicerts (SkicertID,
 ProfileID, SkilCerts, NumYear, Lused) VALUES (null,
 39, 'd', 5,4)INSERT INTO LurkProfiles_Skicerts
 (SkicertID, ProfileID, SkilCerts, NumYear, Lused)
 VALUES (null, 39, 'e', 6,5)your insertions were
 successful

This is OK, it's just a formatting thing, try changing your echo to:

echo Query $key = $query br;

This should give you:

Query 0 = INSERT INTO LurkProfiles_Skicerts (SkicertID,ProfileID, SkilCerts,
NumYear, Lused) VALUES (null,39, 'a', 2,1)
Query 1 = INSERT INTO LurkProfiles_Skicerts (SkicertID, ProfileID,
SkilCerts, NumYear, Lused) VALUES (null,9, 'b', 3,2)
Query 2 = INSERT INTO LurkProfiles_Skicerts (SkicertID, ProfileID,
SkilCerts, NumYear, Lused) VALUES (null, 9, 'c', 4,3)
Query 3 = INSERT INTO LurkProfiles_Skicerts (SkicertID, ProfileID,
SkilCerts, NumYear, Lused) VALUES (null,39, 'd', 5,4)
Query 4 = INSERT INTO LurkProfiles_Skicerts (SkicertID, ProfileID,
SkilCerts, NumYear, Lused) VALUES (null, 9, 'e', 6,5)


  }// end if ($skill != '')

 This probably makes sense to add , perhaps that is why
 if I don't use all the elements for input I get a
 syntax error.

Possibly...

Graham

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



RE: [PHP] Validation problem with array.

2004-10-21 Thread Stuart Felenstein
See inline:
--- Graham Cossey [EMAIL PROTECTED] wrote:

  In other words I need to figure out how to check
  that each line is complete. right now, it is
  matching all the values/inputs correctly.  If
  someone just chose a slus, seems the database

 But is this due to the sql statement being rejected
 as opposed to being
 caught by your validation?

What validation :) .  I haven't added that in yet,due
to figuring out why the insertions weren't taking.

   {
   // You may also want to check for sky 
   slu entries
   You would want to because of the paragraph above
   about My main concern...

Right now I have this [right below]: If I want to
check for skys and slus, I add another set of braces
with if($sky != '' ...
and below end if ($sky != '')


 foreach($skills as $key = $skill)
{
if ($skill != ''  $skys[$key] != '' 
$slus[$key] != '')
{
  
$query = INSERT INTO LurkProfiles_Skicerts
(SkicertID, ProfileID, SkilCerts, NumYear, Lused) 
VALUES (null, $LID, '$skill',
$skys[$key],$slus[$key]);
$res6 = run_query($query);
echo Query $key = $query br;
} end if ($skill != '')

}
Stuart

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



RE: [PHP] Sessions question

2004-10-21 Thread Reinhart Viane
Hey Mike,

After some intensive testing it seemed that $user_id did not solve the
isue

I hereby give the script to get the $user_id:

// check if the user info validates the db
($username and $password are the POST values of username and password
given in on a form)
$sql = mysql_query(SELECT * FROM users WHERE username='$username' AND
password='$password' AND activated='1');
$login_check = mysql_num_rows($sql);

if($login_check  0){
while($row = mysql_fetch_array($sql)){
foreach( $row AS $key = $val ){
$$key = stripslashes( $val );
}
// Register some session variables!
session_register('user_id');
$_SESSION['user_id'] = $user_id;
session_register('first_name');
$_SESSION['first_name'] = $first_name;
session_register('last_name');
$_SESSION['last_name'] = $last_name;
session_register('email_address');
$_SESSION['email_address'] = $email_address;
session_register('user_level');
$_SESSION['user_level'] = $user_level;

mysql_query(UPDATE users SET last_login=now() WHERE
user_id='$user_id'); 

header(Location: main.php);  

}

Now this is my conclusion till now:

All other session items are correctly displayed, except the
$_SESSION['user_id']
I'm trying to find the way when this happens since it does not seem to
happen in a strict order
The method mentioned b4:
'Now let's say user 1 logs in, his session is registered (with userid 
 from database is 5 and first_name is XXX) Then another user logs in, 
 again his session is registered (with userid from database is 1 and 
 first_name is YYY)'

is not always faulty.
I've checked everything I know and the last thing I've done is putted:

session_start();

On the first line instead of after this:
?
require('xx.inc.php');
connect_db();

Untill now all seems to be ok, but I'm not certain at all it is ok.
There can be hundreds of methods how several users log in, upload, log
out etc. so I can not test them all... :(

It seems that sometimes the $_SESSION['user_id'] of the several users
get mixed and this may not happen.

I don't know if this is a known bug or if there are cases which can
cause this...
If im not certain if this can be solved I will have to use another
method to keep the logged in users info (but what one? Don't want to use
cookies)

Thx in advance for any help.

Greetings,

Reinhart 

-Original Message-
From: Mike Smith [mailto:[EMAIL PROTECTED] 
Sent: donderdag 21 oktober 2004 13:28
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Sessions question


On Thu, 21 Oct 2004 11:39:23 +0200, Reinhart Viane [EMAIL PROTECTED] wrote:
 Hey all, i'm new to this list so forgive me if  i make any huge 
 mistakes. I'm in a beginning stage of learning php and i hope you guys

 can help me out with this question:
 
 in a file named checkuser i do this when a users logs in:
 PHP Code
 // Register some session variables!
 session_register('userid');
 $_SESSION['userid'] = $userid;
 session_register('first_name');
 $_SESSION['first_name'] = $first_name;
 session_register('last_name');
 $_SESSION['last_name'] = $last_name;
 session_register('email_address');
 $_SESSION['email_address'] = $email_address;
 session_register('user_level');
 $_SESSION['user_level'] = $user_level;
 
 Now let's say user 1 logs in, his session is registered (with userid 
 from database is 5 and first_name is XXX) Then another user logs in, 
 again his session is registered (with userid from database is 1 and 
 first_name is YYY)
 
 Now user 1 leaves the pages (closes the browser) and user 2 uploads a 
 document (with my own script).
 
 When the document is succesfully uploaded i display this:
 PHP Code
 echo ($_SESSION['first_name'])., the document has been succesfully 
 added; echo ($_SESSION['userid']);
 
 This results in the folowing output:
 YYY, the document has been succesfully added
 5
 
 Meaning the $_SESSION['first_name'] is correct, but the 
 $_SESSION['userid'] is the one of the user who logged out...
 
 Now when using user_id in all places it seems to work correctly...
 
 Is userid something that is defined by the server when making 
 sessions?
 
 If not, i don't have any clue what is going wrong...
 Can someone help me on this? So i know what is wrong?
 
 Thx in advance
 
 Reinhart Viane
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

Where does the value $userid come from is it the result of a query i.e.
SELECT userid FROM users WHERE username='$_POST['username']' AND
passwd='$_POST['password']'

 or do you have a form (text/hidden) with that value?

You mention userid and user_id maybe a typo, but those would be
different. You can see 

RE: [PHP] Validation problem with array.

2004-10-21 Thread Graham Cossey

[snip]
 Right now I have this [right below]: If I want to
 check for skys and slus, I add another set of braces
 with if($sky != '' ...
 and below end if ($sky != '')
 
 
  foreach($skills as $key = $skill)
 {
 if ($skill != ''  $skys[$key] != '' 
 $slus[$key] != '')
 {
   
 $query = INSERT INTO LurkProfiles_Skicerts
 (SkicertID, ProfileID, SkilCerts, NumYear, Lused) 
 VALUES (null, $LID, '$skill',
 $skys[$key],$slus[$key]);
 $res6 = run_query($query);
 echo Query $key = $query br;
   } end if ($skill != '')
 
 }

That looks pretty much like what you want except for:

} //end if ($skill != '')
^^
Comment, this is just to help identify what the brace is closing.

Graham

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



[PHP] URL variables, and the $_GET[xxx] function...

2004-10-21 Thread Tristan . Pretty
I'm moving hosts for a freelance site I do...

They have an events section, and it's sortable by date, name and category 
etc...
To achieve this, I passed the search/sort variables via the URL...
However, I'm testing the new server, and those variables are not being 
detected?

I've put this code at teh top of the code on events page '$sort_by = 
$_GET[sort_by];' etc...
And while that sorts out the problem, I'm curious as to why I need to do 
that, and if those changes will cause me probs elsewhere?

Perhaps a rookie Q, but I guess we all learn something every day eh?

Any thoughts?
Tris...

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

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



[PHP] Strange Array Error

2004-10-21 Thread Shaun
Hi,

I have been trying for the past two hours to understand why I get an error 
with the following code:

?php
 $test_array[] = array();
 $i = 0;
 while($i  7){
  $test_array[$i] += $i;
  echo '$day_total[$i] = '.$day_total[$i].'br';
 }
?

Fatal error: Unsupported operand types in 
/usr/home/expensesystem/public_html/test.php on line 5

I am trying to create a loop where $i is added to array element $i, and 
can't find any information relating to this on google or php.net...

Thanks for your advice. 

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



Re: [PHP] Strange Array Error

2004-10-21 Thread Greg Donald
On Thu, 21 Oct 2004 14:28:26 +0100, Shaun [EMAIL PROTECTED] wrote:
 I have been trying for the past two hours to understand why I get an error
 with the following code:
 
 ?php
  $test_array[] = array();

$test_array = array();

  $i = 0;
  while($i  7){
   $test_array[$i] += $i;

$test_array[$i] = $i++;  // maybe what you want ?

   echo '$day_total[$i] = '.$day_total[$i].'br';
  }
 ?
 
 Fatal error: Unsupported operand types in
 /usr/home/expensesystem/public_html/test.php on line 5
 
 I am trying to create a loop where $i is added to array element $i, and
 can't find any information relating to this on google or php.net...


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Mac OS X and Editor

2004-10-21 Thread Philip Thompson
On Oct 20, 2004, at 3:57 PM, Michael Sims wrote:
Jonel Rienton wrote:
Hi guys, I just like to ask those using Macs here as to what editor
and/or IDE they are using for writing PHP codes.
I don't personally use Mac OS X, but let me throw in a recommendation 
for jEdit
(www.jedit.org).  It's Java based, hence cross-platform, and extremely 
powerful.  I
use it on Windows and couldn't live without it.  I have installed it 
on my friend's
iMac long enough to see that it works, but not long enough to know of 
any
platform-specific issues and/or gotchas.
I use Xcode to do all my coding.
Just a side-comment: in general, OS X users enjoy/use Cocoa-based 
applications over Java-based. Cocoa provides the OS X Experience with 
the native aqua interface and other cool features that Java cannot 
always supply. (Not intending to start a discussion... just informing 
those non-Mac users.)

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


Re: [PHP] URL variables, and the $_GET[xxx] function...

2004-10-21 Thread Greg Donald
On Thu, 21 Oct 2004 14:08:28 +0100, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 I'm moving hosts for a freelance site I do...
 
 They have an events section, and it's sortable by date, name and category
 etc...
 To achieve this, I passed the search/sort variables via the URL...
 However, I'm testing the new server, and those variables are not being
 detected?
 
 I've put this code at teh top of the code on events page '$sort_by =
 $_GET[sort_by];' etc...
 And while that sorts out the problem, I'm curious as to why I need to do
 that, and if those changes will cause me probs elsewhere?
 
 Perhaps a rookie Q, but I guess we all learn something every day eh?
 
 Any thoughts?

I'm guessing you used to have register_globals on, and now you don't.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Strange Array Error

2004-10-21 Thread Chris Dowell
Shaun
The problem is that you've assigned $test_array[] = array();
This means that the first element ($test_array[0]) is an array.
You're then trying to add $i to it, as in $test_array[$i] = 
$test_array[$i] + 1;

in terms of types what you're doing is array = array + integer
Which doesn't make any sense.
If you change the first line to $test_array = array();
Then the individual elements will all be NULL, which evaluates to 0 in 
an integer context, and you will get the result you expect.

Hope this helps
Cheers
Chris
Shaun wrote:
Hi,
I have been trying for the past two hours to understand why I get an error 
with the following code:

?php
 $test_array[] = array();
 $i = 0;
 while($i  7){
  $test_array[$i] += $i;
  echo '$day_total[$i] = '.$day_total[$i].'br';
 }
?
Fatal error: Unsupported operand types in 
/usr/home/expensesystem/public_html/test.php on line 5

I am trying to create a loop where $i is added to array element $i, and 
can't find any information relating to this on google or php.net...

Thanks for your advice. 

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


Re: [PHP] URL variables, and the $_GET[xxx] function...

2004-10-21 Thread R'twick Niceorgaw
Hi Trisan,

Quoting [EMAIL PROTECTED]:

 I've put this code at teh top of the code on events page '$sort_by =
 $_GET[sort_by];' etc...
 And while that sorts out the problem, I'm curious as to why I need to do
 that, and if those changes will cause me probs elsewhere?

Perhaps on your old server, register_globals was on and on the new server it is
off?
Here's a link for more info on it
http://us2.php.net/register_globals

-R'twick
--
This is a signature


This message was sent using IMP, the Internet Messaging Program.

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



Re: [PHP] Sessions question

2004-10-21 Thread Greg Donald
On Thu, 21 Oct 2004 14:43:45 +0200, Reinhart Viane [EMAIL PROTECTED] wrote:
 Hey Mike,
 
 After some intensive testing it seemed that $user_id did not solve the
 isue
 
 I hereby give the script to get the $user_id:
 
 // check if the user info validates the db
 ($username and $password are the POST values of username and password
 given in on a form)
 $sql = mysql_query(SELECT * FROM users WHERE username='$username' AND
 password='$password' AND activated='1');
 $login_check = mysql_num_rows($sql);
 
 if($login_check  0){
 while($row = mysql_fetch_array($sql)){
 foreach( $row AS $key = $val ){

Your select * query above is probably pulling more than two fields, so
a $key and $val in the foreach() will only work with two of those
fields, the other fields will be unhandled.  You might want to ditch
the foreach() loop and just use the while() loop by itself since you
can easily access all the fields from your query in the $row array.



-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



RE: [PHP] Strange Array Error

2004-10-21 Thread Graham Cossey
[snip]
 
 Hi,
 
 I have been trying for the past two hours to understand why I get 
 an error 
 with the following code:
 
 ?php
  $test_array[] = array();
  $i = 0;
  while($i  7){
   $test_array[$i] += $i;
   echo '$day_total[$i] = '.$day_total[$i].'br';
  }
 ?
 
 Fatal error: Unsupported operand types in 
 /usr/home/expensesystem/public_html/test.php on line 5
 
 I am trying to create a loop where $i is added to array element $i, and 
 can't find any information relating to this on google or php.net...
 
 Thanks for your advice. 

Try this:
?php
 $test_array[] = array();
 $i = 0;
 while($i  7){
  $test_array[$i] = $i;
  echo '$test_array[$i] = '.$test_array[$i].'br';
  $i++;
 }
?

PHP objected to the use of +=
You did NOT want to increment $i before doing the echo anyway, did you?

Graham

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



Re: [PHP] Strange Array Error

2004-10-21 Thread Brent Baisley
You are making the first element of the array $test_array and array 
item. An array inside and array.
$test_array[] = array() is the same as $test_array[0] = array()

So what you are trying to do is add $i to an array. Kind of like trying 
to figure out what happens when you add 1 to the color red.

Try one of these:
$test_array = array()
or
$test_array = array(0,0,0,0,0,0,0)
Basically, drop the brackets. You use brackets to reference and array 
element, not the array itself.

On Oct 21, 2004, at 9:28 AM, Shaun wrote:
Hi,
I have been trying for the past two hours to understand why I get an 
error
with the following code:

?php
 $test_array[] = array();
 $i = 0;
 while($i  7){
  $test_array[$i] += $i;
  echo '$day_total[$i] = '.$day_total[$i].'br';
 }
?
Fatal error: Unsupported operand types in
/usr/home/expensesystem/public_html/test.php on line 5
I am trying to create a loop where $i is added to array element $i, and
can't find any information relating to this on google or php.net...
Thanks for your advice.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Strange Array Error

2004-10-21 Thread Chris Dowell
That is, expected results, *apart* from the infinite loop you'll have 
due to not incrementing $i

Cheers
Chris
Chris Dowell wrote:
Shaun
The problem is that you've assigned $test_array[] = array();
This means that the first element ($test_array[0]) is an array.
You're then trying to add $i to it, as in $test_array[$i] = 
$test_array[$i] + 1;

in terms of types what you're doing is array = array + integer
Which doesn't make any sense.
If you change the first line to $test_array = array();
Then the individual elements will all be NULL, which evaluates to 0 in 
an integer context, and you will get the result you expect.

Hope this helps
Cheers
Chris
Shaun wrote:
Hi,
I have been trying for the past two hours to understand why I get an 
error with the following code:

?php
 $test_array[] = array();
 $i = 0;
 while($i  7){
  $test_array[$i] += $i;
  echo '$day_total[$i] = '.$day_total[$i].'br';
 }
?
Fatal error: Unsupported operand types in 
/usr/home/expensesystem/public_html/test.php on line 5

I am trying to create a loop where $i is added to array element $i, 
and can't find any information relating to this on google or php.net...

Thanks for your advice.

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


RE: [PHP] Mac OS X and Editor

2004-10-21 Thread Michael Sims
Philip Thompson wrote:
 I don't personally use Mac OS X, but let me throw in a
 recommendation for jEdit (www.jedit.org).  It's Java based, hence
[...]
 Just a side-comment: in general, OS X users enjoy/use Cocoa-based
 applications over Java-based. Cocoa provides the OS X Experience
 with the native aqua interface and other cool features that Java
 cannot always supply. (Not intending to start a discussion... just
 informing those non-Mac users.)

It's also been my experience that Windows users prefer pure Win32-based applications
over Java-based ones as well.  However, IMHO jEdit is so flexible and powerful, and
so completely out-classes every other *free* Windows based IDE I have used, that I'm
willing to put up with whatever headaches using a Java based program imposes (which
isn't much if you have a reasonably fast machine).  And it is possible on Windows to
configure jEdit so that it's look and feel is very much native Win32.  I'm not sure
if this is possible on OS X or not, but I'd be surprised if it weren't.

Also, this may not be an advantage for the average joe, but for me the
cross-platform capability that Java brings is a major advantage.  I'm a Windows user
now, but eventually I plan to switch to OS X (once I have the cash).  I like the
fact that I can use my favorite IDE, including all the plugins/customizations/macros
that I've built up over the last year or so, on OS X or Linux with a minimum of
hassle.

As usual, this is all IMHO and YMMV... :)

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



[PHP] Passing the Array as Parameter to either the function or object/class???

2004-10-21 Thread Scott Fletcher
Hi!

I wanted to know is can it be done by passing the array as a parameter
to the function?

I also wanted to know is is it possible to pass around the array in the
object-orientated feature like object/class stuffs?

Thanks,
 Scott

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



RE: [PHP] Strange Array Error

2004-10-21 Thread Graham Cossey
Oh @#*!
Thanks Greg, I always get that one wrong !

$test_array = array();

:)

 -Original Message-
 From: Graham Cossey [mailto:[EMAIL PROTECTED]
 Sent: 21 October 2004 14:48
 To: Shaun; [EMAIL PROTECTED]
 Subject: RE: [PHP] Strange Array Error


 [snip]
 
  Hi,
 
  I have been trying for the past two hours to understand why I get
  an error
  with the following code:
 
  ?php
   $test_array[] = array();
   $i = 0;
   while($i  7){
$test_array[$i] += $i;
echo '$day_total[$i] = '.$day_total[$i].'br';
   }
  ?
 
  Fatal error: Unsupported operand types in
  /usr/home/expensesystem/public_html/test.php on line 5
 
  I am trying to create a loop where $i is added to array element $i, and
  can't find any information relating to this on google or php.net...
 
  Thanks for your advice.

 Try this:
 ?php
  $test_array[] = array();
  $i = 0;
  while($i  7){
   $test_array[$i] = $i;
   echo '$test_array[$i] = '.$test_array[$i].'br';
   $i++;
  }
 ?

 PHP objected to the use of +=
 You did NOT want to increment $i before doing the echo anyway, did you?

 Graham

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

2004-10-21 Thread Reinhart Viane
Thanks Greg,

I'll try this, but I do not think this will solve the issue since at
first hand the session variables are correctly made.

The problem arrises (I think) whenever two or more users are logged in
and one closes the pages (so his session is killed I suppose).
Sometimes after that, the other users seem to get other values for the
user_id session variable.
Strange thing is the other session (like first_name or last_name)
variables of the user stay correct. Only the user_id session variable is
changed.

I don't know if this can be caused by the fact register_globals seem to
be 'on' on the server (btw PHP Version 4.2.3)

Thx for the advice, I hope I can sort it out soon

Greetz
Reinhart




-Original Message-
From: Greg Donald [mailto:[EMAIL PROTECTED] 
Sent: donderdag 21 oktober 2004 15:47
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Sessions question


On Thu, 21 Oct 2004 14:43:45 +0200, Reinhart Viane [EMAIL PROTECTED] wrote:
 Hey Mike,
 
 After some intensive testing it seemed that $user_id did not solve the

 isue
 
 I hereby give the script to get the $user_id:
 
 // check if the user info validates the db
 ($username and $password are the POST values of username and password 
 given in on a form) $sql = mysql_query(SELECT * FROM users WHERE 
 username='$username' AND password='$password' AND activated='1');
 $login_check = mysql_num_rows($sql);
 
 if($login_check  0){
 while($row = mysql_fetch_array($sql)){
 foreach( $row AS $key = $val ){

Your select * query above is probably pulling more than two fields, so a
$key and $val in the foreach() will only work with two of those fields,
the other fields will be unhandled.  You might want to ditch the
foreach() loop and just use the while() loop by itself since you can
easily access all the fields from your query in the $row array.



-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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

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



Re: [PHP] Sessions question

2004-10-21 Thread Greg Donald
On Thu, 21 Oct 2004 16:06:37 +0200, Reinhart Viane [EMAIL PROTECTED] wrote:
 I don't know if this can be caused by the fact register_globals seem to
 be 'on' on the server (btw PHP Version 4.2.3)

You can override that setting if the web server is running apache and
AllowOverrides is set for your directory.  You can make an .htaccess
file with this in it:

php_flag register_globals Off


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] php sessions question

2004-10-21 Thread raditha dissanayake
Reinhart Viane wrote:
in a page checkuser i do this after the user is logged in:
 PHP Code
 // Register some session variables!
 session_register('userid');
 $_SESSION['userid'] = $userid;
 session_register('first_name');
 $_SESSION['first_name'] = $first_name;
 session_register('last_name');
 $_SESSION['last_name'] = $last_name;
 session_register('email_address');
 $_SESSION['email_address'] = $email_address;
 session_register('user_level');
 $_SESSION['user_level'] = $user_level;
 

You should only save the userId in the session, everything else should 
be retrieved from your database using that id.


Now let's say user 1 logs in, his session is registered (with userid from 
database is 5 and first_name is XXX)
Then another user logs in, again his session is registered (with userid from 
database is 1 and first_name is YYY)

 

Are both user's in the same computer? then there may be a question about 
the old cookie being sent back to the server (if it's expiration time 
has not been exceeded). If the users are not using the same computer the 
chances are you have a bug in your code.

Now user 1 leaves the pages (closes the browser) and user 2 uploads a 
document (with my own script).

When the document is succesfully uploaded i display this:
 PHP Code
 echo ($_SESSION['first_name'])., the document has been succesfully 
added;
 echo ($_SESSION['userid']);


This results in the folowing output:
YYY, the document has been succesfully added
5
Meaning the $_SESSION['first_name'] is correct, but the $_SESSION['userid'] 
is the one of the user who logged out...

Now when using user_id in all places it seems to work correctly...
Is userid something that is defined by the server when making sessions?
 

no.
If not, i don't have any clue what is going wrong...
Can someone help me on this? So i know what is wrong?
 


Thx in advance
Pout
 


--
Raditha Dissanayake.

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


Re: [PHP] Sessions question

2004-10-21 Thread Mike Smith
On Thu, 21 Oct 2004 14:43:45 +0200, Reinhart Viane [EMAIL PROTECTED] wrote:
 Hey Mike,
 
 After some intensive testing it seemed that $user_id did not solve the
 isue
 
 I hereby give the script to get the $user_id:
 
 // check if the user info validates the db
 ($username and $password are the POST values of username and password
 given in on a form)
 $sql = mysql_query(SELECT * FROM users WHERE username='$username' AND
 password='$password' AND activated='1');
 $login_check = mysql_num_rows($sql);
 
 if($login_check  0){
 while($row = mysql_fetch_array($sql)){
 foreach( $row AS $key = $val ){
 $$key = stripslashes( $val );
 }
 // Register some session variables!
 session_register('user_id');
 $_SESSION['user_id'] = $user_id;
 session_register('first_name');
 $_SESSION['first_name'] = $first_name;
 session_register('last_name');
 $_SESSION['last_name'] = $last_name;
 session_register('email_address');
 $_SESSION['email_address'] = $email_address;
 session_register('user_level');
 $_SESSION['user_level'] = $user_level;
 
 mysql_query(UPDATE users SET last_login=now() WHERE
 user_id='$user_id');
 
 header(Location: main.php);
 
 }
 
 Now this is my conclusion till now:
 
 All other session items are correctly displayed, except the
 $_SESSION['user_id']
 I'm trying to find the way when this happens since it does not seem to
 happen in a strict order
 The method mentioned b4:
 'Now let's say user 1 logs in, his session is registered (with userid
  from database is 5 and first_name is XXX) Then another user logs in,
  again his session is registered (with userid from database is 1 and 
  first_name is YYY)'
 
 is not always faulty.
 I've checked everything I know and the last thing I've done is putted:
 
 session_start();
 
 On the first line instead of after this:
 ?
 require('xx.inc.php');
 connect_db();
 
 Untill now all seems to be ok, but I'm not certain at all it is ok.
 There can be hundreds of methods how several users log in, upload, log
 out etc. so I can not test them all... :(
 
 It seems that sometimes the $_SESSION['user_id'] of the several users
 get mixed and this may not happen.
 
 I don't know if this is a known bug or if there are cases which can
 cause this...
 If im not certain if this can be solved I will have to use another
 method to keep the logged in users info (but what one? Don't want to use
 cookies)
 
 Thx in advance for any help.
 
 Greetings,
 
 Reinhart 
 
 
 
 -Original Message-
 From: Mike Smith [mailto:[EMAIL PROTECTED]
 Sent: donderdag 21 oktober 2004 13:28
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Sessions question
 
 On Thu, 21 Oct 2004 11:39:23 +0200, Reinhart Viane [EMAIL PROTECTED] wrote:
  Hey all, i'm new to this list so forgive me if  i make any huge
  mistakes. I'm in a beginning stage of learning php and i hope you guys
 
  can help me out with this question:
 
  in a file named checkuser i do this when a users logs in:
  PHP Code
  // Register some session variables!
  session_register('userid');
  $_SESSION['userid'] = $userid;
  session_register('first_name');
  $_SESSION['first_name'] = $first_name;
  session_register('last_name');
  $_SESSION['last_name'] = $last_name;
  session_register('email_address');
  $_SESSION['email_address'] = $email_address;
  session_register('user_level');
  $_SESSION['user_level'] = $user_level;
 
  Now let's say user 1 logs in, his session is registered (with userid
  from database is 5 and first_name is XXX) Then another user logs in,
  again his session is registered (with userid from database is 1 and
  first_name is YYY)
 
  Now user 1 leaves the pages (closes the browser) and user 2 uploads a
  document (with my own script).
 
  When the document is succesfully uploaded i display this:
  PHP Code
  echo ($_SESSION['first_name'])., the document has been succesfully
  added; echo ($_SESSION['userid']);
 
  This results in the folowing output:
  YYY, the document has been succesfully added
  5
 
  Meaning the $_SESSION['first_name'] is correct, but the
  $_SESSION['userid'] is the one of the user who logged out...
 
  Now when using user_id in all places it seems to work correctly...
 
  Is userid something that is defined by the server when making
  sessions?
 
  If not, i don't have any clue what is going wrong...
  Can someone help me on this? So i know what is wrong?
 
  Thx in advance
 
  Reinhart Viane
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 Where does the value $userid come from is it the result of a query i.e.
 SELECT userid FROM users WHERE 

Re: [PHP] Sessions question

2004-10-21 Thread raditha dissanayake
hi,
Please don't send multiple posts, I just replied to your previous 
message thinking that it had not been answered, a little further down I 
come across this. It's very confusing to everyone.

thanks
--
Raditha Dissanayake.

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


Re: [PHP] Passing the Array as Parameter to either the function or object/class???

2004-10-21 Thread Greg Donald
On Thu, 21 Oct 2004 09:57:07 -0400, Scott Fletcher [EMAIL PROTECTED] wrote:
 I wanted to know is can it be done by passing the array as a parameter
 to the function?

Yes.  By reference and by value.

 I also wanted to know is is it possible to pass around the array in the
 object-orientated feature like object/class stuffs?

Yes.  By reference and by value.

Some people have issues with theoretical posts like this one.  Showing
an honest attempt with some broken code usually gets help the
quickest.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Validation problem with array.

2004-10-21 Thread Brent Baisley
Since your data on the client is linked, you should keep it linked on 
submission by nesting an array with in the array.
Your client HTML should like something like this:
input type=text name=skills[0][skill] value= size=20

select name=skills[0][skys] size=1
option ...
/select
select name=skills[0][Lused] size=1
option ...
/select
...
input type=text name=skills[1][skill] value= size=20
select name=skills[1][skys] size=1
option ...
/select
select name=skills[1][Lused] size=1
option ...
/select
All the way up to skills[10][...], or however many you want. If 
everything is filled out, you will then get a 10x3 array, just like a 
spreadsheet.
Since empty fields won't get submitted, you will be missing parts of 
your array. But that's easy to check for.

So for submission your are creating grid contain in one array variable 
skills:
row	skill		skys		Lused
1	C++		3		10/1/2000
2			0		10/21/2004
3	...

Now it's easy to process the grid and check for missing data.
$skills = $_POST['skills'];
//Process each row of the array $skills
//Each row may have up to three elements: skill, skys, Lused
foreach($skills as $skill) {
	//Check if a skill was entered by check for array element named 'skill'
	if(isset($skill['skill'])) {
		$query = 'INSERT INTO dbName (SkilCerts, NumYear, Lused)
VALUES ('.$skill['skill'].', '.$skill['skys'].', 
'.$skill['Lused'].')';
	}
}

On Oct 21, 2004, at 6:55 AM, Stuart Felenstein wrote:
Graham, I'm going to make those changes.  Not sure if
that was creating some crazy behaviour. See inline:
--- Graham Cossey [EMAIL PROTECTED] wrote:

{
if ($skill != '') // Has this skill been
entered?
I don't know if I care if it's been entered.  My main
concern would be to make sure that if a $skill was
entered, then a matching $skys and $slus
should be:
skills[0]-baker skys[0]-7 slus[0]-2002
but wouldn't want
skill[0]-baker skys[1]-7 slus[2]-2002
In other words I need to figure out how to check that
each line is complete.  But~ right now, it is
matching all the values/inputs correctly.  If someone
just chose a slus, seems the database won't take it.
{
  // You may also want to check for sky  slu
entries
Not sure why I would want too:
//$result = mysql_query($query);
$res6 = run_query($query);
echo $query;
  ^^^
  What does this output?
It outputs the insert and values string.
And it seems to print the iteration:
INSERT INTO LurkProfiles_Skicerts (SkicertID,
ProfileID, SkilCerts, NumYear, Lused) VALUES (null,
39, 'a', 2,1)INSERT INTO LurkProfiles_Skicerts
(SkicertID, ProfileID, SkilCerts, NumYear, Lused)
VALUES (null, 39, 'b', 3,2)INSERT INTO
LurkProfiles_Skicerts (SkicertID, ProfileID,
SkilCerts, NumYear, Lused) VALUES (null, 39, 'c',
4,3)INSERT INTO LurkProfiles_Skicerts (SkicertID,
ProfileID, SkilCerts, NumYear, Lused) VALUES (null,
39, 'd', 5,4)INSERT INTO LurkProfiles_Skicerts
(SkicertID, ProfileID, SkilCerts, NumYear, Lused)
VALUES (null, 39, 'e', 6,5)your insertions were
successful
}// end if ($skill != '')
This probably makes sense to add , perhaps that is why
if I don't use all the elements for input I get a
syntax error.
Stuart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Passing the Array as Parameter to either the function or object/class???

2004-10-21 Thread Robby Russell
On Thu, 2004-10-21 at 09:57 -0400, Scott Fletcher wrote:
 Hi!
 
 I wanted to know is can it be done by passing the array as a parameter
 to the function?
 
 I also wanted to know is is it possible to pass around the array in the
 object-orientated feature like object/class stuffs?
 

yes and yes.

ie:

function foo($bar)
{
  print_r($bar);
}

$myarray = array(1,2,3,4);

foo($myarray);

ouputs:

Array
(
[0] = 1
[1] = 2
[2] = 3
[3] = 4
)


cheers,

Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
/



signature.asc
Description: This is a digitally signed message part


Re: [PHP] A better way to do this in php???

2004-10-21 Thread Brent Baisley
Here's a one liner that gives the minutes since midnight:
floor( (time()-mktime(0,0,0, date( 'm' ), date( 'd' ), date( 'Y' 
)))/60);

Both time() and mktime() return the seconds since epoch. Time is based 
on current time, and the mktime parameters base it on midnight. A 
simple subtraction gives you the seconds since midnight. Divide by 60 
to get minutes and use floor() to drop any extra seconds.

On Oct 20, 2004, at 6:45 PM, [EMAIL PROTECTED] wrote:
I need to find the exact time of day using minutes since midnight.
What is the easiest and/or better way to do this in php?
This is how I'm doing it now.
// $iMinutes is the total number of minutes since midnight/12am
// 0 = midnight/12am
// 1439 = 11:59pm
$iMinutes = 1230;
if ($iMinutes  0 || $iMinutes  1439) {
$restime = ??:??;
} else {
$iHour = $iMinutes / 60;
$iMins = ($iMinutes - (60*$iHour)) % 60;
if ($iHour = 12) {
$restime .= $iHour . :;
} else {
$restime .= $iHour-12 . :;
}
if ($iMins  10) {
$restime .= 0 . $iMins;
} else {
$restime .= $iMins;
}
if ($iHour  12) {
$restime .=  a.m.;
} else if ($iHour==12  $iMins==0) {
$restime .=  noon;
} else {
$restime .=  pm;
}
}
Thanks, Brent

This message was sent using IMP, the Internet Messaging Program.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Sessions question

2004-10-21 Thread Greg Donald
On Thu, 21 Oct 2004 10:14:47 -0400, Mike Smith [EMAIL PROTECTED] wrote:
 How about changing

How about learning to trim your posts?  Thanks.  :)


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



RE: [PHP] Strange Array Error

2004-10-21 Thread Robby Russell
On Thu, 2004-10-21 at 15:04 +0100, Graham Cossey wrote:
 Oh @#*!
 Thanks Greg, I always get that one wrong !
 
 $test_array = array();
 
 :)

a few less lines version:

$test_array = array();

for ($i=0; $i7; $i++)
$test_array[$i] = $i;

print_r($test_array);

hth,

-Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
/



signature.asc
Description: This is a digitally signed message part


[PHP] Re: Passing the Array as Parameter to either the function or object/class???

2004-10-21 Thread Scott Fletcher
Thanks  I wasn't sure if that would work but now I know it does.  It is
nice to know..

Scott

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



Re: [PHP] Strange Array Error

2004-10-21 Thread M Saleh EG
On Thu, 21 Oct 2004 14:28:26 +0100, Shaun [EMAIL PROTECTED] wrote:
 Hi,
 
 I have been trying for the past two hours to understand why I get an error
 with the following code:
 
 ?php
 $test_array[] = array();
   //Change it to $test_array=array();  
   /*Your statement adds an array to the current+1 position of the
array since you've put the [] after the variable the PHP interpreter
initializes it as an array type of variable so it takes that action*/

 $i = 0;
 while($i  7){
  $test_array[$i] += $i;
  echo '$day_total[$i] = '.$day_total[$i].'br';
// Change the single quotes to double quotes
// i.e. echo {$day_total[$i]}={$day_total[$i]}br /; 
// Add ++$i; here
 }
 ?

Notes: -Always use double quotes if you want to concatanate vars with strings.  
  -Whe ur using arrays in ur strings that is to be
concatenated delimit the array by { and }.
  -Take a look at sprintf function to better format strings in
case ur familiar with C coding style.
  -Sometimes googling might not help nor PHP.net. So, the PHP
manual is ur friend. e.g you could go to Array section in PHP manual
and find out what's up :)

 
 Fatal error: Unsupported operand types in
 /usr/home/expensesystem/public_html/test.php on line 5
 
 I am trying to create a loop where $i is added to array element $i, and
 can't find any information relating to this on google or php.net...
 
 Thanks for your advice.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

Hope that helps.
-- 
M.Saleh.E.G
97150-4779817

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



[PHP] Simple Time Question

2004-10-21 Thread Ben Miller
Probably a stupid question, but hopefully has a simple answer.  Is there a
way to get Grenwich Mean time?  time() and date() functions that I can see
only seem to get date/time from the server, which knowing where that is,
could easily figure out GM time, but would rather go the other way.

Thanks.

Ben

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



RE: [PHP] Simple Time Question

2004-10-21 Thread Daniel Purdy

[snip]
Probably a stupid question, but hopefully has a simple answer.  Is there
a way to get Grenwich Mean time?  time() and date() functions that I can
see only seem to get date/time from the server, which knowing where that
is, could easily figure out GM time, but would rather go the other
way.
[/snip]

You might want to take a look at gmmaketime
http://www.php.net/gmmaketime
HTH!

-- 
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] Simple Time Question

2004-10-21 Thread bbonkosk
Set your server to GMT.

- Original Message -
From: Ben Miller [EMAIL PROTECTED]
Date: Thursday, October 21, 2004 10:48 am
Subject: [PHP] Simple Time Question

 Probably a stupid question, but hopefully has a simple answer.  Is 
 there a
 way to get Grenwich Mean time?  time() and date() functions that I 
 can see
 only seem to get date/time from the server, which knowing where 
 that is,
 could easily figure out GM time, but would rather go the other 
 way.
 Thanks.
 
 Ben
 
 -- 
 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] Simple Time Question

2004-10-21 Thread M Saleh EG
You might want to look at this:
http://www.php.net/manual/en/function.date.php


On Thu, 21 Oct 2004 08:48:54 -0600, Ben Miller [EMAIL PROTECTED] wrote:
 Probably a stupid question, but hopefully has a simple answer.  Is there a
 way to get Grenwich Mean time?  time() and date() functions that I can see
 only seem to get date/time from the server, which knowing where that is,
 could easily figure out GM time, but would rather go the other way.
 
 Thanks.
 
 Ben
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
M.Saleh.E.G
97150-4779817

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



Re: [PHP] remote file existance when protected by a .htaccess

2004-10-21 Thread Mag

--- Matt M. [EMAIL PROTECTED] wrote:

  Nope, no PEAR allowedany other options?
 
 curl, Is that available to you?
 
 http://us2.php.net/curl
 

Hi Matt,
Yep, cURL is available but I was going through the
manual for curl (and google too suggests that might be
my best option)...but it does not look very easy to
learn :-(

so I was hopeing for something else..

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] Simple Time Question

2004-10-21 Thread Robby Russell
On Thu, 2004-10-21 at 08:48 -0600, Ben Miller wrote:
 Probably a stupid question, but hopefully has a simple answer.  Is there a
 way to get Grenwich Mean time?  time() and date() functions that I can see
 only seem to get date/time from the server, which knowing where that is,
 could easily figure out GM time, but would rather go the other way.
 
 Thanks.
 
 Ben
 

You can set an environment variable for your project like so:

putenv(TZ=US/Pacific);

just find the proper GMT time zone format..

-Robby


-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
/



signature.asc
Description: This is a digitally signed message part


Re: [PHP] remote file existance when protected by a .htaccess

2004-10-21 Thread Matt M.
 Hi Matt,
 Yep, cURL is available but I was going through the
 manual for curl (and google too suggests that might be
 my best option)...but it does not look very easy to
 learn :-(

It is not to bad.  Go through the php manual and look at the examples.
 That should help.

If you still cant figure it out, I can put together a quick script to
help you out.

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



Re: [PHP] remote file existance when protected by a .htaccess

2004-10-21 Thread Matt M.
try this function, I lifted almost all of this stuff off of the manual
and the zend site

function check_link($link , $referer='') {
$main = array();
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $link);
curl_setopt ($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_NOBODY, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_NETRC, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);  // this line
makes it work under https
if(isset($referer)) {
curl_setopt($ch, CURLOPT_REFERER, $referer);  
}
ob_start();
curl_exec ($ch);
$stuff = ob_get_contents();
ob_end_clean();
curl_close ($ch);
$parts = split(n,$stuff,2);
$main = split( ,$parts[0],3);
return $main;
} // function check_link

$url = 'your url';
$referer = 'your referer';
print_r(check_link($url , $referer));

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



RE: [PHP] Simple Time Question

2004-10-21 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 21 October 2004 15:49, Ben Miller wrote:

 Probably a stupid question, but hopefully has a simple answer.  Is
 there a way to get Grenwich Mean time?  time() and date() functions
 that I can see only seem to get date/time from the server, which
 knowing where that is, could easily figure out GM time, but would
 rather go the other way. 

time() returns a UNIX timestamp which, by definition, is always in GMT.

date() formats that, converting for the current timezone.

gmdate() formats it without doing any timezone conversion, hence in GMT.

mktime() makes a timestamp (hence in GMT) from the supplied date/time
information, converting from the current timezone.

gmmktime() does the same, but without any timezone conversion, so the
information you supply must be in GMT.


In summary:

* timestamps are always in GMT.

* date() and mktime() do timezone conversion.

* gmdate() and gmmktime() do not.

Cheers!

Mike

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

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



[PHP] Best practices for php application

2004-10-21 Thread abrea
Dear list,
Does anybody know of a url where I can find reading materials about best 
practices to organize the filesystem and variable structure of a php 
application? 
Although application purposes probably vary widely, I imagine that in one 
way or other most include adding, updating, deleting and displaying records, 
so there might be some standard or preferred procedure.
Thanks for any help
Alberto Brea
[EMAIL PROTECTED]


RE: [PHP] Best practices for php application

2004-10-21 Thread Jay Blanchard
[snip]
Does anybody know of a url where I can find reading materials about best

practices to organize the filesystem and variable structure of a php 
application? 
Although application purposes probably vary widely, I imagine that in
one 
way or other most include adding, updating, deleting and displaying
records, 
so there might be some standard or preferred procedure.
[/snip]

Having designed several large applications and examining several other
large projects in PHP (and other languages) I can safely say that there
are no particular rules, save for those common sense dictates (graphics
in one location/directory, style sheets another, etc, includes another),
for filesystem organization. We have a basic model that we start with,
but past that it can get mangled pretty easily dependent upon the needs
of the application itself.

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



RE: [PHP] Simple Time Question

2004-10-21 Thread Robert Cummings
On Thu, 2004-10-21 at 12:25, Ford, Mike wrote:
 To view the terms under which this email is distributed, please go to 
 http://disclaimer.leedsmet.ac.uk/email.htm
 
 
 
 On 21 October 2004 15:49, Ben Miller wrote:
 
  Probably a stupid question, but hopefully has a simple answer.  Is
  there a way to get Grenwich Mean time?  time() and date() functions
  that I can see only seem to get date/time from the server, which
  knowing where that is, could easily figure out GM time, but would
  rather go the other way. 
 
 time() returns a UNIX timestamp which, by definition, is always in GMT.

No it isn't. It goes by your machine's clock.

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

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



[PHP] Re-compiling PHP

2004-10-21 Thread Mike R

I am trying to re-compile php, but keep getting erros that the mysql
extensions are not installed.  I got the binary from php.net and included
mysql in configure (following). What am I not doing correctly?

./configure '--prefix=/usr/local' '--enable-exif' '--enable-track-vars'
'--with-calendar=shared' '--enable-magic-quotes' '--enable-trans-sid'
'--enable-wddx' '--enable-ftp' '--with-gd' '--with-zlib'
'--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-ttf'
'--with-openssl' '--with-gettext=/usr' '--with-gd'
'--with-zlib-dir=/usr/local' '--with-png-dir=/usr'
'--with-jpeg-dir=/usr/local' '--with-mysql'


Thanks,

-Mike



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



Re: [PHP] Best practices for php application

2004-10-21 Thread Robby Russell
On Thu, 2004-10-21 at 13:47 -0300, abrea wrote:
 Dear list,
 Does anybody know of a url where I can find reading materials about best 
 practices to organize the filesystem and variable structure of a php 
 application? 
 Although application purposes probably vary widely, I imagine that in one 
 way or other most include adding, updating, deleting and displaying records, 
 so there might be some standard or preferred procedure.
 Thanks for any help
 Alberto Brea
 [EMAIL PROTECTED]

eh, it depends on how you were trained/taught/learned how to do it.

for good examples, head over to sourceforge and look at some of the
major php projects..and browse their CVS directories..see how they do it
for some examples.

-Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
/



signature.asc
Description: This is a digitally signed message part


Re: [PHP] Re-compiling PHP

2004-10-21 Thread John Nichel
Mike R wrote:
I am trying to re-compile php, but keep getting erros that the mysql
extensions are not installed.  I got the binary from php.net and included
mysql in configure (following). What am I not doing correctly?
You're trying to compile the binaries?
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Simple Time Question

2004-10-21 Thread Robert Cummings
On Thu, 2004-10-21 at 13:00, Robert Cummings wrote:
 On Thu, 2004-10-21 at 12:25, Ford, Mike wrote:
  To view the terms under which this email is distributed, please go to 
  http://disclaimer.leedsmet.ac.uk/email.htm
  
  
  
  On 21 October 2004 15:49, Ben Miller wrote:
  
   Probably a stupid question, but hopefully has a simple answer.  Is
   there a way to get Grenwich Mean time?  time() and date() functions
   that I can see only seem to get date/time from the server, which
   knowing where that is, could easily figure out GM time, but would
   rather go the other way. 
  
  time() returns a UNIX timestamp which, by definition, is always in GMT.
 
 No it isn't. It goes by your machine's clock.

Hmm I could be wrong. Seems the date function adds the timezone modifier
according to the comments on php.net for the time() function.

Apologies,
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] Best practices for php application

2004-10-21 Thread Brent Baisley
That's a whopper of an open ended question. I found the biggest help 
for me was reading up on the MVC (Model, View, Controller) technique, 
which is probably the most commonly used design pattern for just 
about any language.

On Oct 21, 2004, at 12:47 PM, abrea wrote:
Dear list,
Does anybody know of a url where I can find reading materials about 
best
practices to organize the filesystem and variable structure of a php
application?
Although application purposes probably vary widely, I imagine that in 
one
way or other most include adding, updating, deleting and displaying 
records,
so there might be some standard or preferred procedure.
Thanks for any help
Alberto Brea
[EMAIL PROTECTED]

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Simple Time Question

2004-10-21 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 21 October 2004 18:01, Robert Cummings wrote:

 On Thu, 2004-10-21 at 12:25, Ford, Mike wrote:
  To view the terms under which this email is distributed,
 please go to http://disclaimer.leedsmet.ac.uk/email.htm
  
  
  
  On 21 October 2004 15:49, Ben Miller wrote:
  
   Probably a stupid question, but hopefully has a simple answer.  Is
   there a way to get Grenwich Mean time?  time() and date()
   functions that I can see only seem to get date/time from the
   server, which knowing where that is, could easily figure out GM
   time, but would rather go the other way.
  
  time() returns a UNIX timestamp which, by definition, is always in
  GMT. 
 
 No it isn't. It goes by your machine's clock.

Yes, it is.  UNIX timestamps are *always* in GMT -- here is the definition
from the PHP time() page:

 Returns the current time measured in the number of seconds since
 the Unix Epoch (January 1 1970 00:00:00 GMT).

Note that GMT on the end.

Believe me, I have researched this extensively -- you will find that the
same timestamp represents all these times:

12:00 1-Dec-2004 GMT (London, England)
07:00 1-Dec-2004 -0500 (New York)
20:30 1-Dec-2004 +0830 (Darwin, Australia)

and so on.

It is date() and mktime() that do the conversion to and from the server's
local timezone, including DST adjustments where necessary.  The timestamp is
timezone agnostic.

Cheers!

Mike

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



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



RE: [PHP] Re-compiling PHP

2004-10-21 Thread Mike R



 Mike R wrote:
  I am trying to re-compile php, but keep getting erros that the mysql
  extensions are not installed.  I got the binary from php.net 
 and included
  mysql in configure (following). What am I not doing correctly?
 
 You're trying to compile the binaries?

Sorry, the tar'd file I should say.  ;p

:)

-Mike
 

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



RE: [PHP] Re-compiling PHP

2004-10-21 Thread Robby Russell
On Thu, 2004-10-21 at 14:52 -0400, Mike R wrote:
 
 
  Mike R wrote:
   I am trying to re-compile php, but keep getting erros that the mysql
   extensions are not installed.  I got the binary from php.net 
  and included
   mysql in configure (following). What am I not doing correctly?
  
  You're trying to compile the binaries?
 
 Sorry, the tar'd file I should say.  ;p
 

You probably need to do --with-mysql=/path/to/mysql/libs

It's not finding them by itself..so you my need to be a bit more
specific.

..you have mysql libs installed, right?

-Robby


-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
/



signature.asc
Description: This is a digitally signed message part


Re: [PHP] Re-compiling PHP

2004-10-21 Thread John Nichel
Mike R wrote:

Mike R wrote:
I am trying to re-compile php, but keep getting erros that the mysql
extensions are not installed.  I got the binary from php.net 
and included
mysql in configure (following). What am I not doing correctly?
You're trying to compile the binaries?

Sorry, the tar'd file I should say.  ;p
This is PHP5?  If I'm not mistaken (someone will correct me if I am), 
PHP5 doesn't come bundled with MySQL anymore, so you will have to tell 
the configure where MySQL is installed...

--with-mysql=/path/to/mysql
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Re-compiling PHP

2004-10-21 Thread Mike R

Sorry, no, its PHP 4.3.9 - and I am upgrading from 4.1.2.  I have mysql
installed and have been using it.

I'll see if I can put something in about the exact location of the libs.

Any other suggestions out there?

:)

Thanks,

-Mike



 Mike R wrote:
 
 
 Mike R wrote:
 
 I am trying to re-compile php, but keep getting erros that the mysql
 extensions are not installed.  I got the binary from php.net
 
 and included
 
 mysql in configure (following). What am I not doing correctly?
 
 You're trying to compile the binaries?
 
 
  Sorry, the tar'd file I should say.  ;p

 This is PHP5?  If I'm not mistaken (someone will correct me if I am),
 PHP5 doesn't come bundled with MySQL anymore, so you will have to tell
 the configure where MySQL is installed...

 --with-mysql=/path/to/mysql

 --
 John C. Nichel
 ÜberGeek
 KegWorks.com
 716.856.9675
 [EMAIL PROTECTED]

 --
 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] Trying to Integrate PHP 4.3.4 w/ JDK 1.5.0

2004-10-21 Thread Andrew Hauger
Everything compiled okay, and I think everything is
installed in the right places. When I try to run a
test program, I get the error:

[error] PHP Fatal error: 
java.lang.UnsatisfiedLinkError: no php_java in
java.library.path in
/usr/local/apache/htdocs/java_test2.php on line 5

The file php_java.jar is in that directory!

Here are the php.ini parameters:
java.class.path=/usr/local/php-4.3.4/lib/php_java.jar
java.home=/usr/java
java.library.path=/usr/local/php-4.3.4/lib
java.library=/usr/jdk1.5.0/jre/lib/sparc/libjava.so

I appreciate any useful suggestions.

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



RE: [PHP] Re-compiling PHP

2004-10-21 Thread Mike R

Even after re-compiling with the location of the mysql headers, it still
won't work. :\

Pretty discouraging.  What version of PHP did they start dropping the
libraries?  Maybe I need to just upgrade to that version..

:\

-Mike



 -Original Message-
 From: Robby Russell [mailto:[EMAIL PROTECTED]
 Sent: Thursday, October 21, 2004 2:56 PM
 To: Mike R
 Cc: John Nichel; [EMAIL PROTECTED]
 Subject: RE: [PHP] Re-compiling PHP


 On Thu, 2004-10-21 at 14:52 -0400, Mike R wrote:
 
 
   Mike R wrote:
I am trying to re-compile php, but keep getting erros that the mysql
extensions are not installed.  I got the binary from php.net
   and included
mysql in configure (following). What am I not doing correctly?
  
   You're trying to compile the binaries?
 
  Sorry, the tar'd file I should say.  ;p
 

 You probably need to do --with-mysql=/path/to/mysql/libs

 It's not finding them by itself..so you my need to be a bit more
 specific.

 ..you have mysql libs installed, right?

 -Robby


 --
 /***
 * Robby Russell | Owner.Developer.Geek
 * PLANET ARGON  | www.planetargon.com
 * Portland, OR  | [EMAIL PROTECTED]
 * 503.351.4730  | blog.planetargon.com
 * PHP/PostgreSQL Hosting  Development
 /



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



RE: [PHP] Re-compiling PHP

2004-10-21 Thread Matthew Sims
 On Thu, 2004-10-21 at 14:52 -0400, Mike R wrote:


  Mike R wrote:
   I am trying to re-compile php, but keep getting erros that the mysql
   extensions are not installed.  I got the binary from php.net
  and included
   mysql in configure (following). What am I not doing correctly?
 
  You're trying to compile the binaries?

 Sorry, the tar'd file I should say.  ;p


 You probably need to do --with-mysql=/path/to/mysql/libs

 It's not finding them by itself..so you my need to be a bit more
 specific.

 ..you have mysql libs installed, right?

 -Robby

I think just doing --with-mysql=/path/to/mysql is all you need to do. Once
PHP sees the MySQL base directory it knows where the headers and libs are.



-- 
--Matthew Sims
--http://killermookie.org

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



Re: [PHP] Re-compiling PHP

2004-10-21 Thread John Nichel
Matthew Sims wrote:
I think just doing --with-mysql=/path/to/mysql is all you need to do. Once
PHP sees the MySQL base directory it knows where the headers and libs are.
Yeah, that works.  If MySQL was installed with an RPM (or some other 
package), you need the devel package as well (maybe the client and 
shared packages too)

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re-compiling PHP

2004-10-21 Thread Greg Donald
On Thu, 21 Oct 2004 15:35:09 -0400, Mike R [EMAIL PROTECTED] wrote:
 Even after re-compiling with the location of the mysql headers, it still
 won't work. :\
 
 Pretty discouraging.  What version of PHP did they start dropping the
 libraries?  Maybe I need to just upgrade to that version..

What does the --with-mysql portion of your ./configure command look like?

Do you actually have any files on your system named libmysql* ?  A
quick check on two systems I have access to, Suse 9.1 and Debain
Sarge, they are in the same place: /usr/lib/libmysqlclient*.  that
means I would have installed PHP like --with-mysql=/usr .

How is your MySQL installed?  From RPMs?  If so do you have the MySQL
development RPMs installed?  What OS are you running?

 
-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



RE: [PHP] Re-compiling PHP

2004-10-21 Thread Mike R

 On Thu, 21 Oct 2004 15:35:09 -0400, Mike R
 [EMAIL PROTECTED] wrote:
  Even after re-compiling with the location of the mysql headers, it still
  won't work. :\
 
  Pretty discouraging.  What version of PHP did they start dropping the
  libraries?  Maybe I need to just upgrade to that version..

 What does the --with-mysql portion of your ./configure command look like?

 Do you actually have any files on your system named libmysql* ?  A
 quick check on two systems I have access to, Suse 9.1 and Debain
 Sarge, they are in the same place: /usr/lib/libmysqlclient*.  that
 means I would have installed PHP like --with-mysql=/usr .

 How is your MySQL installed?  From RPMs?  If so do you have the MySQL
 development RPMs installed?  What OS are you running?

Redhat 7.3, I believe MySQL was installed with an RPM.  No, I don't have any
development RPMs installed.  Should I maybe recompile MySQL first?

Thanks,

-Mike

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



Re: [PHP] Sessions question

2004-10-21 Thread Curt Zirzow
* Thus wrote Reinhart Viane:
 PHP Code
 // Register some session variables!
 session_register('userid');
 $_SESSION['userid'] = $userid;

Do not use session_register with $_SESSION.

http://php.net/session-register

Curt
-- 
Quoth the Raven, Nevermore.

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



RE: [PHP] Re-compiling PHP

2004-10-21 Thread Robby Russell
On Thu, 2004-10-21 at 16:05 -0400, Mike R wrote:
  On Thu, 21 Oct 2004 15:35:09 -0400, Mike R
  [EMAIL PROTECTED] wrote:
   Even after re-compiling with the location of the mysql headers, it still
   won't work. :\
  
   Pretty discouraging.  What version of PHP did they start dropping the
   libraries?  Maybe I need to just upgrade to that version..
 
  What does the --with-mysql portion of your ./configure command look like?
 
  Do you actually have any files on your system named libmysql* ?  A
  quick check on two systems I have access to, Suse 9.1 and Debain
  Sarge, they are in the same place: /usr/lib/libmysqlclient*.  that
  means I would have installed PHP like --with-mysql=/usr .
 
  How is your MySQL installed?  From RPMs?  If so do you have the MySQL
  development RPMs installed?  What OS are you running?
 
 Redhat 7.3, I believe MySQL was installed with an RPM.  No, I don't have any
 development RPMs installed.  Should I maybe recompile MySQL first?
 
 Thanks,
 
 -Mike

find the mysql-devel package that matches the version you are running.

tip: download apt from freshrpms.net

http://ftp.freshrpms.net/pub/freshrpms/redhat/7.3/apt/

install the rpm for apt... then run:
apt-get update
apt-get install mysql mysql-devel

-Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
/



signature.asc
Description: This is a digitally signed message part


Re: [PHP] Re-compiling PHP

2004-10-21 Thread Greg Donald
On Thu, 21 Oct 2004 16:05:15 -0400, Mike R [EMAIL PROTECTED] wrote:
 Redhat 7.3, I believe MySQL was installed with an RPM.  No, I don't have any
 development RPMs installed.  Should I maybe recompile MySQL first?

Installing MySQL from source is an option, but installing the MySQL
development rpm is a much quicker option.

rpm -Uvh 
ftp://ftp.redhat.com/pub/redhat/linux/7.3/en/os/i386/RedHat/RPMS/mysql-devel-3.23.49-3.i386.rpm

Then run ldconfig.

Then try your PHP ./configure again.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



[PHP] I cannot move files

2004-10-21 Thread Giacomo Cantilli
Hi,

I am building a mailing list. My OS is MandrakeLinux 10.0.

I need to move an uploaded file. That's the script:

-
function show_info($file)
{
$utfn = $file['userfile']['tmp_name'];
$ufn = $file['userfile']['name'];
$dest = /home/yaki/y_uplds/ . $ufn;

if (is_uploaded_file($utfn))
echo pFile uploaded successfully./p;
else
echo pFailure in uploading/p; 

if (move_uploaded_file($utfn,$dest))// line 66
{
print File moved successfully.\n;
print_r($file);
}
else
{
print Failure in moving file.\n;
print_r($file);
}
}


safe_mode is Off in php.ini, safe_mode_gid is Off as well.
Source and destination directory have identical owner.

Those are the responses of the script:


File uploaded successfully.

 Warning: move_uploaded_file(/home/yaki/y_uplds/page01.html): failed to
open stream: Permission denied in /var/www/html/php05.php on line 66
 
 Warning: move_uploaded_file(): Unable to move '/tmp/phpoJDoSs' to
'/home/yaki/y_uplds/page01.html' in /var/www/html/php05.php on line 66

 Failure in moving file. Array ( [userfile] = Array ( [name] =
page01.html [type] = text/html [tmp_name] = /tmp/phpoJDoSs [error] =
0 [size] = 721 ) )


I suppose PHP is running as Apache module and the PHP manual tells me
that I should get appropriate permissions. At this point, after making
several attempts, I don't know how to obtain them.

Thank you in advance for your help

Giacomo Cantilli
[EMAIL PROTECTED]

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



Re: [PHP] I cannot move files

2004-10-21 Thread John Nichel
Giacomo Cantilli wrote:
 Warning: move_uploaded_file(/home/yaki/y_uplds/page01.html): failed to
open stream: Permission denied in /var/www/html/php05.php on line 66
 
 Warning: move_uploaded_file(): Unable to move '/tmp/phpoJDoSs' to
'/home/yaki/y_uplds/page01.html' in /var/www/html/php05.php on line 66

 Failure in moving file. Array ( [userfile] = Array ( [name] =
page01.html [type] = text/html [tmp_name] = /tmp/phpoJDoSs [error] =
0 [size] = 721 ) )
What are the permissions on /var/www/html?
Owner/Group of /var/www/html?
Owner/Group which Apache is running as?
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Simple Time Question

2004-10-21 Thread Marek Kilimajer
Ben Miller wrote:
Probably a stupid question, but hopefully has a simple answer.  Is there a
way to get Grenwich Mean time?  time() and date() functions that I can see
only seem to get date/time from the server, which knowing where that is,
could easily figure out GM time, but would rather go the other way.
gmdate -- Format a GMT/UTC date/time
gmmktime -- Get UNIX timestamp for a GMT date
gmstrftime --  Format a GMT/UTC time/date according to locale settings
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] I cannot move files

2004-10-21 Thread Marek Kilimajer
Apache needs write permission to /home/yaki/y_uplds/
Giacomo Cantilli wrote:
Hi,
I am building a mailing list. My OS is MandrakeLinux 10.0.
I need to move an uploaded file. That's the script:
-
function show_info($file)
{
$utfn = $file['userfile']['tmp_name'];
$ufn = $file['userfile']['name'];
$dest = /home/yaki/y_uplds/ . $ufn;

if (is_uploaded_file($utfn))
echo pFile uploaded successfully./p;
else
echo pFailure in uploading/p; 

if (move_uploaded_file($utfn,$dest))// line 66
{
print File moved successfully.\n;
print_r($file);
}
else
{
print Failure in moving file.\n;
print_r($file);
}
}


safe_mode is Off in php.ini, safe_mode_gid is Off as well.
Source and destination directory have identical owner.
Those are the responses of the script:
File uploaded successfully.
 Warning: move_uploaded_file(/home/yaki/y_uplds/page01.html): failed to
open stream: Permission denied in /var/www/html/php05.php on line 66
 
 Warning: move_uploaded_file(): Unable to move '/tmp/phpoJDoSs' to
'/home/yaki/y_uplds/page01.html' in /var/www/html/php05.php on line 66

 Failure in moving file. Array ( [userfile] = Array ( [name] =
page01.html [type] = text/html [tmp_name] = /tmp/phpoJDoSs [error] =
0 [size] = 721 ) )
I suppose PHP is running as Apache module and the PHP manual tells me
that I should get appropriate permissions. At this point, after making
several attempts, I don't know how to obtain them.
Thank you in advance for your help
Giacomo Cantilli
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php sessions question

2004-10-21 Thread Pete
In message [EMAIL PROTECTED], raditha dissanayake
[EMAIL PROTECTED] writes
Reinhart Viane wrote:

in a page checkuser i do this after the user is logged in:
  PHP Code
  // Register some session variables!
  session_register('userid');
  $_SESSION['userid'] = $userid;
  session_register('first_name');
  $_SESSION['first_name'] = $first_name;
  session_register('last_name');
  $_SESSION['last_name'] = $last_name;
  session_register('email_address');
  $_SESSION['email_address'] = $email_address;
  session_register('user_level');
  $_SESSION['user_level'] = $user_level;
  

You should only save the userId in the session, everything else should 
be retrieved from your database using that id.

I normally do as you have suggested here - but why do you suggest that
this method is better?

-- 
Pete Clark

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



[PHP] Question: Validation on select boxes and lists.

2004-10-21 Thread Stuart Felenstein
Hope this is not off topic, and it might be a dumb
question, but I'm new.
For drop down menus, list boxes, selects etc, would
validation be needed to check the string , say for
special characters ? (as a security precaution)

Thank 
Stuart 

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



RE: [PHP] Question: Validation on select boxes and lists.

2004-10-21 Thread Graham Cossey
[snip]
 Hope this is not off topic, and it might be a dumb
 question, but I'm new.
 For drop down menus, list boxes, selects etc, would
 validation be needed to check the string , say for
 special characters ? (as a security precaution)

I have read several posts/articles on this matter and although the actual
HTML form will only pass the values available, it is possible for a hacker
to compose an HTTP 'message' with data other than that provided by the HTML
form.

So, validation is advisable.

A site that I would highly recommend as it has enlightened me on several
topics is: www.shiflett.org

Graham

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



[PHP] Please Help! Call to undefined function mysql_connect()

2004-10-21 Thread Scott McDonald
Error:
Fatal error: Call to undefined function mysql_connect() in
d:\inetpub\www\test.php on line 5


System: winXPsp2
Tried:
. Re-install IIS
. Re-install PHP using installer.
. Re-install PHP using zip manual install (both ISAPI and CGI approachs)
. Re-install in Safe Mode (d'oh! no IIS in safe mode :p )

Info:
Bug reports in php.net all show that this isn't a bug, but rather
that that extention is not compiled... however, since this is IIS not
linux that's not possible. the one item I found with IIS as the OS
the only response was Man, your F**ked

Other usefull information: when i use the installer, it never
finishes. it hangs on copying php.ini (this is why i thought to
reinstall IIS)

I am at a loss... any ideas?

Thanks -Echo


Re: [PHP] Please Help! Call to undefined function mysql_connect()

2004-10-21 Thread Greg Donald
On Thu, 21 Oct 2004 16:41:28 -0500, Scott McDonald
[EMAIL PROTECTED] wrote:
 Error:
 Fatal error: Call to undefined function mysql_connect() in
 d:\inetpub\www\test.php on line 5
 
 I am at a loss... any ideas?

Did you uncomment the mysql entension in your php.ini ?


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



[PHP] PDFlib 6 and PHP 4.3.8/9

2004-10-21 Thread Brendan P. Caulfield
Hi Everyone,

I am hoping someone out there may be able to help...

I have recently installed PDFlib 6 and am running PHP 4.3.8.  I am having
trouble with the pdf_open_file() function.  I would like to create a PDF
to memory by leaving the second parameter (filename) in the above function
empty.  However, every time I do this, I get the following error message:

Warning: pdf_open_file() expects exactly 2 parameters, 1 given in xxx

This means I always have to create the PDF file before outputting it to
the browser... which is very annoying.

Has anyone else encountered this?  I have been unable to find much in the
groups to this point!

Thanks in advance for the help.

-brendan

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



RE: [PHP] Question: Validation on select boxes and lists.

2004-10-21 Thread Stuart Felenstein
Graham, 

Thank you.  Actually , you suggested this site to me
the other day and it's great! I have read through a
number of documents and have a few more to get
through.

How would a hacker pass an HTTP message ? 
That is interesting.

Stuart
--- Graham Cossey [EMAIL PROTECTED] wrote:

 [snip]
  Hope this is not off topic, and it might be a dumb
  question, but I'm new.
  For drop down menus, list boxes, selects etc,
 would
  validation be needed to check the string , say for
  special characters ? (as a security precaution)
 
 I have read several posts/articles on this matter
 and although the actual
 HTML form will only pass the values available, it is
 possible for a hacker
 to compose an HTTP 'message' with data other than
 that provided by the HTML
 form.
 
 So, validation is advisable.
 
 A site that I would highly recommend as it has
 enlightened me on several
 topics is: www.shiflett.org
 
 Graham
 
 
 

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



[PHP] mysql and the PHP transition from 4 to 5.

2004-10-21 Thread Nick Lane-Smith
Hello php-list,
I'm curious to why default mysql support was dropped from PHP 5?
The separation seems to have been done for license issues with the 
mysql library.
PHP 4.X uses a libmysql with an abandoned copyright for mysql access.

Would the libmysql still work with PHP 5, or is PHP 5 dependent on the 
Mysql AB mysqlclient library?

Are there any LGPL mysql libraries that would work with PHP 5?
thanks,
-Nick
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Question: Validation on select boxes and lists.

2004-10-21 Thread Graham Cossey
[snip]

 How would a hacker pass an HTTP message ?
 That is interesting.

read the off-list posted message from [EMAIL PROTECTED]

(reproduced below for the benefit of other list members)

Graham
--

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: 21 October 2004 23:07
To: Graham Cossey; Stuart Felenstein
Subject: RE: [PHP] Question: Validation on select boxes and lists.


 you have to remember that the user isn't really filling in a form on
your site, rather they are retrieving a page from your site,
storing it on their machine (most times temporarily in their browser)
and then sending it back to your site. if you think of it in the
latter manner you'll realized that while they have it on their
machine, the user can save and edit the form to meet their desires
before sending it back.

as such, *all* data input, (whether from a text area, pulldown,
checkbox, or radio button) should be validated on your side.

an amusing thing to do is to find a site/page that puts prices as the
values on say a pulldown or checkbox. edit these values to something
more to your liking and then submit the form. you could end up being
charged your price of choice, rather than what the site thought
they were going to charge you.

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



Re: [PHP] PDFlib 6 and PHP 4.3.8/9

2004-10-21 Thread Tom Rogers
Hi,

Friday, October 22, 2004, 7:44:37 AM, you wrote:
BPC Hi Everyone,

BPC I am hoping someone out there may be able to help...

BPC I have recently installed PDFlib 6 and am running PHP 4.3.8.  I am having
BPC trouble with the pdf_open_file() function.  I would like to create a PDF
BPC to memory by leaving the second parameter (filename) in the above function
BPC empty.  However, every time I do this, I get the following error message:

BPC Warning: pdf_open_file() expects exactly 2 parameters, 1 given in xxx

BPC This means I always have to create the PDF file before outputting it to
BPC the browser... which is very annoying.

BPC Has anyone else encountered this?  I have been unable to find much in the
BPC groups to this point!

BPC Thanks in advance for the help.

BPC -brendan


try

pdf_open_file($pdf, );

-- 
regards,
Tom

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



Re: [PHP] Help! No output from PHP CLI

2004-10-21 Thread Jason Wong
On Wednesday 20 October 2004 12:06, Warren Guy wrote:

 I'm having a strange problem with command line PHP. Scripts seem to
 function fine, however with no output.

 [EMAIL PROTECTED]:~ php
 ? echo moocows\n; ?
 ^D
 [EMAIL PROTECTED]:~

Try using ?php ... ?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
You auto buy now.
*/

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



Re: [PHP] Floating values

2004-10-21 Thread Jason Wong
On Monday 18 October 2004 19:03, Nunners wrote:

 I'm writing an accounting package, and have setup the MySQL database with
 decimal(6,2) types for the amount of transactions etc.

You should be using the bcmath functions if you aren't already doing so.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
ISO applications:
A solution in search of a problem!
*/

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



Re: [PHP] Trying to Integrate PHP 4.3.4 w/ JDK 1.5.0

2004-10-21 Thread raditha dissanayake
Andrew Hauger wrote:
Everything compiled okay, and I think everything is
installed in the right places. When I try to run a
test program, I get the error:
[error] PHP Fatal error: 
java.lang.UnsatisfiedLinkError: no php_java in
java.library.path in
/usr/local/apache/htdocs/java_test2.php on line 5

The file php_java.jar is in that directory!
 

And what is that directory? :-)
here is what worked for me http://www.raditha.com/php/java.php  i 
originally wrote it for version 1.4.2 but use thed same settings with 1.5.0


 


--
Raditha Dissanayake.

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


Re: [PHP] php sessions question

2004-10-21 Thread raditha dissanayake
Pete wrote:

 

You should only save the userId in the session, everything else should 
be retrieved from your database using that id.
   

I normally do as you have suggested here - but why do you suggest that
this method is better?
 

One reason is for security. You cannot ever rule out the possibility of 
a user injecting someone else's data into the session to get access to 
information that he should not have. Of course he can fake the userid 
too. That's why each time you retrieve the userid from the session  you 
should check if that id has been logged in. I do this (so do many 
others) by keeping two column table with session id and userid in it.



--
Raditha Dissanayake.

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


Re: [PHP] mysql and the PHP transition from 4 to 5.

2004-10-21 Thread raditha dissanayake
Nick Lane-Smith wrote:
Hello php-list,
I'm curious to why default mysql support was dropped from PHP 5?
The separation seems to have been done for license issues with the 
mysql library.
PHP 4.X uses a libmysql with an abandoned copyright for mysql access.
Suffice to say it's pretty hard to find people who speak in support of it.
Would the libmysql still work with PHP 5, or is PHP 5 dependent on the 
Mysql AB mysqlclient library?
You could compile with the 'old' mysql extension. The problem with that 
is the old client libraries do not work with the newer versions of the 
database.

Are there any LGPL mysql libraries that would work with PHP 5?
According to the mysql terms you cannot write a LGPL client library. You 
would be forced to make it a commercial license or make it GPL.
Good news is there is something better. Postgres is released under a 
freeBSD license.  It's miles ahead of mysql in which way you look at it.

thanks,
-Nick

--
Raditha Dissanayake.

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


[PHP] compileproblem gd into php4.3.9 under gentoo

2004-10-21 Thread Patrick Fehr

For the definition of some needed graphical functions,
I depend on gd compiled into php.
As I am using a linux gentoo2.6.8.1 box, I use portage for that kind.
I emerge'd php again, but with the USE-Flag +gd set, this seemed to work.

But still the function php_info(); shows that php was compiled without gd
support.

What I did:
emerge gd
emerge php (+gd)
emerge apache

do I need the flag gd-external as well or what am I doing wrong?
I tried to find a extension entry in the php.ini but all I could find was
a .dll entry, and under linux, this can't be the right thing :)


Well, I thank you for your consideration and hope to having written it
clearly enough(in a few words: gd doesn't get compiled into php, why?) and
I'm thankful for every hint

greets
Patrick

-- 
Patrick Fehr
Swiss Federal Institute Of Technology

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



[PHP] ImageMagik

2004-10-21 Thread Mag
Hi,
I have a requirment to dynamically brighten, darken or
add/remove contrast from a thumbnail image, since I
cannot do this in GD I was thinking of doing this in
ImageMagik, but searching google I cannot find many
tutorials and even visiting the image magik site i
only see that it can be used with php but no examples
were given.

Any idea of any classes that use imagemagik to do the
above or you have any code taht does the above or can
recommend some tutorials that do that above, please
reply.

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] remote file existance when protected by a .htaccess

2004-10-21 Thread Mag
 try this function, I lifted almost all of this stuff
 off of the manual
 and the zend site...

Hey!
Thanks Matt, it works like a charm!

Exactly what I was looking for, its giving me either a
200status header or a 404 and I can easily work from
there.

I have been going through the code (the curl part),
some of it seems a bit complicated and other parts
dont need an explanation... will go through the manual
when I get time, I'm trying to learn about classes and
regular expressions for now plus work on a project.

I did find some classes,code and links via google that
actually fetches the remote file but for some reason
people left out the part if you want to just verify a
file's existance...

Thanks again,
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] Best practices for php application

2004-10-21 Thread Matthew Weier O'Phinney
* Brent Baisley [EMAIL PROTECTED]:
 On Oct 21, 2004, at 12:47 PM, abrea wrote:
  Dear list,
  Does anybody know of a url where I can find reading materials about
  best practices to organize the filesystem and variable structure of
  a php application?  Although application purposes probably vary
  widely, I imagine that in one way or other most include adding,
  updating, deleting and displaying records, so there might be some
  standard or preferred procedure.
 
 That's a whopper of an open ended question. I found the biggest help 
 for me was reading up on the MVC (Model, View, Controller) technique, 
 which is probably the most commonly used design pattern for just 
 about any language.

Hear, hear! I first ran into this pattern when programming in Perl -- I
stumbled across CGI::Application, tried it out, and wondered how anybody
would program any other way. (Obligatory self-promotion: I've since
ported it to PHP -- http://freshmeat.net/projects/cgiapp/ ). 

For the OP, the basic idea behind an MVC pattern is: 

* Model -- separate code that deals with manipulating your data store
  into classes or distinct functions grouped in a file
* View -- separate code that deals solely with presentation logic (if
  the user is an administrator, show these links; otherwise, show
  these) into files of their own (or use a template engine)
* Controller -- separate code that deals with user input and validations
  into a controller.
 
Typically, your controller is either the actual script for the
application or a class that can be invoked with metadata (read:
customizable applications!). It then takes input, validates and filters
it, and passes it to the Model code. The data it receives back from the
Model is either piped directly back to the View, or acted upon and
further transformed before doing so. 

Learning to program this way is difficult at first -- it's a far cry
from opening a file, writing out a few statements, and executing it.
However, the flexibility it affords, and the maintainability, are
invaluable.

I'm not sure of any URLs to give the OP. I'd highly recommend The
Pragmatic Programmer, by Hunt and Thomas (Addison Wesley Press).
Another place to look might be the Horde's CVS collection -- to see how
other PHP programmers do it.

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



Re: [PHP] ImageMagik

2004-10-21 Thread Brian V Bonini
On Thu, 2004-10-21 at 14:07, Mag wrote:
 Hi,
 I have a requirment to dynamically brighten, darken or
 add/remove contrast from a thumbnail image, since I
 cannot do this in GD I was thinking of doing this in
 ImageMagik, but searching google I cannot find many
 tutorials and even visiting the image magik site i
 only see that it can be used with php but no examples
 were given.
 
 Any idea of any classes that use imagemagik to do the
 above or you have any code taht does the above or can
 recommend some tutorials that do that above, please
 reply.

Your looking to use the mogrify component of ImageMagick

$ mogrify -contrast (to enhance)
$ mogrify +contrast (to reduce)

You could use one of PHP's program execution functions to call mogrify
as above.

exec('mogrify -contrast' . $image . ' /dev/null 21 ');

or something like that..

-- 

s/:-[(/]/:-)/g


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

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



Re: [PHP] MySQL PHP database script PLEASE

2004-10-21 Thread Ramil Sagum
   td? echo $row[end]; ?/td
   tdA HREF=/momatlib/gendai/pdf/? echo $row[GO]; ?.pdfpdf/A/td
  /tr

replace the  above block with

td? echo $row[end]; ?/td
td
?php   if($row[GO] = 1000) {  ?
  A HREF=/momatlib/gendai/pdf/? echo $row[GO]; ?.pdfpdf/A
?php   }?
/td
/tr


ganbatte!



ramil
http://ramil.sagum.net

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



Re: [PHP] MySQL PHP database script PLEASE

2004-10-21 Thread Matthew Sims
snip

 I NEED THIS
 When GO = 1000 ), the links to PDF file are shown,
 and when GO  1000, the links to PDF file are not shown (just brank
 cells).

 So probably I need to change this part.
  tdA HREF=/momatlib/gendai/pdf/? echo $row[GO];
 ?.pdfpdf/A/td
 But dont know how to do it.

 Please help me anybody, thank you!!

My syntax may look different but it's basically the same thing.



 Here is a complete PHP (simplified version) Im using.
 --
 html
 body

 TITLEgen_search1.php/TITLE
 BODY TEXT=#00 LINK=#FF VLINK=#008040 ALINK=#FF00FF
 BASEFONT SIZE=3

 table border=1 align=center BGCOLOR=#F2FEE0
 tr
 td align=centerID/td
 td align=centerVolume/td
 td align=centerDate/td
 td align=centerTitle/td
 td align=centerAuthor/td
 td align=centerPage/td
 td align=centerPage/td
 td align=centerImage/td
 /tr

 ?
 mysql_connect(localhost,root,love);

// I hope that's not your real passwd that you just posted. :)

 mysql_select_db(gendai);
 if($go ==  
$dt ==  
$ti ==  
$au ==  
$ay == )
 {
  echo 'Please type something';
 }

/*
From the looks of the code below, these ought to be $_GET vars? Where are
they coming from? When passing variables through the URL they should be
called through the $_GET array. Variables passed through headers are
called through the $_POST vars. I'll use $_GET as I'm simpy guessing.

This also might mean that you have register_globals on in php.ini? You
should turn it off and train to use the $_GET and $_POST.

http://us2.php.net/manual/en/language.variables.external.php
http://us2.php.net/manual/en/security.registerglobals.php
*/

if (empty($_GET[go]) 
empty($_GET[dt]) 
empty($_GET[ti]) 
empty($_GET[au]) 
empty($_GET[ay])) {

  echo Please type something;


 elseif($go == % || $dt == % || $ti == % || $au == % || $ay ==
 %){
  echo 'Not Valid';
 }

} elseif ($_GET[go] == % |
  $_GET[dt] == % |
  $_GET[ti] == % |
  $_GET[au] == % |
  $_GET[ay] == %) {
  echo Not Valid;


 else{
  if($go == ){
 $go = '%';
  }
  if($dt == ){
 $dt = '%';
  }
  if($ti == ){
 $ti = '%';
  }
  if($au == ){
$au = '%';
  }
  if($ay == ){
$ay = '%';
  }

// For this part we can make it a little easier using a foreach loop.

} else {

  foreach ($_GET as $value) {
 if (empty($value)) $value = %;
  }

/*
The foreach loop will cycle through each of the values in the $_GET array
and assign it a % if it's empty
*/


 $result = mysql_query(select * from gen_table
  where GO   like '%$go%'
and ym   like '%$dt%'
and Tit  like '%$ti%'
and Aut  like '%$au%'
and Auty like '%$ay%');

// What I think you're doing is using the $_GET array to query your DB?

$result = mysql_query(select * from gen_table
  where GO like ''.$_GET[go].''
and ym like ''.$_GET[dt].''
and Tit like ''.$_GET[ti.''
and Aut like ''.$_GET[au].''
and Auty like ''.$_GET[ay].');

/*
Because $_GET is an array you need to concatenate them into the string.
Check out complex (curly) syntax:
http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex
*/


  $rows = mysql_num_rows($result);
  echo $rows,Records Availablep;

// %row is just a straight variable so you can include it in the string

echo $rows Records Availablep;


   while($row = mysql_fetch_array($result)){
   ?
   tr
   td align =rightA HREF = gen_detail.php ?id=? echo $row[ID]
 ??
 echo $row[ID]; /A/td
   td align =rightA HREF = gen_search1.php ?go=? echo $row[GO]
 ?? echo $row[GO]; /A/td
   td? echo $row[ym];  ?/td
   td width=400? echo $row[Tit]; ?/td
   td width=200? echo $row[Aut]; ?/td
   td? echo $row[sta]; ?/td
   td? echo $row[end]; ?/td
   tdA HREF=/momatlib/gendai/pdf/? echo $row[GO];
 ?.pdfpdf/A/td

Were the above $row[ID] and $row[GO] missing the semi-colon a typo?

  /tr
   ?
}

 }
 ?
 /table
 /body
 /html
 --


Not sure if I missed anything?

-- 
--Matthew Sims
--http://killermookie.org

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



RE: [PHP] php sessions question

2004-10-21 Thread Reinhart Viane

I normally do as you have suggested here - but why do you suggest that 
this method is better?
  


One reason is for security. You cannot ever rule out the possibility of 
a user injecting someone else's data into the session to get access to 
information that he should not have. Of course he can fake the userid 
too. That's why each time you retrieve the userid from the session  you 
should check if that id has been logged in. I do this (so do many 
others) by keeping two column table with session id and userid in it.

-- 
Raditha Dissanayake.

Do you have an example or dou you know of any tutorials where this
method is used?
Thx
Reinhart

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



Re: [PHP] Best practices for php application

2004-10-21 Thread Brent Clements
For a pretty cool PHP MVC Framework, check out 

http://www.phpmvc.net/

-Brent

- Original Message - 
From: Matthew Weier O'Phinney [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, October 21, 2004 9:11 PM
Subject: Re: [PHP] Best practices for php application


 * Brent Baisley [EMAIL PROTECTED]:
  On Oct 21, 2004, at 12:47 PM, abrea wrote:
   Dear list,
   Does anybody know of a url where I can find reading materials about
   best practices to organize the filesystem and variable structure of
   a php application?  Although application purposes probably vary
   widely, I imagine that in one way or other most include adding,
   updating, deleting and displaying records, so there might be some
   standard or preferred procedure.
  
  That's a whopper of an open ended question. I found the biggest help 
  for me was reading up on the MVC (Model, View, Controller) technique, 
  which is probably the most commonly used design pattern for just 
  about any language.
 
 Hear, hear! I first ran into this pattern when programming in Perl -- I
 stumbled across CGI::Application, tried it out, and wondered how anybody
 would program any other way. (Obligatory self-promotion: I've since
 ported it to PHP -- http://freshmeat.net/projects/cgiapp/ ). 
 
 For the OP, the basic idea behind an MVC pattern is: 
 
 * Model -- separate code that deals with manipulating your data store
   into classes or distinct functions grouped in a file
 * View -- separate code that deals solely with presentation logic (if
   the user is an administrator, show these links; otherwise, show
   these) into files of their own (or use a template engine)
 * Controller -- separate code that deals with user input and validations
   into a controller.
  
 Typically, your controller is either the actual script for the
 application or a class that can be invoked with metadata (read:
 customizable applications!). It then takes input, validates and filters
 it, and passes it to the Model code. The data it receives back from the
 Model is either piped directly back to the View, or acted upon and
 further transformed before doing so. 
 
 Learning to program this way is difficult at first -- it's a far cry
 from opening a file, writing out a few statements, and executing it.
 However, the flexibility it affords, and the maintainability, are
 invaluable.
 
 I'm not sure of any URLs to give the OP. I'd highly recommend The
 Pragmatic Programmer, by Hunt and Thomas (Addison Wesley Press).
 Another place to look might be the Horde's CVS collection -- to see how
 other PHP programmers do it.
 
 -- 
 Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
 Webmaster and IT Specialist   | http://www.garden.org
 National Gardening Association| http://www.kidsgardening.com
 802-863-5251 x156 | http://nationalgardenmonth.org
 
 -- 
 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