php-general Digest 29 Apr 2007 19:03:13 -0000 Issue 4763

2007-04-29 Thread php-general-digest-help

php-general Digest 29 Apr 2007 19:03:13 - Issue 4763

Topics (messages 254104 through 254112):

Re: Help me put this into phpinesse!
254104 by: Tijnema !

Running processes in windows
254105 by: Nathan Wallis
254108 by: Tijnema !

Re: how to detect type of image
254106 by: tedd
254107 by: Edward Vermillion
254112 by: tedd

PHP 6: Mysql with iso-8859-1 chars outputting utf-8: Could not convert binary 
string to Unicode string
254109 by: Rangel Reale

small picture into thumbnail
254110 by: Alain Roger
254111 by: Robert Cummings

Administrivia:

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

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

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---

On 4/29/07, Brad Sumrall [EMAIL PROTECTED] wrote:

?php

   ob_start();

   session_start();

   header(Cache-control: private);

   require(includes/configure.php);


$conn=mysql_connect(DB_SERVER,DB_SERVER_USERNAME,DB_SERVER_PASSWORD);

   mysql_select_db(DB_DATABASE) or die(mysql_error().: database
not available);

   $show=no;

   isset($_SESSION['userid']);


What's the sense of above line?
isset is a function, that returns true or false.


   if $SESSION=NULL

   include './phpbb/login_global.php'



   $show=yes;

?



What am I missing?



Brad


There's no concrete question what you want here. So i guess that is missing.

Tijnema



---End Message---
---BeginMessage---
Howdy.

 

I have an application in windows that I am running with a PHP page using
exec  (start..

 

I am wondering as to the efficiency of such a statement and how taxing it is
on the server.  If multiple people access a page with such a statement, what
toll does it take on the server and is there a better way to manage calls to
the server side executable?  When this statement is called a command prompt
window appears for the duration of the execution.  I am guessing it would be
possible to crash the server if thousands of these processes we created at
around the same timejust anyone experience would be greatly appreciated.

 

Thanks.

 

Nathan

 

 

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

On 4/29/07, Nathan Wallis [EMAIL PROTECTED] wrote:

Howdy.



I have an application in windows that I am running with a PHP page using
exec  (start..



I am wondering as to the efficiency of such a statement and how taxing it is
on the server.  If multiple people access a page with such a statement, what
toll does it take on the server and is there a better way to manage calls to
the server side executable?  When this statement is called a command prompt
window appears for the duration of the execution.  I am guessing it would be
possible to crash the server if thousands of these processes we created at
around the same timejust anyone experience would be greatly appreciated.



Thanks.



Nathan



Switch to linux.

If you still want to stick to windows. I believe it is possible to
hide the command window, that would help also (Or was it a patch in
PHP-DEV?).
Windows won't be able to handle thousands of such processes. Even if
you have a really fast server, more then hundred processes is too much
for windows. It might still continue to run, but then it would be
extremely slow. If you're really expecting 1000s of requests, you
should definitely switch to linux.

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

At 4:46 PM -0500 4/28/07, Edward Vermillion wrote:

On Apr 28, 2007, at 12:21 PM, tedd wrote:


At 9:22 AM -0500 4/28/07, Edward Vermillion wrote:

It should, but instead try this:

$image_size = getimagesize($filename);
echo $image_size['mime'];



$image_size['mime'] ? Where did that come from?


I duno, maybe the manual.

http://us2.php.net/getimagesize   -- 5th or 6th example down.



Ahhh... that's for sending a mime type to the browser.


Ahhh no, it's just a way to get contents of the file.

If you really want to study this, try opening every different image 
file (gif, jpg, png, etc.) you have on your desktop and examine each 
of the header files via a HEX editor. You will find that every file 
has an id of some type in it's header.


The php functions that provide data about files, do just that. They 
inspect the header of the file and report what they have found. How 
you use them, is your business.


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com
---End Message---
---BeginMessage---


On Apr 29, 2007, at 8:03 AM, tedd wrote:


At 4:46 PM -0500 4/28/07, Edward Vermillion wrote:

On Apr 28, 2007, at 12:21 PM, tedd wrote:


At 9:22 AM -0500 4/28/07, Edward Vermillion wrote:

It should, but instead try this:

$image_size = getimagesize($filename);
echo $image_size['mime'];




[PHP] Re: [PHP-WIN] Re: [PHP] slow performance

2007-04-29 Thread Stanislav Malyshev

Maybe you need to configure FastCGI for more processes - 500 could be
result of getting more requests than there are processes to handle them.


How would I do that?


The easiest way would be to open WINDOWS/system32/inetsrv/fcgiext.ini 
and edit the MaxInstances parameter for PHP binary there/ Then you'd 
need to restart the IIS.

--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

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



Re: [PHP] Help me put this into phpinesse!

2007-04-29 Thread Tijnema !

On 4/29/07, Brad Sumrall [EMAIL PROTECTED] wrote:

?php

   ob_start();

   session_start();

   header(Cache-control: private);

   require(includes/configure.php);


$conn=mysql_connect(DB_SERVER,DB_SERVER_USERNAME,DB_SERVER_PASSWORD);

   mysql_select_db(DB_DATABASE) or die(mysql_error().: database
not available);

   $show=no;

   isset($_SESSION['userid']);


What's the sense of above line?
isset is a function, that returns true or false.


   if $SESSION=NULL

   include './phpbb/login_global.php'



   $show=yes;

?



What am I missing?



Brad


There's no concrete question what you want here. So i guess that is missing.

Tijnema





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



[PHP] Running processes in windows

2007-04-29 Thread Nathan Wallis
Howdy.

 

I have an application in windows that I am running with a PHP page using
exec  (start..

 

I am wondering as to the efficiency of such a statement and how taxing it is
on the server.  If multiple people access a page with such a statement, what
toll does it take on the server and is there a better way to manage calls to
the server side executable?  When this statement is called a command prompt
window appears for the duration of the execution.  I am guessing it would be
possible to crash the server if thousands of these processes we created at
around the same timejust anyone experience would be greatly appreciated.

 

Thanks.

 

Nathan

 

 



Re: [PHP] Re: how to detect type of image

2007-04-29 Thread tedd

At 4:46 PM -0500 4/28/07, Edward Vermillion wrote:

On Apr 28, 2007, at 12:21 PM, tedd wrote:


At 9:22 AM -0500 4/28/07, Edward Vermillion wrote:

It should, but instead try this:

$image_size = getimagesize($filename);
echo $image_size['mime'];



$image_size['mime'] ? Where did that come from?


I duno, maybe the manual.

http://us2.php.net/getimagesize   -- 5th or 6th example down.



Ahhh... that's for sending a mime type to the browser.


Ahhh no, it's just a way to get contents of the file.

If you really want to study this, try opening every different image 
file (gif, jpg, png, etc.) you have on your desktop and examine each 
of the header files via a HEX editor. You will find that every file 
has an id of some type in it's header.


The php functions that provide data about files, do just that. They 
inspect the header of the file and report what they have found. How 
you use them, is your business.


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Re: how to detect type of image

2007-04-29 Thread Edward Vermillion


On Apr 29, 2007, at 8:03 AM, tedd wrote:


At 4:46 PM -0500 4/28/07, Edward Vermillion wrote:

On Apr 28, 2007, at 12:21 PM, tedd wrote:


At 9:22 AM -0500 4/28/07, Edward Vermillion wrote:

It should, but instead try this:

$image_size = getimagesize($filename);
echo $image_size['mime'];



$image_size['mime'] ? Where did that come from?


I duno, maybe the manual.

http://us2.php.net/getimagesize   -- 5th or 6th example down.



Ahhh... that's for sending a mime type to the browser.


Ahhh no, it's just a way to get contents of the file.

If you really want to study this, try opening every different image  
file (gif, jpg, png, etc.) you have on your desktop and examine  
each of the header files via a HEX editor. You will find that every  
file has an id of some type in it's header.


The php functions that provide data about files, do just that. They  
inspect the header of the file and report what they have found. How  
you use them, is your business.




Well, from the example it looks like that's returning a string that  
can go straight into the header() function...


?php
$size = getimagesize($filename);
$fp=fopen($filename, rb);
if ($size  $fp) {
  header(Content-type: {$size['mime']});
  fpassthru($fp);
  exit;
} else {
  // error
}
?

whereas index 2 in the array returns an integer that corresponds to  
the IMAGETYPE_* constants. I would assume they both get the  
information from the same place, but just return it in different  
formats based on the intended usage. Just like index 3 will get you a  
string of 'width=? height=?' to add to an image tag, while index 0  
and 1 returns an integer of width and height respectively.


I can get the width and height from index 3, but that's not what it  
was designed for.


Ed

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



Re: [PHP] Running processes in windows

2007-04-29 Thread Tijnema !

On 4/29/07, Nathan Wallis [EMAIL PROTECTED] wrote:

Howdy.



I have an application in windows that I am running with a PHP page using
exec  (start..



I am wondering as to the efficiency of such a statement and how taxing it is
on the server.  If multiple people access a page with such a statement, what
toll does it take on the server and is there a better way to manage calls to
the server side executable?  When this statement is called a command prompt
window appears for the duration of the execution.  I am guessing it would be
possible to crash the server if thousands of these processes we created at
around the same timejust anyone experience would be greatly appreciated.



Thanks.



Nathan



Switch to linux.

If you still want to stick to windows. I believe it is possible to
hide the command window, that would help also (Or was it a patch in
PHP-DEV?).
Windows won't be able to handle thousands of such processes. Even if
you have a really fast server, more then hundred processes is too much
for windows. It might still continue to run, but then it would be
extremely slow. If you're really expecting 1000s of requests, you
should definitely switch to linux.

Tijnema

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



[PHP] PHP 6: Mysql with iso-8859-1 chars outputting utf-8: Could not convert binary string to Unicode string

2007-04-29 Thread Rangel Reale
Hello!

I have a MySQL database where all tables are in the latin1 character set, with 
accented (Portuguese) characters.

In my php.ini I have


; Unicode settings ;


unicode.semantics = on
unicode.runtime_encoding = iso-8859-1
unicode.script_encoding = iso-8859-1
unicode.output_encoding = utf-8
unicode.from_error_mode = U_INVALID_SUBSTITUTE
unicode.from_error_subst_char = 3f
unicode.fallback_encoding = iso-8859-1

because all my files and data in mysql server are in iso-8859-1.


When connecting to mysql I issue:

  mysql_query('set names latin1', $this-mysql_link);

but when I do query in any record that have accented characters I get this 
warning (using mysql_fetch_assoc):

--
Could not convert binary string to Unicode string (converter UTF-8 failed on 
bytes (0xE7) at offset 9)
--

for all accented characters in all fields.


If I changed the set names query to:

  mysql_query('set names utf8', $this-mysql_link);

it works, but I would like to keep compatibility with PHP 5, and for my 
application it requires set names to be latin1. Also, my databases are not 
created with the utf8 option.

As I understood PHP 6's unicode support, all string characters (including mysql 
result values) are converted from unicode.runtime_encoding to unicode (utf-16), 
but looks like it is trying to convert from ASCII, which does not have all the 
accented characters. Am I assuming right? How to make mysql_fetch_assoc assume 
field values are in iso-8859-1 instead of ASCII?

Thanks,
Rangel Reale


[PHP] small picture into thumbnail

2007-04-29 Thread Alain Roger

Hi,

I would like to know how i can display small sized picture in my web
application ?
I mean in my database, picture can have max. 500 Kb, however as on 1 PHP
page i will display 20 pictures at once, i do not want to force end users to
download all 20 pictures (10Mb around) to have an overview.

I would like directly on server to resize picture to display them to end
user in format 100px*120px (for example) and like that size should be around
20 or 50Kb per picture.
I was thinking to use imagecopyresized function for that, but will it no
kill the server CPU and RAM ?

If you have some other suggestion, they are welcome, but do not forget that
i must have pictures in Database and 500 Kb (due to picture printing later
on - so good enough quality).

thanks a lot,

--
Alain

Windows XP SP2
PostgreSQL 8.1.4
Apache 2.0.58
PHP 5


Re: [PHP] small picture into thumbnail

2007-04-29 Thread Robert Cummings
On Sun, 2007-04-29 at 18:15 +0200, Alain Roger wrote:
 Hi,
 
 I would like to know how i can display small sized picture in my web
 application ?
 I mean in my database, picture can have max. 500 Kb, however as on 1 PHP
 page i will display 20 pictures at once, i do not want to force end users to
 download all 20 pictures (10Mb around) to have an overview.
 
 I would like directly on server to resize picture to display them to end
 user in format 100px*120px (for example) and like that size should be around
 20 or 50Kb per picture.
 I was thinking to use imagecopyresized function for that, but will it no
 kill the server CPU and RAM ?
 
 If you have some other suggestion, they are welcome, but do not forget that
 i must have pictures in Database and 500 Kb (due to picture printing later
 on - so good enough quality).

Create the thumbnail once and cache it. On subsequent requests check if
thumbnail exists, if so use the cache. If not build from original image.
This way you incur the heavy CPU hit once for each image requested. This
take more disk space though, but not terribly.

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

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



Re: [PHP] Re: how to detect type of image

2007-04-29 Thread tedd

At 9:53 AM -0500 4/29/07, Edward Vermillion wrote:

On Apr 29, 2007, at 8:03 AM, tedd wrote:
The php functions that provide data about files, do just that. They 
inspect the header of the file and report what they have found. How 
you use them, is your business.




Well, from the example it looks like that's returning a string that 
can go straight into the header() function...


?php
$size = getimagesize($filename);
$fp=fopen($filename, rb);
if ($size  $fp) {
  header(Content-type: {$size['mime']});
  fpassthru($fp);
  exit;
} else {
  // error
}
?

whereas index 2 in the array returns an integer that corresponds to 
the IMAGETYPE_* constants. I would assume they both get the 
information from the same place, but just return it in different 
formats based on the intended usage. Just like index 3 will get you 
a string of 'width=? height=?' to add to an image tag, while index 0 
and 1 returns an integer of width and height respectively.


I can get the width and height from index 3, but that's not what it 
was designed for.


It was designed to provide information. As I said you use it as you 
want. Index 3 could have been used in and image tag, or in a report 
of the image -- whatever you can find a use for it, use it.


The above example uses 'mime' for a header, but the below code uses 
it more directly.


http://sperling.com/a/image_data/

Whatever floats your boat.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] single signon Solution php and .net

2007-04-29 Thread Murtaza Chang

Hi, me and my fellow developer have built two applications that need to
authenticate users using LDAP, we have successfully accomplished it, but the
problem is his application is in .net and mine is in php, my php app needs
to call secure pages of .net and vice versa, now when the user is logged
onto let say my php app he is logged and his session is created and when I
redirect him to .net app he again sees a login form because the session isnt
created in .net app.
I need some single sign on solution I found lots of APIs and libraries for
java but have no idea what can I use for php and .net, kindly experience
programmers guide me.
Thankyou

--
Murtaza Chang
http://flickr.com/photos/blackstallion/


RE: [PHP] single signon Solution php and .net

2007-04-29 Thread Buesching, Logan J
The first thing that comes to my mind is to use a database to handle
session data as defined by: 
http://us2.php.net/manual/en/function.session-set-save-handler.php.  You
can then, when attempting to authenticate, pass the session ID back and
forth through your applications.  There may be similar things for .Net,
but I as I am not a .Net web developer, I can't help you out in that
area.

-Logan

 -Original Message-
 From: Murtaza Chang [mailto:[EMAIL PROTECTED]
 Sent: Sunday, April 29, 2007 3:13 PM
 To: php-general@lists.php.net
 Subject: [PHP] single signon Solution php and .net
 
 Hi, me and my fellow developer have built two applications that need
to
 authenticate users using LDAP, we have successfully accomplished it,
 but the
 problem is his application is in .net and mine is in php, my php app
 needs
 to call secure pages of .net and vice versa, now when the user is
 logged
 onto let say my php app he is logged and his session is created and
 when I
 redirect him to .net app he again sees a login form because the
session
 isnt
 created in .net app.
 I need some single sign on solution I found lots of APIs and libraries
 for
 java but have no idea what can I use for php and .net, kindly
 experience
 programmers guide me.
 Thankyou
 
 --
 Murtaza Chang
 http://flickr.com/photos/blackstallion/

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



Re: [PHP] ${}

2007-04-29 Thread Daniel Bächtle



where can I find the documentation about this symbol?


http://www.php.net/string#language.types.string.substr

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



[PHP] uploads

2007-04-29 Thread jekillen

Hello again;
can someone point me to a system for cleaning
uploaded files; embedded php scripts in image
files, viruses etc, shell escape chars, anything
that would be hazardous?
The idea is when a file is uploaded, as soon
as it gets to the server it is inspected, cleaned/rejected
before it is used or sent anywhere else on the server.
I am using php to upload anything that would be sent
in an e-mail attachment. Once the files have been
'sanitized' they would be made available for display.
Thanks in advance;
Jeff k

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



Re: [PHP] uploads

2007-04-29 Thread Tijnema !

On 4/29/07, jekillen [EMAIL PROTECTED] wrote:

Hello again;
can someone point me to a system for cleaning
uploaded files; embedded php scripts in image
files, viruses etc, shell escape chars, anything
that would be hazardous?
The idea is when a file is uploaded, as soon
as it gets to the server it is inspected, cleaned/rejected
before it is used or sent anywhere else on the server.
I am using php to upload anything that would be sent
in an e-mail attachment. Once the files have been
'sanitized' they would be made available for display.
Thanks in advance;
Jeff k



What's your platform? Windows or Linux?

Tijnema

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



Re: [PHP] phpbb / sessionid nightmare

2007-04-29 Thread Chris

Brad Sumrall wrote:
The cookie it's self says 
PHPSESSID=26b7974a5d71c7d0bfebbf71750dac7b

Path=/
Host=www.domain.com

When I go to the jacked up page, I pickup this one
PHPSESSID=a787e077dd18ed18cb824f664d38315d
Path=/
Host=domain.com


That will be your problem. A cookie created on domain.com is ONLY 
readable by domain.com (unless you make it '.domain.com' which is 
technically different to 'domain.com').


Check out 'session.cookie_domain', you can set it with an ini_set call:

ini_set('session.cookie_domain', '.domain.com');

See http://www.php.net/manual/en/ref.session.php

and http://www.php.net/setcookie for more info about how cookie domains 
work.


--
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] FW: I really need help

2007-04-29 Thread Stephen Hernandez
I have literally just started using php and my sql so I really hope
somebody can help me and I am addressing the right people as I don't
want to be a pain in the neck. I have tested whether PHP is installed
and running on the remote web server that hosts my website and it is
running ok.
Next I wanted to see if I could access MySQL using PHP.  I downloaded a
file from a Web site at janet.valade.com called mysql_up.php as it comes
from a book she has written called PHP  MySQL for Dummies which is the
book I am using to learn - as you can tell I am right at the beginning
:-) .
I get an error message which relates  to lines 9, 10 and 11 of the
program which are:
$host=host;
$user=mysqlaccount;
$password=mysqlpassword;
 
These were the values I had to change which I guess is where the problem
is. I was supposed to change host to the name of the computer where
MySQL is installed. But I do not know what name I should put, the name
of my site is spanishbyproz.com. In the example Janet uses she puts
datebasehost.mycompany.com . What should I write for host ?
 
I would really appreciate any advice and am sorry it is such a basic
question.
 
Many thanks in advance,
 
Steve


Re: [PHP] FW: I really need help

2007-04-29 Thread Tijnema !

On 4/30/07, Stephen Hernandez [EMAIL PROTECTED] wrote:

I have literally just started using php and my sql so I really hope
somebody can help me and I am addressing the right people as I don't
want to be a pain in the neck. I have tested whether PHP is installed
and running on the remote web server that hosts my website and it is
running ok.
Next I wanted to see if I could access MySQL using PHP.  I downloaded a
file from a Web site at janet.valade.com called mysql_up.php as it comes
from a book she has written called PHP  MySQL for Dummies which is the
book I am using to learn - as you can tell I am right at the beginning
:-) .
I get an error message which relates  to lines 9, 10 and 11 of the
program which are:
$host=host;
$user=mysqlaccount;
$password=mysqlpassword;

These were the values I had to change which I guess is where the problem
is. I was supposed to change host to the name of the computer where
MySQL is installed. But I do not know what name I should put, the name
of my site is spanishbyproz.com. In the example Janet uses she puts
datebasehost.mycompany.com . What should I write for host ?

I would really appreciate any advice and am sorry it is such a basic
question.

Many thanks in advance,

Steve


In 99% of the cases is MySQL running on the same host, and you should
fill in localhost

Tijnema




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



RE: [PHP] FW: I really need help

2007-04-29 Thread Buesching, Logan J
You will have to find that information out through whoever your host is.
There is no one configuration for that.  

The first question to ask is did you create a MySQL database?  If you
did, then find out whatever the host was for doing that.  Many times,
your host will put it at mysql.___domainname___.com, so since you have
spanishbyproz.com, you can probably try mysql.spanishbyproz.com.

-Logan 

 -Original Message-
 From: Stephen Hernandez [mailto:[EMAIL PROTECTED]
 Sent: Sunday, April 29, 2007 7:29 PM
 To: php-general@lists.php.net
 Subject: [PHP] FW: I really need help
 
 I have literally just started using php and my sql so I really hope
 somebody can help me and I am addressing the right people as I don't
 want to be a pain in the neck. I have tested whether PHP is installed
 and running on the remote web server that hosts my website and it is
 running ok.
 Next I wanted to see if I could access MySQL using PHP.  I downloaded
a
 file from a Web site at janet.valade.com called mysql_up.php as it
 comes
 from a book she has written called PHP  MySQL for Dummies which is
the
 book I am using to learn - as you can tell I am right at the beginning
 :-) .
 I get an error message which relates  to lines 9, 10 and 11 of the
 program which are:
 $host=host;
 $user=mysqlaccount;
 $password=mysqlpassword;
 
 These were the values I had to change which I guess is where the
 problem
 is. I was supposed to change host to the name of the computer where
 MySQL is installed. But I do not know what name I should put, the name
 of my site is spanishbyproz.com. In the example Janet uses she puts
 datebasehost.mycompany.com . What should I write for host ?
 
 I would really appreciate any advice and am sorry it is such a basic
 question.
 
 Many thanks in advance,
 
 Steve

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



Re: [PHP] FW: I really need help

2007-04-29 Thread Robert Cummings
On Mon, 2007-04-30 at 00:29 +0100, Stephen Hernandez wrote:
 I have literally just started using php and my sql so I really hope
 somebody can help me and I am addressing the right people as I don't
 want to be a pain in the neck. I have tested whether PHP is installed
 and running on the remote web server that hosts my website and it is
 running ok.
 Next I wanted to see if I could access MySQL using PHP.  I downloaded a
 file from a Web site at janet.valade.com called mysql_up.php as it comes
 from a book she has written called PHP  MySQL for Dummies which is the
 book I am using to learn - as you can tell I am right at the beginning
 :-) .
 I get an error message which relates  to lines 9, 10 and 11 of the
 program which are:
 $host=host;
 $user=mysqlaccount;
 $password=mysqlpassword;
  
 These were the values I had to change which I guess is where the problem
 is. I was supposed to change host to the name of the computer where
 MySQL is installed. But I do not know what name I should put, the name
 of my site is spanishbyproz.com. In the example Janet uses she puts
 datebasehost.mycompany.com . What should I write for host ?
  
 I would really appreciate any advice and am sorry it is such a basic
 question.

Try using:

$host = 'localhost';

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

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



Re: [PHP] Name Capitalization

2007-04-29 Thread Leonard Burton

Hi Paul,

[comments below inline]

On 3/19/07, Paul Novitski [EMAIL PROTECTED] wrote:

At 3/19/2007 07:17 PM, Leonard Burton wrote:
What my case is that I have came across a list of names that I need to
use and all of the names were in caps.  From there anything is a step
in the right direction.

As you know, anytime you parse anything in bulk there will be
exceptions to the rule.

My goal would be to just pick the most common usage.  If von Dielengan
is supposed to be VonDielengan in one case or Von Dielengan in another
is ok, it can be manually retouched later.

The CPAN class that someone posted earlier has some good points except
its not in PHP.

I will be working on some code sometime over the next 3 to 5 days and
might send it to you if you are willing to look at it.


Sure, it sounds like fun.  I've written de-cap routines before for
whole addresses, names included.  It's an amusing challenge to
whittle down the error rate.

I'll be interested to compare notes on strategies for implementing
this efficiently in PHP.


I have set up a Google Code Page for this project.
http://code.google.com/p/lastname

Initially I had a coder translate the project to PHP.

What do you think of how it is implemented?

Would you still like to help work on it?

Thanks and take care,

--
Leonard Burton, N9URK
http://www.jiffyslides.com
[EMAIL PROTECTED]
[EMAIL PROTECTED]

The prolonged evacuation would have dramatically affected the
survivability of the occupants.

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



RE: [PHP] Help me put this into phpinesse!

2007-04-29 Thread Brad Sumrall
When the page opens, connect to server (this works fine).
Look for session, if no session is found, look for phpbb session (two
different session possibilities)

Reading through the phpbb site, it say I must have the code that is in
include './phpbb/login_global.php'

Brad

-Original Message-
From: Tijnema ! [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 29, 2007 5:03 AM
To: Brad Sumrall
Cc: php-general@lists.php.net; [EMAIL PROTECTED]
Subject: Re: [PHP] Help me put this into phpinesse!

On 4/29/07, Brad Sumrall [EMAIL PROTECTED] wrote:
 ?php

ob_start();

session_start();

header(Cache-control: private);

require(includes/configure.php);


 $conn=mysql_connect(DB_SERVER,DB_SERVER_USERNAME,DB_SERVER_PASSWORD);

mysql_select_db(DB_DATABASE) or die(mysql_error().: database
 not available);

$show=no;

isset($_SESSION['userid']);

What's the sense of above line?
isset is a function, that returns true or false.

if $SESSION=NULL

include './phpbb/login_global.php'



$show=yes;

 ?



 What am I missing?



 Brad

There's no concrete question what you want here. So i guess that is missing.

Tijnema



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



RE: [PHP] phpbb / sessionid nightmare

2007-04-29 Thread Brad Sumrall
You might be hitting the nail on the head.
That is why I am trying to get crafty and look for two sessions.
But, give me a sec and follow your lead!
I am back on this project now and finishing laundry at the same time.

Thank you sir!

Brad

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 29, 2007 6:45 PM
To: Brad Sumrall
Cc: [EMAIL PROTECTED]; php-general@lists.php.net
Subject: Re: [PHP] phpbb / sessionid nightmare

Brad Sumrall wrote:
 The cookie it's self says 
 PHPSESSID=26b7974a5d71c7d0bfebbf71750dac7b
 Path=/
 Host=www.domain.com
 
 When I go to the jacked up page, I pickup this one
 PHPSESSID=a787e077dd18ed18cb824f664d38315d
 Path=/
 Host=domain.com

That will be your problem. A cookie created on domain.com is ONLY 
readable by domain.com (unless you make it '.domain.com' which is 
technically different to 'domain.com').

Check out 'session.cookie_domain', you can set it with an ini_set call:

ini_set('session.cookie_domain', '.domain.com');

See http://www.php.net/manual/en/ref.session.php

and http://www.php.net/setcookie for more info about how cookie domains 
work.

-- 
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] phpbb / sessionid nightmare

2007-04-29 Thread Brad Sumrall
The cookie domain in phpbb is already set at ./domain.com

??

I think I need to go back to my little hack?

Opinions?

Brad

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 29, 2007 6:45 PM
To: Brad Sumrall
Cc: [EMAIL PROTECTED]; php-general@lists.php.net
Subject: Re: [PHP] phpbb / sessionid nightmare

Brad Sumrall wrote:
 The cookie it's self says 
 PHPSESSID=26b7974a5d71c7d0bfebbf71750dac7b
 Path=/
 Host=www.domain.com
 
 When I go to the jacked up page, I pickup this one
 PHPSESSID=a787e077dd18ed18cb824f664d38315d
 Path=/
 Host=domain.com

That will be your problem. A cookie created on domain.com is ONLY 
readable by domain.com (unless you make it '.domain.com' which is 
technically different to 'domain.com').

Check out 'session.cookie_domain', you can set it with an ini_set call:

ini_set('session.cookie_domain', '.domain.com');

See http://www.php.net/manual/en/ref.session.php

and http://www.php.net/setcookie for more info about how cookie domains 
work.

-- 
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Running processes in windows

2007-04-29 Thread Chris

Nathan Wallis wrote:

Howdy.

 


I have an application in windows that I am running with a PHP page using
exec  (start..

 


I am wondering as to the efficiency of such a statement and how taxing it is
on the server.  If multiple people access a page with such a statement, what
toll does it take on the server and is there a better way to manage calls to
the server side executable?  When this statement is called a command prompt
window appears for the duration of the execution.  I am guessing it would be
possible to crash the server if thousands of these processes we created at
around the same timejust anyone experience would be greatly appreciated.


I think you can probably stop that from happening (no idea how - maybe 
ask the php-windows list), but it depends on what happens in that 
command prompt.


If you're doing a simple thing, then it won't do much. If you're doing a 
database dump or something else I/O and/or processor intensive, of 
course it's going to take a toll on the server (regardless of the 
operating system).


--
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] Delete first line of a csv file if it is the headers

2007-04-29 Thread Richard Kurth
 The below script will parse a csv file to a database I need to remove
the first line because it is the header files and I don't need them. How can
I test for that and remove them.
 
 $file = fopen($_POST['copy'], 'r') or $message .= Could not open .
$_POST[copy] . for reading.BR\n;
while (!feof($file)){
# We could easily be importing 10,000 records.  Give us
some time here, okay?
set_time_limit(30);
$fields = fgetcsv($file, 100);
   
if ($fields  count($fields)){
$recordcount++;
 
# Wipe out every possible field, in case they have
some missing:
reset($possiblefields);
while (list(,$fieldname) = each($possiblefields)){
$$fieldname = '';
}
 
reset($_POST['fieldorder']);
$fieldcount = 0;
$notes = '';
while (list(,$field) = each($fields)){
$fieldname =
$_POST['fieldorder'][$fieldcount++];
if ($fieldname == 'notes'){
$notes .= addslashes($field\n);
}
elseif ($fieldname == '-- ignore --'){
# ignore it
}
else{
# Note that file data is not Magic-Quoted:
$$fieldname = addslashes($field);
}
}
  require 'importinsert.php';
}


Re: [PHP] phpbb / sessionid nightmare

2007-04-29 Thread Chris

Brad Sumrall wrote:

The cookie domain in phpbb is already set at ./domain.com


I doubt it's set to ./domain.com

What about your session (ie NOT phpbb) ?

--
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] Delete first line of a csv file if it is the headers

2007-04-29 Thread Chris

Richard Kurth wrote:

 The below script will parse a csv file to a database I need to remove
the first line because it is the header files and I don't need them. How can
I test for that and remove them.
 
 $file = fopen($_POST['copy'], 'r') or $message .= Could not open .

$_POST[copy] . for reading.BR\n;



while (!feof($file)){


You don't need this loop. fgetcsv will do it for you (see the example at 
http://php.net/fgetcsv



# We could easily be importing 10,000 records.  Give us
some time here, okay?
set_time_limit(30);


and you're setting this with every line in the file.. probably not what 
you intended.



From the php page but slightly modified:

$row = 0;
$handle = fopen(test.csv, r);
while (($data = fgetcsv($handle, 1000, ,)) !== FALSE) {
$row++;
if ($row == 1) {
echo Found headers, skipping\n;
continue;
}
$num = count($data);
echo p $num fields in line $row: br /\n;
}


snip


if ($fieldname == 'notes'){
$notes .= addslashes($field\n);


If you're putting this into a database you should look to use the 
relevant _escape_string functions (eg mysql_real_escape_string or 
pg_escape_string) because they handle quotes  character sets a lot 
smarter than addslashes does.



# Note that file data is not Magic-Quoted:
$$fieldname = addslashes($field);


Same here.

--
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] phpbb / sessionid nightmare

2007-04-29 Thread Brad Sumrall
Wait, you might be on to something!
Phpbb is set to ./domain
But, on the page I find nothing related to domain
This is a new page.
Think about it as a blank .php page first.

Now, where would you point me now?

Brad

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 30, 2007 12:18 AM
To: Brad Sumrall
Cc: php-general@lists.php.net
Subject: Re: [PHP] phpbb / sessionid nightmare

Brad Sumrall wrote:
 The cookie domain in phpbb is already set at ./domain.com

I doubt it's set to ./domain.com

What about your session (ie NOT phpbb) ?

-- 
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] phpbb / sessionid nightmare

2007-04-29 Thread Brad Sumrall
Login page is located in /phpbb/login.php

New page is /login.php

A test echo page reviles NOTHING!
Login ID does not echo.

If I login @   /index.php, the echo test passes!

Brad

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 30, 2007 12:18 AM
To: Brad Sumrall
Cc: php-general@lists.php.net
Subject: Re: [PHP] phpbb / sessionid nightmare

Brad Sumrall wrote:
 The cookie domain in phpbb is already set at ./domain.com

I doubt it's set to ./domain.com

What about your session (ie NOT phpbb) ?

-- 
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] phpbb / sessionid nightmare

2007-04-29 Thread Brad Sumrall
I have reached the point that I have ripped the entire page out and trying
to just get an echo test to work.
The help files in phpbb are not helping/working.

Brad

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 30, 2007 12:18 AM
To: Brad Sumrall
Cc: php-general@lists.php.net
Subject: Re: [PHP] phpbb / sessionid nightmare

Brad Sumrall wrote:
 The cookie domain in phpbb is already set at ./domain.com

I doubt it's set to ./domain.com

What about your session (ie NOT phpbb) ?

-- 
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Changing Session Timeout

2007-04-29 Thread Aaron Axelsen
I did some more investigating, and tracked down the problem. 
Apparently, even though i was setting a separate save_path inside the
default save path the garbage collector was still picking up the
sessions in that directory.

I moved the session save_path dir to a separate location and the
sessions were removed according to the ini settings.  The 1 weird thing
I noticed is that the session cookie on the client PC is not getting set
properly.  I am trying to set a session timeout of 3 hours, the server
is set to GMT time, and the client PC is set to CST time.  The cookie on
the client PC reports that it has an expiration time of 1.5 hours
instead of 3.  Does anyone have any ideas why thats happening?

Aaron Axelsen wrote:
 Everything i've read in the documentation states to call session_start
 after you have changed your necessary settings.  Do you have a working
 example using session cookies I can compare this with?

 Richard Lynch wrote:
  On Fri, April 27, 2007 1:37 pm, tedd wrote:
  At 12:26 PM -0500 4/27/07, Aaron Axelsen wrote:
  With the following set, its still timing me out.  I logged in
  and waited about 40 minutes, and it was timed out by then. This
  is getting very confusing, what else could it be that is
  causing this to not work?
 
  session_name('myapp');
 
  $mytimeout = 180 * 60; // minutes * 60
 
  session_set_cookie_params($mytimeout);
 
  $sessdir = ini_get('session.save_path')./myapp; if
  (!is_dir($sessdir)) { mkdir($sessdir, 0777); }
  ini_set('session.save_path', $sessdir);
 
  // New Attempt session_cache_limiter();
  session_cache_expire($mytimeout / 60);
  ini_set('session.gc_maxlifetime', $mytimeout);
  #ini_set('session.gc_probability',1);
  #ini_set('session.gc_divisor',1);
 
  session_start();
 
  The above is not the order of your code, is it?
 
  If so, move session_start(); to the top, namely the first line of
   code.

  I don't think you want to do that...

  You want all those settings to take effect BEFORE you actually
  start the session which sends out the headers.



-- 
Aaron Axelsen
Technical Director
Modevia Web Services LLC

1-866-451-9198 x802
[EMAIL PROTECTED]
www.modevia.com

-- 
Aaron Axelsen
[EMAIL PROTECTED]

Great hosting, low prices.  Modevia Web Services LLC -- http://www.modevia.com

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



[PHP] PHP MySQL - Field Title

2007-04-29 Thread Christian Haensel

Good Morning guys and girls

As I am rather lazy, I don't wanna do a data readout on my MySQL table in 
the following way with mysql_fetch_assoc()


$data_item1=$data['xitem1'];
$data_item2=$data['yitem2];


I am trying to do the following:

I have the correct number of fields in the table, which is 116. Now I want 
to use a for-loop and read teh data into a string, then shove it into 
another table, which has the exact same layout. I was thinking about 
something like


for($i=0; $i= 115; $i++) {
   $data_item[$i]=$data[$i];
}

but now I have the problem with the field names and all... can someone point 
me into the right direction? All I have to so is move the contents of one 
field to the second database wich has the same layout as the first DB.


Would be thankful for any help :o)

Cheers!

Chris 


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