Re: [PHP] html area

2006-02-28 Thread Robert Cummings
On Tue, 2006-02-28 at 02:58, 2wsxdr5 wrote:
> I am looking for a simple html area text area type editor, similar to to 
> what you find in the phpbbs and Joomla.  I don't need a lot of features 
> it is just to edit small snipits of html and I really want it to be very 
> simple to implement.  I have been looking for the past few hours and so 
> far everything seems way more complex than what I need and a pain to set 
> up.  Any recommendations would be appreciated

FCKEditor was a pretty simple to integrate into a CMS. I had to edit
some of the code to segregate image uploads on an article by article
basis with permissions blocking, but all in all a decent experience.

They have good separation of the configuration system such that you can
override configuration settings in several different ways to suit your
needs. The only part that was a bit questionable was configuring their
PHP scripts that hook into their dialogs (such as the filemanager).

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] HOW update time and date-fields to mysql....

2006-02-28 Thread Gustav Wiberg

Hi there guys!

I have used a date-field and a time-field in a mysql-database.

How should I update these fields through php?
This is my code now (it works fine locally with data on a win-machine, but 
not on Linux at my webhotel - Time doesn't work at all)



function safeQuote($value)
{
  // Stripslashes
  if (get_magic_quotes_gpc()) {
  $value = stripslashes($value);
  }
  // Quote if not integer
  if (!is_numeric($value)) {
  $value = "'" . mysql_real_escape_string($value) . "'";
  }

  return $value;
}


$sql = "UPDATE tbforum SET";
$sql .= " question=" . safeQuote($frmQuestion);
$sql .= ", insertDate='" . $dat . "'";
$sql .= ", insertTime='" . time() . "'";
$sql .= " WHERE IDForum=" . safeQuote($idForum);
$querys = mysql_query($sql);

/G 


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



Re: [PHP] HOW update time and date-fields to mysql....

2006-02-28 Thread Robin Vickery
On 28/02/06, Gustav Wiberg <[EMAIL PROTECTED]> wrote:
> Hi there guys!
>
> I have used a date-field and a time-field in a mysql-database.
>
> How should I update these fields through php?
> This is my code now (it works fine locally with data on a win-machine, but
> not on Linux at my webhotel - Time doesn't work at all)

Doesn't work on Linux in what way?

Have you tried printing out $sql? Does it contain what you expected?

Does the mysql_query() succeed? what does mysql_error() tell you about
what went wrong?

I'd be absolutely amazed if time() really doesn't work.

I'm *guessing* that as you're running stripslashes() on these
variables, you're running your local machine with register_globals set
on, but the Linux machine has register_globals turned off.

  -robin


Re: [PHP] Re: Strange slowdowns in PHP

2006-02-28 Thread William Lovaton
Ohhh I see now.  Yes, it should be putting things into a buffer before
sending the data to the client.  I guess shutdown function executes
after the content have been sent.

My users are usually working on LAN connections but sometimes there are
network problems and this could be one of the symptoms. 

Cheers,

-William

El lun, 27-02-2006 a las 19:32 -0300, Manuel Lemos escribió:
> Hello,
> 
> What I am trying to tell you is that generating data and serving it to
> the user browser are to separate steps. The output that your PHP script
> produces goes to a buffer that needs to be flushed after the script
> ends. I suppose you are serving data to users with slow connections.
> That would explain why you have the problem some times but not always.
> 
> 
> -- 
> 
> Regards,
> Manuel Lemos
> 
> Metastorage - Data object relational mapping layer generator
> http://www.metastorage.net/
> 
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
> 

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



Re: [PHP] HOW update time and date-fields to mysql....

2006-02-28 Thread matt stone
On 2/28/06, Gustav Wiberg <[EMAIL PROTECTED]> wrote:
>
> Hi there guys!
>
> I have used a date-field and a time-field in a mysql-database.
>
>
>
>
> $sql = "UPDATE tbforum SET";
> $sql .= " question=" . safeQuote($frmQuestion);
> $sql .= ", insertDate='" . $dat . "'";
> $sql .= ", insertTime='" . time() . "'";
> $sql .= " WHERE IDForum=" . safeQuote($idForum);
> $querys = mysql_query($sql);



Use NOW() for both your date and time fields if the fields have been set up
as that. MySQL will then add the date and time according to whatever those
values are on your db machine.

Cheers
Matt


[PHP] About date & time...

2006-02-28 Thread Gustav Wiberg

Hi

Thanx for your input about date & time...

Here's some functions that worked for me after some searching...


function currenttime() {

$today = getdate();

$ithours = $today["hours"];
if (intval($ithours)<10) {
 $ithours = "0" . $ithours;
}

$itminutes = $today["minutes"];
if (intval($ithours)<10) {
 $ithours = "0" . $ithours;
}

$itseconds = $today["seconds"];
if (intval($itseconds)<10) {
 $itseconds = "0" . $itseconds;
}


$it = $ithours . ":" . $itminutes . ":" . $itseconds;
return $it;
}

function currentdate() {

$today = getdate();

$idyear = $today["year"];
if (intval($idyear)<10) {
 $idyear = "0" . $idyear;
}

$idmonthnr = $today["mon"];
if (intval($idmonthnr )<10) {
 $idmonthnr  = "0" . $idmonthnr ;
}

$idmonthday = $today["mday"];
if (intval($idmonthday)<10) {
 $idmonthday = "0" . $idmonthday;
}


$id = $idyear . "-" . $idmonthnr . "-" . $idmonthday;
return $id;

}

$insertTime = currenttime();
$insertDate = currentdate();



/G

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



[PHP] Re: About date & time...

2006-02-28 Thread Barry

Gustav Wiberg wrote:

Hi

Thanx for your input about date & time...

Here's some functions that worked for me after some searching...


function currenttime() {

$today = getdate();

$ithours = $today["hours"];
if (intval($ithours)<10) {
 $ithours = "0" . $ithours;
}

$itminutes = $today["minutes"];
if (intval($ithours)<10) {
 $ithours = "0" . $ithours;
}

$itseconds = $today["seconds"];
if (intval($itseconds)<10) {
 $itseconds = "0" . $itseconds;
}


$it = $ithours . ":" . $itminutes . ":" . $itseconds;
return $it;
}

function currentdate() {

$today = getdate();

$idyear = $today["year"];
if (intval($idyear)<10) {
 $idyear = "0" . $idyear;
}

$idmonthnr = $today["mon"];
if (intval($idmonthnr )<10) {
 $idmonthnr  = "0" . $idmonthnr ;
}

$idmonthday = $today["mday"];
if (intval($idmonthday)<10) {
 $idmonthday = "0" . $idmonthday;
}


$id = $idyear . "-" . $idmonthnr . "-" . $idmonthday;
return $id;

}

$insertTime = currenttime();
$insertDate = currentdate();



/G

OMG >_<

There are lotsa functions like date and so

Also > $idmonthday = "0" . $idmonthday; < This is totally crap >_<

Therefor is the sprintf function ...

I know it works, but well. if noone wants to check the manual for better 
functions.. Your choice


--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] About date & time...

2006-02-28 Thread Andrei
I don't understand! Why don't u use date function and just format it as 
u want?


Andy

Gustav Wiberg wrote:

Hi

Thanx for your input about date & time...

Here's some functions that worked for me after some searching...


function currenttime() {

$today = getdate();

$ithours = $today["hours"];
if (intval($ithours)<10) {
 $ithours = "0" . $ithours;
}

$itminutes = $today["minutes"];
if (intval($ithours)<10) {
 $ithours = "0" . $ithours;
}

$itseconds = $today["seconds"];
if (intval($itseconds)<10) {
 $itseconds = "0" . $itseconds;
}


$it = $ithours . ":" . $itminutes . ":" . $itseconds;
return $it;
}

function currentdate() {

$today = getdate();

$idyear = $today["year"];
if (intval($idyear)<10) {
 $idyear = "0" . $idyear;
}

$idmonthnr = $today["mon"];
if (intval($idmonthnr )<10) {
 $idmonthnr  = "0" . $idmonthnr ;
}

$idmonthday = $today["mday"];
if (intval($idmonthday)<10) {
 $idmonthday = "0" . $idmonthday;
}


$id = $idyear . "-" . $idmonthnr . "-" . $idmonthday;
return $id;

}

$insertTime = currenttime();
$insertDate = currentdate();



/G



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



Re: [PHP] Fw: 参加してみませんか?

2006-02-28 Thread Barry
Andrei wrote:
> u... Nice... I would agree if I would understand something... lol
> 
> Andy
> 
> sns-コミュニティー wrote:
> 
>>■□■ コミュニティー・エンターテイメント ■□■
>>□■□ ソーシャルネットワーキングサイトに参加してみませんか? □■□
>>
>>メンバーより招待された方のみで構成されている為、安心快適!!
>>ポイント代・料金等は一切御座いません。全て無料でお使いになれます!
>>
>>http://tada-asobi.com/tada/keijiban3/
>>テレビ・雑誌で話題!有名芸能人のブログ、写真等を全て無料でご覧になれます!
>>
>>■これまでの友人関係を活性化できる
>>信頼できる旧知の友人、お知り合いとのお付き合いの活性化を図るさまざまな
>>ツールをご用意しています。
>>
>>■「友人の友人」と交流できる・芸能人、アイドル、俳優と友達になれる!
>>
>>友人同士のネットワークをたどって「友人の友人」との交流が
>>簡単にできます。そこにはあなたの友人から繋がる信頼できるネットワークが
>>形成されています。どこかで繋がっている人同士が集まるコミュニティー
>>であり、これがソーシャルネットワーキングの特徴です。
>>
>>テレビ・雑誌で話題!ご利用料金・登録料は一切御座いません!全て無料でお使いになれます。
>>
>>情報・コミュニティーに最適!
>>http://tada-asobi.com/tada/keijiban3/
>>それでは、参加を心よりお待ちしております。
>>※2006/03/06まで有効

Lol its just plain spam mail xD

You can get some shitn crap if you go to the site and apply to some
stupid stuff.

And guess what you get, a whole bunch of nonsense!


quick quick ;)
-- 
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] More CLASS help

2006-02-28 Thread Jason Gerfen

I am not sure if what I am doing here is a problem or not.  Pointers?

class mySubnet
{
var $data;
function SubnetSettings( $level, $add_vlan, $edit_vlan, $del_vlan ) {
   $subnets = new mySubnet;
}
}

--
Jason Gerfen

"When asked what love is:
Love is the Jager talking."
~Craig Baldo

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



RE: [PHP] More CLASS help

2006-02-28 Thread jblanchard
[snip]
I am not sure if what I am doing here is a problem or not.  Pointers?

class mySubnet
{
 var $data;
 function SubnetSettings( $level, $add_vlan, $edit_vlan, $del_vlan ) {
}
}
[/snip]

Call the constructor outside of the class.

$subnets = new mySubnet; 

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



[PHP] usort(): The argument should be an array

2006-02-28 Thread Remember14a
Can anyone comment and fix this error

Warning: usort(): The argument should be an array in 
/home2/wwwabcde/public_html/search/searchfuncs.php on line 300

below is part of the code which gives this error, the line highlighted in red 
is the point where error is pointing, 
--

$row[4];

   $res[$i]['size'] = $row[5];

   $res[$i]['weight'] = $result_array[$row[0]];

   $i++;

  }
  usort($res, "cmp"); 

  echo mysql_error();

  $res['maxweight'] = $maxweight;

  $res['results'] = $results;

  return $res;

 /**/

 }

?>


Re: [PHP] About date & time...

2006-02-28 Thread tedd

Thanx for your input about date & time...

Here's some functions that worked for me after some searching...

function currenttime() {

-snip- lot's of code.


Hi Gustav:

Not meaning to embarrass, but your code could be shortened 
considerably by using date(), like so:


Your lengthy  -- function currenttime()

can be replaced simply with:

   echo("Date: " . date('Y\-\ m\-\ d') . "" );

and your -- function currentdate()

can be replaced with:

echo("Time: " . date('h\:\ i\:\ s') . "" );

If you don't like the spaces in the output, then strip them out, like so:

$date = date('Y\-\ m\-\ d');
$date = str_replace(" ", "", $date);
echo("Date: " . $date. "" );

and

$date = date('h\:\ i\:\ s') ;
$date = str_replace(" ", "", $date);
echo("Time: " . $date. "" );

You can find more code examples at:

http://www.weberdev.com/AdvancedSearch.php?searchtype=title&search=date&Submit1.x=0&Submit1.y=0


tedd

--

http://sperling.com

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



Re: [PHP] More CLASS help

2006-02-28 Thread Jochem Maas

Jason Gerfen wrote:

I am not sure if what I am doing here is a problem or not.  Pointers?


pointers don't 'exist' in php (like they do in C) - oh crap, you meant
'pointers' in the general english language sense.

the question would be what are you trying to do?



class mySubnet
{
var $data;
function SubnetSettings( $level, $add_vlan, $edit_vlan, $del_vlan ) {
   $subnets = new mySubnet;


as Jay B. pointed out - you probably want to be creating an object of mySubnet
in code that occurs somewhere outside of the class definition


}
}



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



Re: [PHP] usort(): The argument should be an array

2006-02-28 Thread Robin Vickery
On 28/02/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Can anyone comment and fix this error
> 
> Warning: usort(): The argument should be an array in
> /home2/wwwabcde/public_html/search/searchfuncs.php on line 300

[...]

>   usort($res, "cmp");

Put a print_r($res) above this line and see what the contents of $res
are. Whatever it is, it's not an array.  Probably because your mysql
result set is empty and you forgot to initialise $res before you
looped through it (assuming the junk above is the tail end of a loop).

  -robin


[PHP] usort(): The argument should be an array

2006-02-28 Thread Remember14a
No this doesnt solve error.
let me give you more details to understand problem with the said code.

go to this link, please.

http://www.abcdefg.us/search/search.php

in search enter, 
Justice, you get response without an error.

Now enter law,

you get error, pasted below,

Warning: usort(): The argument should be an array in 
/home2/wwwabcde/public_html/search/searchfuncs.php on line 300
--
below is part of the code and few lines of code above and below the error 
point, as the code is more tha 300 lies I had to paste tail  end of code at the 
point of error.
  --

$row[4];

   $res[$i]['size'] = $row[5];

   $res[$i]['weight'] = $result_array[$row[0]];

   $i++;

  }
  usort($res, "cmp"); 

  echo mysql_error();

  $res['maxweight'] = $maxweight;

  $res['results'] = $results;

  return $res;

 /**/

 }

?>


Re: [PHP] Re: URL output query

2006-02-28 Thread Rafael

Chris wrote:

Rafael wrote:


Hi Chris,
if the only thing you want is to get the domain (having the whole 
URL) you have more than one way to solve it.  Chris -it's a little 
akward that Chris answered to Chris- already told you about 
parse_url(), and since we're talking about strings, I would suggest 
something like

  $domain = preg_replace('{^([a-z]+://[^/]+).*$}X', '%1', $uri);


We are two different people !? Not sure how that's difficult.


	Did I say difficult?  What I meant is that seing a question from Chris, 
immediately followed by a message from Chris leds to think it's an 
"extension" of the question (maybe something he forgot, or something 
new), but it wasn't, it was an answer from (a different) Chris, hence a 
little akward.

--I hope this makes things clear for you.

I don't know why you'd use a regular expression when you can use a 
function instead (easier to maintain, it'll be faster, you won't make a 
mistake)...


	What I sent was a way to get what he wants in 1 function call.  You 
should understand that preg_* family functions are just like str_* 
family functions, they work with strings, it's as simple as that -and 
yes, they're functions too.


	Now, probably parse_url() relies in preg_* or ereg_* functions -that 
wouldn't be rare-, so I don't think parse_url() would be faster than 
preg_replace(), and even if it is the difference would be meaningless; 
and neither I see how writing more lines would be faster.  I also would 
like to know how the use of parse_url() would guarantee that he won't 
make a mistake.


	Man, I can only conclude you've satanized preg_* functions because of a 
lack of knowledge, and I suggest you to investigate more about them, 
they're quite useful the same for easy and complex tasks.  Someone said 
once that you don't know the power of regexp until you know them, and 
that's definetely true.



But of course there is always more than one way to solve a problem.


	Agreed, so Chris may consider whatever he likes the most.  If he, like 
you, thinks that regular expressions are too complex and don't like the 
idea of knowing them, then he will most likely choose parse_url() -which 
is just fine.

--
Atentamente,
J. Rafael Salazar Magaña
Innox - Innovación Inteligente
Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE
http://www.innox.com.mx

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



Re: [PHP] usort(): The argument should be an array

2006-02-28 Thread Thorsten Suckow-Homberg



$row[4];

  $res[$i]['size'] = $row[5];

  $res[$i]['weight'] = $result_array[$row[0]];

  $i++;

 }
 usort($res, "cmp"); 


 echo mysql_error();

 $res['maxweight'] = $maxweight;

 $res['results'] = $results;

 return $res;

/**/

}

?>

 

That's not enough, we need the part that sits above and in between the 
brace where $res gets filled.

You could also put mysql_error(); above the usort-statement.
Is it possible that $res has once been the return-value of mysql_query() ?

Don't forget to var_dump() your values _before_ the error can occur.

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



[PHP] Re: usort(): The argument should be an array

2006-02-28 Thread Robin Vickery
On 28/02/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> No this doesnt solve error.
> let me give you more details to understand problem with the said code.
>
> go to this link, please.
>
> http://www.abcdefg.us/search/search.php
>
> in search enter,
> Justice, you get response without an error.
>
> Now enter law,
>
> you get error, pasted below,
>
> Warning: usort(): The argument should be an array in
> /home2/wwwabcde/public_html/search/searchfuncs.php on line
> 300

Yeah, sure.

So you know $res *isn't* an array, which is why you're getting the
warning that  "The argument should be an array".

So you need to find out what *is* in $res, which is why I suggested
the print_r().

Now do a var_dump($res) and see what *is* in $res. Then you'll have to
work out *why* it's not an array - and the answer to that is somewhere
in those 300 lines of code you can't post.

The few lines at the end of the loop seem to be treating $res as an
array. But as it's *not* an array, either those lines aren't being
executed or you've initialised $res to something silly beforehand,
like a string.

  -robin


[PHP] Session problem when upgrading from 4 to 5.

2006-02-28 Thread Matthijs Dijkstra
Hi,

Unfortunately it is not possible (for me) to initialise the 'session.save_path' 
directive in PHP 5. Up to version 4.3.5. there was no problem and the directive 
was set to '/tmp'. After upgrading to 5.0.2. and later to 5.1.2. I did not 
succeed in initialising the directive. 

/usr/local/lib/php/php.ini:
session.save_path = "/tmp"

Configuration history related to the 'session.save_path' directive:
PHP Version 4.0.0/tmpgood
PHP Version 4.3.5/tmpgood
PHP Version 5.0.2no valuewrong
PHP Version 5.1.2no valuewrong
Checked with phpinfo().

I have checked the NEWS file and found two remarks concerning the save_path 
directive:
- Fixed bug #33072 (Add a safemode/open_basedir check for runtime
"session.save_path" change using session_save_path() function). (Rasmus)
- Fixed bug #33520 (crash if safe_mode is on and session.save_path is changed).
(Dmitry)

So my question is: Is it possible to define the directive 'session.save_path' 
in PHP 5 in the php.ini file?

Matthijs Dijkstra

Re: [PHP] Re: How can I stop PHP from resolving symlinks?

2006-02-28 Thread Roy Souther




It is and the key word here is "Follow" as in resolve the real file location before parsing. 

This is clearly an Apache problem. I have asked this question on a few Apache forums and lists now and have not had any response.

Is there any way to make Apache parse the files where it finds them and not go looking for the real file?

On Thu, 2006-02-23 at 15:59 -0700, Joel Leibow wrote:


You need to check your httpd.conf and make sure the "Options FollowSymLinks" 
is set for the server.  Check the apache documentation for further 
information.

Joel Leibow

"Roy Souther" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
I am trying to stop PHP from resolving symlinks. I have a PHP CMS that I use 
to host dozens of sites using Apache virtual hosting features. I need all 
the sites to run the exact same PHP CMS code but use their unique 
directories to host the different config files. The problem is that the PHP 
scripts are running from the directory that the links point to and not the 
directory where the site is. The big problem with that is the CMS tries to 
read a configuration file that is in a relative location to the PHP script 
like ../config.php.

[EMAIL PROTECTED] ls -l /usr/local/cms
-rw-r--r--  1 user users 20 Jan 16 02:17 index.php
drwxr-xr-x  9 user users 4096   Feb 22 16:40 admin
[EMAIL PROTECTED] ls -l /vhost/test01.com/var/www/html/
-rw-r--r--  1 user users 20 Jan 16 02:17 config.php
lrwxrwxrwx  1 root root  31 Feb 22 14:05 index.php -> 
/usr/local/cms/index.php
lrwxrwxrwx  1 root root  31 Feb 22 14:05 admin -> 
/usr/local/cms/admin
[EMAIL PROTECTED] cd /vhost/test01.com/var/www/html/admin/
[EMAIL PROTECTED] pwd
/vhost/test01.com/var/www/html/admin
[EMAIL PROTECTED]

Bash is doing what I need. It sees the current directory as the full path of 
the symlink.

The admin.php at this point only has system("pwd"); in it and it prints out 
/usr/local/cms/admin as the directory it is in, not what I want. It will 
never see the ../config.php file.

I tried doing this
chdir ($_SERVER[DOCUMENT_ROOT]."/".$_SERVER[REQUEST_URI]);
but it still resolves the link and does not accept the path that I 
constructed.

How can I make PHP use the symlink and stop trying to resolve the original 
files?


Royce Souther
www.SiliconTao.com
Let Open Source help your business move beyond.

For security this message is digitally authenticated by GnuPG. 










Royce Souther
www.SiliconTao.com
Let Open Source help your business move beyond.

For security this message is digitally authenticated by GnuPG.













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


Re: [PHP] move_uploaded_file and CPU wait state (IO)

2006-02-28 Thread Aleksandar Skodric

Hi,

Yes, /tmp is on another disk then the final directory. I shall move it 
to the same disk (tmp_upload_dir) right now.


Question: can I define tmp_upload_dir to be otherwise just for one host 
in apache conf, like:


php_ini upload_tmp_dir /some/dir

I am not sure that this works for all PHP ini settings?

Will let you know how this works out!

Thank you!

Regards,
Aleks

PS. Did I do sth wrong, or someone tried to unsubscribe using my thread? :)

Curt Zirzow wrote:

On Mon, Feb 27, 2006 at 06:39:13PM +0100, [EMAIL PROTECTED] wrote:
  

Hi,

My first mailing, if I'm in wrong group or such, let me know ;)

Here comes my question. I have implemented file uploads to my server. At the 
end of upload, file is
beeing moved from /tmp to permanent directory. However, whenever this happens, 
CPU goes berzerk and
waits for disk to finish moving file. As allowed files may be up to 100 MB per 
file, having more
then 3 users makes complete server freeze. Meantime, server load reaches 
skyhigh 40+. After file is
moved, server resumes normal operation, however while moving file server is 
completely not
responding.



I'm just taking a wild guess at this moment, but usually is a sign
when disk access is an issue and tends to be because it is rather
full excpecially with larger files.

Some questions that i that I would first look at:

  - how much space is on /tmp or the drive you are moving it to
  - is /tmp on the same drive as where ever you are moving it to.
  - if it is the same drive, the move should be quick
  - test a move directly on the filesystyem and see how long it takes 


Just in case you arn't familiar with disk usage do a:
  du -h

and observe the output.

  

Is there a work around? I am not so good with linux (yet ^^), so I do not know 
if there is place
for improvement on OS itself. I asked this question on Debian forum, but am 
trying here as well.

If someone has same problem and prefferably solution, or even sugestions - all 
is welcome! :)



Although of what I mentioned really shouldn't explain your 40+ load
unless you are under requests and you are very close to 100% on one
of those disk partitions from 'du'.

  

2 x 80 GB IDE HDD



Since you have 2 disks i would suggest putting all your logging
information on one disk or the other and reserver the other disk
for accessing pages or uploads.

But then again it really doesn't explain the 40+ server load, you
may have other issues at hand.


Curt.
  


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



Re: [PHP] Where to put my class files

2006-02-28 Thread Curt Zirzow
On Tue, Feb 28, 2006 at 12:55:18PM +0700, Peter Lauri wrote:
> Best group member,
> 
> I want to run the backend of the system under HTTPS for security reasons.
> The pages in HTTP and HTTPS are both using the same classfiles.
> 
> Right now I have the class files in httpdocs/classes/
> 
> In the httpsdocs/admin I have a variable
> $class_path='http://www.mydomain.com/classes/'; to describe where the class
> files can be found. I do this that does not generate an error:
> 
> require_once($class_path.'orderadmin.class.php');
> 
> When I then do below it gives be an error.
> echo OrderAdmin::getNewOrderList();
> 
> Fatal error: Undefined class name 'orderadmin' in
> /home/httpd/vhosts/mydomain.com/httpsdocs/admin/order.php on line 46

It looks like you have a dir structure like:

  mydomain.com/httpsdocs/  #https docs
  mydomain.com/httpdocs/   #http docs

What I would do is make a directory:

  mydomain.com/include/

And set my include_path to include that directory, and since it
appears you have open_basedir in effect, include the path in
open_basedir as well.

Then put your classes in:
  mydomain.com/include/classes/

Then both sets of scripts can use:

$class_path = 'classes/';
require_once($class_path.'orderadmin.class.php');

That is how I would do it.

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

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



[PHP] working with ini files

2006-02-28 Thread Benjamin Adams
I have created my own ini file. I can read the values into an array  
fine. but What I want to do is change a value in the ini file. Example


file.ini
dog = 3
cat = 4
fish = 7

altered file.ini
dog = 3
cat = 5
fish = 7

how can I do this, I tried using ini_set but its not working.
help would be great, Thanks!!
Ben

RE: [PHP] working with ini files

2006-02-28 Thread Jim Moseby
> 
> I have created my own ini file. I can read the values into an array  
> fine. but What I want to do is change a value in the ini file. Example
> 
> file.ini
> dog = 3
> cat = 4
> fish = 7
> 
> altered file.ini
> dog = 3
> cat = 5
> fish = 7
> 
> how can I do this, I tried using ini_set but its not working.
> help would be great, Thanks!!


ini_set is for manipulating PHP.ini settings.  Try this:

http://codewalkers.com/seecode/138.html

JM

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



RE: [PHP] working with ini files

2006-02-28 Thread jblanchard
[snip]
I have created my own ini file. I can read the values into an array  
fine. but What I want to do is change a value in the ini file. Example

file.ini
dog = 3
cat = 4
fish = 7

altered file.ini
dog = 3
cat = 5
fish = 7
[/snip]

ini_set is for the php.ini, not yours. You will need to open and write
to your ini file. http://www.php.net/fopen

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



Re: [PHP] working with ini files

2006-02-28 Thread Aleksandar Skodric
May I presume that your ini file is just simple plain text file? Check 
then how you can use PHP to handle files:


http://nl2.php.net/manual/en/function.file.php
http://nl2.php.net/manual/en/function.fopen.php
http://nl2.php.net/manual/en/function.fwrite.php

Although, I suggest creating such things in database, if you have that 
option.


Regards,
Aleksandar

Benjamin Adams wrote:
I have created my own ini file. I can read the values into an array 
fine. but What I want to do is change a value in the ini file. Example


file.ini
dog = 3
cat = 4
fish = 7

altered file.ini
dog = 3
cat = 5
fish = 7

how can I do this, I tried using ini_set but its not working.
help would be great, Thanks!!
Ben


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



[PHP] Array sort question

2006-02-28 Thread PHP



 
Hi,
How can I sort a 2 dimensional array by number of 
elements?
Ex:
 
rgArray[0] = ("1","2");
rgArray[1] = ("1");
rgArray[2] = ("1","2","3","4");
rgArray[3] = ("1","2","3");
 
Now I would like to sort it so I can loop through 
them from least elements to most (or vice versa):
 
rgArray[1]   (now 
rgArray[0])    1
rgArray[0]   (now 
rgArray[1])    1,2
rgArray[3]   (now 
rgArray[2])    1,2,3
rgArray[2]   (now 
rgArray[3])    1,2,3,4
 
 
Thanks.
 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.1/271 - Release Date: 2/28/2006

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

RE: [PHP] Array sort question

2006-02-28 Thread jblanchard
[snip]

How can I sort a 2 dimensional array by number of elements?

[/snip]

 

Start by RTFM http://www.php.net/manual/en/function.count.php

 



Re: [PHP] Array sort question

2006-02-28 Thread Jeremy Privett

[EMAIL PROTECTED] wrote:

[snip]

How can I sort a 2 dimensional array by number of elements?

[/snip]

 


Start by RTFM http://www.php.net/manual/en/function.count.php

 
  
I love how infinitely helpful people on this mailing list are. It's a 
wonder people are being turned off to PHP. There's no one here willing 
to help new people more than throwing them "RTFM" responses.


--
Jeremy Privett
Director of Product Development
Zend Certified Engineer
Completely Unique
[EMAIL PROTECTED]

Phone: 303.415.2592
Fax:   303.415.2597
Web:   www.completelyunique.com

This email may contain confidential and privileged material for the sole use of 
the intended recipient. Any review or distribution by others is strictly 
prohibited. If you are not the intended recipient please contact the sender and 
delete all copies. Your compliance is appreciated.

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



RE: [PHP] Array sort question

2006-02-28 Thread jblanchard
[snip]
I love how infinitely helpful people on this mailing list are. It's a
wonder people are being turned off to PHP. There's no one here willing
to help new people more than throwing them "RTFM" responses.
[/snip]

Are you new here? I would rather teach a man how to fish than give him
his supper on a silver platter. The OP did not show one ounce of having
tried to find the answer on his own, he just wanted us to write the code
for him. 

This same exact thing happens every few months, people get chastised for
aa RTFM answer when that is the most appropriate answer. I didn't see
you jump up with an answer there Sparky. Nope, your response was almost
worthless. I, at least, gave the man a place to start looking for
answers. 

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



Re: [PHP] Array sort question

2006-02-28 Thread Saline Erik
Sometimes I just need a point in the right direction.  So RTFM is not  
so bad.



Erik


On Feb 28, 2006, at 11:26 AM, <[EMAIL PROTECTED]>  
<[EMAIL PROTECTED]> wrote:



[snip]
I love how infinitely helpful people on this mailing list are. It's a
wonder people are being turned off to PHP. There's no one here willing
to help new people more than throwing them "RTFM" responses.
[/snip]

Are you new here? I would rather teach a man how to fish than give him
his supper on a silver platter. The OP did not show one ounce of  
having
tried to find the answer on his own, he just wanted us to write the  
code

for him.

This same exact thing happens every few months, people get  
chastised for

aa RTFM answer when that is the most appropriate answer. I didn't see
you jump up with an answer there Sparky. Nope, your response was  
almost

worthless. I, at least, gave the man a place to start looking for
answers.

--
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] Array sort question

2006-02-28 Thread Jeremy Privett

[EMAIL PROTECTED] wrote:

[snip]
I love how infinitely helpful people on this mailing list are. It's a
wonder people are being turned off to PHP. There's no one here willing
to help new people more than throwing them "RTFM" responses.
[/snip]

Are you new here? I would rather teach a man how to fish than give him
his supper on a silver platter. The OP did not show one ounce of having
tried to find the answer on his own, he just wanted us to write the code
for him. 


This same exact thing happens every few months, people get chastised for
aa RTFM answer when that is the most appropriate answer. I didn't see
you jump up with an answer there Sparky. Nope, your response was almost
worthless. I, at least, gave the man a place to start looking for
answers. 

  
I agree with you there. My response wasn't more helpful than yours, but 
you could've given him a more appropriate answer than RTFM with a link 
the the count function. I agree with you about not writing anyone's code 
for them, but you could at least be a little less harsh in your response 
to new people. RTFM is not exactly the best way to get people 
enthusiastic about things... It usually just pisses them off.


Also, links to other functions to help out like http://www.php.net/usort 
or http://www.php.net/array_multisort would've helped out more, as well.


--
Jeremy Privett
Director of Product Development
Zend Certified Engineer
Completely Unique
[EMAIL PROTECTED]

Phone: 303.415.2592
Fax:   303.415.2597
Web:   www.completelyunique.com

This email may contain confidential and privileged material for the sole use of 
the intended recipient. Any review or distribution by others is strictly 
prohibited. If you are not the intended recipient please contact the sender and 
delete all copies. Your compliance is appreciated.

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



Re: [PHP] Array sort question

2006-02-28 Thread Jeremy Privett

Saline Erik wrote:
Sometimes I just need a point in the right direction.  So RTFM is not 
so bad.



Erik


If you say so. In that case, jblanchard, I apologize for my outburst.

--
Jeremy Privett
Director of Product Development
Zend Certified Engineer
Completely Unique
[EMAIL PROTECTED]

Phone: 303.415.2592
Fax:   303.415.2597
Web:   www.completelyunique.com

This email may contain confidential and privileged material for the sole 
use of the intended recipient. Any review or distribution by others is 
strictly prohibited. If you are not the intended recipient please 
contact the sender and delete all copies. Your compliance is appreciated.


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



Re: [PHP] Array sort question

2006-02-28 Thread John Nichel

Jeremy Privett wrote:

[EMAIL PROTECTED] wrote:

[snip]

How can I sort a 2 dimensional array by number of elements?

[/snip]

 


Start by RTFM http://www.php.net/manual/en/function.count.php

 
  
I love how infinitely helpful people on this mailing list are. It's a 
wonder people are being turned off to PHP. There's no one here willing 
to help new people more than throwing them "RTFM" responses.




My, you were helpful.

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

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



RE: [PHP] Array sort question

2006-02-28 Thread jblanchard
[snip]
If you say so. In that case, jblanchard, I apologize for my outburst.
[/snip]

Apology accepted. Look, several of us have been on this list for years
and have helped several others through their issues. Mailing lists like
this (try a C++ newsgroup for example) are much more merciless than some
of us here, we have toned it in the past year or so. Folks here
volunteer a lot of their time and are less likely to help those that
will not help themselves.

The array sorting suggestions you provide will not sort based on the
number of items in each array, which is what the OP wanted. He will have
to count each array and then order the arrays by the number of objects
contained in each. He could make an array of the arrays and go in that
direction.

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



Re: [PHP] About date & time...

2006-02-28 Thread Gustav Wiberg


- Original Message - 
From: "tedd" <[EMAIL PROTECTED]>

To: ; "Gustav Wiberg" <[EMAIL PROTECTED]>
Sent: Tuesday, February 28, 2006 4:17 PM
Subject: Re: [PHP] About date & time...



>Thanx for your input about date & time...


Here's some functions that worked for me after some searching...

function currenttime() {

-snip- lot's of code.


Hi Gustav:

Not meaning to embarrass, but your code could be shortened considerably by 
using date(), like so:


Your lengthy  -- function currenttime()

can be replaced simply with:

   echo("Date: " . date('Y\-\ m\-\ d') . "" );

and your -- function currentdate()

can be replaced with:

echo("Time: " . date('h\:\ i\:\ s') . "" );

If you don't like the spaces in the output, then strip them out, like so:

$date = date('Y\-\ m\-\ d');
$date = str_replace(" ", "", $date);
echo("Date: " . $date. "" );

and

$date = date('h\:\ i\:\ s') ;
$date = str_replace(" ", "", $date);
echo("Time: " . $date. "" );

You can find more code examples at:

http://www.weberdev.com/AdvancedSearch.php?searchtype=title&search=date&Submit1.x=0&Submit1.y=0


tedd

--

http://sperling.com


Hi there!

Not meaning to embarrass, but your code could be shortened considerably by 
using date(), like so:
*hehe* It's all okey, it was something like this you're typing that I was 
searching for, but couldn't find it exactly as I wanted. Thanx a lot!!! :-) 
I really appreciate it!


/G 


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



Re: [PHP] Array sort question

2006-02-28 Thread Robin Vickery
On 28/02/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> The array sorting suggestions you provide will not sort based on the
> number of items in each array, which is what the OP wanted.

That's not entirely fair. I would have said his usort() suggestion was
a better pointer than a link to count() - which gives no hint as to
how to sort the list, which is after all what the OP's trying to do.

ObSuggestion:

function byLength($a, $b)
{
   return sizeof($a) - sizeof($b);
}

usort($rgArray, 'byLength');


RE: [PHP] Array sort question

2006-02-28 Thread jblanchard
[snip]
That's not entirely fair. I would have said his usort() suggestion was
a better pointer than a link to count() - which gives no hint as to
how to sort the list, which is after all what the OP's trying to do.

ObSuggestion:

function byLength($a, $b)
{
   return sizeof($a) - sizeof($b);
}

usort($rgArray, 'byLength');

Well said, after all there is more than one way to skin a cat.

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



Re: [PHP] About date & time...

2006-02-28 Thread Gustav Wiberg


- Original Message - 
From: "tedd" <[EMAIL PROTECTED]>

To: ; "Gustav Wiberg" <[EMAIL PROTECTED]>
Sent: Tuesday, February 28, 2006 4:17 PM
Subject: Re: [PHP] About date & time...



>Thanx for your input about date & time...


Here's some functions that worked for me after some searching...

function currenttime() {

-snip- lot's of code.


Hi Gustav:

Not meaning to embarrass, but your code could be shortened considerably by 
using date(), like so:


Your lengthy  -- function currenttime()

can be replaced simply with:

   echo("Date: " . date('Y\-\ m\-\ d') . "" );

and your -- function currentdate()

can be replaced with:

echo("Time: " . date('h\:\ i\:\ s') . "" );

If you don't like the spaces in the output, then strip them out, like so:

$date = date('Y\-\ m\-\ d');
$date = str_replace(" ", "", $date);
echo("Date: " . $date. "" );

and

$date = date('h\:\ i\:\ s') ;
$date = str_replace(" ", "", $date);
echo("Time: " . $date. "" );

You can find more code examples at:

http://www.weberdev.com/AdvancedSearch.php?searchtype=title&search=date&Submit1.x=0&Submit1.y=0


tedd

--

http://sperling.com


Hi there!

I've now done coding like this...


function currenttime() {

 $t = date('h\:\ i\:\ s');
 $returnTime = str_replace(" ", "", $t);
 return $returnTime;

}

function currentdate() {

 $d = date('Y\-\ m\-\ d');
 $returnDate = str_replace(" ", "", $d);
 return $returnDate;

}

$insertTime = currenttime();
$insertDate = currentdate();

I'm a swede, and I we use hours 0 - 24.

8 pm = 20 for us.
9 pm = 21 for us
10 pm = 22...

and so on...

But with date()-function there is 10 pm that shows (and I want 22 to show 
instead)


I'm using PHP 4.0.3...

Do I have to use getdate() then? (getdate()-function showed 22...)

/G

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



Re: [PHP] html area

2006-02-28 Thread Grant Young
Tiny_MCE is another fairly simple editor - although I've experienced 
some quirks that can be quite annoying/tricky.

http://tinymce.moxiecode.com/

Regards, Grant

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



Re: [PHP] About date & time...

2006-02-28 Thread Grant Young

Hi Gustav.



I'm a swede, and I we use hours 0 - 24.

8 pm = 20 for us.
9 pm = 21 for us
10 pm = 22...

and so on...

But with date()-function there is 10 pm that shows (and I want 22 to 
show instead)


I'm using PHP 4.0.3...

Do I have to use getdate() then? (getdate()-function showed 22...)


The docs for date() (http://www.php.net/date) show that there are a 
number of different options for the first parameter.  If you check out 
the table on that page, you'll find:


>> H | 24-hour format of an hour with leading zeros | 00 through 23

With this in mind, the following will work (if I understand your 
question correctly):


$t = date('H\:\ i\:\ s');

HTH, Grant

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



Re: [PHP] About date & time...

2006-02-28 Thread tedd

Gustav:


I'm a swede, and I we use hours 0 - 24.


Well... I don't know what I am, but non sum qualis eram.

In any event, you want military time -- simple enough -- just change 
the h to H, like so:


  echo("Time: " . date('H\:\ i\:\ s') . "" );

You can find more code examples at:

http://www.weberdev.com/AdvancedSearch.php?searchtype=title&search=date&Submit1.x=0&Submit1.y=0

Also, you need to review the php manual regarding date() -- it's a 
super function that has lot's of formatting symbols.


tedd

--

http://sperling.com

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



Re: [PHP] About date & time...

2006-02-28 Thread Gustav Wiberg


- Original Message - 
From: "Grant Young" <[EMAIL PROTECTED]>

To: 
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, February 28, 2006 11:25 PM
Subject: Re: [PHP] About date & time...



Hi Gustav.



I'm a swede, and I we use hours 0 - 24.

8 pm = 20 for us.
9 pm = 21 for us
10 pm = 22...

and so on...

But with date()-function there is 10 pm that shows (and I want 22 to 
show instead)


I'm using PHP 4.0.3...

Do I have to use getdate() then? (getdate()-function showed 22...)


The docs for date() (http://www.php.net/date) show that there are a 
number of different options for the first parameter.  If you check out 
the table on that page, you'll find:


>> H | 24-hour format of an hour with leading zeros | 00 through 23

With this in mind, the following will work (if I understand your 
question correctly):


$t = date('H\:\ i\:\ s');

HTH, Grant


AHA!!!

Sometimes I'm so stupid... hm...

Thanx! :-)

/G

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



[PHP] Basic PDO Questions

2006-02-28 Thread Chris Drozdowski

I have a three quick PDO questions.

1) If a PDOStatement is created within a function or method, is it's  
server result set connection is automatically freed up when the  
function returns (I assume so, but want to make sure)?


2) Does setting a PDOStatement to null (PDOStatement = null)  
terminate the server result set connection (I assume so, but want to  
make sure)?


3) The documentation for PDO::quote encourages us to use prepared  
statements over the PDO::query() or PDO::exec() methods citing the  
economy and portability of prepared statements. For queries that will  
run only once, is there significantly more overhead using prepared  
statements rather than the PDO::query() or PDO::exec() methods? I  
know that that's kind of an unclear/subjective question, but I just  
don't know how to state it better.



Thanks,

Chris D

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



Re: [PHP] move_uploaded_file and CPU wait state (IO)

2006-02-28 Thread Chris

Aleksandar Skodric wrote:

Hi,

Yes, /tmp is on another disk then the final directory. I shall move it 
to the same disk (tmp_upload_dir) right now.


Question: can I define tmp_upload_dir to be otherwise just for one host 
in apache conf, like:


php_ini upload_tmp_dir /some/dir




I'm guessing not, but the php docs will tell you for sure - 
http://www.php.net


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

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



Re: [PHP] About date & time...

2006-02-28 Thread Gustav Wiberg


- Original Message - 
From: "tedd" <[EMAIL PROTECTED]>

To: ; "Gustav Wiberg" <[EMAIL PROTECTED]>
Sent: Tuesday, February 28, 2006 11:34 PM
Subject: Re: [PHP] About date & time...



Gustav:


I'm a swede, and I we use hours 0 - 24.


Well... I don't know what I am, but non sum qualis eram.

In any event, you want military time -- simple enough -- just change the h 
to H, like so:


  echo("Time: " . date('H\:\ i\:\ s') . "" );

You can find more code examples at:

http://www.weberdev.com/AdvancedSearch.php?searchtype=title&search=date&Submit1.x=0&Submit1.y=0

Also, you need to review the php manual regarding date() -- it's a super 
function that has lot's of formatting symbols.


tedd

--

http://sperling.com

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


Yes, thanx! I've totally missed the part about 12/24-h setting... :-)

/G

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



[PHP] fopen failing, permission denied

2006-02-28 Thread Dan Baker
I have the following code snippet:
$h = fopen("$path/file.txt", 'x+');

And it generates the following error:
Warning: fopen(/home/./myarea/file.txt): failed to open stream: 
Permission denied

The path is correct, but the php process doesn't seem to have file 
permissions in the folder.
Is there some magic I can do to allow php to have file rights to the 
"myarea" folder?  (This is on a purchased ISP site)

Thanks
DanB 

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



[PHP] Editing an existing pdf?

2006-02-28 Thread Jay Contonio
I am just looking for someone to point me in the right direction. I
need to be able to *edit* an existing pdf, not create a new one. I
basically would be adding an image or text from a form to an existing
pdf. Does the PDFLib have an overlay function? These will not be 72
DPI pdf's either.

Thanks.

--
Jay Contonio
http://www.jcontonio.com/

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



RE: [PHP] Array sort question

2006-02-28 Thread tedd




I would rather teach a man how to fish than give him
his supper on a silver platter.



Write his code and you can reduce his frustration for a day, but 
teach him to program and you'll frustrate him for life.


tedd
--

http://sperling.com

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



Re: [PHP] working with ini files

2006-02-28 Thread Adam Ashley
On Tue, 2006-02-28 at 13:32 -0500, Benjamin Adams wrote:
> I have created my own ini file. I can read the values into an array  
> fine. but What I want to do is change a value in the ini file. Example
> 
> file.ini
> dog = 3
> cat = 4
> fish = 7
> 
> altered file.ini
> dog = 3
> cat = 5
> fish = 7
> 
> how can I do this, I tried using ini_set but its not working.
> help would be great, Thanks!!
> Ben

As has been mentioned ini_set is for php.ini values. You can do what you
want with fopen and all that manually or check out
http://pear.php.net/package/Config all the hard work has been done for
you.

Adam Ashley


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


Re: [PHP] Editing an existing pdf?

2006-02-28 Thread Max Schwanekamp

Jay Contonio wrote:

I am just looking for someone to point me in the right direction. I
need to be able to *edit* an existing pdf, not create a new one. I
basically would be adding an image or text from a form to an existing
pdf. Does the PDFLib have an overlay function? These will not be 72
DPI pdf's either.


Never used it myself, but FPDF says it can do this using the FPDI 
extension.

http://fpdf.org/en/FAQ.php  (see item 17)

--
Max Schwanekamp
http://www.neptunewebworks.com/

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



Re: [PHP] fopen failing, permission denied

2006-02-28 Thread Chris

Dan Baker wrote:

I have the following code snippet:
$h = fopen("$path/file.txt", 'x+');

And it generates the following error:
Warning: fopen(/home/./myarea/file.txt): failed to open stream: 
Permission denied


The path is correct, but the php process doesn't seem to have file 
permissions in the folder.
Is there some magic I can do to allow php to have file rights to the 
"myarea" folder?  (This is on a purchased ISP site)


Go in through ftp or ssh and fix the permissions.

If you only want to read the file, then it only needs to be 644.

If you need to write the file it will either need to be 646 or 664.

That's your only option apart from deleting the file (through ftp) and 
recreating it through your php script ... or getting your host to change 
to the CGI version of php which is most unlikely to happen.


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

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



Re: [PHP] Editing an existing pdf?

2006-02-28 Thread Max Schwanekamp

Jay Contonio wrote:

With FPDF you have been able to add jpegs or pngs to existing high-res
pdfs? I understand adding data using the FDF file but what about an
image?


Yeah, I use FPDF on a fairly busy site to generate PDFs that have one of 
various logos embedded.  The PDF can be regular 72DPI - that's print 
quality for text.  But the image should be at print resolution, i.e. 
300DPI or better, preferably a 24-bit PNG.


--
Max Schwanekamp
http://www.neptunewebworks.com/

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



Re: [PHP] Different results in function on PHP 4 and PHP 5

2006-02-28 Thread Chris

Stephen Lake wrote:

Good Afternoon Folks,

After pounding my head into the ground for days over a problem I am having, 
I decided to post here to see what you guys and girls think.


I have a user defined function that outputs categories from a database and 
assosiated eShops. Now in PHP 4 this is working perfectly however my client 
has PHP 5, and the function is only outputting the first eshop for each 
category. How can I get this working properly in PHP 5?


Below is the function in question:

function getAllCategories($mysql,$region) {
 $cat_list = "SELECT * FROM ilp_category_zone ORDER BY category";
  $mysql->execute_query($cat_list);

  if($mysql->numrows() <= 0) {
   print "There are currently no categories";
  } else {
   while($r = $mysql->fetchrow()) {
$cid[] = $r['cid'];
   }

   foreach($cid as $value) {




Try that as

foreach($cid as $cidpos => $value) {

Does $cid actually have all the values that it should?

echo sizeof($cid);

just before the foreach.

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

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



[PHP] Dynamic Form List - how to change values

2006-02-28 Thread Pat
I have a list from a MYSQL database that I am dumping to a screen. I'd 
like the user to be able to change the quantity on the form for any 
record on the screen, then post that information back so the user can 
review it, and I can then update the database.


Simple checkout routine. Or so I thought.

I have these fields displayed on the screen before the user changes the 
quantity:


$imageqty = $row["cialbum"]."-".$row["ciset"]."-".$row["ciimage"];
$qty = $row["ciqty"];
print "name='$imageqty' size='5' value='$qty'>";


I've set the $imageqty variable to hold the initial value from the 
database. The initial screen works fine.


However, when I reprocess the file, how can I retrieve the original 
value of the field that is named the same as $imageqty?


The form outputs something like this:
http://.../chkout.php?NATURE-1.jpg=6&continue=Continue+Checkout, which 
does show the $imageqty of "NATURE-1.jpg" value with the new qty of "6".


How can I get the script to pull the value?

$imageqty = $row["cialbum"]."-".$row["ciset"]."-".$row["ciimage"];
$newqty = $_GET["$imageqty"]; 

Retrieves nothing.

Thanks for your help.

Pat

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



[PHP] Re: html area

2006-02-28 Thread juanito

2wsxdr5 wrote:
I am looking for a simple html area text area type editor, similar to to 
what you find in the phpbbs and Joomla.  I don't need a lot of features 
it is just to edit small snipits of html and I really want it to be very 
simple to implement.  I have been looking for the past few hours and so 
far everything seems way more complex than what I need and a pain to set 
up.  Any recommendations would be appreciated



this'd be how that's done...

http://www.massless.org/mozedit/
say thanx to chris wetherell for this (and Meg also)

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



Re: [PHP] Basic PDO Questions

2006-02-28 Thread Curt Zirzow
On Tue, Feb 28, 2006 at 05:48:36PM -0500, Chris Drozdowski wrote:
> I have a three quick PDO questions.
> 
> 1) If a PDOStatement is created within a function or method, is it's  
> server result set connection is automatically freed up when the  
> function returns (I assume so, but want to make sure)?

Correct. Assuming you dont return it or assign a function input
variable that is being passed by reference.

> 
> 2) Does setting a PDOStatement to null (PDOStatement = null)  
> terminate the server result set connection (I assume so, but want to  
> make sure)?

I assume you mean a variable that contains a PDOStatement:
  $stmt = $dbh->prepare($sql);
  $stmt = null;

Yes this is correct.  The one thing to keep in mind though is the
above will be only true if you havn't assigned $stmt to another
variable:

  $another_stmt = $stmt;
  $stmt = null;

The result set connection will still exist, until all variables
referencing to the object are unset/null'd


> 
> 3) The documentation for PDO::quote encourages us to use prepared  
> statements over the PDO::query() or PDO::exec() methods citing the  
> economy and portability of prepared statements. For queries that will  
> run only once, is there significantly more overhead using prepared  
> statements rather than the PDO::query() or PDO::exec() methods? I  
> know that that's kind of an unclear/subjective question, but I just  
> don't know how to state it better.

The key points addressed in the docs with using prepare instead:
  * portable
  * immune to sql injection
  * speed

As far as portable, as noted in the next paragraph, the ODBC driver
doesn't support the quote() method, so if you are crafting a sql
by hand (within your app) you will have to know what driver you are
dealing with.

Also, using just a prepare/execute method, it makes your code much
easier to allow for abstract database servers. This is why i like
pdo so much, it isn't an abstract layer but allows you to build a
common interface that can be abstracted.


The Immune to sql injection. This is rather straight forward, you
just set up your query with input variables and assign the
variables to the input variables:

  $sql = "select * from some_table where userid = ? and name = ?";
  $stmt = $dbh->prepare($sql);
  $stmt->bindValue(1, $_GET['userid'], PDO::PARAM_INT)
  $stmt->bindValue(2, $_GET['name'], PDO::PARAM_STR);

With the above code you dont have to worry about escaping data nor
how it is needed to quote the variable, it is handled by the
driver.


With speed, benchmarks will only show a difference if you have code
like:

  $sql = "select * from some_table where id = ?";
  $stmt = $dbh->prepare($sql);
  foreach(array(1,2,3) as $id) {
$stmt->bindValue(1, $id, PDO::PARAM_INT);
$stmt->execute();
  }

  vs.

  foreach(array(1,2,3) as $id) {
$sql = "select * from some_table where id = " . (int) $id;
$stmt = $dbh->query($sql);
  }

The speed difference is with query() and the server has to parse
the query to make sure it is valid and then execute within each
iteration of the loop. With the prepare/execute method, the server
just parses the query once. I would assume stored procedures or
views benefit more with this method since they are a bit more
complicated to parse.


HTH,

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

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