php-general Digest 31 Dec 2003 13:58:43 -0000 Issue 2504
Topics (messages 173511 through 173540):
Re: Mysql management programme for windows?
173511 by: John W. Holmes
Re: What is the Basic function to encode the password upon the authentication..
173512 by: John W. Holmes
173540 by: Scott Fletcher
Re: MySQL Sub search - Is there such a thing?
173513 by: John W. Holmes
173515 by: Raditha Dissanayake
Re: How to use anchor with php post string to jump to a page???
173514 by: Mike Migurski
Re: How do I protect downloadable files?
173516 by: Raditha Dissanayake
173517 by: Kim Steinhaug
173520 by: Larry Brown
173525 by: Andrew Séguin
173526 by: Andrew Séguin
Re: Testing for Well-Formed XML
173518 by: Al
Re: Selecting between using letters
173519 by: Kim Steinhaug
PHP forms that are valid XHTML
173521 by: Tim Burgan
173522 by: Tom Rogers
173523 by: Leif K-Brooks
173524 by: Tim Burgan
Re: connecting to progress db
173527 by: Aidan Lister
Re: PHP5 XML functions
173528 by: Aidan Lister
173530 by: Ray Hunter
Re: Failed error_log directive
173529 by: Aidan Lister
Securing Free Scripts
173531 by: Ian
173532 by: John W. Holmes
173533 by: Ugo Bellavance
173534 by: Jake McHenry
need help with php and mysql
173535 by: webmaster.multiwebmastertools.com
173536 by: webmaster.multiwebmastertools.com
PHP and MSSQL (and Access????)
173537 by: DragonEye WebDesign
Help with PNG creation script
173538 by: Ashley M. Kirchner
173539 by: Marcus Wendt
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 ---
pehepe php wrote:
Do you know any mysql management programme as phpmyadmin but not works
on the server. i want to install on my PC. then i connect my database on
server from my PC at home. Do you know it?
Well, you could just run PHPMyAdmin on your own computer and just have
it connect to the remote host. Otherwise, there are a host of programs
you could run: MySQL Command Center (MySQL CC), MySQLFront, Mascon, EMS
MySQL Manager 2, fabForce DB Designer 4, Navicat PremiumSoft MySQL
Studio, SQLYog...
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Scott Fletcher wrote:
What is the function exactly for encoding the user's typed password in
PHP after the HTTP Authentication pop-up window by Apache was submitted? I
tried the base64_encode() but it is not the right function. The
authentication header here is ..
--snip--
header('WWW-Authenticate: Basic realm="My Private Stuff"');
header('HTTP/1.0 401 Unauthorized');
--snip--
Encoding it for what? It comes into PHP as a $_SERVER variable in plain
text. If you want to compare it to an .htaccess type password, then I
think crypt() is what you need.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Thanks, that does help!!!
FletchSOD
"John W. Holmes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Scott Fletcher wrote:
>
> > What is the function exactly for encoding the user's typed password
in
> > PHP after the HTTP Authentication pop-up window by Apache was submitted?
I
> > tried the base64_encode() but it is not the right function. The
> > authentication header here is ..
> >
> > --snip--
> > header('WWW-Authenticate: Basic realm="My Private Stuff"');
> > header('HTTP/1.0 401 Unauthorized');
> > --snip--
>
> Encoding it for what? It comes into PHP as a $_SERVER variable in plain
> text. If you want to compare it to an .htaccess type password, then I
> think crypt() is what you need.
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Vernon wrote:
Some one is asking me to create a sub search on a search that has already
been done. For instance, the database has 50,000 records, a user does a
search for two keywords which yielded 1700 records. They want to now filter
that list with other keywords. The logic is that searching 1700 records has
got to be faster than searching 50,000 records.
The only way I know how to do this is to save the results of the pervious
search to hidden fields and allow the user to add more keywords, which in
essence isn't doing other than adding more keywords to the search doing the
same exact thing they did before with new keywords. Is this logic correct or
is there a way to save that queries results and search only that?
You could store the results of the first search into a temporary table
and then "sub-search" from that table...
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Vernon wrote:
The logic is that searching 1700 records has got to be faster than searching 50,000 records.
No. Not according to theory. If you want to discuss theory it will have
to be in database news group this is php.
--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--- End Message ---
--- Begin Message ---
>Here's a better example to what I meant from the last posting when I said
>something about color=red#RowNum3.
>--snip--
>As in example #3, PHP seem to be able to distingush the difference when
>there is a pound symbol, or "#" in it and know that '#RowNum3' is not part
>of the post string to the variable, color.
This is because PHP never sees the pound symbol - the target is recognized
client-side and stripped prior to sending the request to the server. If
you check your server logs, you'll see that it isn't there.
---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html
--- End Message ---
--- Begin Message ---
Hi,
Larry has made a good suggestion. This is something that works because
i have also used something simiar. If you really want to get a
sophisticated you can use a a simple shopping cart. In our site when we
give free downloads for selected users we just inject a zero valued
order into the database.
Larry Brown wrote:
You could have your authorization info in the mysql db including file
locations that are stored along with the authorization level necessary to
download them. If the person is authenticated to download the file, the php
script uses the file location info from the db to open the file and generate
the headers necessary to start the download. This way the end user never
has to have direct access to the download directory and you don't have to
copy the file into a temporary directory.
Larry
-----Original Message-----
From: news.php.net [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 30, 2003 2:13 PM
To: [EMAIL PROTECTED]
Subject: [PHP] How do I protect downloadable files?
Hello, I have wrtten a PHP based web site with a MySql backend and now I
want to password protect downloadable files. I have logon and session
handling taken care of but I can't figure out how to only allowed those who
are currently logged in and above a certain security level to access the
downloadable content and prevent bookmarking of the file location for
redownloading.
--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--- End Message ---
--- Begin Message ---
However I forgot to mention, all theese header tricks are real swell
indeed, but you should get hold of a friend on a macintosh.
The method I use doesnt work on the macintosh, so for the mac
users we just serve the files "as is", meaning they accually dont get
protected...
The other methods aswell should be tested on macintosh systems
just to be sure.
--
Kim Steinhaug
---------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
---------------------------------------------------------------
"Kim Steinhaug" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I would go for the 3rd alternative. There are several ways to
> "stream" the file with the use of headers.
>
> This way you can validate the user securely with your logon system,
> and you can place the files outside the viewable web content.
> Typically oputside your www / public_html folder.
>
> I use this myself in an application I use, streaming files at 50MB
> does not use alot of resources at all, atleast not the way I use.
> My use for the script is to serve high resolution images to several
> customers, often TIF images up to 50MB and larger.
>
> Heres the code I use :
>
> $distribution= "filepathonserver";
> if ($fd = fopen ($distribution, "r")){
> $size=filesize($distribution);
> $fname = basename ($distribution);
>
> header("Pragma: ");
> header("Cache-Control: ");
> header("Content-type: application/octet-stream");
> header("Content-Disposition: attachment; filename=\"".$fname."\"");
> header("Content-length: $size");
>
> while(!feof($fd)) {
> $buffer = fread($fd, 2048);
> print $buffer;
> }
> fclose ($fd);
> exit;
> }
>
> --
> Kim Steinhaug
> ---------------------------------------------------------------
> There are 10 types of people when it comes to binary numbers:
> those who understand them, and those who don't.
> ---------------------------------------------------------------
>
>
> "Apz" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > On Tue, 30 Dec 2003, news.php.net wrote:
> > > Creating unique symlinks would be easier but my development machine is
> > > Windows and my server is FreeBSD and I can't create file links under
> > > Windows. Plus, my FreeBSD server is not near me so remote
development
> is
> > > difficult.
> >
> > 1) windows has symlinks since win2000, however they are named Junctions.
> > I would recommend visiting sysinternals.com and getting junctions
> > tool (win2k/xp/2k3 -> miscalenous). Hey, it even comes with source!
> >
> > 2) another way is to make a redirect, so you do:
> > getFile.php?file=something.zip
> >
> > and in your code you do:
> > <?
> > include "_mylibs.php"
> > if (userLoggedIn())
> > header "Location: ".$_REQUEST["file"];
> > else
> > echo "Only Valid People Can Login";
> > ?>
> >
> > 3) final way is to pass through the file yourself. Safest way, but
> > potentially more resource hungry than the two above
> > in your code you do:
> >
> >
> > <?
> > include "_mylibs.php"
> > if (userLoggedIn())
> > {
> > header("Content-type: application/octet-stream");
> > header("Content-Disposition: attachment; ".
> > "filename=".$_REQUEST["file"]);
> > readfile($_REQUEST["file"]);
> > }
> > else
> > echo "Only Valid People Can Login";
> > ?>
> >
> >
> >
> > recommended reads:
> > http://www.php.net/manual/en/function.header.php
> >
> > further recommended things to checkout:
> > freshmeat , and search for anti leecher scripts.
> >
> >
> >
> > /apz, bringing joy to the world....
--- End Message ---
--- Begin Message ---
Time for them to upgrade to OSX...
I've not tried to crack that nut. Is there anyone here who has successfully
managed headers for Mac users? It's hard to believe it hasn't been done.
-----Original Message-----
From: Kim Steinhaug [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 30, 2003 8:04 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] How do I protect downloadable files?
However I forgot to mention, all theese header tricks are real swell
indeed, but you should get hold of a friend on a macintosh.
The method I use doesnt work on the macintosh, so for the mac
users we just serve the files "as is", meaning they accually dont get
protected...
The other methods aswell should be tested on macintosh systems
just to be sure.
--
Kim Steinhaug
---------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
---------------------------------------------------------------
"Kim Steinhaug" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I would go for the 3rd alternative. There are several ways to
> "stream" the file with the use of headers.
>
> This way you can validate the user securely with your logon system,
> and you can place the files outside the viewable web content.
> Typically oputside your www / public_html folder.
>
> I use this myself in an application I use, streaming files at 50MB
> does not use alot of resources at all, atleast not the way I use.
> My use for the script is to serve high resolution images to several
> customers, often TIF images up to 50MB and larger.
>
> Heres the code I use :
>
> $distribution= "filepathonserver";
> if ($fd = fopen ($distribution, "r")){
> $size=filesize($distribution);
> $fname = basename ($distribution);
>
> header("Pragma: ");
> header("Cache-Control: ");
> header("Content-type: application/octet-stream");
> header("Content-Disposition: attachment; filename=\"".$fname."\"");
> header("Content-length: $size");
>
> while(!feof($fd)) {
> $buffer = fread($fd, 2048);
> print $buffer;
> }
> fclose ($fd);
> exit;
> }
>
> --
> Kim Steinhaug
> ---------------------------------------------------------------
> There are 10 types of people when it comes to binary numbers:
> those who understand them, and those who don't.
> ---------------------------------------------------------------
>
>
> "Apz" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > On Tue, 30 Dec 2003, news.php.net wrote:
> > > Creating unique symlinks would be easier but my development machine is
> > > Windows and my server is FreeBSD and I can't create file links under
> > > Windows. Plus, my FreeBSD server is not near me so remote
development
> is
> > > difficult.
> >
> > 1) windows has symlinks since win2000, however they are named Junctions.
> > I would recommend visiting sysinternals.com and getting junctions
> > tool (win2k/xp/2k3 -> miscalenous). Hey, it even comes with source!
> >
> > 2) another way is to make a redirect, so you do:
> > getFile.php?file=something.zip
> >
> > and in your code you do:
> > <?
> > include "_mylibs.php"
> > if (userLoggedIn())
> > header "Location: ".$_REQUEST["file"];
> > else
> > echo "Only Valid People Can Login";
> > ?>
> >
> > 3) final way is to pass through the file yourself. Safest way, but
> > potentially more resource hungry than the two above
> > in your code you do:
> >
> >
> > <?
> > include "_mylibs.php"
> > if (userLoggedIn())
> > {
> > header("Content-type: application/octet-stream");
> > header("Content-Disposition: attachment; ".
> > "filename=".$_REQUEST["file"]);
> > readfile($_REQUEST["file"]);
> > }
> > else
> > echo "Only Valid People Can Login";
> > ?>
> >
> >
> >
> > recommended reads:
> > http://www.php.net/manual/en/function.header.php
> >
> > further recommended things to checkout:
> > freshmeat , and search for anti leecher scripts.
> >
> >
> >
> > /apz, bringing joy to the world....
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I have not tested with mac but I had problems with certain versions of IE
in a similar script where it would basicaly show the binary content within
IE rather then initiate a download.
What I saw was when I verified the headers returned, the headers were
repeated. Therefore I had something like:
------
Content-Type: text/html
X-Powered-By: php...
Content-Type: immage/gif
------
What worked for me and might help you is if you used header($header, TRUE)
to force a replacement of all Content- headers that might have been set by
php (like Content-Type: text/html)
I would simply suggest comparing the headers you get when you download the
file directly compared to when you get the headers from your PHP script.
For this a variety of tools are at your disposition, proxomitron's log
window being one of my favorites.
Once you have an identical set of headers, well... I can't think of any
reason for it to fail on mac (unless the original download would fail as
well ;) ).
Hope it helps,
Andrew
> Time for them to upgrade to OSX...
>
> I've not tried to crack that nut. Is there anyone here who has
> successfully
> managed headers for Mac users? It's hard to believe it hasn't been done.
> ...
--- End Message ---
--- Begin Message ---
Quite true.
I typed away from memory my sample headers, the actual script was done
about 3 months ago and is on a protected intranet server I don't have
access to quite at the moment ;).
My apologies for the mistake,
Thank you for pointing that out :)
Andrew.
> In a message dated 12/30/2003 9:33:49 PM Eastern Standard Time,
> [EMAIL PROTECTED] writes:
>
> Content-Type: immage/gif
>
> it should Content-Type: image/gif
>
--- End Message ---
--- Begin Message ---
"Ian Williams" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
> I'm trying to build a validator in PHP, to check that XML documents are
> well-formed.
As a starting point I'd check out the excellent, open-source PEAR modules
available for XML manipulation at
http://pear.php.net/packages.php?catpid=22&catname=XML, and in particular
the XML parser module at http://pear.php.net/package/XML_Parser.
Hope that helps,
Al
--- End Message ---
--- Begin Message ---
Im on my way to bed so short do it yourself answer,
but you should look up the regex part of mySQL. I think you can
match the beginning and end of a coloumns entry. And using the
power of the regex function you could make a WHERE statement
for somethink like [a-e] if it was a-e you were looking for.
Remember ofcourse that you wuld need to use the regex syntax.
The page on mySQL covering the topic has a lot of examples.
--
Kim Steinhaug
---------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
---------------------------------------------------------------
"Doug Parker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> How would I create a select statement in MySQL that would return a range
of
> records from the LastName field where the value starts with a designated
> letter - for example, returning the range where the first letter of
LastName
> is between A and E...
>
> Any help would be greatly appreciated.
>
>
>
> ------------------------------------------------------------
> http://www.phreshdesign.com
--- End Message ---
--- Begin Message ---
Hello,
I'm *very* new to PHP. I am working through the 'Professional PHP
Programming' book by Worx.
In their forms they use the name attribute (ie. name="example") instead of
XHTML's id attribute (ie. id="example").
If I use 'name' my results display on the next page after the submit
button is pressed, but if I change it 'id' the results do not display.
How can I fix this?
Thanks
Tim Burgan
--- End Message ---
--- Begin Message ---
Hi,
Wednesday, December 31, 2003, 11:45:37 AM, you wrote:
TB> Hello,
TB> I'm *very* new to PHP. I am working through the 'Professional PHP
TB> Programming' book by Worx.
TB> In their forms they use the name attribute (ie. name="example") instead of
TB> XHTML's id attribute (ie. id="example").
TB> If I use 'name' my results display on the next page after the submit
TB> button is pressed, but if I change it 'id' the results do not display.
TB> How can I fix this?
TB> Thanks
TB> Tim Burgan
id is used locally on the client and not passed when you press submit,
there is nothing wrong with using both if id is needed like
<input type="text" id="test" name="test" value=""/>
--
regards,
Tom
--- End Message ---
--- Begin Message ---
Tim Burgan wrote:
In their forms they use the name attribute (ie. name="example") instead of
XHTML's id attribute (ie. id="example").
How can I fix this?
(X)HTML still requires name to be used for forms. It's usually best to
use both name and ID for forms.
--- End Message ---
--- Begin Message ---
Thanks for your replies.
The name attribute is depreciated in XHTML for use with the input tag and
has been replaced with the id attribute.
The name element can still be used in the form tag though.
What I'm looking for is something similar to ASP's
GetElementByID("example");
Thanks
Tim Burgan
--- End Message ---
--- Begin Message ---
Hi,
"Php" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
> I am not sure how to go about this. =( I think my problems are twofold.
>
> problem 1. I have to connect to a progress database, for which there is
> no built-in php
> support. I have been looking at the unified ODBC functions, but progress
> isn't
> one of the supported dbs there either.
I've never heard of this sort of database, but I'd be checking with them for
any drivers, and then google.
> problem 2. the db is not specifically a web db. It is the clients'
> production db that
> is located on their facility and it is behind a firewall. I know I will
> get a performance
> hit with this setup, but I can live with this.
No database is a "web db".
If the database 'progress' has a server, then you can probably connect to it
somehow via the web. If it doesn't have a server (ie Filemaker pro, etc),
then you cannot connect via the web.
> question 1: do I need a progress driver, or do the ODBC functions take
> care of that?
Check the ODBC documentation.
> question 2: is it possible for the db connection to get thru a firewall,
> and then connect
> to a db?
No, a firewall blocks all incoming connections unless specifically told not
to do so. You'll have to arrange to allow connections from your IP/Port
through the firewall.
>
> TIA,
> Craig
--- End Message ---
--- Begin Message ---
I wish, I'm interested as well :/
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> I've just gotten PHP5 B3 working using the precompiled binaries under Win
XP,
> but the dom xml functions of PHP4 don't seem to be immediately available.
> Does anyone have suggestions on how to learn to use the new XML
functionality?
> The source code?
>
> Greg Steffenson
>
--- End Message ---
--- Begin Message ---
Make sure that in your php.ini file that you have uncommented that the
php_dom extensions and any other extensions that you want to use.
Also make sure that php and your web server have access to the
extensions.
I usually place my extensions in the system path where they can be
accessed.
Also, I am not sure if the php installer contains all the extensions. I
usually download the zip file and it contains all the extensions.
--
Ray
On Tue, 2003-12-30 at 21:38, Aidan Lister wrote:
> I wish, I'm interested as well :/
>
> <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> > I've just gotten PHP5 B3 working using the precompiled binaries under Win
> XP,
> > but the dom xml functions of PHP4 don't seem to be immediately available.
> > Does anyone have suggestions on how to learn to use the new XML
> functionality?
> > The source code?
> >
> > Greg Steffenson
> >
--- End Message ---
--- Begin Message ---
I still have not found a solution to this problem. What are some debugging
steps I could take?
"Aidan Lister" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> I am trying to log all php script errors from a virtualhost to a file.
> A callback function is not the solution I am looking for.
>
> I have tried to the following settings in my httpd.conf (apache) to no
> avail.
>
> php_admin_flag display_errors off
> php_admin_flag log_errors on
> php_admin_flag error_log /tmp/phplog
>
> When an erroneous file is viewed, errors are not displayed (as expected),
> however the file /tmp/phplog is not created.
>
> I'd be grateful for any help.
>
> Thank you.
--- End Message ---
--- Begin Message ---
If I am putting out a couple free scripts to the public, is there any
way I can make sure people dont remove the copyright?
Any ideas welcome
- Ian
--- End Message ---
--- Begin Message ---
Ian wrote:
If I am putting out a couple free scripts to the public, is there any
way I can make sure people dont remove the copyright?
No.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
> -----Message d'origine-----
> De : Ian [mailto:[EMAIL PROTECTED]
> Envoyé : Wednesday, December 31, 2003 12:21 AM
> À : [EMAIL PROTECTED]
> Objet : [PHP] Securing Free Scripts
>
>
> If I am putting out a couple free scripts to the public, is there any
> way I can make sure people dont remove the copyright?
You own the copyright even if the copyright notice is not there, so you can enforce it
legally. You could also licence it under something like the BSD licence that
stipulates that the user must leave the copyright notice. However, you can't force
them technically, I think.
>
> Any ideas welcome
>
> - Ian
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: John W. Holmes [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 31, 2003 12:39 AM
> To: Ian
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Securing Free Scripts
>
>
> Ian wrote:
>
> > If I am putting out a couple free scripts to the public, is
> there any
> > way I can make sure people dont remove the copyright?
>
> No.
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals - www.phparch.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
Encrypt the source code. I've been looking heavily into this recently.
There were some great posts on here a while back. Search the archives.
Thanks,
Jake McHenry
Nittany Travel MIS Coordinator
http://www.nittanytravel.com
--- End Message ---
--- Begin Message ---
i made a bobo and now mysql server is returning a to many connections error i dont
have access to reboot so is there a comand i can use to close all connections.
--- End Message ---
--- Begin Message ---
hi all i had an to many connections error with mysql
i dont have anyway to reboot the server so is there someway i can give php a command
and shut down all open connections on mysql thank you
--- End Message ---
--- Begin Message ---
hi,
I have been learning PHP and MySQL from a book that I have bought. I am
really pleased with the way these 2 systems work, but I was wondering if
MSSQL wouldn't be easier to use, more specifically I was wondering wether I
could make an Access Database and connect it to my php website using MSSQL.
I heard it would be possible
And now I ask the experts... :-)
grtz
DragonEye
--- End Message ---
--- Begin Message ---
The attached text file contains a script that I've gotten from a web
site and that I've been using for a while now to generate on the fly PNG
headers. There can be several headers on one page, spanning several
days worth of articles. The script works, except it's a huge overhead
because it generates each header every time it gets displayed. What I'd
like to do is amend the script to where it will creates a physical PNG
file on the server, so that the next time it's called, it will check its
"cache" first to see if that particular header already exists before
creating another. Basically something to the tune of:
a web page calls the script:
script checks internal cache for that header
if header doesn't exist
create header -> save in cache (disk based?)
endif
serve header from cache
end routine
I don't know if it makes sense to incorporate this with an MySQL
database which contains pointers to the physical files on disk. I don't
know if that will speed up the searching for a particular header
(searching the DB, as opposed to scanning the disk directory.) The only
thing I can think of is to have a database with a table that contains
both article dates as well as the pointer, so the search only has to go
through a small set of records, as opposed to the whole DB, but is it
really worth it?
Now, somewhere in there, it also needs to scan the cache for old
headers that are no longer needed, based on a time frame that I set
(maybe 14 days? maybe 30 days? I haven't decided yet.) Again, maybe
using a DB is worth it so one can simply delete all the pointers and
physical files confirming to a specific range search in the DB? Right
now, I just want the thing to cut down on CPU usage because it's
generating those headers every time a page gets called. Not good.
--
W | I haven't lost my mind; it's backed up on tape somewhere.
+--------------------------------------------------------------------
Ashley M. Kirchner <mailto:[EMAIL PROTECTED]> . 303.442.6410 x130
IT Director / SysAdmin / WebSmith . 800.441.3873 x130
Photo Craft Laboratories, Inc. . 3550 Arapahoe Ave. #6
http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A.
<?php
function label($text) {
$georgia = $_SERVER["DOCUMENT_ROOT"]."/fonts/georgiaz.ttf";
$freeformi = $_SERVER["DOCUMENT_ROOT"]."/fonts/tt1002m_.ttf";
$fontsize = 11;
$pad = 30;
$image = imagecreate(1000,25);
$background = ImageColorAllocate($image, 115,180,200);
$bcolor1 = ImageColorAllocate($image, 125,190,210);
$bcolor2 = ImageColorAllocate($image, 105,160,180);
$bcolor3 = ImageColorAllocate($image, 105,170,190);
$color = ImageColorAllocate($image, 0,17,85);
ImageRectangle($image,0,0,1000,25,$background);
ImageTTFText($image, 30, 0, 49, 29, $bcolor1, $freeformi, strtoupper($text));
ImageTTFText($image, 30, 0, 53, 33, $bcolor2, $freeformi, strtoupper($text));
ImageTTFText($image, 30, 0, 51, 31, $bcolor3, $freeformi, strtoupper($text));
ImageTTFText($image, $fontsize, 0, (int)($pad/2), 18, $color, $georgia, ":::
".stripslashes($text));
return($image);
}
Header("Content-type: image/png");
ImagePNG(label($text));
ImageDestroy($image);
?>
--- End Message ---
--- Begin Message ---
I'd definitivly suggest you NOT to use this database-pointer approach!
Instead of simply sending that .png-header once
you could store the image in a physical file by using an unique ID based
on the functions arguments.
Later on just check if a file with this ID exists and return its URL
instead of calling that function again.
I have recently written such a script (to be used as smarty-plugin) tell
me if you want to have a look at it.
-----Ursprüngliche Nachricht-----
Von: Ashley M. Kirchner [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 31. Dezember 2003 11:04
An: [EMAIL PROTECTED]
Betreff: [PHP] Help with PNG creation script
The attached text file contains a script that I've gotten from a web
site and that I've been using for a while now to generate on the fly PNG
headers. There can be several headers on one page, spanning several
days worth of articles. The script works, except it's a huge overhead
because it generates each header every time it gets displayed. What I'd
like to do is amend the script to where it will creates a physical PNG
file on the server, so that the next time it's called, it will check its
"cache" first to see if that particular header already exists before
creating another. Basically something to the tune of:
a web page calls the script:
script checks internal cache for that header
if header doesn't exist
create header -> save in cache (disk based?)
endif
serve header from cache
end routine
I don't know if it makes sense to incorporate this with an MySQL
database which contains pointers to the physical files on disk. I don't
know if that will speed up the searching for a particular header
(searching the DB, as opposed to scanning the disk directory.) The only
thing I can think of is to have a database with a table that contains
both article dates as well as the pointer, so the search only has to go
through a small set of records, as opposed to the whole DB, but is it
really worth it?
Now, somewhere in there, it also needs to scan the cache for old
headers that are no longer needed, based on a time frame that I set
(maybe 14 days? maybe 30 days? I haven't decided yet.) Again, maybe
using a DB is worth it so one can simply delete all the pointers and
physical files confirming to a specific range search in the DB? Right
now, I just want the thing to cut down on CPU usage because it's
generating those headers every time a page gets called. Not good.
--
W | I haven't lost my mind; it's backed up on tape somewhere.
+--------------------------------------------------------------------
Ashley M. Kirchner <mailto:[EMAIL PROTECTED]> . 303.442.6410 x130
IT Director / SysAdmin / WebSmith . 800.441.3873 x130
Photo Craft Laboratories, Inc. . 3550 Arapahoe Ave. #6
http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A.
--- End Message ---