php-general Digest 17 Feb 2002 01:40:02 -0000 Issue 1176

Topics (messages 85030 through 85076):

php blocking functions
        85030 by: Sofhian Mahat

Text editor for linux
        85031 by: Torkil Johnsen
        85034 by: Matthew Darcy
        85044 by: Jackson Miller
        85074 by: Greg Donald
        85075 by: Scott

LINUX distrib of PHP different to windows?
        85032 by: Andy
        85049 by: Lars Torben Wilson

Re: modular programming
        85033 by: Kunal Jhunjhunwala

Re: Sessions that last for ever
        85035 by: SpamSucks86
        85038 by: Joe Van Meer
        85056 by: Erik Price
        85059 by: Nigel Gilbert
        85070 by: Greg Donald

Re: Sessions and templating help
        85036 by: Joe Van Meer

Re: scheduled tasks
        85037 by: flume33.yahoo.com
        85040 by: Michael Sims
        85057 by: Erik Price
        85062 by: B Richards
        85063 by: B Richards

My Session don't expire
        85039 by: Rodrigo Peres
        85041 by: Andrey Hristov

Re: Outputing XML to browser???
        85042 by: Christian Blichmann
        85043 by: Christian Blichmann
        85051 by: Jim Hankins
        85052 by: Jim Hankins
        85054 by: Jim Hankins

Problems with Cookies
        85045 by: Georgie Casey
        85046 by: Georgie Casey

Tricky variable question! Impossible??
        85047 by: Andy
        85050 by: Edward van Bilderbeek - Bean IT

Re: The ASP "application" object in PHP?
        85048 by: Peter J. Schoenster

PHP Help Requested
        85053 by: Pete Bekisz
        85072 by: Greg Donald

Change gif image with php
        85055 by: Rodrigo Peres
        85058 by: Adrian Murphy
        85060 by: Andrew Brampton
        85061 by: hugh danaher
        85064 by: Rasmus Lerdorf

FREE webspace with NO ADS!! (also PHP included!)
        85065 by: Balazs Laszlo

ftp_rawlist()   info
        85066 by: Artemis Mendrinos

Test please ignore
        85067 by: Paul Fowler

pdf_place_image size not scale
        85068 by: Paul Fowler

Where To Find Resources About Programming Style (my bleedin' code is so darn ugly)
        85069 by: Frank Joerdens
        85071 by: Michael Sims

exec on Windows
        85073 by: Scott

Help please
        85076 by: webmaster mbtradingco

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 ---
Hello everyone,

I am searching for an alternate way to accomplish user synchronization.

I would like two or more users to block on the read of some stream, so that when one 
person writes to it, the other person(s) will read it.  The only way I currently know 
to do this is with the socket functions.  However, this poses a small problem.  If I 
use the socket functions, I have to keep a script running on the server at all times.  
I would really like to have users block at the end of a file until new information is 
appended.  I certainly don't want to have all my clients sit in infinite while loops, 
and I'm sure my isp doesn't either.  I may be shit out of luck anyway, if they are 
killing processes that run for too long.

I appreciate any and all suggestions.  If someone knows exactly which functions block, 
aside from the socket functions, could you please tell me?  Thank you.

Respectfully,
Chad
--- End Message ---
--- Begin Message ---
Anyone know of a good text editor for linux, WITH syntax highlighting for
php/html + other languages?

- TOrkil

--- End Message ---
--- Begin Message ---
there is a way of using vi/vim to highlight syntax with PHP and HTML.

I am playing with it at the moment.

Matt,


-----Original Message-----
From: Torkil Johnsen [mailto:[EMAIL PROTECTED]]
Sent: 16 February 2002 13:45
To: [EMAIL PROTECTED]
Subject: [PHP] Text editor for linux


Anyone know of a good text editor for linux, WITH syntax highlighting for
php/html + other languages?

- TOrkil


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

--- End Message ---
--- Begin Message ---
I am using Komodo from Active State.  http://www.activestate.com
It runs in windows and Linux.

On Sat, 2002-02-16 at 09:17, Matthew Darcy wrote:
> there is a way of using vi/vim to highlight syntax with PHP and HTML.
> 
> I am playing with it at the moment.
> 
> Matt,
> 
> 
> -----Original Message-----
> From: Torkil Johnsen [mailto:[EMAIL PROTECTED]]
> Sent: 16 February 2002 13:45
> To: [EMAIL PROTECTED]
> Subject: [PHP] Text editor for linux
> 
> 
> Anyone know of a good text editor for linux, WITH syntax highlighting for
> php/html + other languages?
> 
> - TOrkil
> 
> 
> -- 
> 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
> 


--- End Message ---
--- Begin Message ---
> Anyone know of a good text editor for linux, WITH syntax highlighting for
> php/html + other languages?

Vim - http://www.vim.org/

If you use X, then use gvim.

------------------------------------------------------------------------ 
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
------------------------------------------------------------------------

--- End Message ---
--- Begin Message ---
Nedit, Bluefish are also good under X

-----Original Message-----
From: Greg Donald [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, February 16, 2002 7:22 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Text editor for linux

> Anyone know of a good text editor for linux, WITH syntax highlighting
for
> php/html + other languages?

Vim - http://www.vim.org/

If you use X, then use gvim.

------------------------------------------------------------------------

Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
------------------------------------------------------------------------


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

--- End Message ---
--- Begin Message ---
Hi there,

I just installed my first linux box and I have problems on configuring php
for my needs.

It does not matter what I do to php.ini, nothing is changing. And yes, I did
restart apache. I thought php4.1.1
comes with gd2.0 build in, like on windows distrib. but it does not. I
compiled php4.1.1 with mysql support and
thought thats it. But no! There is no gd version. So I did compile the one
from boutel.com and put it into the propper dir changed php.ini but still
the same!

Thanx for any help

Cheers Andy


--- End Message ---
--- Begin Message ---
On Sat, 2002-02-16 at 05:55, Andy wrote:
> Hi there,
> 
> I just installed my first linux box and I have problems on configuring php
> for my needs.
> 
> It does not matter what I do to php.ini, nothing is changing. And yes, I did
> restart apache. I thought php4.1.1
> comes with gd2.0 build in, like on windows distrib. but it does not. I

Well, we don't distribute *nix binaries, so nothing comes 'built in' per
se--you have to select which extensions to build at configure time. The 
GD extension source is included, though.

> compiled php4.1.1 with mysql support and

But not with GD support, I take it?

shanna% ./configure --help | grep gd
  --with-gdbm[=DIR]       Include GDBM support
  --with-gd[=DIR]         Include GD support (DIR is GD's install dir).
  --enable-gd-native-ttf    GD: Enable TrueType string function.

Granted, this should be in the docs.


Torben

> thought thats it. But no! There is no gd version. So I did compile the one
> from boutel.com and put it into the propper dir changed php.ini but still
> the same!
> 
> Thanx for any help
> 
> Cheers Andy
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506

--- End Message ---
--- Begin Message ---
Hey DN,
The Guestbook was an example of what im trying to do. I am NOT coding a
guest book...
Regards,
Kunal Jhunjhunwala

"Minds think with ideas, not information. No amount of data, bandwidth, or
processing power can substitute for inspired thought." - Clifford Stoll
----- Original Message -----
From: "DL Neil" <[EMAIL PROTECTED]>
To: "Kunal Jhunjhunwala" <[EMAIL PROTECTED]>; "php-list"
<[EMAIL PROTECTED]>
Sent: Saturday, February 16, 2002 6:17 PM
Subject: Re: [PHP] modular programming


> Hey Kunal,
>
> > The entire concept of OOP was based on the data and not the processing
:)
>
> No, this seems too much of a simplification. In the 'good old days' we
used to design a program by using a
> flowchart. Such is an entirely procedural/code-based approach. Each of the
philosophies that followed/developed
> from there, suggested that we should pay (more) attention to the data (and
its structure/characteristics).
> However none is exclusively "based on the data and not the processing".
You need to consider both and not one at
> the expense of the other... This point was emphasised by an earlier
correspondent!
>
> > But, no one has yet addressed the core of my question.
>
> What do you mean? Here is the original question:
> -----
> does anyone know of any good papers on modular programing? I have been
able
> to make my code modular, but I am not satisfied with it. I am trying to
make
> my program work the "plug in" way.. where i can just add more modules on
the
> fly... any tips? :)
> -----
> Which bits were addressable by someone else, and which parts are very much
restricted by knowledge only in your
> head? The "add more modules on the fly" was such a mixture of
terminology/buzz-words as to sound
> Superman-futuristic!? (include files possibly?)
>
> Two suggestions:
> - do the reading and sort out your approach, then roll forward into the
specific application/review its
> design/modularity etc
> - address a specific situation (as below) by describing your objectives
for it, the necessary parameters, what
> you have done so far, etc
> Don't muddle the entire process of LEARNING about a philosophy/approach,
with 'fixing' a specific piece of code.
>
> How can I make any
> > application plugable? I am trying to create a standard which will work
with
> > every other language. A simple example of what I am attempting to do is
:
> > I have a guestbook A. I have features in it
> > a. allow public viewing of records
> > b. dont allow publiv viewing of records
> >
> > Now, this is very simply, I could just store the on/off value and then
> > validate agianst that. But when it comes to bigger applications, and
more
> > complex situations, where you have to make choices like, allowing the
data
> > to be written to a dbase or no, wether it should get processed or no.
How
> > does one handle such situations?
>
> What's wrong with your 'guestbook' solution? If you're not satisfied,
start a new conversational thread (ie with
> a more descriptive title) because there are many experienced 'guest
bookers' on the list, who will be more than
> capable/happy to share ideas/experience.
>
> The philosophies behind modular programming, structured programming, and
object-oriented programming all unite
> in the realisation that "bigger applications" and "more complex
situations" can be rendered to be collections of
> smaller and less complex 'units' that can be individually programmed (and
tested) as 'simple solutions', and
> then combined together to provide size, complexity, and power. (and so
we're back to doing a bit of reading up
> on/absorbing the subject!)
>
> Regards,
> =dn
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

--- End Message ---
--- Begin Message ---
I think changing a setting in php.ini will do it, I'm just not sure
which one. session.cache_expire seems like it might do something, or
maybe session.gc_maxlifetime. Look them up in the manual

-----Original Message-----
From: Nigel Gilbert [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, February 16, 2002 7:44 AM
To: [EMAIL PROTECTED]
Subject: Sessions that last for ever

By default, a session (created with session_register) seems to last just

as long as the user has their browser open.  If a user quits the 
browser, the session is automatically destroyed.

I want a session to last indefinitely (or until my program destroys 
it).  There are some hints about how this could be done with cookies in 
the documentation, but not a clear recipe.  What sequence of PHP 
statements should I use to achieve this?

Thanks for any help,

Nigel


--- End Message ---
--- Begin Message ---
Hi Nigel, you could set a cookie once they enter your site, and check at the
top of each page you want accessible with this variable to see if they have
it or not.

Joe :)


Nigel Gilbert <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> By default, a session (created with session_register) seems to last just
> as long as the user has their browser open.  If a user quits the
> browser, the session is automatically destroyed.
>
> I want a session to last indefinitely (or until my program destroys
> it).  There are some hints about how this could be done with cookies in
> the documentation, but not a clear recipe.  What sequence of PHP
> statements should I use to achieve this?
>
> Thanks for any help,
>
> Nigel
>


--- End Message ---
--- Begin Message ---

On Saturday, February 16, 2002, at 07:43  AM, Nigel Gilbert wrote:

> By default, a session (created with session_register) seems to last 
> just as long as the user has their browser open.  If a user quits the 
> browser, the session is automatically destroyed.
>
> I want a session to last indefinitely (or until my program destroys 
> it).  There are some hints about how this could be done with cookies in 
> the documentation, but not a clear recipe.  What sequence of PHP 
> statements should I use to achieve this?

I don't have the answer you're looking for (maybe it's a php.ini 
setting), but I suspect that it might be a dangerous idea.  The longer a 
session ID is hanging about, the easier it is for a cracker to hijack it 
and use it for evil intent.

Remember, every time a page is requested within any given session, 
either a cookie variable or a GET variable is being sent along with the 
HTTP headers.  Keeping a session going for more time than needed means 
that the variable representing the session ID is leaving footprints all 
over the place.


Erik <-- who has become overcautious lately upon learning how HTTP works



----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
But very many commercial sites, including Apple and Amazon to name two, 
do exactly this.  When you re-enter the site they 'remember' who you are 
using a cookie.  In my case, I'm building a multi-player strategy game 
and while I want the players to go through an initial briefing the first 
time they ever join the game, thereafter they should be able to get 
straight into the game if they are still using the same PC.  But as I 
said, the specifics of my use aren't so important - lots of sites leave 
permanent cookies around and the results don't seem to be catastrophic.

The question is still: how to do it?

Nigel




On Saturday, February 16, 2002, at 07:52 PM, Erik Price wrote:

>
> On Saturday, February 16, 2002, at 07:43  AM, Nigel Gilbert wrote:
>
>> By default, a session (created with session_register) seems to last 
>> just as long as the user has their browser open.  If a user quits the 
>> browser, the session is automatically destroyed.
>>
>> I want a session to last indefinitely (or until my program destroys 
>> it).  There are some hints about how this could be done with cookies 
>> in the documentation, but not a clear recipe.  What sequence of PHP 
>> statements should I use to achieve this?
>
> I don't have the answer you're looking for (maybe it's a php.ini 
> setting), but I suspect that it might be a dangerous idea.  The longer 
> a session ID is hanging about, the easier it is for a cracker to hijack 
> it and use it for evil intent.
>
> Remember, every time a page is requested within any given session, 
> either a cookie variable or a GET variable is being sent along with the 
> HTTP headers.  Keeping a session going for more time than needed means 
> that the variable representing the session ID is leaving footprints all 
> over the place.
>
>
> Erik <-- who has become overcautious lately upon learning how HTTP works
>
>
>
> ----
>
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
>
>
__________________________________________________________________________
Professor Nigel Gilbert, FREng, AcSS, Pro Vice-Chancellor and Professor 
of
Sociology, University of Surrey, Guildford GU2 7XH, UK. +44 (0)1483 
689173

--- End Message ---
--- Begin Message ---
> But very many commercial sites, including Apple and Amazon to name two,
> do exactly this.  When you re-enter the site they 'remember' who you are
> using a cookie.  In my case, I'm building a multi-player strategy game
> and while I want the players to go through an initial briefing the first
> time they ever join the game, thereafter they should be able to get
> straight into the game if they are still using the same PC.  But as I
> said, the specifics of my use aren't so important - lots of sites leave
> permanent cookies around and the results don't seem to be catastrophic.
>
> The question is still: how to do it?

If each user has a unique user id, then make a table called seen_briefing:

create table seen_briefing (
  id int(11) unsigned not null default '0',
  primary key (id)
)

Make an entry once a user has seen whatever they need to. Then, on their
next login, do a join against the seen_briefing table, check for an entry...


--
Greg Donald

--- End Message ---
--- Begin Message ---
Hi Justin, are you using <?php session_start(); ?> at the top of every page
you want to keep the session?

Cheers, Joe :)


Justin Deutsch <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi All,
>
> I am running Apache with PHP4 as a module.  I have also written a script
(template.php) that sets up the default envrionment, like the CSS and
navigation etc.  The script also reads in a file, as defined by the ?path=
of the URL.  The file it reads in must have the sections (includes, header
and body,  as defined by /*** ***/ and /*** end ***/ pairs).  The file is
the split into these sections and along with the templated bits of the page
compile into a single string which is the executed using the eval().  Now
this all works fine, but I also want to use sessions.  The first session
from the index.html file, which is first acessed as a login page, stores the
player class fine, but when I go to the next page (player_login.html) I seem
to loose the session.
>
> You might ask why I don't just use an existing templating system, well
it's because I think that you should only have to write the template once
and not have to touch it again.  The templating systems I have come across
force you to include a file at the top and bottom of the code you are
writing.  The one down side to the way I am doing it is that I have had to
force the other file into a include, header and body section, but this is a
trivial formatting issue.
>
> Is there something I'm missing?  I have included the code for the three
scripts below.
>
> --------
> template.php
> --------
>
> <?PHP
> /*
>  * This script is the basis for a templaing engine.  The engine uses the
>  * rewrite feature of the web server to capture the Virtual URL that the
>  * user wants and maps it to this script with a paraeter.  This script
>  * then sets up the template and includes the content from the file
>  * indicated by the user.
>  *
>  * A directory structure containing tall of the content is required, and
>  * with Apache a directory to map from.
>  */
>
>
> /* Put setup here */
> require_once("site-config.php");
> require_once("html_header.php");
> require_once("html_footer.php");
> require_once("misc_function.php");
>
>
> /* Set up some defaults */
> $title = "";
> $body = "";
> $page = "";
> $file_read = false;
> $file_content = "";
> unset($content_header);
>
> /* Read the contents of a file into a string */
> function read_file($filename)
> {
> global $file_read;
> global $file_content;
> $file_content = "";
> $file_read = false;
> //print "$filename\n\n<br><br>";
> if(file_exists($filename))
> {
> $page_code = file($filename);
> foreach ($page_code as $line)
> {
> $file_content .= $line;
> }
> //print "$file_content";
> $file_read = true;
> }
> else
> {
> $file_content = '
> <h1>File Not Found</h1>
> <p>Could not find <?=$filename?>, please let the Web Administrator
> know</p>
> ';
> }
> }
>
> /* Get the index information */
>
> read_file($NAV_COLUMN);
> $navigation = $file_content;
>
> /*
>  * garentee that if the user gives no file name then they will get the
>  * index file
>  */
> if(strcmp(basename($path), "") == 0)
> {
> if(!preg_match("/\/$/", $path))
> {
> $path .= "/";
> }
> $path .= "index.html";
> }
> /* Get the Header information and the content of the body */
> $file_name = "$CONTENT_PATH/$path";
> read_file($file_name);
> if($file_read)
> {
> //print "$file_name";
>
> /* Grab the HTTP header stuff from the file. This includes any
> * session information.
> *
> * The header section is defined by
> * <*** header ***> and <*** end header ***> at the start of the
> * file.
> */
> $section = preg_split("/\s*<\*{3}\s*end\s*header\s*\*{3}>\s*/im",
> $file_content,
> 2
> );
> if(count($section) == 2)
> {
> $content_header = $section[0];
> $content_header = preg_replace("/<\*{3}\s*header\s*\*{3}>/im",
> "",
> $content_header,
> 1
> );
> $body = $section[1];
>
> /* get the includes section */
> $section = preg_split("/\s*<\*{3}\s*end\s*includes\s*\*{3}>\s*/im",
> $content_header,
> 2
> );
> if(count($section) == 2)
> {
> $include_files = $section[0];
> $include_files = preg_replace("/<\*{3}\s*includes\s*\*{3}>/im",
> "",
> $include_files,
> 1
> );
> $content_header = $section[1];
>
> }
>
> }
> else
> {
> $body = $section[0];
> }
> }
> else
> {
> $body = $file_content;
> }
>
> if(isset($include_files))
> {
> $page .= $include_files."\n";
> }
>
> $page .= '<?PHP
> /*
>  * Start of Template code
>  */
>
> /* include state management here in an if to see if it is wanted */
>
> if(defined($KEEP_STATE) && $KEEP_STATE)
> {
> session_start();
> }
> /* Set up the headers and footers */
> header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
> header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
> header("Cache-Control: no-store, no-cache, must-revalidate");
> header("Cache-Control: post-check=0, pre-check=0", false);
> header("Pragma: no-cache");
>
> /* keep state = '.$KEEP_STATE.' */
>
> ?>
> ';
>
> if(isset($content_header))
> {
> $page .= $content_header."\n";
> }
>
>
> $page .= '
> <?PHP
> /*
>  * Start of Template code section
>  */
> $header = new html_header($title);
> $footer = new html_footer();
> $header->display()
> ?>'."\n";
> //$header->display();
> //print "<h1>:$title</h1>";
>
> /*
> print "<br><stong>header</strong>";
> highlight_string($content_header);
> */
>
> $page .= '<table summary="naigation" width="100%" height="100%">'."\n";
> $page .= '<tr>'."\n";
> $page .= '  <td width="83" class="index">'."\n";
> $page .= $navigation;
> //$page .= "<span class=\"index\">fred&nbsp;</span>\n";
> $page .= '  </td>'."\n";
> $page .= '  <td>'."\n";
>
> /*
> $page .= "<br><strong>body<strong><BR>";
> highlight_string($body);
> */
>
> $page .= $body."\n";
>
> $page .= '<?$test = session_id();print "session_id = $test";?>';
> $page .= '<?print "phpid = $PHPSESSID";?>';
>
> $page .= '  </td>'."\n";
> $page .= '</tr>'."\n";
> $page .= '</table>'."\n";
>
> $page .= '<?$footer->display();?>'."\n";
>
> print eval("?>".$page);
> if($DEBUG)
> {
> ?><h1>Debuging Information Follows</h1>
> <table width="100%"><TR><TD width="83">&nbsp;</TD><TD>
> <?
> //print "<h2>Base Name = ".basename($path)."</h2>";
> /*
> * This section adds line numbers to the string so you can make
> * sense out of the eval line numbers when an error is produced.
> *
> * IT WOULD BE A VERY GOOD IDEA TO TURN THIS INTO A FUCTION FOR
> * FUTURE USE.
> */
> flush();
> ob_start();
>
> highlight_string($page);
>
> $page = ob_get_contents();
>
> ob_end_clean();
>
> $new_page = preg_split('/<br\s*\/>/s', $page, -1);
> $i = 0;
> $page = "";
> while($i < count($new_page))
> {
> $line_no = $i + 1;
> $page .= "<font color=\"black\">$line_no: </font> ".$new_page[$i]."<br
\/>";
> $i++;
> }
> /* End line number section */
> print $page;
> ?>
> </TD></tr></table>
> <?
> }
>
> ?>
>
> --------
> index.html
> --------
> <*** includes ***>
> <?PHP
> /*
>  * Put any include or require statments here
>  */
> require_once("modules/login_box.php");
> require_once("database.php");
> require_once("player.php");
> require_once("modules/new_user.php");
>
>
> ?>
> <*** end includes ***>
> <*** header ***>
> <?PHP
> /* Put any session information here and other code which must be run
>  * before the HTML is actually sent.
>  */
> global $db;
> global $player;
> global $nick_name;
> $login_failed = TRUE;
>
> $login_box = new login_box($LOGIN_ACTION);
> $title = "";
>
> if(isset($nick_name))
> {
> /* The user has attempted to login */
>
> if(isset($new_user) && $new_user)
> {
> $title = "New User Registration";
> }
> else
> {
> if(isset($register) && $register)
> {
> /* The user is submitting their details */
>
> // Check if the user id already exists.
> $query = "SELECT id FROM player WHERE nickname = '$nick_name'";
>
> $result = $db->query($query);
>
> if(DB::isError($result))
> {
> die("Checking id: ".$result->getMessage());
> }
>
> if($result->numRows() > 0)
> {
> error_message("This nick name/login already exists, please try another");
> }
>
> // Add the user.
> if(isset($nick_name) && (strlen($nick_name) > 0)
> && !preg_match("/^\s*$/", $nick_name))
> {
> $column = "nickname";
> $values = "'".trim($nick_name)."'";
> }
> if(isset($password) && (strlen($password) > 0)
> && !preg_match("/^\s*$/", $password))
> {
> $password = md5(trim($password));
> $password2 = md5(trim($password2));
> if(strcmp($password, $password2) == 0)
> {
> $column .= ", password";
> $values .= ", '".$password."'";
> }
> else
> {
> error_message("Your passwords don't match please"
> . " entre them again :$password:$password2:");
> }
>
> }
> if(isset($first_name) && (strlen($first_name) > 0)
> && !preg_match("/^\s*$/", $first_name))
> {
> $column .= ", firstname";
> $values .= ", '".trim($first_name)."'";
> }
> if(isset($last_name) && (strlen($last_name) > 0)
> && !preg_match("/^\s*$/", $last_name))
> {
> $column .= ", lastname";
> $values .= ", '". trim($last_name)."'";
> }
> if(isset($email) && (strlen($email) > 0)
> && preg_match("/^[^@]+@[^.]+\..*$/", $eamil))
> {
> $column .= ", email";
> $values .= ", '".trim($email)."'";
> }
> if(isset($street) && (strlen($street) > 0)
> && !preg_match("/^\s*$/", $street))
> {
> $column .= ", street";
> $values .= ", '".trim($street)."'";
> }
> if(isset($suburb) && (strlen($suburb) > 0)
> && !preg_match("/^\s*$/", $suburb))
> {
> $column .= ", suburb";
> $values .= ", '".trim($suburb)."'";
> }
> if(isset($state) && (strlen($state) > 0)
> && !preg_match("/^\s*$/", $state))
> {
> $column .= ", state";
> $values .= ", '".trim($state)."'";
> }
> if(isset($postcode) && (strlen($postcode) > 0)
> && !preg_match("/^\s*$/", $postcode))
> {
> $column .= ", postcode";
> $values .= ", ".trim($postcode);
> }
> $column .= ", preferedname";
> if(isset($prefered_name))
> {
> if(strcmp($prefered_name, "nick_name") == 0)
> {
> $values .= ", true";
> }
> else
> {
> $values .= ", false";
> }
> }
> else
> {
> $values .= ", false";
> }
> if(isset($list))
> {
> if(strcmp($list, "true"))
> {
> // Send an email to the list
> }
> }
>
> //Get a valid Id
> // This needs work so it won't break if we get more than max(int2)
> // users
> $query = "SELECT id FROM player ORDER BY id DESC";
> $result = $db->query($query);
> if(DB::isError($result))
> {
> die("Getting valid id:  ".$result->getMessage());
> }
> $row = $result->fetchRow();
> $id = $row[0] + 1;
> $column .= ", id";
> $values .= ", $id";
>
> // Set the user active
> $column .= ", active";
> $values .= ", true";
>
> $query = "INSERT INTO player ($column) VALUES ($values)";
> //print $query;
>
> $result = $db->query($query);
>
> if(DB::isError($result))
> {
> print "$query<br>";
> die("Inserting new player:  ".$result->getMessage());
> }
>
> }
> else
> {
> /*
> * We only need to calculate the password if the user is
> * an existing user
> */
> $password = md5(trim($password));
> }
>
> // Check the database for this user
> //session_register_var("nick_name", $nick_name);
> session_register("nick_name");
> $GLOBALS["nick_name"] = $nick_name;
> $title = $nick_name;
>
> $query = "SELECT id "
> ."FROM player "
> ."WHERE nickname = '".trim($nick_name)."' "
> ."  and password = '$password'";
>
> $result = $db->query($query);
>
> if(DB::isError($result))
> {
> die("Geting registered user:  ".$result->getMessage());
> }
>
> if($result->numRows() != 0)
> {
> $row = $result->fetchRow();
> // print "<br>$password<br>$row[0]<br>";
>
> $player = new player($row[0], $db);
> session_register_var("player", $player);
>
> // Yeah!  The user loged in sussessfully and we can give them their
> // useable page.
> $login_failed = FALSE;
>
> }
>
> if($login_failed)
> {
> $title = "Login Failed";
> }
> else
> {
> $title = "Welcome";
> }
> }
>
> }
> else
> {
> /* The user has not attempted to login */
> $title = "Login";
> }
>
>
>
> ?>
> <*** end header ***>
> <?PHP
> /* This section is where your HTML code goes and any code which can run
>  * in the HTML
>  */
>
> if(isset($nick_name))
> {
> /* The user has attempted to login */
> if(isset($new_user) && $new_user)
> {
> if(isset($password))
> {
> new_user_form($nick_name, $password);
> }
> else
> {
> new_user_form($nick_name);
> }
> }
> else
> {
> if($login_failed)
> {
> ?>
> <p>Please try loging in again.  You may have mispelled your
> nick name or password</p>
> <?PHP
> $login_box->display($nick_name);
> }
> else
> {
> ?>
> <p>Welcome to Maric's Place</p>
> <?PHP
> session_register_var("player", $player);
> }
> }
>
> }
> else
> {
> /* The user has not attempted to login */
> $login_box->display();
> }
>
> ?>
>
> ------
> player_list.html
> ------
> <*** includes ***>
> <?PHP
> /* Put any session information here and other code which must be run
>  * before the HTML is actually sent.
>  */
>  require_once('database.php');
>  require_once('player.php');
> ?>
> <*** end includes ***>
>
> <*** header ***>
> <?PHP
>
>  global $db;
>  global $player;
>  $title = "Player List";
>  $i;
>
> ?>
> <*** end header ***>
> <?PHP
> /* This section is where your HTML code goes and any code which can run
>  * in the HTML
>  */
>
> $query = "SELECT firstname, lastname, nickname FROM player";
> $result = $db->query($query);
> if(DB::isError($result))
> {
> die("Couldn't list Players: ".$result->getMessage());
> }
>
> ?>
> <table summary="Player List" border="1" align="center" cellpadding="2">
> <tr>
> <td><strong>First Name</strong></td>
> <td><strong>Last Name</strong></td>
> <td><strong>Alias</strong></td>
> </tr>
> <?PHP
> //print $player->first_name();
> $i = 0;
> while($i < $result->numRows())
> {
> $row = $result->fetchRow();
> print "<tr>\n";
> foreach ($row as $cell)
> {
> print "<td>".htmlentities($cell) ."</td>\n";
> }
> print "</tr>\n";
> $i++;
> }
> ?>
> </table>
> <?PHP
> print $player.":<br>\n";
> print $nick_name."+<br>\n";
> print session_id()."-<br>\n";
> ?>
>
> --
> Justin 'Doychi' Deutsch
> [EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
"Is currently anyway of doing scheduled tasks with PHP (without using 
crontab)? "
"What's wrong with using cron?"

I'm building an OSS  site where the PostgreSQL data base maintenance, 
email sending, stats gathering, number crunching and graph plotting 
needs to be automated. My target audience will need things as simple as 
possible. I am under the impression that it would be a hassle and cost 
more to get a web host to install a cron script for Postgres. (Or have 
php as an executable binary instead of shared object.)

What I do so far is look at a serial number from a data base table. If 
it is divisible by 20, I fill up a graph plotting que. If divisible by 
50, another que is filled, etc. The footer has a script that checks a 
table with each que status and then does does a few things out of the 
highest priority que.

I figure the user will not notice a few small scripts running after all 
the text is displayed. If there is a better way, let me know!!

Thanks, Jeff
--- End Message ---
--- Begin Message ---
At 06:41 AM 2/16/2002 -0800, [EMAIL PROTECTED] wrote:
>"Is currently anyway of doing scheduled tasks with PHP (without using 
>crontab)? "
>"What's wrong with using cron?"
>
>I'm building an OSS  site where the PostgreSQL data base maintenance, 
>email sending, stats gathering, number crunching and graph plotting needs 
>to be automated. My target audience will need things as simple as 
>possible. I am under the impression that it would be a hassle and cost 
>more to get a web host to install a cron script for Postgres. (Or have php 
>as an executable binary instead of shared object.)

If the web host gives you access to a shell account then you could setup 
the script...you wouldn't need them to do it.  You could build a copy of 
PHP as an executable in your home directory and run it from there, no need 
to get the host to do it.

Or there are a few ways that you could schedule the task remotely...use a 
cron job from another server that either runs the PHP script locally, 
connecting to the SQL database remotely, or you can use a cron job and lynx 
to call a remote PHP page that will run your script.  Of course, this 
requires your script to be in your web servers directory tree, but if 
security is a concern you could always setup a .htaccess file to challenge 
for credentials then use the "-auth" switch to lynx in your remote 
script.  It's not the most secure thing in the world, but it's better than 
nothing...

--- End Message ---
--- Begin Message ---

On Friday, February 15, 2002, at 03:03  PM, Rodney Davis wrote:

> Is currently anyway of doing scheduled tasks with PHP (without using
> crontab)?  For example, using an email script to send out e-mail
> reminders every Monday or something like that?

One way to do it (stole this from my 'Beginning PHP' book [Wrox]):

Store the current timestamp into a file.  Read this file every time some 
commonly-used feature of your site is executed.  Then, when X number of 
seconds has passed beyond the timestamp, execute some other code:

$countfile = "./countfile.txt";
$fp = fopen($countfile, 'r+');
$oldtime = fread($fp);

if ((time()) >= ($oldtime + 24 * 60 * 60 * 7)) {
    // a week has passed since the last time the file was written to
    // execute the code (mail or whatever)
}

rewind($fp);
fwrite($fp, time());
fclose($fp);

or something like that.  NB this code is definitely untested, so it 
probably won't work, but the theory is there.  Also, be sure to take 
into account the security issues of having a file writeable by your web 
server -- I'm assuming you already have experience with this.

Erik



----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
What do people think about making a cron job call a page by doing a lynx
http://www.site.com/automatedtasks.php every hour?


-----Original Message-----
From: Michael Sims [mailto:[EMAIL PROTECTED]]
Sent: February 16, 2002 9:59 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] scheduled tasks


At 06:41 AM 2/16/2002 -0800, [EMAIL PROTECTED] wrote:
>"Is currently anyway of doing scheduled tasks with PHP (without using
>crontab)? "
>"What's wrong with using cron?"
>
>I'm building an OSS  site where the PostgreSQL data base maintenance,
>email sending, stats gathering, number crunching and graph plotting needs
>to be automated. My target audience will need things as simple as
>possible. I am under the impression that it would be a hassle and cost
>more to get a web host to install a cron script for Postgres. (Or have php
>as an executable binary instead of shared object.)

If the web host gives you access to a shell account then you could setup
the script...you wouldn't need them to do it.  You could build a copy of
PHP as an executable in your home directory and run it from there, no need
to get the host to do it.

Or there are a few ways that you could schedule the task remotely...use a
cron job from another server that either runs the PHP script locally,
connecting to the SQL database remotely, or you can use a cron job and lynx
to call a remote PHP page that will run your script.  Of course, this
requires your script to be in your web servers directory tree, but if
security is a concern you could always setup a .htaccess file to challenge
for credentials then use the "-auth" switch to lynx in your remote
script.  It's not the most secure thing in the world, but it's better than
nothing...


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


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

--- End Message ---
--- Begin Message ---

What do people think about making a cron job call a page by doing a lynx
http://www.site.com/automatedtasks.php every hour?


-----Original Message-----
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: February 16, 2002 3:02 PM
To: Rodney Davis
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] scheduled tasks



On Friday, February 15, 2002, at 03:03  PM, Rodney Davis wrote:

> Is currently anyway of doing scheduled tasks with PHP (without using
> crontab)?  For example, using an email script to send out e-mail
> reminders every Monday or something like that?

One way to do it (stole this from my 'Beginning PHP' book [Wrox]):

Store the current timestamp into a file.  Read this file every time some 
commonly-used feature of your site is executed.  Then, when X number of 
seconds has passed beyond the timestamp, execute some other code:

$countfile = "./countfile.txt";
$fp = fopen($countfile, 'r+');
$oldtime = fread($fp);

if ((time()) >= ($oldtime + 24 * 60 * 60 * 7)) {
    // a week has passed since the last time the file was written to
    // execute the code (mail or whatever)
}

rewind($fp);
fwrite($fp, time());
fclose($fp);

or something like that.  NB this code is definitely untested, so it 
probably won't work, but the theory is there.  Also, be sure to take 
into account the security issues of having a file writeable by your web 
server -- I'm assuming you already have experience with this.

Erik



----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

--- End Message ---
--- Begin Message ---
Hi list,

I'm using IE5 on Mac with MacOS 9.2.2.
I've made a script that use session_register(), but even when I quit the
browser the values registered with session still there.
Ex: I run the script, quit the browser, reopen it and do an echo($myvar)
and, the value is there, didn't expire.
How can I correct this???

Thank's in advance

Rodrigo Peres
-- 


--- End Message ---
--- Begin Message ---
Maybe the content of the page is cached. Try to reload/to clear the cache of the 
browser.



Best regards,
Andrey Hristov
----- Original Message ----- 
From: "Rodrigo Peres" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Saturday, February 16, 2002 4:50 PM
Subject: [PHP] My Session don't expire


> Hi list,
> 
> I'm using IE5 on Mac with MacOS 9.2.2.
> I've made a script that use session_register(), but even when I quit the
> browser the values registered with session still there.
> Ex: I run the script, quit the browser, reopen it and do an echo($myvar)
> and, the value is there, didn't expire.
> How can I correct this???
> 
> Thank's in advance
> 
> Rodrigo Peres
> -- 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
Hello!
>From my understanding of your question, I'd say that you'll
have to configure Apache so that it calls PHP for XML-files,
too. You can set this up in your either ".htaccess" files or
in your Apache config file (-> see the docs, I don't know
exactly 'cos I'm using IIS/5.0 with Win2k). This is what I
use for on my ISPs virtual web server:
    AddType x-mapp-php4 .xml
    AddType x-mapp-php4 .xhtml
    DirectoryIndex index.xml index.xhtml
    IndexIgnore .htaccess .htpasswd

The <?php [...] ?> - tags should then be processed _before_
the browser.
An alternative to using XML is using XHTML 1.0 (either
transitional or strict) in your .html - files:
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
        <head></head>
        <body></body>
    </html>

Don't forget to end your empty tags with /> instead of >, like this: <br />

Hope it helps, regards,

--
Christian Blichmann

_____________________________________________
don't hesitate - email me with your thoughts:
e-mail: [EMAIL PROTECTED]
 - please remove the ".nospam" from address.
_____________________________________________
do you want to know more?
web:    http://www.blichmann.de


--- End Message ---
--- Begin Message ---
Whoops, sent you a wrong .htaccess - file, here's
what I really use (the other one was old):
    AddType application/x-httpd-php .php .php4 .htm .html .xml .xhtml
    DirectoryIndex index.xml index.xhtml
    IndexIgnore .htaccess .htpasswd

--
Christian Blichmann

_____________________________________________
don't hesitate - email me with your thoughts:
e-mail: [EMAIL PROTECTED]
 - please remove the ".nospam" from address.
_____________________________________________
do you want to know more?
web:    http://www.blichmann.de


--- End Message ---
--- Begin Message ---
Christian, when I changed the AddType to include .htm .html .xml and .xhtml
now even if I don't have any php content in the file, it displays as plain
text instead of xml, the files have an xml ext. Any ideas?


"Christian Blichmann" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Whoops, sent you a wrong .htaccess - file, here's
> what I really use (the other one was old):
>     AddType application/x-httpd-php .php .php4 .htm .html .xml .xhtml
>     DirectoryIndex index.xml index.xhtml
>     IndexIgnore .htaccess .htpasswd
>
> --
> Christian Blichmann
>
> _____________________________________________
> don't hesitate - email me with your thoughts:
> e-mail: [EMAIL PROTECTED]
>  - please remove the ".nospam" from address.
> _____________________________________________
> do you want to know more?
> web:    http://www.blichmann.de
>
>


--- End Message ---
--- Begin Message ---
Christian, never mind, my fault. It's working beauthifully now.  Thanks so
much for the help!  Save my weekend!
Jim

"Jim Hankins" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Christian, when I changed the AddType to include .htm .html .xml and
.xhtml
> now even if I don't have any php content in the file, it displays as plain
> text instead of xml, the files have an xml ext. Any ideas?
>
>
> "Christian Blichmann" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Whoops, sent you a wrong .htaccess - file, here's
> > what I really use (the other one was old):
> >     AddType application/x-httpd-php .php .php4 .htm .html .xml .xhtml
> >     DirectoryIndex index.xml index.xhtml
> >     IndexIgnore .htaccess .htpasswd
> >
> > --
> > Christian Blichmann
> >
> > _____________________________________________
> > don't hesitate - email me with your thoughts:
> > e-mail: [EMAIL PROTECTED]
> >  - please remove the ".nospam" from address.
> > _____________________________________________
> > do you want to know more?
> > web:    http://www.blichmann.de
> >
> >
>
>


--- End Message ---
--- Begin Message ---
OK so it's not working.  I was having cache issues, so it now displays as
text instead of xml but does process the <?php ?> commands.  I'm close, any
ideas what I need to do?  Do I need to now place some kind of header in all
my xml files or is there some type of apache config that needs changing?
Now all xml displays as text even if I don't use php commands.  I assume
because of the ext is getting process before the mime type text/xml line or
something?


"Jim Hankins" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Christian, never mind, my fault. It's working beauthifully now.  Thanks so
> much for the help!  Save my weekend!
> Jim
>
> "Jim Hankins" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Christian, when I changed the AddType to include .htm .html .xml and
> .xhtml
> > now even if I don't have any php content in the file, it displays as
plain
> > text instead of xml, the files have an xml ext. Any ideas?
> >
> >
> > "Christian Blichmann" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Whoops, sent you a wrong .htaccess - file, here's
> > > what I really use (the other one was old):
> > >     AddType application/x-httpd-php .php .php4 .htm .html .xml .xhtml
> > >     DirectoryIndex index.xml index.xhtml
> > >     IndexIgnore .htaccess .htpasswd
> > >
> > > --
> > > Christian Blichmann
> > >
> > > _____________________________________________
> > > don't hesitate - email me with your thoughts:
> > > e-mail: [EMAIL PROTECTED]
> > >  - please remove the ".nospam" from address.
> > > _____________________________________________
> > > do you want to know more?
> > > web:    http://www.blichmann.de
> > >
> > >
> >
> >
>
>


--- End Message ---
--- Begin Message ---
Rite, a user logs in at http://localhost/employers/login.php and PHP sets a
cookie, eusername, that has his username, funnily enough.

then he clicks on to the /employers/search.php, submits his query and clicks
on the page of http://localhost/freelancers/some_guy/index.php

When I have a bit of PHP code at the top of /some_guy/index.php that check
if an employer is looking at this site.
<?
if ($eusername <> ""){
    do this;
}
?>

But PHP keeps telling me that eusername IS equal to "" and no employer is
logged in, when they're definately is. WHY?? Has it something to do with the
scope of cookies?? Because when I check if eusername exists in a page in the
employers directory, it works fine.


--- End Message ---
--- Begin Message ---
email me if you dont understand something about my question. I read it back
to myself, and it all sounds so complicated!

TIA
"Georgie Casey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Rite, a user logs in at http://localhost/employers/login.php and PHP sets
a
> cookie, eusername, that has his username, funnily enough.
>
> then he clicks on to the /employers/search.php, submits his query and
clicks
> on the page of http://localhost/freelancers/some_guy/index.php
>
> When I have a bit of PHP code at the top of /some_guy/index.php that check
> if an employer is looking at this site.
> <?
> if ($eusername <> ""){
>     do this;
> }
> ?>
>
> But PHP keeps telling me that eusername IS equal to "" and no employer is
> logged in, when they're definately is. WHY?? Has it something to do with
the
> scope of cookies?? Because when I check if eusername exists in a page in
the
> employers directory, it works fine.
>
>


--- End Message ---
--- Begin Message ---
Hi guys,

I am not sure if this is possible. Not on my knowledge, but maybe someone is
smarter than I am :-)

I want to pass an icon to a function. Therefore I am putting all the html
into a var called icon.
Inside this html their is another variable with an array which value is set
inside the function.

How can I pass this html thing and ensure that the variable is gonna be set?
Take a look at the code underneath.
Like that it is just printing out $picture_id[$i]

  $icon_1 = " <a href=\"index.php?fuseaction=edit&action=delete&id=%s\"
      onclick=\"return confirm('Are you sure you want to delete picture no:
$picture_id[$i]');\">
      <img src=\"../app_global/pics/delete.gif\" width=20 height=20 border=0
alt=\"delete\">
     </a>";

Can anybody help on this?

Thanx for any help

Cheers Andy


--- End Message ---
--- Begin Message ---
Well, as long as you use double quotes: " the variables will be parsed
inside you statement... single quotes however mean the exact string...

example:
$icon = "1.jpg";
$str = "this is the image $icon";
$str2 = 'this is the image $icon';

print $str; // returns: "this is the image 1.jpg"
print $str2; // returns: "this is the image $icon"


Greets,

Edward

----- Original Message -----
From: "Andy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 16, 2002 6:03 PM
Subject: [PHP] Tricky variable question! Impossible??


> Hi guys,
>
> I am not sure if this is possible. Not on my knowledge, but maybe someone
is
> smarter than I am :-)
>
> I want to pass an icon to a function. Therefore I am putting all the html
> into a var called icon.
> Inside this html their is another variable with an array which value is
set
> inside the function.
>
> How can I pass this html thing and ensure that the variable is gonna be
set?
> Take a look at the code underneath.
> Like that it is just printing out $picture_id[$i]
>
>   $icon_1 = " <a href=\"index.php?fuseaction=edit&action=delete&id=%s\"
>       onclick=\"return confirm('Are you sure you want to delete picture
no:
> $picture_id[$i]');\">
>       <img src=\"../app_global/pics/delete.gif\" width=20 height=20
border=0
> alt=\"delete\">
>      </a>";
>
> Can anybody help on this?
>
> Thanx for any help
>
> Cheers Andy
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---
On 16 Feb 2002, at 8:37, michael kimsal wrote:

> I don't believe the original poster you quote really had/has
> a firm grasp on what it actually does.
> 
> The tried and true example is a hit counter.  No matter who hits a
> page, if that page increases an application variable called "counter"
> for example, the counter keeps going up.
> 
> You hit it and it has a value of 1.
> Then I hit the page and it has a value of 2.
> The bob hits it and it has a value of 3.
> 
> And so on.
> 
> There's no messaging from one session to another, though I don't doubt
> you could architect some code to operate like that.  It's like a
> 'session' state that's not specific to any one user - a 'commons'
> area, if you like.
> 
> Does that help?
> 
> Also, a second draft of this info, along with a bit of code example in
> PHP, is in a PDF at
> 
> http://demo.logicreate.com/index.php/filemgt/main/event=view/pkey=6/ph
> pfaq.pdf


Yes, I responded to quickly as after reading someone else's 
response to one of your emails it became clear the original poster 
was mistaken. Thanks for the clarification.

Peter
http://www.readbrazil.com/
Answering Your Questions About Brazil
--- End Message ---
--- Begin Message ---
Hello =)

    I have a template stored in a database which contains variables.  Then, in a 
separate file, I have the variables set, and I call the template and run it through 
eval().  Unfortunately, it only is parsing a few of them.  Could somebody take a look 
and give me some input?

Thanks

    -- Script:  http://penfieldsocrates.org/test.php
    -- Script Source: http://penfieldsocrates.org/test.txt
    -- Template:  http://penfieldsocrates.org/from_db.txt (need to view source)


--- End Message ---
--- Begin Message ---
> I have a template stored in a database which contains variables.  Then,
> in a separate file, I have the variables set, and I call the template and
run
> it through eval().  Unfortunately, it only is parsing a few of them.
Could
> somebody take a look and give me some input?

Here's what my template table looks like:

CREATE TABLE templates (
  id tinyint(4) unsigned NOT NULL auto_increment,
  name varchar(16) NOT NULL default '',
  template text NOT NULL,
  PRIMARY KEY  (id),
  UNIQUE KEY name (name)
)

Then here is my template function that preps the data for use with eval():

function template($name, $set="main"){
global $tb_templates;
$sql = "
 select
  *
 from
  $tb_templates
 where
  name = '$name'
";
if($query = sql_query($sql)){
 if(sql_num_rows($query)==1){
  $array = sql_fetch_array($query);
  $template = str_replace("\\'","'",addslashes($array["template"]));
 } else {
  $template = $name . " template not found.";
 }
}
return $template;
}

Then here is how to use eval() properly:

$template_name = template("template_name");
eval("\$template_name = \"$template_name\";");

This will parse all your $vars you store in the templates.


------------------------------------------------------------------------
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
------------------------------------------------------------------------



--- End Message ---
--- Begin Message ---
Hi list

I have some buttons made in photoshop in .gif format. This buttons have
round corner, feather, multiple colors etc. There's a way to open it with
php and write some text to it. I know that is possible to create images, but
what about to change them??? I need to do this because the text that will
fill the buttons come from mysql and change everyday.

Thank's in advance


Rodrigo


ps: If someone want to see the button I'm talking look in
http://www.celebnet.com.br/home.php under the "AS ++".

--- End Message ---
--- Begin Message ---
button.php
<?php
      Header("Content-type: image/gif");

 $string=str_replace("%20", " ", $string);
 $theimage = "images/" . $button .".gif";
    $im = imageCreateFromgif($theimage);
    $white = ImageColorAllocate($im, 255, 255, 255);


    $font = "/fonts/VERDANAB.TTF";
 $box = imagettfbbox ( 12, 0, $font, $string);


 $th=$box[7]-$box[3];
 $th= $th + 2;
 $py = (imagesy($im) -$th)/2;

 $px      = (imagesx($im) -($box[2]-$box[0]))/2;

 $size = 12;



 ImageTTFText ($im, $size, 0, $px, $py, $white,$font,$string);

    Imagegif($im);
    ImageDestroy($im);
?>

fot this to work you need to upload VERDANAB.TTF to a folder called  'fonts'
and you call the image like this:
to draw 'hello' on a button called 'mybutton.gif' stored in 'images' folder
<img src="button.php?string=hello&button=mybutton">

----- Original Message -----
From: "Rodrigo Peres" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Saturday, February 16, 2002 7:49 PM
Subject: [PHP] Change gif image with php


> Hi list
>
> I have some buttons made in photoshop in .gif format. This buttons have
> round corner, feather, multiple colors etc. There's a way to open it with
> php and write some text to it. I know that is possible to create images,
but
> what about to change them??? I need to do this because the text that will
> fill the buttons come from mysql and change everyday.
>
> Thank's in advance
>
>
> Rodrigo
>
>
> ps: If someone want to see the button I'm talking look in
> http://www.celebnet.com.br/home.php under the "AS ++".
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
ya its completly possible..
I've never done it, but I'm sure I read how to over at phpbuilder.com

Andrew
----- Original Message -----
From: "Rodrigo Peres" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Saturday, February 16, 2002 7:49 PM
Subject: [PHP] Change gif image with php


> Hi list
>
> I have some buttons made in photoshop in .gif format. This buttons have
> round corner, feather, multiple colors etc. There's a way to open it with
> php and write some text to it. I know that is possible to create images,
but
> what about to change them??? I need to do this because the text that will
> fill the buttons come from mysql and change everyday.
>
> Thank's in advance
>
>
> Rodrigo
>
>
> ps: If someone want to see the button I'm talking look in
> http://www.celebnet.com.br/home.php under the "AS ++".
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Rodrigo,
I've been struggling with this for some time, so here goes:

The php4 builds do not support .gif files, you'll need to change your files
to .jpg or .png format, or use php3 (I can't change to php3).

I use imagecreate() func. before imagecreatefromjpeg() func. because if I
didn't do this, the added text would be gray regardless of the desired
color.

The mysql portion is solid and yields the desired results.

However, I'm having trouble with something related to the
imagecreatefromjpeg() func., I get a server error (500) on some images
regardless of their size.  This is the only error produced by the func. and
it is maddening.  From experimentation, I believe that there's something
wrong with the .jpg files, the .jpg file upload, or the phase of the moon.

Good luck,
Hugh




<?php
header("content-type: image/jpg");

$font="fonts/arial.ttf";
$font2="fonts/wingding.ttf";

$im_size = GetImageSize("$image_file");
$imWidth = $im_size[0];
$imHeight = $im_size[1];

$image=ImageCreate($imWidth,$imHeight);

$black=imagecolorallocate($image,0,0,0);
$white=imagecolorallocate($image,255,255,255);
$red=imagecolorallocate($image,255,100,100);
$orange=imagecolorallocate($image,255,200,0);
$yellow=imagecolorallocate($image,233,233,0);
$green=imagecolorallocate($image,80,255,80);
$lt_blue=imagecolorallocate($image,180,180,255);
$blue=imagecolorallocate($image,120,120,255);
$dk_blue=imagecolorallocate($image,0,0,200);
$purple=imagecolorallocate($image,200,100,200);
$brown=imagecolorallocate($image,190,160,150);

$image2=imagecreatefromjpeg("$image_file");


imagecopy ($image, $image2, 0, 0, 0, 0, $imWidth, $imHeight);

 $db="data_base_name";
 $pass="password";
 $link=mysql_connect("localhost","","$pass");
 if (! $link) die("Can't log in at this time");
 mysql_select_db($db,$link) or die ("Can't log in at this time");
 $query="mysql query ";
 $results=mysql_query($query);
 if (!$results) die(mysql_error());
 mysql_close($link);

while ($landmark=mysql_fetch_array($results))
 {
 $coordinate_x=$landmark['x'];
 $coordinate_y=$landmark['y'];
 $plant=$landmark['plant'];
 if ($plant=="flowering") $var_color=$red;
 if ($plant=="conifer") $var_color=$orange;
 if ($plant=="palm") $var_color=$yellow;
 if ($plant=="other") $var_color=$lt_blue;

 imagettftext($image,  5, 0,$coordinate_x-3, $coordinate_y-4, $black,
$font2, "l");
 imagettftext($image, 19, 0,$coordinate_x-7, $coordinate_y+4, $black,
$font2, "l");
 imagettftext($image, 17, 0,$coordinate_x-6, $coordinate_y+2,
$black,$font2,"l");
 imagettftext($image, 17, 0,$coordinate_x-6, $coordinate_y+2, $var_color,
$font2, "l");
 imagettftext($image,  5, 0,$coordinate_x-3, $coordinate_y-4, $white,
$font2, "l");
 }

imagejpeg($image,"./new/$image_file",100);

ImageDestroy($image);
ImageDestroy($image2);

header("location: finished.php");
?>


----- Original Message -----
From: "Rodrigo Peres" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Saturday, February 16, 2002 11:49 AM
Subject: [PHP] Change gif image with php


> Hi list
>
> I have some buttons made in photoshop in .gif format. This buttons have
> round corner, feather, multiple colors etc. There's a way to open it with
> php and write some text to it. I know that is possible to create images,
but
> what about to change them??? I need to do this because the text that will
> fill the buttons come from mysql and change everyday.
>
> Thank's in advance
>
>
> Rodrigo
>
>
> ps: If someone want to see the button I'm talking look in
> http://www.celebnet.com.br/home.php under the "AS ++".
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
> Rodrigo,
> I've been struggling with this for some time, so here goes:
> 
> The php4 builds do not support .gif files, you'll need to change your files
> to .jpg or .png format, or use php3 (I can't change to php3).

This is not true.  GIF support depends solely on the version of the GD 
library PHP is linked against.  GIF support was not removed from PHP.  It 
was removed from later versions of the GD library.  Simply grab an older 
version of GD which has GIF support and link PHP against that.

-Rasmus

--- End Message ---
--- Begin Message ---
Hi!

You can find details at the next link:

http://endi.go.ro/ml.htm

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com
--- End Message ---
--- Begin Message ---
Hello,

Everything works with the FTP connection...but
I have a problem with the address at ftp_rawlist.

I tried "/" to see the root directory and it didn't accepted it...
What is rong?

Artemis Mendrinos.


--- End Message ---
--- Begin Message ---
Test please ignore

Just a test to see if I am on the list yet.

--- End Message ---
--- Begin Message ---
Is there a way to fake adding images with a constrained size as appose to a
scale?

I am trying to build a dynamic catalog, but I want all images the same size
and not scaled.

I am sure the response will be to make them all the same size before using
pdf_place_image, but the items change regularly and I want a one stop
solution.

Any ideas???

Paul


|--------------------------------------|
|    Paul Fowler
|    Zgtec, Inc.
|    P.O. Box 11199
|    Aspen, CO 81612
|    <[EMAIL PROTECTED]>
|    <http://www.zgtec.com>
|--------------------------------------|

--- End Message ---
--- Begin Message ---
I am looking for a good manual or introduction on how to write readable,
extensible code (in any programming language). To give you an example,
this bit looks pretty darn horrible and I just don't know how to
rephrase it to make it more concise and readable:

----------------------------- snip -----------------------------
if ( ($var>0) & ( (strlen($var)==strlen(intval($var))) or 
((strlen($var)-1)==strlen(intval($var))) ) ) {

        do stuff;

}
----------------------------- snap -----------------------------

(actually, depending on how you've configured your mail reader, or how
your terminal is set, this boolean expression may acually not appear in
one line . . . which is a problem in itself)

I am not sure why, but one problem that I happen to run up against is
that I write expressions (boolean) which get very long and because you
can't split them (what with them being conditionals in if clauses) - or
can you? - they stretch off the screen which makes my code pretty much
unreadable (I noticed that good-looking code tends to stick with, like,
70 or something characters in width).

But that's just one problem.

The stuff that I do always works, but I always have difficulties
understanding it once I come back to it after a while (the fact that I
am also lazy at commenting is not the issue - it is my belief that
well-written code should be readable as well as functional).

There must be some kind of canonical text on the subject matter, just as
there are canonical texts on SQL (Codd, Celko), C (Kernigan, Ritchie),
Perl (Wall), epistemology (Kant), the laws of motion (Newton), general
relativity (Einstein), psychoanlysis (Freud) . . . you name it.

Regards, Frank
--- End Message ---
--- Begin Message ---
At 12:26 AM 2/17/2002 +0100, Frank Joerdens wrote:
>I am looking for a good manual or introduction on how to write readable,
>extensible code (in any programming language). To give you an example,
>this bit looks pretty darn horrible and I just don't know how to
>rephrase it to make it more concise and readable:
>
>----------------------------- snip -----------------------------
>if ( ($var>0) & ( (strlen($var)==strlen(intval($var))) or 
>((strlen($var)-1)==strlen(intval($var))) ) ) {
>
>         do stuff;
>
>}
>----------------------------- snap -----------------------------

This is all just IMHO, because I'm still a bit of a beginner.

I have always been tempted to write code in the fewest lines possible.  But 
sometimes this is a Bad Thing, because it can make it very difficult to 
figure out what you were thinking when you wrote it.  I think readability 
is more important, especially in PHP apps where you are not trying to 
squeeze out every last bit of performance (don't get me wrong, speed is 
important, but let's face it, we're not designing low level device drivers 
or real time kernels here...)

Anyway, not really knowing what you are trying to accomplish above, I would 
rewrite it like so:

$strlength = strlen($var);
$intlength = strlen(intval($var));
if($strlength == $intlength || $strlength - 1 == $intlength) {
   $length_ok = true;
}

if($var > 0 && $length_ok) {
   do stuff;
}

Yes, that is 6 more lines of code than your example, but I believe it is 
much clearer and easier to read.  Also, the above is actually self 
documenting IMHO.  If I was going to use your example in my code, I would 
definitely have to comment it to remind myself of it's purpose later, where 
my example I believe doesn't require comments as it's easier to read.

Don't have any specific book recommendations...maybe someone else will jump 
in and suggest something...

--- End Message ---
--- Begin Message ---
I am trying to develop a music scheduling system on Windows using the
command line to fire off WinAMP.  The first exec works fine, then it
stops
and says that program execution time has been exceeded.  

An example would be:

exec ("winamp.exe M000001.mp3");

a while loop kicks off the second.  I tried to send the output to null 
winamp.exe >null or nul and no luck.  Anyone else try this on Windows?

Thanks,

-Scott



--- End Message ---
--- Begin Message ---

I’m trying to control the way a new window opens when submiting a form.

 

When I do it from a regular button, I use:

 

<p align="center"> <a href=""#pv"" >rollbars=0,width=300,height=340,top=150,left=150');return true">

 

and it works, it opens the new window, but I’m not transferring any values in here.

 

What I want to do is that when I push the submit button of a form, it opens in the same window size as the prior example. I hope you can assist me.

 

E.

--- End Message ---

Reply via email to