[PHP] php gallery for pictures and videos

2007-10-17 Thread zakaria ghandour

Hi,

i must create gallery (pictures and videos) in php
The user must login to see only his personal files.
There is any tool doing this.

thanks
-- 
View this message in context: 
http://www.nabble.com/php-gallery-for-pictures-and-videos-tf4638844.html#a13249060
Sent from the PHP - General mailing list archive at Nabble.com.

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



[PHP] Re: php gallery for pictures and videos

2007-10-17 Thread Colin Guthrie
zakaria ghandour wrote:
 i must create gallery (pictures and videos) in php
 The user must login to see only his personal files.
 There is any tool doing this.

Yes.

Google: php photo gallery the very first link:

http://gallery.menalto.com/

It's very good and has lots of features and as an added bonus is easy to
embed inside other PHP applications (e.g. CMSs like Joomla, Drupal etc.)

Col

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



[PHP] How to replace define in a require file with mysql?

2007-10-17 Thread Ronald Wiplinger

I have a file linked with require into my program with statements like:

define(_ADDRESS,Address);
define(_CITY,City);

I would like to replace this with a mysql table with these two fields 
(out of many other fields).


How can I do that?

bye

Ronald

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



[PHP] How to replace define in a require file with mysql?

2007-10-17 Thread Ronald Wiplinger

I have a file linked with require into my program with statements like:

define(_ADDRESS,Address);
define(_CITY,City);

I would like to replace this with a mysql table with these two fields
(out of many other fields).

How can I do that?

bye

Ronald

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



[PHP] Array problem

2007-10-17 Thread Merlin

Hi there,

I am pulling picture ids out of a db and comment ids. The comments 
belong to the pic ids and are stored in two seperate tables.
I am having trouble with the arrays to display them after pulling out of 
the db.


The data is filled like this:

while (rows etc.){
$comment_id[$row-pic_id][] = $row-comment_id;
}

The goal is to cycle through that array and display the picture followed 
by the belonging comments:


Picture ID 1
-Comment 1 to pic_id 1
-Comment 2 to pic_id 1
-Comment 3 to pic_id 1

Picture ID 2
-Comment 1 to pic_id 2
-Comment 2 to pic_id 2

That does sound easy, but unfortunatelly I could not figure it out so far.

Can somebody give me a hint on how to cycle throug the arrays, or an 
alternative way to achive my goal?


Thank you for any help.

Best regards, Merlin

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



[PHP] Sessions - Ini settings and timeout

2007-10-17 Thread Holografix
I have some questions about sessions timeout and sessions ini settings.

In php.ini I have session.gc_maxlifetime = 30 (for testing purpose only) ,
session.gc_probability = 1 and session.gc_divisor = 100 (didn't touch this 
values)

I have two simple pages


page1.php
-
session_start();
$_SESSION[test] = TEST;
a href=page2.phptest timeout/a


page2.php
=
session_start();
if (!isset($_SESSION[test]) ) {
echo no session; die();
}
print_r($_SESSION);


I open page1.php in the browser and only click in the link after waiting 
more than 30 seconds (session.gc_maxlifetime).
After this period what should happen with $_SESSION[test] in page2.php?

In php, session.gc_maxlifetime: ; After this number of seconds, stored data 
will be seen as 'garbage' and
; cleaned up by the garbage collection process.

I need to understand this and get a way to automaticly logout a user after n 
minutes of inactivity.

My environment:
Windows XP PRO SP2, apache 2.2.4, php 5.2.4 (apache module),  mysql 5.4.5


Best regards
holo

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



Re: [PHP] Sessions - Ini settings and timeout

2007-10-17 Thread Zoltán Németh
2007. 10. 17, szerda keltezéssel 11.58-kor Holografix ezt írta:
 I have some questions about sessions timeout and sessions ini settings.
 
 In php.ini I have session.gc_maxlifetime = 30 (for testing purpose only) ,
 session.gc_probability = 1 and session.gc_divisor = 100 (didn't touch this 
 values)
 
 I have two simple pages
 
 
 page1.php
 -
 session_start();
 $_SESSION[test] = TEST;
 a href=page2.phptest timeout/a
 
 
 page2.php
 =
 session_start();
 if (!isset($_SESSION[test]) ) {
 echo no session; die();
 }
 print_r($_SESSION);
 
 
 I open page1.php in the browser and only click in the link after waiting 
 more than 30 seconds (session.gc_maxlifetime).
 After this period what should happen with $_SESSION[test] in page2.php?
 
 In php, session.gc_maxlifetime: ; After this number of seconds, stored data 
 will be seen as 'garbage' and
 ; cleaned up by the garbage collection process.
 
 I need to understand this and get a way to automaticly logout a user after n 
 minutes of inactivity.

session.gc_maxlifetime is not what you are looking for. it works like at
every request there is a 1/100 chance
(session.gc_probability/session.gc_divisor) that the garbage collector
will run. if it runs, and finds session data older than
session.gc_maxlifetime, that is cleaned up.

in order to achieve what you want you should store a 'last action'
timestamp or something like that in the session, and upon each request
check how many seconds passed since that timestamp and decide session
validity based on that. eg:

session_start();
if ($_SESSION['last_action_timestamp'] - time()  $max_lifetime)
{
// session expired
}
else
{
$_SESSION['last_action_timestamp'] = time();
}

greets
Zoltán Németh

 
 My environment:
 Windows XP PRO SP2, apache 2.2.4, php 5.2.4 (apache module),  mysql 5.4.5
 
 
 Best regards
 holo
 

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



Re: [PHP] Array problem

2007-10-17 Thread Zoltán Németh
2007. 10. 17, szerda keltezéssel 13.08-kor Merlin ezt írta:
 Hi there,
 
 I am pulling picture ids out of a db and comment ids. The comments 
 belong to the pic ids and are stored in two seperate tables.
 I am having trouble with the arrays to display them after pulling out of 
 the db.
 
 The data is filled like this:
 
 while (rows etc.){
   $comment_id[$row-pic_id][] = $row-comment_id;
 }
 
 The goal is to cycle through that array and display the picture followed 
 by the belonging comments:
 
 Picture ID 1
 -Comment 1 to pic_id 1
 -Comment 2 to pic_id 1
 -Comment 3 to pic_id 1
 
 Picture ID 2
 -Comment 1 to pic_id 2
 -Comment 2 to pic_id 2
 
 That does sound easy, but unfortunatelly I could not figure it out so far.
 
 Can somebody give me a hint on how to cycle throug the arrays, or an 
 alternative way to achive my goal?

something like

$pic_ids = array_keys($comment_id);
foreach ($pic_ids as $pic_id) {
// echo image tag or what you want
foreach ($comment_id[$pic_id] as $comment) {
// echo comment or what you want
}
}

greets
Zoltán Németh

 
 Thank you for any help.
 
 Best regards, Merlin
 

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



Re: [PHP] How to replace define in a require file with mysql?

2007-10-17 Thread Richard Heyes

I have a file linked with require into my program with statements like:

define(_ADDRESS,Address);
define(_CITY,City);

I would like to replace this with a mysql table with these two fields
(out of many other fields).

How can I do that?


I'm not aware of any method of undefining an already defined constant. 
Except changing the line in your required file...


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Which PHP-Editor to use?

2007-10-17 Thread Jason Pruim


On Oct 16, 2007, at 5:26 PM, Matt Livingston wrote:


That is why I believe in a disposable system

I have 2 main computers, one running XP and the other running  
Ubuntu Linux.
I make regular backups to secure server online via FTP and  
regularly burn
backups to CD.  At any time if I got a virus that was by some  
(small) chance
powerful enough to cause damage to my PC that could not easily be  
cleaned up
- I would simply reformat the HD and reinstall the OS ;) (and that  
process
of reformatting and reinstalling takes a mere 30 minutes to 2 hours  
- latter

being the Windows and former being Ubuntu)

-Matt


Just another reason I'm glad I have a Mac :) No virus to worry about :)



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



RE: [PHP] Array problem

2007-10-17 Thread Ford, Mike
On 17 October 2007 12:09, Merlin wrote:

 Hi there,
 
 I am pulling picture ids out of a db and comment ids. The comments
 belong to the pic ids and are stored in two seperate tables.
 I am having trouble with the arrays to display them after
 pulling out of
 the db.
 
 The data is filled like this:
 
 while (rows etc.){
   $comment_id[$row-pic_id][] = $row-comment_id;
 }
 
 The goal is to cycle through that array and display the
 picture followed
 by the belonging comments:
 
 Picture ID 1
 -Comment 1 to pic_id 1
 -Comment 2 to pic_id 1
 -Comment 3 to pic_id 1
 
 Picture ID 2
 -Comment 1 to pic_id 2
 -Comment 2 to pic_id 2
 
 That does sound easy, but unfortunatelly I could not figure
 it out so far.
 
 Can somebody give me a hint on how to cycle throug the arrays, or an
 alternative way to achive my goal?

Something like this should work:

  foreach ($comment_id as $pic_id=$comment_ids):
echo Start of information for picture $pic_id;
foreach ($comment_ids as $com_id):
  echo Comment $com_id for picture $pic_id;
endforeach;
  endforeach;

Cheers!

Mike

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


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

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



[PHP] Security Question

2007-10-17 Thread Andrew Peterson
Does anyone know a good way to protect a directory that a php script NEEDS
to write too?

What I'm doing now:

1. create a directory manually myDir
2. chmod 777 myDir
3. password protect the directory with htaccess

Is this the best way, or is there something better?

Also, is there a way to mkdir or fopen a file dynamically, without
pre-creating a directory with 777 permissions?

Thanks for the help,
Andrew


Re: [PHP] Security Question

2007-10-17 Thread Richard Heyes

Does anyone know a good way to protect a directory that a php script NEEDS
to write too?

What I'm doing now:

1. create a directory manually myDir
2. chmod 777 myDir
3. password protect the directory with htaccess

Is this the best way, or is there something better?


You could chmod the file/directory to 700 and change the owner to that 
of the webserver (presumably the script is being run via the webserver). 
This has the drawback that anything run from the webserver will have 
write access to the files.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Sessions - Ini settings and timeout

2007-10-17 Thread Holografix
Many thanks Zoltán.

It's clear now
One more thing: session.cookie_lifetime defaults to 0 (until browser is 
closed).
if setting session.cookie_lifetime to 60 can I look for 
$_SESSION[session_name()] in every request ?

best regards
holo


Zoltán Németh [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 2007. 10. 17, szerda keltezéssel 11.58-kor Holografix ezt írta:
 I have some questions about sessions timeout and sessions ini settings.

 In php.ini I have session.gc_maxlifetime = 30 (for testing purpose only) 
 ,
 session.gc_probability = 1 and session.gc_divisor = 100 (didn't touch 
 this
 values)

 I have two simple pages


 page1.php
 -
 session_start();
 $_SESSION[test] = TEST;
 a href=page2.phptest timeout/a


 page2.php
 =
 session_start();
 if (!isset($_SESSION[test]) ) {
 echo no session; die();
 }
 print_r($_SESSION);


 I open page1.php in the browser and only click in the link after waiting
 more than 30 seconds (session.gc_maxlifetime).
 After this period what should happen with $_SESSION[test] in page2.php?

 In php, session.gc_maxlifetime: ; After this number of seconds, stored 
 data
 will be seen as 'garbage' and
 ; cleaned up by the garbage collection process.

 I need to understand this and get a way to automaticly logout a user 
 after n
 minutes of inactivity.

 session.gc_maxlifetime is not what you are looking for. it works like at
 every request there is a 1/100 chance
 (session.gc_probability/session.gc_divisor) that the garbage collector
 will run. if it runs, and finds session data older than
 session.gc_maxlifetime, that is cleaned up.

 in order to achieve what you want you should store a 'last action'
 timestamp or something like that in the session, and upon each request
 check how many seconds passed since that timestamp and decide session
 validity based on that. eg:

 session_start();
 if ($_SESSION['last_action_timestamp'] - time()  $max_lifetime)
 {
 // session expired
 }
 else
 {
 $_SESSION['last_action_timestamp'] = time();
 }

 greets
 Zoltán Németh


 My environment:
 Windows XP PRO SP2, apache 2.2.4, php 5.2.4 (apache module),  mysql 5.4.5


 Best regards
 holo
 

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



Re: [PHP] Why $_REQUEST do the same thing as mysql_escape_string()

2007-10-17 Thread Eric Butera
On 10/17/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 I put some thing in an form input filed like this:
 '  \
 then submit to a php script.
 When use $_GET / $_POST / $_REQUEST to get the value,
 I always get:
 \' \ \\
 In php expression it should be:
 $_REQUEST['field'] = \\' \\\ ;

 Any one who can tell me why?


magic_quotes_gpc

Also it doesn't necessarily do the same thing.
mysql_real_escape_string() takes into consideration character sets.

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



[PHP] Why $_REQUEST do the same thing as mysql_escape_string()

2007-10-17 Thread truncatei
I put some thing in an form input filed like this:
'  \
then submit to a php script.
When use $_GET / $_POST / $_REQUEST to get the value,
I always get:
\' \ \\
In php expression it should be:
$_REQUEST['field'] = \\' \\\ ;

Any one who can tell me why?


Re: [PHP] Security Question

2007-10-17 Thread Jim Lucas

Andrew Peterson wrote:

Does anyone know a good way to protect a directory that a php script NEEDS
to write too?

What I'm doing now:

1. create a directory manually myDir
2. chmod 777 myDir
3. password protect the directory with htaccess

Is this the best way, or is there something better?

Also, is there a way to mkdir or fopen a file dynamically, without
pre-creating a directory with 777 permissions?

Thanks for the help,
Andrew

Along with what Richard said, you could also move the directory outside of the webroot and not have 
to worry about the .htaccess file.  Nothing but PHP could access the directory contents, and only 
through your interface could it be access.


--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] php gallery for pictures and videos

2007-10-17 Thread Jim Lucas

zakaria ghandour wrote:

Hi,

i must create gallery (pictures and videos) in php
The user must login to see only his personal files.
There is any tool doing this.

thanks

the answer you seek is in the words of your question

google: php gallery

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] How to replace define in a require file with mysql?

2007-10-17 Thread Jim Lucas

Ronald Wiplinger wrote:

I have a file linked with require into my program with statements like:

define(_ADDRESS,Address);
define(_CITY,City);

I would like to replace this with a mysql table with these two fields 
(out of many other fields).


How can I do that?

bye

Ronald


Well, if you have all the settings in a DB already, then what I would do is 
this.

SELECT param_name, param_value FROM yourTable;

then

while ( list($name, $value) = mysql_fetch_row($results_handler) ) {
define($name, $value);
}

put this in place of your existing defines and you should be good.

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Sessions - Ini settings and timeout

2007-10-17 Thread Casey
You could set $_SESSION['lasttime'] to time() and check it on every  
page.




On Oct 17, 2007, at 3:58 AM, Holografix [EMAIL PROTECTED] wrote:

I have some questions about sessions timeout and sessions ini  
settings.


In php.ini I have session.gc_maxlifetime = 30 (for testing purpose  
only) ,
session.gc_probability = 1 and session.gc_divisor = 100 (didn't  
touch this

values)

I have two simple pages


page1.php
-
session_start();
$_SESSION[test] = TEST;
a href=page2.phptest timeout/a


page2.php
=
session_start();
if (!isset($_SESSION[test]) ) {
   echo no session; die();
}
print_r($_SESSION);


I open page1.php in the browser and only click in the link after  
waiting

more than 30 seconds (session.gc_maxlifetime).
After this period what should happen with $_SESSION[test] in  
page2.php?


In php, session.gc_maxlifetime: ; After this number of seconds,  
stored data

will be seen as 'garbage' and
; cleaned up by the garbage collection process.

I need to understand this and get a way to automaticly logout a user  
after n

minutes of inactivity.

My environment:
Windows XP PRO SP2, apache 2.2.4, php 5.2.4 (apache module),  mysql  
5.4.5



Best regards
holo

--
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] Which PHP-Editor to use?

2007-10-17 Thread Matt Arnilo S. Baluyos (Mailing Lists)
Does Eclipse already have word-wrap?

To my disappointment, it was still lacking that basic functionality
the last time I tried it.


On 8/3/07, Nathan Nobbe [EMAIL PROTECTED] wrote:
 eclipse with php eclipse, but i may be switching to eclipse pdt once it
 becomes stable if there is no support for xdebug in php eclipse when it
 does.

 -nathan

 On 8/2/07, Merlin [EMAIL PROTECTED] wrote:
 
  Hi there,
 
  I have worked now for several years happily with homesite 4.5, but now
  it looks like I have to switch to another system as homesite will not
  run without admin rights on a XP machine.
 
  What editors do you use? Do you have any recomendations on a special
  one? I have looked into eclipse, but I would hear from your experience
  which one would you recommend me to switch to?
 
  Thank you for any comment.
 
  Best regards,
 
  Merlin

-- 
Stand before it and there is no beginning.
Follow it and there is no end.
Stay with the ancient Tao,
Move with the present.

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



Re: [PHP] Which PHP-Editor to use?

2007-10-17 Thread Matt Arnilo S. Baluyos (Mailing Lists)
On 10/18/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 2007/10/18, Matt Arnilo S. Baluyos (Mailing Lists)
 [EMAIL PROTECTED]:
  Does Eclipse already have word-wrap?
 
  To my disappointment, it was still lacking that basic functionality
  the last time I tried it.

 PHP Eclipse's auto format code?

Hmmm. Not so sure if that's the name they use for such feature. But
something that does basic word-wrapping for Eclipse.

-- 
Stand before it and there is no beginning.
Follow it and there is no end.
Stay with the ancient Tao,
Move with the present.

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