php-general Digest 21 Jul 2008 15:11:34 -0000 Issue 5581

2008-07-21 Thread php-general-digest-help

php-general Digest 21 Jul 2008 15:11:34 - Issue 5581

Topics (messages 277133 through 277144):

Re: Pasword Protecting several pages
277133 by: Micah Gersten
277134 by: R.C.
277135 by: Micah Gersten

Re: accessing variable value
277136 by: Chris

syntax error
277137 by: Ronald Wiplinger
277138 by: Ted Wood
277139 by: Eric Butera
277140 by: Aschwin Wesselius
277141 by: Eric Butera
277142 by: Aschwin Wesselius
277143 by: Eric Butera

Re: session ok? [SOLVED]
277144 by: tedd

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---
Set a session variable after the login has been confirmed and check for
it at the beginning of every page.  If it's not set, then redirect to login.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



R.C. wrote:
 I'm still trying to get this scenario worked out and don't seem to be able
 to get it done.

 Here's what I'm trying to do:
 User logs into a login page and inputs email address and password.  User
 accessess password protected page, which contains a few links.  User clicks
 on one of the links, opens page, looks at content and then clicks back to
 main page.

 User is now asked to input password again what do I have to do to make
 sure all related links/pages on the main.php page are accessible with that
 same password the user input the first time?  Also.. how can I password
 protect ALL the linked pages on the main.php site with the same password but
 user only has to log in once!!

 No database, but just sessions?  I looked at those and also Tedd was kind
 enough to send something but for some reason I can't get it to go.

 Can someone forward some good instructions on how to accomplish this task?
 I would greatly appreciate it. Still learning this program as you can tell.

 Best
 Ref





   
---End Message---
---BeginMessage---
Thank you Micah,

Could you give me some code on that?

Ref

Micah Gersten [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Set a session variable after the login has been confirmed and check for
 it at the beginning of every page.  If it's not set, then redirect to
login.

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 R.C. wrote:
  I'm still trying to get this scenario worked out and don't seem to be
able
  to get it done.
 
  Here's what I'm trying to do:
  User logs into a login page and inputs email address and password.  User
  accessess password protected page, which contains a few links.  User
clicks
  on one of the links, opens page, looks at content and then clicks back
to
  main page.
 
  User is now asked to input password again what do I have to do to
make
  sure all related links/pages on the main.php page are accessible with
that
  same password the user input the first time?  Also.. how can I password
  protect ALL the linked pages on the main.php site with the same password
but
  user only has to log in once!!
 
  No database, but just sessions?  I looked at those and also Tedd was
kind
  enough to send something but for some reason I can't get it to go.
 
  Can someone forward some good instructions on how to accomplish this
task?
  I would greatly appreciate it. Still learning this program as you can
tell.
 
  Best
  Ref
 
 
 
 
 
 


---End Message---
---BeginMessage---
checkLogin.php

?php

session_start();
if ($_SESSION['login'] != true)
{
header(Location: login.php);
exit();
}

?

info.php

?php

include_once('checkLogin.php');

...Code goes here...

?

login.php

?php

session_start();

if ($_POST['Username'] == *Check Credentials Here*)
{
$_SESSION['login'] = true;
header(Location: info.php);
exit();
}

//Output Form Here

?

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



R.C. wrote:
 Thank you Micah,

 Could you give me some code on that?

 Ref

 Micah Gersten [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
   
 Set a session variable after the login has been confirmed and check for
 it at the beginning of every page.  If it's not set, then redirect to
 
 login.
   
 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 R.C. wrote:
 
 I'm still trying to get this scenario worked out and don't seem to be
   
 able
   
 to get it done.

 Here's what I'm trying to do:
 User logs into a login page and inputs email address and password.  User
 accessess password protected page, which contains a few links.  User
   
 clicks
   
 on one of the links, opens page, looks at content and then clicks back
   
 to
   
 main page.

 User is now asked to input password 

[PHP] syntax error

2008-07-21 Thread Ronald Wiplinger
On a system with php4 and mysql 4.x I had these lines:

require(../db-config); // includes $dbhost, $buname, $dbpass
$db = mysql_connect($dbhost, $dbuname, $dbpass);
mysql_select_db($dbname,$db);

$sql = SELECT * FROM CATEGORY WHERE .;
$result = mysql_query($sql,$db);
$num=mysql_num_rows($result);
while ($myrow = mysql_fetch_array($result)) {


Moving the *.php to a php5 and mysql 5.x site I get these errors:

PHP Warning:  mysql_num_rows(): supplied argument is not a valid MySQL
result resource in ...
PHP Warning:  mysql_fetch_array(): supplied argument is not a valid MySQL
result resource in ...


Looking at the manual, I cannot see what I am doing wrong.

bye

R.


Re: [PHP] syntax error

2008-07-21 Thread Ted Wood


Not a syntax error. It's not successfully connecting to the database.  
Check your settings.


~Ted



On 21-Jul-08, at 4:24 AM, Ronald Wiplinger wrote:


On a system with php4 and mysql 4.x I had these lines:

require(../db-config); // includes $dbhost, $buname, $dbpass
$db = mysql_connect($dbhost, $dbuname, $dbpass);
mysql_select_db($dbname,$db);

   $sql = SELECT * FROM CATEGORY WHERE .;
   $result = mysql_query($sql,$db);
   $num=mysql_num_rows($result);
   while ($myrow = mysql_fetch_array($result)) {


Moving the *.php to a php5 and mysql 5.x site I get these errors:

PHP Warning:  mysql_num_rows(): supplied argument is not a valid MySQL
result resource in ...
PHP Warning:  mysql_fetch_array(): supplied argument is not a valid  
MySQL

result resource in ...


Looking at the manual, I cannot see what I am doing wrong.

bye

R.



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



Re: [PHP] syntax error

2008-07-21 Thread Eric Butera
On Mon, Jul 21, 2008 at 7:24 AM, Ronald Wiplinger [EMAIL PROTECTED] wrote:
 On a system with php4 and mysql 4.x I had these lines:

 require(../db-config); // includes $dbhost, $buname, $dbpass
 $db = mysql_connect($dbhost, $dbuname, $dbpass);
 mysql_select_db($dbname,$db);

$sql = SELECT * FROM CATEGORY WHERE .;
$result = mysql_query($sql,$db);
$num=mysql_num_rows($result);
while ($myrow = mysql_fetch_array($result)) {
 

 Moving the *.php to a php5 and mysql 5.x site I get these errors:

 PHP Warning:  mysql_num_rows(): supplied argument is not a valid MySQL
 result resource in ...
 PHP Warning:  mysql_fetch_array(): supplied argument is not a valid MySQL
 result resource in ...


 Looking at the manual, I cannot see what I am doing wrong.

 bye

 R.


Your mysql_connect is probably failing.  Look at your error log or
look at mysql_error() for a reason why.

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



Re: [PHP] syntax error

2008-07-21 Thread Aschwin Wesselius

Eric Butera wrote:

On Mon, Jul 21, 2008 at 7:24 AM, Ronald Wiplinger [EMAIL PROTECTED] wrote:
  

On a system with php4 and mysql 4.x I had these lines:

require(../db-config); // includes $dbhost, $buname, $dbpass
$db = mysql_connect($dbhost, $dbuname, $dbpass);
mysql_select_db($dbname,$db);

   $sql = SELECT * FROM CATEGORY WHERE .;
   $result = mysql_query($sql,$db);
   $num=mysql_num_rows($result);
   while ($myrow = mysql_fetch_array($result)) {


Moving the *.php to a php5 and mysql 5.x site I get these errors:

PHP Warning:  mysql_num_rows(): supplied argument is not a valid MySQL
result resource in ...
PHP Warning:  mysql_fetch_array(): supplied argument is not a valid MySQL
result resource in ...


Looking at the manual, I cannot see what I am doing wrong.

bye

R.




Your mysql_connect is probably failing.  Look at your error log or
look at mysql_error() for a reason why.


Probably the mysql extension is not found or not loaded (due to not 
being compiled with the right path or the default path in PHP is not the 
right one). Happened to me a couple of times.



--

Aschwin Wesselius

/'What you would like to be done to you, do that to the other'/


Re: [PHP] syntax error

2008-07-21 Thread Eric Butera
On Mon, Jul 21, 2008 at 7:55 AM, Aschwin Wesselius
[EMAIL PROTECTED] wrote:
 Eric Butera wrote:

 On Mon, Jul 21, 2008 at 7:24 AM, Ronald Wiplinger [EMAIL PROTECTED]
 wrote:


 On a system with php4 and mysql 4.x I had these lines:

 require(../db-config); // includes $dbhost, $buname, $dbpass
 $db = mysql_connect($dbhost, $dbuname, $dbpass);
 mysql_select_db($dbname,$db);

$sql = SELECT * FROM CATEGORY WHERE .;
$result = mysql_query($sql,$db);
$num=mysql_num_rows($result);
while ($myrow = mysql_fetch_array($result)) {
 

 Moving the *.php to a php5 and mysql 5.x site I get these errors:

 PHP Warning:  mysql_num_rows(): supplied argument is not a valid MySQL
 result resource in ...
 PHP Warning:  mysql_fetch_array(): supplied argument is not a valid MySQL
 result resource in ...


 Looking at the manual, I cannot see what I am doing wrong.

 bye

 R.



 Your mysql_connect is probably failing.  Look at your error log or
 look at mysql_error() for a reason why.

 Probably the mysql extension is not found or not loaded (due to not being
 compiled with the right path or the default path in PHP is not the right
 one). Happened to me a couple of times.


 --

 Aschwin Wesselius

 'What you would like to be done to you, do that to the other'


Wouldn't that be  call to undefined function then?

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



Re: [PHP] syntax error

2008-07-21 Thread Aschwin Wesselius

Eric Butera wrote:

On Mon, Jul 21, 2008 at 7:55 AM, Aschwin Wesselius
[EMAIL PROTECTED] wrote:
  

Probably the mysql extension is not found or not loaded (due to not being
compiled with the right path or the default path in PHP is not the right
one). Happened to me a couple of times.


--

Aschwin Wesselius

'What you would like to be done to you, do that to the other'




Wouldn't that be  call to undefined function then?


Oh my. I'm so sorry. You're absolutely right. I mixed these two. I'm 
a bit side-tracked today.


Thanks for pointing that out.


--

Aschwin Wesselius

/'What you would like to be done to you, do that to the other'/


Re: [PHP] syntax error

2008-07-21 Thread Eric Butera
On Mon, Jul 21, 2008 at 8:32 AM, Aschwin Wesselius
[EMAIL PROTECTED] wrote:
 Oh my. I'm so sorry. You're absolutely right. I mixed these two. I'm a
 bit side-tracked today.

 Thanks for pointing that out.


 --

 Aschwin Wesselius


It's no problem, I got scared I was spreading propaganda!  hehe :)

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



Re: [PHP] session ok? [SOLVED]

2008-07-21 Thread tedd

Hi gang:

I found the problem I was having with sessions and want to share it 
with you -- it surprised me.


To refresh -- I was having a problem with destroying a session. I 
went through all the steps shown in the manual and dozens of 
recommended ways of doing it I found on the net.


However, I found that while I was actually destroying the session I 
wanted, another session was being created in a very unexpected way.


Now, the manual says:

session_start() creates a session or resumes the current one based 
on the current session id that's being passed via a request, such as 
GET, POST, or a cookie.


From that one assumes that if you place a session_start at the 
beginning of each page, then the first time it's encountered, a 
session will be created and with every encounter thereafter the 
established session will be used.


That's the way it works PROVIDED that you do not use the following in 
your code:


header('Location: http://www.yourdomain.com/whatever/index.php');

If you use that statement, then a new session will be created AND you 
will find that you'll have two sessions working concurrently. That 
creates several problems -- one of them being while you may destroy 
the first session, the second will be still remain.


Now, how many people knew this?

Am I the only one who didn't?

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] session ok? [SOLVED]

2008-07-21 Thread Micah Gersten
When you use a header redirect, you start with a new page.  Everything
you did until then is gone.  When you call session_start on the new
page, it resumes the same session, not creates a new one.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



tedd wrote:
 Hi gang:

 I found the problem I was having with sessions and want to share it
 with you -- it surprised me.

 To refresh -- I was having a problem with destroying a session. I went
 through all the steps shown in the manual and dozens of recommended
 ways of doing it I found on the net.

 However, I found that while I was actually destroying the session I
 wanted, another session was being created in a very unexpected way.

 Now, the manual says:

 session_start() creates a session or resumes the current one based on
 the current session id that's being passed via a request, such as GET,
 POST, or a cookie.

 From that one assumes that if you place a session_start at the
 beginning of each page, then the first time it's encountered, a
 session will be created and with every encounter thereafter the
 established session will be used.

 That's the way it works PROVIDED that you do not use the following in
 your code:

 header('Location: http://www.yourdomain.com/whatever/index.php');

 If you use that statement, then a new session will be created AND you
 will find that you'll have two sessions working concurrently. That
 creates several problems -- one of them being while you may destroy
 the first session, the second will be still remain.

 Now, how many people knew this?

 Am I the only one who didn't?

 Cheers,

 tedd

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



Re: [PHP] session ok? [SOLVED]

2008-07-21 Thread Jason Pruim


On Jul 21, 2008, at 11:11 AM, tedd wrote:


Hi gang:

I found the problem I was having with sessions and want to share it  
with you -- it surprised me.


To refresh -- I was having a problem with destroying a session. I  
went through all the steps shown in the manual and dozens of  
recommended ways of doing it I found on the net.


However, I found that while I was actually destroying the session I  
wanted, another session was being created in a very unexpected way.


Now, the manual says:

session_start() creates a session or resumes the current one based  
on the current session id that's being passed via a request, such as  
GET, POST, or a cookie.


From that one assumes that if you place a session_start at the  
beginning of each page, then the first time it's encountered, a  
session will be created and with every encounter thereafter the  
established session will be used.


That's the way it works PROVIDED that you do not use the following  
in your code:


header('Location: http://www.yourdomain.com/whatever/index.php');

If you use that statement, then a new session will be created AND  
you will find that you'll have two sessions working concurrently.  
That creates several problems -- one of them being while you may  
destroy the first session, the second will be still remain.


Now, how many people knew this?

Am I the only one who didn't?


If what you said is true tedd... I didn't know that and it could  
explain some problems I've been having with a website... In a little  
bit I'll read through this thread and see if I can replicate the  
problem over on my server.




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





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



Re: [PHP] session ok? [SOLVED]

2008-07-21 Thread Daniel Brown
On Mon, Jul 21, 2008 at 11:11 AM, tedd [EMAIL PROTECTED] wrote:

 That's the way it works PROVIDED that you do not use the following in your
 code:

 header('Location: http://www.yourdomain.com/whatever/index.php');

Was this line of code included in a script access at
http://www.yourdomain.com/whatever/?

If it wasn't HTTP (vs HTTPS), in the /whatever directory, under
the www. CNAME, then the cookie would be invalid.  If it WAS still
adhering to all of the same, did you use session_write_close() to save
the session data to disk before redirecting?

If all else fails, be sure to read through the user notes on the
manual pages.  For example, session_start() has a bunch of manual
entries with the term 'location' that discuss quite similar issues,
including resolutions.  Note that if they don't contain suggestions
and/or resolutions, we delete them, to make sure that the user notes
are as concise and helpful as possible.  Felepe (Pena) and I deleted
or modified over 700 of them in the last two days alone.

Check out the user notes on session_start() here:

http://www.php.net/manual/en/function.session-start.php

-- 
/Daniel P. Brown
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] Pasword Protecting several pages

2008-07-21 Thread tedd

At 7:44 PM -0700 7/20/08, R.C. wrote:

No database, but just sessions?  I looked at those and also Tedd was kind
enough to send something but for some reason I can't get it to go.

Can someone forward some good instructions on how to accomplish this task?
I would greatly appreciate it. Still learning this program as you can tell.

Best
Ref


Ref:

It you will look, this is what I prepared for you:

http://webbytedd.com/b1/simple-session/

Everything you need is there.

Hope this helps,

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] session ok? [SOLVED]

2008-07-21 Thread tedd

At 11:23 AM -0400 7/21/08, Daniel Brown wrote:

On Mon, Jul 21, 2008 at 11:11 AM, tedd [EMAIL PROTECTED] wrote:


 That's the way it works PROVIDED that you do not use the following in your
 code:

 header('Location: http://www.yourdomain.com/whatever/index.php');


Was this line of code included in a script access at
http://www.yourdomain.com/whatever/?

If it wasn't HTTP (vs HTTPS), in the /whatever directory, under
the www. CNAME, then the cookie would be invalid.  If it WAS still
adhering to all of the same, did you use session_write_close() to save
the session data to disk before redirecting?

If all else fails, be sure to read through the user notes on the
manual pages.  For example, session_start() has a bunch of manual
entries with the term 'location' that discuss quite similar issues,
including resolutions.  Note that if they don't contain suggestions
and/or resolutions, we delete them, to make sure that the user notes
are as concise and helpful as possible.  Felepe (Pena) and I deleted
or modified over 700 of them in the last two days alone.

Check out the user notes on session_start() here:

http://www.php.net/manual/en/function.session-start.php


A, I think I see now what the problem was.

The original session was started using:

http://webbytedd.com

and my redirect was using:

http://www.webbytedd.com

Thus two domain and two sessions.

Thanks for bringing that to my attention. It's always nice to finally 
understand something.


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] session ok? [SOLVED]

2008-07-21 Thread Andrew Ballard
On Mon, Jul 21, 2008 at 11:21 AM, Jason Pruim [EMAIL PROTECTED] wrote:

 On Jul 21, 2008, at 11:11 AM, tedd wrote:

 Hi gang:

 I found the problem I was having with sessions and want to share it with
 you -- it surprised me.

 To refresh -- I was having a problem with destroying a session. I went
 through all the steps shown in the manual and dozens of recommended ways of
 doing it I found on the net.

 However, I found that while I was actually destroying the session I
 wanted, another session was being created in a very unexpected way.

 Now, the manual says:

 session_start() creates a session or resumes the current one based on the
 current session id that's being passed via a request, such as GET, POST, or
 a cookie.

 From that one assumes that if you place a session_start at the beginning
 of each page, then the first time it's encountered, a session will be
 created and with every encounter thereafter the established session will be
 used.

 That's the way it works PROVIDED that you do not use the following in your
 code:

 header('Location: http://www.yourdomain.com/whatever/index.php');

 If you use that statement, then a new session will be created AND you will
 find that you'll have two sessions working concurrently. That creates
 several problems -- one of them being while you may destroy the first
 session, the second will be still remain.

 Now, how many people knew this?

 Am I the only one who didn't?

 If what you said is true tedd... I didn't know that and it could explain
 some problems I've been having with a website... In a little bit I'll read
 through this thread and see if I can replicate the problem over on my
 server.



 --

 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 11287 James St
 Holland, MI 49424
 www.raoset.com
 [EMAIL PROTECTED]

Setting a session and then issuing a redirect should not cause. Are
you exiting immediately after you set the location header? (Or at
least calling session_write_close()?)  It sounds like the client is
handling the redirect and calling the new resource before your server
has finished the process and written the session to disk.

I'm pretty sure in ASP that when you call Response.Redirect(...some
resource...) that that call automatically exits the script, but PHP
continues processing the current script (at least until the server
becomes aware that the client is no longer listening).

You could write your own redirect function that does all of this for you:

?php


function client_redirect($redirect_url) {
// You should make sure that $redirect_url is valid

session_write_close();

// Send the Location header to redirect the client.
header(Location: $redirect_url);

// flush any existing output buffers
while (@ob_end_flush());

exit();

}

?

Andrew

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



Re: [PHP] session ok? [SOLVED]

2008-07-21 Thread Andrew Ballard
On Mon, Jul 21, 2008 at 11:37 AM, tedd [EMAIL PROTECTED] wrote:
 At 11:23 AM -0400 7/21/08, Daniel Brown wrote:

 On Mon, Jul 21, 2008 at 11:11 AM, tedd [EMAIL PROTECTED] wrote:

  That's the way it works PROVIDED that you do not use the following in
 your
  code:

  header('Location: http://www.yourdomain.com/whatever/index.php');

Was this line of code included in a script access at
 http://www.yourdomain.com/whatever/?

If it wasn't HTTP (vs HTTPS), in the /whatever directory, under
 the www. CNAME, then the cookie would be invalid.  If it WAS still
 adhering to all of the same, did you use session_write_close() to save
 the session data to disk before redirecting?

If all else fails, be sure to read through the user notes on the
 manual pages.  For example, session_start() has a bunch of manual
 entries with the term 'location' that discuss quite similar issues,
 including resolutions.  Note that if they don't contain suggestions
 and/or resolutions, we delete them, to make sure that the user notes
 are as concise and helpful as possible.  Felepe (Pena) and I deleted
 or modified over 700 of them in the last two days alone.

Check out the user notes on session_start() here:

http://www.php.net/manual/en/function.session-start.php

 A, I think I see now what the problem was.

 The original session was started using:

 http://webbytedd.com

 and my redirect was using:

 http://www.webbytedd.com

 Thus two domain and two sessions.

 Thanks for bringing that to my attention. It's always nice to finally
 understand something.

 Cheers,

 tedd



You can fix that, too, but setting session.cookie_domain to
'webbytedd.com' rather than letting it default to the current
HTTP_HOST value. That should allow the session cookie to be sent to
'ANYSUBDOMAIN.webbytedd.com' as well as just 'webbytedd.com'. Of
course, make sure you actually want this behavior. Some sites will
rely on different session pools for different subdomains.

Andrew

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



[PHP] PHP Warning: imagettftext()

2008-07-21 Thread Lou Baccari



Hello,

 I'm trying to move a site over to the V5 of CentOS and I having 
problems with php/gd/freetype.  It looks like my older
systems which is running php-4.3.8-1.1, gd-2.0.15-1, freetype-2.1.4-5 
can execute the code successfully.


 Now when I try to execute the same code on CentOS V5 with php-5.2.6, 
php-gd-5.2.6, gd-2.0.33-9.4,
freetype-2.2.1-20 the same piece of code fails with the error: 

 *[Mon Jul 21 13:13:11 2008] [error] [client 137.203.140.206] PHP 
Warning:  imagettftext() [a 
href='function.imagettftext'function.imagettftext/a]: Could not 
read font in /www/html/template/lou2.php on line 10
[Mon Jul 21 13:13:11 2008] [error] [client 137.203.140.206] PHP 
Warning:  imagettftext() [a 
href='function.imagettftext'function.imagettftext/a]: Could not 
read font in /www/html/template/lou2.php on line 11

***

 I read through php.net and marc.info but I have not yet found a 
solution,  Any ideas?


Thanks,

Lou

code 


?php
//header(Content-type: image/png);
$im = imagecreate(400, 30);
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
$text = 'BBBleh...';
$font = 'arial.ttf';
putenv( 'GDFONTPATH='.realpath('.') );
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

header(Content-type: image/png);

imagepng($im);
imagedestroy($im);
?




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



Re: [PHP] syntax error

2008-07-21 Thread Daniel Brown
On Mon, Jul 21, 2008 at 7:24 AM, Ronald Wiplinger [EMAIL PROTECTED] wrote:

Try this:

$result = mysql_query($sql,$db) or die(mysql_error());

-- 
/Daniel P. Brown
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] syntax error

2008-07-21 Thread Daniel Brown
Please keep replies on list for all to benefit and be able to assist.

On Mon, Jul 21, 2008 at 5:47 PM, Ronald Wiplinger [EMAIL PROTECTED] wrote:

 On Tue, Jul 22, 2008 at 1:51 AM, Daniel Brown [EMAIL PROTECTED] wrote:

Try this:

 $result = mysql_query($sql,$db) or die(mysql_error());

Did you try my suggestion above?  If so, did you receive any errors?

 echo result=$resultbr;
 $num=mysql_num_rows($result);
 echo num=$num;

 I get:

 result=
 num=

The most you'd get from $result in this case would be a resource
identifier message, because that's all mysql_query() returns.  And
since the resource link doesn't seem to be correctly established, $num
will be empty.

-- 
/Daniel P. Brown
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

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