php-windows Digest 4 Apr 2003 01:14:09 -0000 Issue 1666
Topics (messages 19268 through 19279):
Re: Help with gd
19268 by: Neil Smith
PHP probs with XML docs
19269 by: trystano.aol.com
Better Error Trapping!
19270 by: Matt Babineau
19272 by: Stephen
Re: unlink?
19271 by: Norbert Grüttner
PHP with PDFlib installation on Windows
19273 by: Bill Hudspeth
fopen permission denied
19274 by: Walter Gyr
19275 by: Nick H. -- Level II Technical Support
session ids
19276 by: Iggy
19277 by: Charles P. Killmer
for loop help!
19278 by: Kieran Hall
Re: Global Variable Issues
19279 by: John
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]
----------------------------------------------------------------------
--- Begin Message ---
Hi Achilles - try something like this (you will have to read the exact
syntax in the manual cause its quite involved but ovious if you're logical
about it) :
<?php
$im = ImageCreateFromJPEG("$imagepath/$imagename")
// Create a gd image ($im) first.
$imtext=ImageCreate (100,22); // Make new, blank image 100x22px for text
$black = ImageColorAllocate ($imtext, 100, 100, 100); // Set black point
(some level of grey)
$white = ImageColorAllocate ($imtext, 255, 255, 255); // Set white point
$coords=ImageTTFText
($imtext,10,0,4,16,$white,$fontpath."arial.ttf","© Copyrightmessage
here 2003");
// Make TTF text and overlay it onto the image.
// Adjust $fontpath to your actual fonts directory.
ImageCopyMergeGray ($im, $imtext, 0, $newheight-22, 0,0,$newwidth,22,33);
// Centre text within image : Vary left & top parameters as required.
header("Content-type: image/jpeg");
ImageJPEG($im);
?>
Hope that helps (it works for me :-)
Cheers, Neil Smith.
At 12:37 03/04/2003 +0000, you wrote:
From: "Achilles Maroulis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Date: Wed, 2 Apr 2003 17:41:29 +0300
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Subject: Re: [PHP-WIN] Help with gd
Hi again... Thanx everyone who read the topic and answered....
...but noone answered my question...
is there a way I can insert a watermark on a jpg with gd???
Maybe it's because there isn't a solution for my problem.
--- End Message ---
--- Begin Message ---
Uhm, reffering to my post yesterday about IE try to open my PHP document as an XML
docuemnt I think I have located the problem.
If I don't make the PHP document XHTML compliant, then the PHP document loads into IE
ok. If I make the PHP document XHTML compliant, and build up a query string using the
dot syntax to identify tables and their columns and store this in a variable, I have
the errors.
Is this a known error, or has anyone experienced this before??
Cheers
Tryst
--- End Message ---
--- Begin Message ---
Hi All-
I have searched for a while and cannot seem to find a quality error trapping
script!!!
Here is the situation, about a week ago one of the sites I built (which is
hosted on a shared server @ an ISP) went down. It went down because the
database server got moved. If I had been notified of the page errors that
were being generated, I would have been able to address the problem more
quickly and get their site back online. Luckily I found the problem, not the
client, however they did have a few people call and ask about it.
I was very angry and spent the rest of the day looking for a good error
trapping script, but I couldn't find anything. I am not very experienced
with error trapping in PHP, so here are a couple questions.
Aside from major code errors which should be fixed in development, things
like database connections won't stop the page from processing, so I am
wondering if PHP Errors (Warnings?) are stored in an array? Maybe I can put
a script into the php.ini appending every page with a small piece of code
that checks if any errors are present and if they are immediately email me.
Does that sound like a solid process for doing some basic alerting when PHP
scripts are generating errors?
I'd love to hear other people's input on this and how they are attacking
this problem!
Thanks!
-------------------------------
Matt Babineau
criticalcode
e:: <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
p:: 603.943.4237
w:: www.criticalcode.com
--- End Message ---
--- Begin Message ---
My solution to the problem was to create an error reporting function. If
something goes wrong during key parts of the code (eg database erorr, mail
sending error, file reading error etc) then the error function is called. My
error reporting function attempts to send me an email, and if the email is
not sent instructs the user to send it manually. It also displays the normal
site interface without any php features (its hard coded in HTML - that way I
know it will ALWAYS work).
for example
MySQL_query( "Do Stuff to MySQL" )
OR error_report( '1', 'A MySQL Error occured while doing XYZ', __FILE__,
__LINE__, MySQL_error() );
I suggest you come up with a similar solution.
Stephen
----- Original Message -----
From: "Matt Babineau" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 03, 2003 4:48 PM
Subject: [PHP-WIN] Better Error Trapping!
Hi All-
I have searched for a while and cannot seem to find a quality error trapping
script!!!
Here is the situation, about a week ago one of the sites I built (which is
hosted on a shared server @ an ISP) went down. It went down because the
database server got moved. If I had been notified of the page errors that
were being generated, I would have been able to address the problem more
quickly and get their site back online. Luckily I found the problem, not the
client, however they did have a few people call and ask about it.
I was very angry and spent the rest of the day looking for a good error
trapping script, but I couldn't find anything. I am not very experienced
with error trapping in PHP, so here are a couple questions.
Aside from major code errors which should be fixed in development, things
like database connections won't stop the page from processing, so I am
wondering if PHP Errors (Warnings?) are stored in an array? Maybe I can put
a script into the php.ini appending every page with a small piece of code
that checks if any errors are present and if they are immediately email me.
Does that sound like a solid process for doing some basic alerting when PHP
scripts are generating errors?
I'd love to hear other people's input on this and how they are attacking
this problem!
Thanks!
-------------------------------
Matt Babineau
criticalcode
e:: <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
p:: 603.943.4237
w:: www.criticalcode.com
--- End Message ---
--- Begin Message ---
Paul,
you have to make sure, that the file you are trying to delete via unlink is
not currently in use by you application:
Example which WILL NOT WORK
$array = File("filename");
Unlink ("filename");
Another one NOT WORKING
$fh = fopen("filename");
$data = fgets($fh);
unlink("filename"");
But this one should work
$fh = fopen("filename");
$data = fgets($fh);
fclose($fh);
unlink("filename");
Regards
Norbert
"Paul Dymecki" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hello,
> I was wondering if anyone knows how to delete a file from the
> filesystem? I've been trying unlink but it doesn't seem to be working as
> expected. Do spaces in the file path have to be compensated for or
> something?
> thx for any help,
> Paul
>
>
>
>
>
> _________________________________________________________________
> The new MSN 8: smart spam protection and 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
--- End Message ---
--- Begin Message ---
Hello,
I am having problems getting the PDF extension to work with PHP on Windows.
I am running PHP 4.2.3 on Windows NT 4.0 using IIS as my internet server. I
have enabled the PDF extension in the php.ini file, with no apparent
success. When I try to load the page, I get an empty screen (i.e., no error
messages or undefined functions). It was my understanding that the Windows
module version of PHP had PDFLib libraries already built in. What might be
my problem?
Thanks, Bill
--- End Message ---
--- Begin Message ---
Hi All
I have update to PHP 4.3.1 W2000, apache 2.0.14 MYSQL 4.0.12 .
In a php script
$fp = fopen("i:\\data\\import.txt", "r");
" Cannot open permission denied....."
i: is mapped network drive
When i call the script from command line it works.
Can anybody help ?
Walter
--- End Message ---
--- Begin Message ---
You need to make sure that IUSR has permissions on that file. When you call
from command line it's using your credentials. When it's from a browser,
it's IUSR_MACHINE
Regards,
Nick H.
[EMAIL PROTECTED]
----- Original Message -----
From: "Walter Gyr" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 03, 2003 11:46 AM
Subject: [PHP-WIN] fopen permission denied
> Hi All
>
> I have update to PHP 4.3.1 W2000, apache 2.0.14 MYSQL 4.0.12 .
>
> In a php script
>
> $fp = fopen("i:\\data\\import.txt", "r");
> " Cannot open permission denied....."
>
> i: is mapped network drive
>
>
> When i call the script from command line it works.
>
> Can anybody help ?
>
>
> Walter
>
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
I have been having a huge problem with session IDs for a while now and
havn't been able to find a solution.
a simple code like this:
session_start();
echo session_id();
session_unset();
session_destroy();
run on a single php page will always give me the same id no matter how many
times I refresh the window. Now my understanding of sessions may be wrong,
but I though when you kill a session the id is killed as well. that would
mean when I refresh the page, a new id should be generated. Unfortunately
this does not happen and I can't figure out why. Only after I shut all
browser windows down, I get a new id and then the same story again.
Now, I know that the damn session is erased from the temp folder because I
see it happen, however the id sticks to the browser for whatever reason.
I am running php4.2.3 on w2k pro and IIS
can anybody help me please?
thanx,
iggy
--- End Message ---
--- Begin Message ---
PHP will use the session id that your browser specifies. If you have
php setup to store session id in cookies, every time you refresh the
page your browser is telling php what session id to use. Then when you
close your browser, your cookies may be getting deleted.
Charles Killmer
-----Original Message-----
From: Iggy [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 03, 2003 4:22 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] session ids
I have been having a huge problem with session IDs for a while now and
havn't been able to find a solution.
a simple code like this:
session_start();
echo session_id();
session_unset();
session_destroy();
run on a single php page will always give me the same id no matter how
many times I refresh the window. Now my understanding of sessions may be
wrong, but I though when you kill a session the id is killed as well.
that would mean when I refresh the page, a new id should be generated.
Unfortunately this does not happen and I can't figure out why. Only
after I shut all browser windows down, I get a new id and then the same
story again.
Now, I know that the damn session is erased from the temp folder because
I see it happen, however the id sticks to the browser for whatever
reason. I am running php4.2.3 on w2k pro and IIS
can anybody help me please?
thanx,
iggy
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I want to display information from my database in two columns. I run
into a problem when there are three records. Another table data cell is
produced containing template material. Does anyone know a quick
solution to this problem? Code below:
$cols = 2;
$cell_count = 0;
if($numrows < $cols){
$cells = $numrows;
}
else{
$cells = $cols;
}
$test = $numrows/$cols;
if($test <= 0){
$rows = 1;
}
else{
$rows = round($test);
}
for($i = 0; $i < $rows; $i++){
echo"<tr>";
for($j = 0; $j < $cells; $j++){
$r=$lower_news->fobject();
$l_news_id = $r->id;
$l_news_title = $r->title;
$l_news_date = $r->date;
$l_news_username = $r->username;
$l_news_image = $r->image;
$l_news_intro = $r->intro;
$l_news_views = $r->views;
echo"<td width=\"50%\" align=\"left\">\n";
echo"<table cellpadding=\"0\" cellspacing=\"0\">\n";
echo"<tr>\n";
echo"<td align=\"left\" valign=\"top\"><a
href=\"javascript://void(0)\" OnClick=\"NewsPic('News',
'$hse_root_web_addr"."news/picture.php?pic=$l_news_image')\"><img
class=\"news_headline\" width=\"64\" height=\"48\"
src=\"$hse_root_web_addr"."news/img/$l_news_image\" alt=\"Click for
bigger version!\" /></a></td>\n";
echo"<td valign=\"top\">\n";
echo"<table width=\"100%\" cellpadding=\"1\" cellspacing=\"0\">\n";
echo"<tr>\n";
echo"<td align=\"left\" valign=\"top\"
class=\"lower_news_headline\"><a
href=\"$hse_root_web_addr"."news/?id=$l_news_id\">$l_news_title</a></td>
\n";
echo"</tr>\n";
echo"<tr>\n";
echo"<td align=\"left\" class=\"info\"><b>Published:</b>
$l_news_date<br /><b>Author:</b> $l_news_username</td>";
echo"</tr>\n";
echo"</table>\n";
echo"</td>\n";
echo"</tr>\n";
echo"</table>\n";
echo"</td>\n";
}
echo"</tr>";
}
?>
--- End Message ---
--- Begin Message ---
Try setting this variable as a session.
Here is a piece of code used once a user has been validated against a MySQL
dbase. ($uname was assigned from the login.html page)
<?
session_start();
$_SESSION['valid_user'] = $uname;
?>
Then, on each page that requires a preson to be logged in to access, this
goes at the top:
<?
//start the session
session_start();
//see if this person is 'valid_user', if not, redirect to LOGIN.HTML
if (!isset($_SESSION['valid_user'])){
header( "Location: login.html" );
}
//if he is 'valid_user' then load the page as normal
else {
?>
NORMAL PAGE CODE HERE
//allows me to assign a the info from 'valid_user' to a variable
$uname=($_SESSION['valid_user']);
<?
//end ELSE statement
}
?>
"Cam" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Through past releases of PHP, I've developed with global variables on.
> These days it's becoming the trend, for security & asthetics purposes, to
> turn global variables off... Let's say I have a $status variable that
> changes depending upon the user's actions on the previous page and
displays
> a message...
>
> Is there a way to propagate this variable through pages without 1)
declaring
> it as a global, 2) writing it to a cookie, 3) passing it through the URL
or
> 4) passing it through a form w/ POST?
>
> 1-globals are now off
> 2-cookie writing is impracical & no desire to store 1 time information
> client side
> 3-displaying the status message in the URL (or a status id) would look
> unprofessional and allow for user manipulation of the message they see by
> editing the URL string
> 4-not all my site's page transitions occur through forms, so I see no way
to
> use $_POST every time
>
> I appreciate any suggestions & hearing your thoughts,
>
> Cam
>
>
--- End Message ---