php-general Digest 13 Apr 2002 11:17:33 -0000 Issue 1284

Topics (messages 92821 through 92861):

PHP 4.0.6 and xsl-transformation
        92821 by: K. Pihl

how to detect error
        92822 by: Charmaine Tian
        92843 by: Rasmus Lerdorf

Re: Wanting a better understanding of classes in PHP...
        92823 by: Shu Chow

XHTML tag attribute quoting (Was Re: Forms in PHP)
        92824 by: Andrew Chase

Re: session_is_registered
        92825 by: Oliver Beddows
        92830 by: Norman Zhang
        92834 by: Oliver Beddows
        92836 by: Oliver Beddows

including class files with unserialize_callback_func
        92826 by: Ian

Re: mysql question --
        92827 by: Jason Caldwell

passing array from one page to itself?
        92828 by: sundogcurt
        92832 by: sundogcurt
        92833 by: Richard Baskett

Monitoring a SSL Auth'd page
        92829 by: Ninety-Nine Ways To Die
        92837 by: Rasmus Lerdorf

New to web / PHP development.  Please take pity on me.
        92831 by: Marc Shlaes

Re: country ip recognition and php
        92835 by: Manuel Lemos

Regilar expressions problem
        92838 by: Leif K-Brooks
        92844 by: Oliver Beddows

Re: variable scoping...
        92839 by: Aric Caley
        92840 by: Aric Caley
        92842 by: Rasmus Lerdorf
        92859 by: Aric Caley

inclusion of class definitions with unserialize_callback_func in php.ini
        92841 by: Ian

Closing curly brackets?
        92845 by: Jennifer Downey
        92848 by: Jennifer Downey

Re: quotes
        92846 by: Analysis & Solutions

Re: using php for keywords
        92847 by: olinux

form mail with attachment
        92849 by: mm fernandez

Re: Local Test | Different folder - Help!! (part2)
        92850 by: phplists.woodenpickle.com
        92853 by: phplists.woodenpickle.com

Re: Pass variables via URL
        92851 by: phplists.woodenpickle.com

How can I read client-side files or upload them to a server?
        92852 by: Don
        92855 by: Justin French

Cannot enter single quotation marks in fields
        92854 by: Denis L. Menezes

Error accessing class
        92856 by: Andrew Schoenherr
        92857 by: Tyler Longren

PHP, LDAP and SASL
        92858 by: Quinn Perkins

Re: Forms in PHP
        92860 by: David Robley

Switching from "Register_Globals=On"
        92861 by: Andre Dubuc

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 ---
Hey PHP-gurus!

How do I run and invoke PHP XSL-parsing and
transformation using PHP version 4.0.6.?

Here is the sample code I want to run.

files included:
  PHP-script
  XML-file and XSL-file:They are formatted nicely
client-side by IE6.0.
  (Please disregard the stupid text in the XML-file,
it is an extract from a database with a lot of test
postings)

When I run the script (post.php) I get an 'empty'
XHTML-document, which is probably the result of
applying the 
XSL-stylesheet(standard.xsl) on the XML-document
(writeout.xml), and getting nothing -> a 'bad'
transformation.

The script doen't display any errors, and the logging
does not seem to work.
Please help.

PS : I didn't do the server setup myself, how can I
check if the XSL-parser is configured correctly?

YT
Karsten Pihl, denmark




__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
<?php

// constants
define(XSL1, "standard.xsl");
define(XMLLINK, '<?xml-stylesheet type="text/xsl" href="'.XSL1.'"?>');  
define(XMLHEAD, '<?xml version="1.0" encoding="iso-8859-1"?>'."\n".XMLLINK);
define(XMLFILE, "writeout.xml");
define(LOG, 'transform.log');

// ## executing
transform();

// functions
function load($fromFile){
  //returns file $fromFile as string $str
  $fh = fopen($fromFile, "r") or die("Can't open file ".$fromFile);
  $str = fread($fh, filesize($fromFile));
  fclose($fh);
  return $str;
}//load

function save($str, $toFile){
// writes string $str to file $toFile, returns boolean for succes
  $fh = fopen($toFile, "wb") or die("Can't open file ".$toFile);
  $bf = fwrite($fh, $str);
  fclose($fh);
  // 
  if ($bf == -1) return false;
  else return true;
}//save


function transform(){
  // echo 'valid: ', $valid_user; 
  // almindelige brugere må gerne se nyheder
  // filtrerer(parser) xml dokumentet igennem stylesheet'et.
 
  $myxml = load(XMLFILE);
  $mystyle = load(XSL1);
 
  $handle = @xslt_create() or die("Can't create XSLT handle!");
  
  xslt_set_log($handle, true);
  xslt_set_log($handle, getcwd().LOG);

   // $xsltproc = xslt_create();
  
  // create processer handle 
  
  echo $handle;

  // do transformation
  $result = xslt_process($handle, $myxml, $myxsl);
  // echo $out; 
  // echo 'res', $result;
  if ($result){
    echo $result; 
    // pre($result);
    $res = $result;
  }
  else{ 
   $res = "error occurred during transformation : ".xslt_error($handle); 
   $res.= " with error code: ".xslt_errorno($handle); 
  }
  // Free ressources
  @xslt_free($handle);
  return $res;
} // transform;


?>
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="standard.xsl"?>
<allnews>
<news id="2"><date>7/4/2002</date>
<time>22:48</time>
<header>Sunday</header>
<section>comment</section>
<body>Sunday evening is quit</body>
</news>
<news id="3"><date>30/3/2002</date>
<time>13:47</time>
<header>Sunday</header>
<section>weather</section>
<body>The weather is beutifull today</body>
</news>
<news id="4"><date>4/4/2002</date>
<time>18:45</time>
<header>Thursday</header>
<section>comment</section>
<body>Databasesystems</body>
</news>
<news id="5"><date>4/4/2002</date>
<time>18:46</time>
<header>Monday</header>
<section>comment</section>
<body>Advanced Object-oriented programming.
A very interesting subject</body>
</news>
<news id="6"><date>4/4/2002</date>
<time>18:46</time>
<header>Thuesday</header>
<section>calender</section>
<body>At tuesdays: webprogramming</body>
</news>
<news id="7"><date>30/3/2002</date>
<time>13:52</time>
<header>Saturday</header>
<section>comment</section>
<body>I am happy today.</body>
</news>
<news id="8"><date>4/4/2002</date>
<time>20:25</time>
<header>Sunday</header>
<section>comment</section>
<body>Sunday evening is quit yes yes yes yes</body>
</news>

</allnews>
<?xml version="1.0"?>
<xsl:stylesheet version="1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns="http://www.w3.org/1999/xhtml";>
  <xsl:output method="html" encoding="iso-8859-1"
        doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
        doctype-system="DTD/xhtml1-transitional.dtd"
        indent="yes"/>

<xsl:template match="allnews">
  <html>
  <head><title>My news</title></head>
  <body>
    <xsl:apply-templates select="news"/>
  </body>
  </html>
</xsl:template>

<xsl:template match="news">
 <h4>
 <table><tr>
   <td>
    <xsl:value-of select="section" />
   </td>
   <td>
    <xsl:value-of select="date" />
   </td>
   <td>
     <xsl:value-of select="time" />
   </td></tr>
  </table>
  </h4>
  <h1><xsl:value-of select="header" /></h1>
  <h2><xsl:value-of select="body" /></h2>
</xsl:template>
 
</xsl:stylesheet>







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

If a PHP script is terminated due to time out (defined by
max_execution_time) or memory error (memory_limit exceeds), how can I detect
the error in code?

connection_timeout() is deprecated as of 4.0.5, and connection_status() does
not return the correct value when time out happens.

Any solutions? Thanks in advance.

--Charmaine


--- End Message ---
--- Begin Message ---
Read the chapter on connection handling in the manual.  Basically you need
to register a shutdown function using register_shutdown_function() and
check connection_status() from that.

-Rasmus

On Fri, 12 Apr 2002, Charmaine Tian wrote:

> Hi,
>
> If a PHP script is terminated due to time out (defined by
> max_execution_time) or memory error (memory_limit exceeds), how can I detect
> the error in code?
>
> connection_timeout() is deprecated as of 4.0.5, and connection_status() does
> not return the correct value when time out happens.
>
> Any solutions? Thanks in advance.
>
> --Charmaine
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
I recently finished a great book on OO theory called 
Beginning Java Objects by Jacquie Barker.  It's published 
by Wrox.  The book is a Java book and there are Java code 
snippets, but it's OO theories will work for all OO 
languages.  Java is C style coding like PHP, so you 
shouldn't have any problem reading the code.  Still the 
author doesn't presume even basic knowledge of Java.  I 
use this book in my transformation to be a Java developer, 
it's certainly helped me design better PHP apps.
--- End Message ---
--- Begin Message ---
Are single quotes valid around tag attributes in XHTML?  I skimmed over the
W3C XHTML 1.0 spec before posting the previous message and got the
impression all attributes had to be double quoted.  It would be great if
single quotes were valid, since I've fallen into the habit of using
them for the same exact reason this thread got started... easier to read and
faster to type than \" :)

Oops, and shame on me - tag and attribute names in my previous code snippets
should all be lower case,
too, IE:

echo "<option value=\"$option_value\">$option_text</option>\n";

Of course, a page will render just fine in any modern browser whether tag
attribute values are single or double quoted (or in most cases, even if
they're not quoted at all.)  But if everyone got in the habit of adhering to
standards, and browsers implemented standards correctly (without extending
them with propietary junk), what a nice world it would be. Oh, and world
peace would be great too. :P

Of course, I'm just as guilty of lax coding.  The next time I begin a site
from scratch my plan is to use PSGML mode in emacs, and edit against the
XHTML 1.0 DTD.  Strict? Yes, but clean and compliant :)  (And PSGML does
great code formatting as you go.)

-Andy


> Unfortunately, if you want to maintain XHTML
> : compliance the tag attributes have to be double-quoted too...
> :
> : echo "<OPTION VALUE=\"$option_value\">$option_text</OPTION>\n";
>
> Why stick with quotation marks?
>
>       echo "<OPTION VALUE='$option_value'>$option_text</OPTION>\n";>

--- End Message ---
--- Begin Message ---
On Saturday 13 April 2002 12:01 am, you wrote:
> Hi,
>
> If I have register_globals=off, how do I pass session variables? I tried
> session_register("var1"). session_is_registered("var1") appears successful,
> but if I tried to echo the $var1". Nothing shows. How do I pass session
> variables?
>
> Thanks,
> Norman

Try this:
<?php echo($_SESSION['var1']); ?>

Also read the manual for more information on session handling functions.
http://www.php.net/manual/en/ref.session.php

Regards,
Oliver.
--- End Message ---
--- Begin Message ---
Sorry it still does not work. Can it be because I have HEADER(Location: ...)
redirection after the session_registered('var1')?

Regards,
Norman

"Oliver Beddows" <[EMAIL PROTECTED]> wrote in message
20020412235134.QNTP29761.mta05-svc.ntlworld.com@there">news:20020412235134.QNTP29761.mta05-svc.ntlworld.com@there...
On Saturday 13 April 2002 12:01 am, you wrote:
> Hi,
>
> If I have register_globals=off, how do I pass session variables? I tried
> session_register("var1"). session_is_registered("var1") appears
successful,
> but if I tried to echo the $var1". Nothing shows. How do I pass session
> variables?
>
> Thanks,
> Norman

Try this:
<?php echo($_SESSION['var1']); ?>

Also read the manual for more information on session handling functions.
http://www.php.net/manual/en/ref.session.php

Regards,
Oliver.


--- End Message ---
--- Begin Message ---
On Saturday 13 April 2002 1:19 am, you wrote:
> Sorry it still does not work. Can it be because I have HEADER(Location:
> ...) redirection after the session_registered('var1')?
>
> Regards,
> Norman

Okay,
This worked on my machine, PHP v4.1.2.

<?php
session_start();
$barney = "A big purple dinosaur";
session_register("barney");
echo($_SESSION['barney']);
echo($HTTP_SESSION_VARS['barney']);
session_write_close();
?>

Regards,
Oliver
--- End Message ---
--- Begin Message ---
Sorry...I must get some sleep.

<?php
session_start();

$barney = "A big purple dinosaur";
session_register("barney");

session_write_close();

// Redirect after session data has been written.
header('Location: /');
exit;
?>

<?php
// Another page...
session_start(); // Not sure if you need this function call.
// Try either one of these to echo the session var.
echo($_SESSION['barney']);
echo($HTTP_SESSION_VARS['barney']);
?>

Regards,
Oliver

--- End Message ---
--- Begin Message ---
i am using the following to try to pull in php classes from separate files
based on their names using unserialize_callback_func.
I cant seem to get it
to work with cgi php 4.1.6 on apache/redhat .
I notice that it isnt shown under variables available for ini_set() but it
is shown for unserialize() from which Ive adapted the following script:

ini_set('unserialize_callback_func','thecallback');

function thecallback($classname) {
     echo "calling back";
     $filename="includez/".$classname.".cls.php";
     include($filename);
}

I would think i'd atleast get an acknowledgement that the function indeed
 fired. Has this feature not yet been implemented?




--- End Message ---
--- Begin Message ---
Got it figured out --
--------------------
To export table structure:

C:> mysqldump -d {database name} {tables} >sqltextfile.sql
Then to import the new Table Structure:

To import table structure / data
C:> mysql {database name} <sqltextfile.sql

Just a note: If you want to copy the structure of an existing table with the
intent of
creating *another* table in the same DB with the same structure, then make
sure you edit the
"sqltextfile.sql" file and change the CREATE TABLE {table name} to something
else.

For example:
C:> mysqldump -d mydb subscribers >subscribers.sql

** edit the "subscribers.sql" text file and change the following line:
CREATE TABLE subscribers

to

CREATE TABLE subscribers2  (or whatever)

save... then

C:> mysql mydb <subscribers.sql

that's it...


--- End Message ---
--- Begin Message ---
Hi again guys, I'm having trouble finding documentation on passing an 
array. Here is what I am doing.

I have one page that calls itself, I want to pass an array that is setup 
the first time it's called to itself the second time it's called.
I'm running out of both time AND hair (both of which are a rare comodoty 
these days).

Any hint will be a HUGE help!

Thanks in advance.

--- End Message ---
--- Begin Message ---
You didn't by any chance go by the name 99ways2die at one time did you?

I thought of that but when the second page loads the values are dumped 
into a db and I have it written already and it uses an array, I would 
like to keep it that way

(Gru)

[EMAIL PROTECTED] wrote:

>You could do something like the following:
>
>$array = array("value1","value2","value3");
>for($i=0;$i<count($array);$i++){
>    echo "<input type=hidden name=\"value$i\" value=\"$array[$i]\">";
>}
>--
>
>On Fri, 12 Apr 2002 17:14:14  
> sundogcurt wrote:
>
>>Hi again guys, I'm having trouble finding documentation on passing an 
>>array. Here is what I am doing.
>>
>>I have one page that calls itself, I want to pass an array that is setup 
>>the first time it's called to itself the second time it's called.
>>I'm running out of both time AND hair (both of which are a rare comodoty 
>>these days).
>>
>>Any hint will be a HUGE help!
>>
>>Thanks in advance.
>>
>>
>>-- 
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
>See Dave Matthews Band live or win a signed guitar
>http://r.lycos.com/r/bmgfly_mail_dmb/http://win.ipromotions.com/lycos_020201/splash.asp
> 
>

--- End Message ---
--- Begin Message ---
If you are passing it through a posted form, just name your array variable
name[]  So for example:

<input type="text" name="varname[]">
<input type="text" name="varname[]">

When it is posted php will realize it's an array and treat it such.

Or if you are just passing it through a link, you can do the same thing..

<a href="nextpage.php?varname[]=hey&varname[]=why">link</a>

Or you can serialize/deserialize.. Or you could use cookies, sessions, etc
etc etc..

If you give us a little more info on exactly what you are doing we could
probably help you with the best way of doing it :)

Cheers!

Rick

"The greatest trick the devil ever played was convincing the world he didn't
exist." - Unknown

> From: sundogcurt <[EMAIL PROTECTED]>
> Date: Fri, 12 Apr 2002 17:14:14 -0700
> To: GENERAL PHP LIST <[EMAIL PROTECTED]>
> Subject: [PHP] passing array from one page to itself?
> 
> Hi again guys, I'm having trouble finding documentation on passing an
> array. Here is what I am doing.
> 
> I have one page that calls itself, I want to pass an array that is setup
> the first time it's called to itself the second time it's called.
> I'm running out of both time AND hair (both of which are a rare comodoty
> these days).
> 
> Any hint will be a HUGE help!
> 
> Thanks in advance.
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Ok I got a question for you guys and gals, I am not sure how to go about this, looking 
for opinions.

I am trying to open a secured url, we'll say 
https://www.bob.com/test/index.php?blah=freak

Also, it's got http-auth in it, say user=abc and password=123, so how would I go about 
using php to download the page, compare it, then generate a, say, snmp trap based on 
the findings (say I downloaded the page or have search text in the page), and if it 
can't get to it, or gets an error, etc... it generates the trap. 
Just curious how I should go about this, fopen doesn't seem to support https, not sure 
if I could use AUTH with that anyway, but any suggestions are welcome...

-Matt


See Dave Matthews Band live or win a signed guitar
http://r.lycos.com/r/bmgfly_mail_dmb/http://win.ipromotions.com/lycos_020201/splash.asp
 
--- End Message ---
--- Begin Message ---
See the curl extension.  http://php.net/curl

And as of PHP 4.3 you will be able to open an https page directly with
fopen().

-Rasmus

On Fri, 12 Apr 2002, Ninety-Nine Ways To Die wrote:

> Ok I got a question for you guys and gals, I am not sure how to go about this, 
>looking for opinions.
>
> I am trying to open a secured url, we'll say 
>https://www.bob.com/test/index.php?blah=freak
>
> Also, it's got http-auth in it, say user=abc and password=123, so how would I go 
>about using php to download the page, compare it, then generate a, say, snmp trap 
>based on the findings (say I downloaded the page or have search text in the page), 
>and if it can't get to it, or gets an error, etc... it generates the trap.
> Just curious how I should go about this, fopen doesn't seem to support https, not 
>sure if I could use AUTH with that anyway, but any suggestions are welcome...
>
> -Matt
>
>
> See Dave Matthews Band live or win a signed guitar
> 
>http://r.lycos.com/r/bmgfly_mail_dmb/http://win.ipromotions.com/lycos_020201/splash.asp
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
I made the simplest program I could to try to figure out why my
session_start() isn't working.

PHPINFO tells me that
1. Sessions are enabled.
2. The path c:/temp is shown so php.ini is doing the right thing

The path exists and can be successfully written to from the OS

The OS is WIN98 running Apache.

What is wrong?????????????????????/

code ----------------------------------------
----------------------------------------------
<?php
session_start();
$test=session_save_path();
print "Session Save Path is: $test";
?>

output---------------------------------------
---------------------------------------------

Warning: open(/temp/sess_66ae6b55dc3e157c00345e53b72c8a0e, O_RDWR) failed: m
(2) in d:\testsite\test.php on line 2

Session Save Path is: c:/temp


--- End Message ---
--- Begin Message ---
Hello,

Nick Wilson wrote:
> What functions do I need to be looking at if I want to determine from
> what country a visitor is from?
> 
> Is this problematical, I look at my logs shows that not all visitors
> form .dk have that at the end of the refferer string...

You may use GetEnv("REMOTE_HOST") to return the user address domain. If
this is not resolved, you may try gethostbyaddr(GetEnv("REMOTE_ADDR")) .

With the domain, you may pick the top level domain (TLD) part just
keeping the domain string after the last dot. If the TLD has 2
characters it is the country code.

If this fails, you may want to resort to a IP address location service
like NetGeo.

If you do not want to reinvent the wheel, you may want to try to use
this ready to use PHP class that does that for you to get not only the
country, but also the location and coordinates (latitude and longitude).

http://www.phpclasses.org/browse.html/package/514.html


Here you may find an application of this class to rank all the countries
from where the users log in this site:

http://www.phpclasses.org/browse.html/statistics/statistics.html#user-countries


An even cooler application of this class is this page for the users to
pick the mirror site that is closer from the user computer network with
distances in Kilometers computed by the same class:

http://www.phpclasses.org/mirrors.html?closest=1

Regards,
Manuel Lemos
--- End Message ---
--- Begin Message ---
I have an interactive website, with forums programmed by me.  They have
smilies, and I'm trying to make a way  for users to be able to type smilies
without them changing to images if they want.  I'm trying to make it so if
they type "NOSMILE:)" it will remove the NOSMILE and not display the smiley.
I use "(NOSMILE){0}:)".  The smiliey still displays if it has NOSMILE in
front of it.  Any ideas?

--- End Message ---
--- Begin Message ---
On Saturday 13 April 2002 2:13 am, you wrote:
> I have an interactive website, with forums programmed by me.  They have
> smilies, and I'm trying to make a way  for users to be able to type smilies
> without them changing to images if they want.  I'm trying to make it so if
> they type "NOSMILE:)" it will remove the NOSMILE and not display the
> smiley. I use "(NOSMILE){0}:)".  The smiliey still displays if it has
> NOSMILE in front of it.  Any ideas?

Hi,
I think this should work...

<?php
$text = 'NOSMILE:)';

if( preg_match('/(NOSMILE){1}(:\)){1}/', $text) )
{
        echo('NOSMILE:) detected in text');
}
?>

Regards,
Oliver
--- End Message ---
--- Begin Message ---
Believe me, I'm not doing it on purpose.  I'm trying to get two different
script packages to play nice with each other and I want to keep the
modifications at a minumum to make it easier to update the software.
Specificaly I'm talking about a weblog package (phpslash) and forums package
(phpbb), as well as a shopping cart (phpshop), initialy... maybe others as
well.

the class name problem isnt that bad, really.  But there's global variables
as well that need to be isolated.  get/post vars, session vars, etc.

My idea is to isolate each script, pass in the global vars that it expects
to see.  The overall, "parent" script would keep the variables for all the
scripts under different names that dont conflict, converting them on entry
to each script.

"Michael Virnstein" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> why do you have more than one class with the same name?
> would be easier using different names for different classes.
> or define a base class template
> and extend it in the files as desired, but give them unique names.
> how do you know later, which class does what in which way, when they have
> the same
> name. not very good imo.
>
> "Aric Caley" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Is it possible to keep the variable name-space separate between, say,
two
> > files (one included into the other) to avoid name collisions?  I'm
trying
> to
> > get two scripts to work together on the same page.  Each script defines
> some
> > classes that have the same names but work differently (ex., class
> Template).
> > All I need is to embed the output of one script into the other.
> >
> > Now, I could do this by just getting the output from a URL but that
seems
> > really inefficient.  Or I could run the script from the CGI version of
PHP
> > using exec() but that also seems like it could be really slow and
clunky.
> >
> > Is there some efficient way of doing this?
> >
> > It would be cool if you could just put the include() inside of a
function
> > and have all the classes and variable names be local inside that
function
> > but that didnt seem to work...  plus the scripts explicitly access
global
> > variable names.
> >
> >
>
>


--- End Message ---
--- Begin Message ---
but the virtual() documentation says you can't use it on a php script?

"Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I guess the only real way is to use virtual() in this case.  That's a bit
> clunky as well, but it isn't quite as bad as going through CGI or all the
> way out to the port 80 level.
>
> -Rasmus
>
> On Fri, 12 Apr 2002, Aric Caley wrote:
>
> > Is it possible to keep the variable name-space separate between, say,
two
> > files (one included into the other) to avoid name collisions?  I'm
trying to
> > get two scripts to work together on the same page.  Each script defines
some
> > classes that have the same names but work differently (ex., class
Template).
> > All I need is to embed the output of one script into the other.
> >
> > Now, I could do this by just getting the output from a URL but that
seems
> > really inefficient.  Or I could run the script from the CGI version of
PHP
> > using exec() but that also seems like it could be really slow and
clunky.
> >
> > Is there some efficient way of doing this?
> >
> > It would be cool if you could just put the include() inside of a
function
> > and have all the classes and variable names be local inside that
function
> > but that didnt seem to work...  plus the scripts explicitly access
global
> > variable names.
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>


--- End Message ---
--- Begin Message ---
The documentation is outdated.  That restriction has been lifted as of PHP
version 4.0.6.

(cc'ing phpdoc to fix)

-Rasmus

On Fri, 12 Apr 2002, Aric Caley wrote:

> but the virtual() documentation says you can't use it on a php script?
>
> "Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I guess the only real way is to use virtual() in this case.  That's a bit
> > clunky as well, but it isn't quite as bad as going through CGI or all the
> > way out to the port 80 level.
> >
> > -Rasmus
> >
> > On Fri, 12 Apr 2002, Aric Caley wrote:
> >
> > > Is it possible to keep the variable name-space separate between, say,
> two
> > > files (one included into the other) to avoid name collisions?  I'm
> trying to
> > > get two scripts to work together on the same page.  Each script defines
> some
> > > classes that have the same names but work differently (ex., class
> Template).
> > > All I need is to embed the output of one script into the other.
> > >
> > > Now, I could do this by just getting the output from a URL but that
> seems
> > > really inefficient.  Or I could run the script from the CGI version of
> PHP
> > > using exec() but that also seems like it could be really slow and
> clunky.
> > >
> > > Is there some efficient way of doing this?
> > >
> > > It would be cool if you could just put the include() inside of a
> function
> > > and have all the classes and variable names be local inside that
> function
> > > but that didnt seem to work...  plus the scripts explicitly access
> global
> > > variable names.
> > >
> > >
> > >
> > > --
> > > 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 ---
unfortunately, this doesnt seem to work.  Rather, it works, but it doesnt
seem to work any differently than an include() (although you can't use
output buffering on it, so in that regard its different).  It seems to pass
in all the variables and classes.

My other option, which I have been avoiding, is to rename the classes... not
all that hard really; and then for variables either rename them all, or do
this:

backupallglobalvariablesandunsetthem();
setvariablesthatscriptisexpectingtosee();
include("script");
unsetallvariablesnotinbackup();
restorebackupvariables();

and then repeat this for each script I'm trying to embed...
basicaly wrap each script/application in a clean "sterilized" php
envirionment.

I dont know how much overhead this would add.  But it seems like the only
solution at this point.  It just occured to me that this might actualy make
things more secure in a way since the parent script will totaly control what
variables get passed in..

"Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> The documentation is outdated.  That restriction has been lifted as of PHP
> version 4.0.6.
>
> (cc'ing phpdoc to fix)
>
> -Rasmus
>
> On Fri, 12 Apr 2002, Aric Caley wrote:
>
> > but the virtual() documentation says you can't use it on a php script?
> >
> > "Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > I guess the only real way is to use virtual() in this case.  That's a
bit
> > > clunky as well, but it isn't quite as bad as going through CGI or all
the
> > > way out to the port 80 level.
> > >
> > > -Rasmus
> > >
> > > On Fri, 12 Apr 2002, Aric Caley wrote:
> > >
> > > > Is it possible to keep the variable name-space separate between,
say,
> > two
> > > > files (one included into the other) to avoid name collisions?  I'm
> > trying to
> > > > get two scripts to work together on the same page.  Each script
defines
> > some
> > > > classes that have the same names but work differently (ex., class
> > Template).
> > > > All I need is to embed the output of one script into the other.
> > > >
> > > > Now, I could do this by just getting the output from a URL but that
> > seems
> > > > really inefficient.  Or I could run the script from the CGI version
of
> > PHP
> > > > using exec() but that also seems like it could be really slow and
> > clunky.
> > > >
> > > > Is there some efficient way of doing this?
> > > >
> > > > It would be cool if you could just put the include() inside of a
> > function
> > > > and have all the classes and variable names be local inside that
> > function
> > > > but that didnt seem to work...  plus the scripts explicitly access
> > global
> > > > variable names.
> > > >
> > > >
> > > >
> > > > --
> > > > 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 ---
 i am using the following to try to pull in php classes from separate files
 based on their names using unserialize_callback_func.
 I cant seem to get it
 to work with cgi php 4.1.6 on apache/redhat .
 I notice that it isnt shown under variables available for ini_set() but it
 is shown for unserialize() from which Ive adapted the following script:

ini_set('unserialize_callback_func','thecallback');

function thecallback($classname) {
      echo "calling back";
      $filename="includez/".$classname.".cls.php";
      include($filename);
 }

I would think i'd atleast get an acknowledgement that the function indeed
  fired. Has this feature not yet been implemented?






--- End Message ---
--- Begin Message ---
Hi everyone,

I have a question about this code. The way it sits now it always shows the
last record in the table.
in other words if the user has 6 items, like:
item id 1
item id 2
item id 5
item id 6
item id 7
item id 8

it will only show the last record item id 8.

I believe it has something to do with the first while statement's closing
curly bracker
But I can't seem to get it in the right place.

Can someone spot the mistake and show me how to fix it.
see also comments in code.



$id = $HTTP_GET_VARS["id"];


$query = "SELECT id, name, image, quantity, type FROM
{$config["prefix"]}_my_items WHERE uid={$session["uid"]} ORDER BY id";
$ret = mysql_query($query);
         while($row = mysql_fetch_array($ret))
{
$iid = $row['id'];
$image = $row['image'];
$name = $row['name'];
$quantity = $row['quantity'];
$type = $row['type'];


            if($iid == $id)
{
$display_block ="<CENTER><img src=$image border=0><br><font size =
2>$name<BR>$quantity<BR>$type</font></CENTER>";
                    echo "$display_block<BR><BR>";
if($type == "food")
//if book or weapon is present then set an option and include in the form
later
{$thisoption="<OPTION VALUE=\"feed\">Feed my pet\n</OPTION>";
}else{
//if any other type is present then set a blank
$thisoption="";}
}
}



//check if form has been submitted
if($submit){

   if($sort == 'shop')
     {
         echo "This item has been taken care of<BR>";

// We are selecting user id to insert into the users items.
$db="SELECT  uid FROM {$config["prefix"]}_users WHERE
uid={$session["uid"]}";
$ret = mysql_query($db);
while(list($db)=mysql_fetch_row($ret))
{ $user = $db;
echo "Your user ID is $user<BR>";
}


echo "You have $quantity of this item and it's id is $iid<BR>";


}
// it seems like the first while statement's closing curly bracket should go
here but if I put it here I get a pars error.
}else{
//if the form has not been submitted run the following


?>
<FORM ACTION="<?echo"$PHP_SELF";?>" METHOD="post">
<SELECT NAME="sort" SIZE=1 >
<?echo "$thisoption";?>
<OPTION VALUE="shop">Put in my shop</OPTION>
<OPTION VALUE="locker">Put into my Footlocker</OPTION>
<OPTION VALUE="discard">Discard this item</OPTION>
<OPTION VALUE="donate">Donate this item</OPTION>
</SELECT>
<INPUT TYPE="submit" VALUE="Submit" NAME="submit" >
</FORM>
<?
}
//if I put the first while statement's closing curly bracket here it works
great except it prints multiple dropdown lists on the page.

I have tried the bracket in numerous places but I can't find the right spot.





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002


--- End Message ---
--- Begin Message ---
My apologies for putting this in the wrong list.

Jennifer

"Jennifer Downey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi everyone,
>
> I have a question about this code. The way it sits now it always shows the
> last record in the table.
> in other words if the user has 6 items, like:
> item id 1
> item id 2
> item id 5
> item id 6
> item id 7
> item id 8
>
> it will only show the last record item id 8.
>
> I believe it has something to do with the first while statement's closing
> curly bracker
> But I can't seem to get it in the right place.
>
> Can someone spot the mistake and show me how to fix it.
> see also comments in code.
>
>
>
> $id = $HTTP_GET_VARS["id"];
>
>
> $query = "SELECT id, name, image, quantity, type FROM
> {$config["prefix"]}_my_items WHERE uid={$session["uid"]} ORDER BY id";
> $ret = mysql_query($query);
>          while($row = mysql_fetch_array($ret))
> {
> $iid = $row['id'];
> $image = $row['image'];
> $name = $row['name'];
> $quantity = $row['quantity'];
> $type = $row['type'];
>
>
>             if($iid == $id)
> {
> $display_block ="<CENTER><img src=$image border=0><br><font size =
> 2>$name<BR>$quantity<BR>$type</font></CENTER>";
>                     echo "$display_block<BR><BR>";
> if($type == "food")
> //if book or weapon is present then set an option and include in the form
> later
> {$thisoption="<OPTION VALUE=\"feed\">Feed my pet\n</OPTION>";
> }else{
> //if any other type is present then set a blank
> $thisoption="";}
> }
> }
>
>
>
> //check if form has been submitted
> if($submit){
>
>    if($sort == 'shop')
>      {
>          echo "This item has been taken care of<BR>";
>
> // We are selecting user id to insert into the users items.
> $db="SELECT  uid FROM {$config["prefix"]}_users WHERE
> uid={$session["uid"]}";
> $ret = mysql_query($db);
> while(list($db)=mysql_fetch_row($ret))
> { $user = $db;
> echo "Your user ID is $user<BR>";
> }
>
>
> echo "You have $quantity of this item and it's id is $iid<BR>";
>
>
> }
> // it seems like the first while statement's closing curly bracket should
go
> here but if I put it here I get a pars error.
> }else{
> //if the form has not been submitted run the following
>
>
> ?>
> <FORM ACTION="<?echo"$PHP_SELF";?>" METHOD="post">
> <SELECT NAME="sort" SIZE=1 >
> <?echo "$thisoption";?>
> <OPTION VALUE="shop">Put in my shop</OPTION>
> <OPTION VALUE="locker">Put into my Footlocker</OPTION>
> <OPTION VALUE="discard">Discard this item</OPTION>
> <OPTION VALUE="donate">Donate this item</OPTION>
> </SELECT>
> <INPUT TYPE="submit" VALUE="Submit" NAME="submit" >
> </FORM>
> <?
> }
> //if I put the first while statement's closing curly bracket here it works
> great except it prints multiple dropdown lists on the page.
>
> I have tried the bracket in numerous places but I can't find the right
spot.
>
>
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002


--- End Message ---
--- Begin Message ---
> From: "Heidi Belal" <[EMAIL PROTECTED]>
On Fri, Apr 12, 2002 at 03:15:13PM -0700, hugh danaher wrote:

> > <input type="text" value="this is a double quote "
> > like this.">

> addslashes()
> stripslashes()

Nay.  She's asking about HTML.  Slashes aren't going to solve that.  All 
output from databases, or wherever, needs to go through 
htmlspecialchars().  That'll change " to &quot; so your HTML stay 
healthy.

--Dan

-- 
               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
--- End Message ---
--- Begin Message ---
Here's a start.

http://www.phpbuilder.com/columns/tim20000526.php3

olinux


--- Marc <[EMAIL PROTECTED]> wrote:
> hi
> 
> how can i use php to list keywords in search engines
> ?!?
> how to index a website keywords via php =)
> 
> plz mail
> 
> thx
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
--- End Message ---
--- Begin Message ---


i have this code for my form mail:

<?php
mail ([EMAIL PROTECTED], "$subject", "From: $name\r\nEmail: 
$email\r\nWebsite: $website\r\nMessage: $message", "From: $email\r\n");
?>

i need to add an attachment file with the variable $file. what do i need to 
add in the code so that i will also be able to receive the attached file 
sent from the website?

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

--- End Message ---
--- Begin Message ---
You need to make sure the hosts file in c:\windows is called just hosts with
no extension.. Just rename it.. It may also take a reboot and/or some time
for windows to start using it properly.. And it may help to change the
forward slash in <Directory "c:/website"> to a backslash..

Later,
Bob

"Tiago SimõEs" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> For those that haven't read my previous posts, i'm trying to be able to
test
> locally my php site. My installation (both apache and php) went smoothly.
> But instead of using the htdocs folder for the test i wanted to use the
> c:\website folder. So with some help from you guys i manage to configure
the
> httpd.conf file (in the conf Apache subfolder) like this:
>
> #this is the bottom part of the conf file
>
> <VirtualHost website.localhost>
>     DocumentRoot "C:\website"
>     ServerName website.localhost
> </VirtualHost>
>
> <Directory "C:/website">
> AddType application/x-httpd-php .php
> AddType application/x-httpd-php .php4
> #Next line is optional (for viewing source)
> AddType application/x-httpd-php-source .phps
> </Directory>
>
>
> and in the hosts.sam file in the C:\Windows\
>
> 127.0.0.1       localhost
> 127.0.0.1       website.localhost
>
> It "sounds good to me. So why it doesn't work? Any ideas?
>
>
>
>
>


--- End Message ---
--- Begin Message ---
My mistake, you have the directory line correctly written with the forward
slash.. But the hosts file should not have any extension..

Bob
<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> You need to make sure the hosts file in c:\windows is called just hosts
with
> no extension.. Just rename it.. It may also take a reboot and/or some time
> for windows to start using it properly.. And it may help to change the
> forward slash in <Directory "c:/website"> to a backslash..
>
> Later,
> Bob
>
> "Tiago SimõEs" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > For those that haven't read my previous posts, i'm trying to be able to
> test
> > locally my php site. My installation (both apache and php) went
smoothly.
> > But instead of using the htdocs folder for the test i wanted to use the
> > c:\website folder. So with some help from you guys i manage to configure
> the
> > httpd.conf file (in the conf Apache subfolder) like this:
> >
> > #this is the bottom part of the conf file
> >
> > <VirtualHost website.localhost>
> >     DocumentRoot "C:\website"
> >     ServerName website.localhost
> > </VirtualHost>
> >
> > <Directory "C:/website">
> > AddType application/x-httpd-php .php
> > AddType application/x-httpd-php .php4
> > #Next line is optional (for viewing source)
> > AddType application/x-httpd-php-source .phps
> > </Directory>
> >
> >
> > and in the hosts.sam file in the C:\Windows\
> >
> > 127.0.0.1       localhost
> > 127.0.0.1       website.localhost
> >
> > It "sounds good to me. So why it doesn't work? Any ideas?
> >
> >
> >
> >
> >
>
>


--- End Message ---
--- Begin Message ---
This works:

<img src="<?php echo( "$image.gif" ) ?>" width=150 height=100 border=0>

This works too if you're not opposed to using straight php:

<?php

print "<html>\n<head>\n<title>Image Switch</title>\n";
print "<div align=center><img src=\"$image.gif\" width=150 height=100
border=0></div>\n";
print "</body>\n</html>";

?>

Later,

Bob Weaver

"Craig Westerman" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm trying to set $image = imageA via a URL:
>
> http://www.abc123.com/php001/image_switch.php?image=imageA
>
> Script is:
>
> <html>
> <head>
>    <title>Image Switch</title>
> </head>
> <body>
>
> <div align="center"><img src="<?php $image ?>.gif" width="150"
height="100"
> border="0"></div>
>
> </body>
> </html>
>
>
> Image link ends up as:
> http://www.abc123.com/php001/.gif
>
> Link needs to be:
> http://www.abc123.com/php001/imageA.gif
>
> What am I doing wrong?
>
> Thanks
>
> Craig ><>
> [EMAIL PROTECTED]
>


--- End Message ---
--- Begin Message ---
Is there a way, in PHP, for me to read client-side files or upload them to a server?

Thanks,
Don
--- End Message ---
--- Begin Message ---
To the best of my knowledge, the only files you should be able to read off
the client side are cookies originating from the same domain.*

Otherwise, it'd be a massive breach of privacy.

The only other option is for the user to browse their hard drive, select a
file via a web based form, and upload it to the server with the aid of PHP.


This topic has been discussed millions of times on the list, and should be
easy to search for.


* MSIE security bugs excluded :)


Justin French

--------------------
Creative Director
http://Indent.com.au
--------------------




on 13/04/02 2:35 PM, Don ([EMAIL PROTECTED]) wrote:

> Is there a way, in PHP, for me to read client-side files or upload them to a
> server?
> 
> Thanks,
> Don
> 

--- End Message ---
--- Begin Message ---
Hello friends ,

 I cannot enter single quotation marks in fields. Is this a standard feature
? Is there a workaround?

I am using mysql + php4 on unix.

Thanks
Denis

--- End Message ---
--- Begin Message ---
Hello,

PHP Version: 4.1.0, Apache Version: 1.3.12, Server: Linux 7.0
Class name: class.Htpasswd.php3

Thanks to Jason Wong for pointers on posting to the list, the parse
error was a simple omission of a quotation mark on my part.

This is the error I am getting...

Warning: Failed opening 'class.Htpasswd.php3' for inclusion 
(include_path='.:/php/includes') in /var/www/html/php/dev/valid_user.php 
on line 9

Fatal error: Cannot instantiate non-existent class: htpasswd in 
/var/www/html/php/dev/valid_user.php on line 10

7 <body>
8  <?php
9   include("class.Htpasswd.php3");
10  $aHTPasswd = new Htpasswd("/var/www/html/private/.htpassd");
11  if (!$aHTPasswd->EXISTS)
12   {
13     print("authentication error<br>);
14   }
15   else
16   {
17    if ( $aHTPasswd->verifyUser( "phpbook", "phpbook" ) )
18    {
19      print( "phpbook is a valid user<br>" );
20    }
21    else
22    {
23      print( "phpbook is not a valid user<br>" );
24    }
25  }
26 ?>
27 </body>
28 </html>

Any ideas on the error?

Thank you,

Regards,

Andrew Schoenherr

--- End Message ---
--- Begin Message ---
Hi Andrew,

This error indicates that your path to class.Htpasswd.php3 is wrong.
use this:
include("path/to/class.Htpasswd.php3");

Right now, it's set to look in the php/includes dir.  If the file is
actually in there, then apache might not have perms to read the file (IE:
it's owned by root).

Good luck,
Tyler Longren
Captain Jack Communications
www.captainjack.com
[EMAIL PROTECTED]

----- Original Message -----
From: "Andrew Schoenherr" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 13, 2002 12:54 AM
Subject: [PHP] Error accessing class


> Hello,
>
> PHP Version: 4.1.0, Apache Version: 1.3.12, Server: Linux 7.0
> Class name: class.Htpasswd.php3
>
> Thanks to Jason Wong for pointers on posting to the list, the parse
> error was a simple omission of a quotation mark on my part.
>
> This is the error I am getting...
>
> Warning: Failed opening 'class.Htpasswd.php3' for inclusion
> (include_path='.:/php/includes') in /var/www/html/php/dev/valid_user.php
> on line 9
>
> Fatal error: Cannot instantiate non-existent class: htpasswd in
> /var/www/html/php/dev/valid_user.php on line 10
>
> 7 <body>
> 8  <?php
> 9   include("class.Htpasswd.php3");
> 10  $aHTPasswd = new Htpasswd("/var/www/html/private/.htpassd");
> 11  if (!$aHTPasswd->EXISTS)
> 12   {
> 13     print("authentication error<br>);
> 14   }
> 15   else
> 16   {
> 17    if ( $aHTPasswd->verifyUser( "phpbook", "phpbook" ) )
> 18    {
> 19      print( "phpbook is a valid user<br>" );
> 20    }
> 21    else
> 22    {
> 23      print( "phpbook is not a valid user<br>" );
> 24    }
> 25  }
> 26 ?>
> 27 </body>
> 28 </html>
>
> Any ideas on the error?
>
> Thank you,
>
> Regards,
>
> Andrew Schoenherr
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
I have an OS X box that has been running PHP 4.1.2 and OpenLDAP 2.0.23 
without any problems. I can bind to the LDAP database from PHP and 
everyone is happy.

I wanted to build a new box with Cyrus-IMAP, Cyrus-SASL and OpenLDAP, 
moving my mail and authentication to it and leave the first box to just 
Apache and PHP. The second box appears to work fine.

Where I'm having problems is binding from my PHP/Apache box to the new 
OpenLDAP box. With identical schema and data, I get errors trying to 
bind to the SASL/LDAP box from my PHP/Apache box that I don't get trying 
to bind to the local LDAP database. I can authenticate locally using the 
LDAP tools with a password against the SASL system.

Does anyone have any idea if any of the following are true:

1) Do I have to build SASL and rebuild LDAP and then build a PHP against 
that LDAP to enable my PHP to bind to my Cyrus/SASL/LDAP box?
2) Is there something special on has to do to bind to a OpenLDAP/SASL 
rather than just OpenLDAP with PHP?

Quinn


--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Hi all,
> 
> Now I have a weird problem. I am using this code and can't understand why it
> doesn't work.
> When the script is run it returns a blank page, no error or done.
> 
> here it is and any help would be appreciated.
> 
> if(($type == book) or ($type == weapon)){
The above line is probably causing a problem. The values being compared 
are probably being treated as constants, as they are not enclosed in 
quotes. As you haven't declared the constants, there will be no match. 
Try
if(($type == 'book') or ($type == 'weapon')){


>      echo "<form action=\"$PHP_SELF\" method=\"post\">";
>      echo "<SELECT NAME=\"sort\" SIZE=\"1\">";
>      echo "<OPTION VALUE=\"shop\">Put in my shop</OPTION>";
>      echo "<OPTION VALUE=\"locker\">Put into my Footlocker</OPTION>";
>      echo "<OPTION VALUE=\"discard\">Discard this item</OPTION>";
>      echo "<OPTION VALUE=\"donate\">Donate this item</OPTION>";
>      echo "</SELECT>";
>      echo "<INPUT TYPE=\"submit\" VALUE=\"Do It!\"submit\">";
> 
> 
> 
> if(isset($submit))
> {
> 
> if($sort == "shop")
> {
>                   echo "done" or die("Not!");
>   }
>  }
> }
> elseif($type==food)

Same problem as above

> {
> 
>      echo "<SELECT NAME=\"sort\" SIZE=\"1\">";
>      echo "<OPTION VALUE=\"feed\">Feed my pet</OPTION>";
>      echo "<OPTION VALUE=\"shop\">Put in my shop</OPTION>";
>      echo "<OPTION VALUE=\"locker\">Put into my Footlocker</OPTION>";
>      echo "<OPTION VALUE=\"discard\">Discard this item</OPTION>";
>      echo "<OPTION VALUE=\"donate\">Donate this item</OPTION>";
>      echo "</SELECT>";
>      echo "<INPUT TYPE=\"submit\" VALUE=\"Do it!\" NAME=\"submit\">";
>      echo "</form>";
> 
> 
>     }
>   }
> }
> 
> Thanks for your time
> Jennifer
> 

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam
--- End Message ---
--- Begin Message ---
To prototype my site, I've used "register_globals=on", and "track_vars=on". 
I'm at the point where I would like to switch the globals "off',
and prepare the site for production use. 

My problem is that I don't know how to implement the use of 
$HTTP_SESSION_VARS or $_SESSION in my webapages (or where to put the "if 
(isset($_SESSION . . .)"

I assumed the logical place would be at the opening page (index.php) that has 
the menu structure. I put the call the "if(isset . . .)" right at the top of 
this page (before the HTML), and the page loads. However, when I call other 
pages and attempt to call up the database conection, I get an "undefined 
function" error [ Btw: everything worked great with globals=on].

What I'm not clear on: if I'm using $HTTP_SESSION_VARS or $_SESSION do I have 
to put something declaring such on every page that I've written (at this 
point there are 47 of them)? Or do I declare a session on the opening page? I 
assumed that by doing so, with track_vars enabled, the vars would 
automatically be transferred to each new page within the session. Am I 
missing something here? All my variables are in the form of $sfname or 
$rcity, and so on.

I've read the manual on "Session handling functions", but I must have a thick 
block on this concept . What should I do now that I want to use 
$HTTP_SESSION_VARS or $_SESSION ? How do I implement it on secondary pages? 
Will I be facing a major re-write of all my code? [Gulp :>]

Any help or pointers where to read up would be greatly appreciated.

Tia,
Andre


-- 
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the Holy Souls in Purgatory.

May God bless you abundantly in His love!
For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/
--- End Message ---

Reply via email to