php-general Digest 2 Jun 2002 13:13:58 -0000 Issue 1381

Topics (messages 100265 through 100309):

PHP Coding Problem
        100265 by: Christopher J. Crane

Re: New to PHP- Form Validation Logic/Design Question
        100266 by: John Holmes

Re: help me....S.O.S...my php doesn't ascend
        100267 by: John Holmes

Re: Newman Says: Only one value from a msSQL field.
        100268 by: Leif K-Brooks
        100269 by: John Holmes

Include question
        100270 by: John Holmes
        100274 by: Bogdan Stancescu
        100280 by: John Holmes
        100309 by: Bogdan Stancescu

Determine overhead of PHP script.
        100271 by: John Holmes
        100273 by: Bogdan Stancescu

massive words
        100272 by: Justin French
        100275 by: Bogdan Stancescu
        100278 by: Justin French
        100306 by: Michael Davey

Baffled, line producing error
        100276 by: Craig Vincent
        100279 by: Jonathan Rosenberg
        100283 by: John Holmes
        100285 by: Craig Vincent
        100288 by: Philip Olson
        100289 by: Craig Vincent

Re: displaying client IP address
        100277 by: Bogdan Stancescu

Re: Problems with upload
        100281 by: Aaron Ott

simple email validation ereg
        100282 by: Justin French
        100284 by: Clay Loveless

Re: Apache, html, php and global variables
        100286 by: Peter Goggin
        100287 by: John Holmes
        100290 by: Jason Wong
        100291 by: John Holmes

Global vars
        100292 by: Anzak Wolf
        100297 by: Philip Olson

Alguine me puede Ayudar...S.O.S...mi PHP no sube .....
        100293 by: omora.arauco.cl
        100294 by: omora.arauco.cl
        100304 by: Michael Hall

Re: Problems with Multi-Uploads (AGAIN)
        100295 by: Jason Wong

Going Crazy Logic.
        100296 by: r
        100298 by: John Holmes

Thumb Drive Web Server?
        100299 by: John Holmes

php sessions
        100300 by: Michal Dvoracek

cant start apache after compiling PHP with LDAP
        100301 by: Andy

still running the old version after recompiling??
        100302 by: Andy
        100303 by: Jason Wong

Smart URLs
        100305 by: Scott 'INtense!' Reismanis
        100308 by: Andrew Brampton

Payflow Extension Support
        100307 by: Justin Felker

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 ---
Here is a piece of code, that is close to doing what I want it to.
The end result I would like to have is an array that is simple to work with.
If the XML tag was <issue-name>RED HAT</issue-name>, I would like something
like the following:

$Tags['issue-name']. So I could print it out. Something like, print
"$Tags['issue-name']<br>\n";

I was able to get a numerical representation of the array like, $Tags[5] and
the value of that tag was "RED HAT", but then I would have to know what the
position of the data I am looking for in the array. I would prefer to know
the tag name and the array and get to the data that way. I know there is a
way to do this, but I just can't figure it out. There is a lot of
information on Parsing the XML file but not getting into a useful array, or
at least that I have found easily to understand.


if(!isset($Sym)) { $Sym = 'IKN'; }
$URI = 'http://quotes.nasdaq.com/quote.dll?page=xml&mode=stock&symbol=';
$simple = implode( '', file("$URI$Sym"));

$p = xml_parser_create();
xml_parse_into_struct($p,$simple,$vals,$index);
xml_parser_free($p);
file://echo "Index array\n";
file://print_r($index);
file://echo "\nVals array\n";
file://print_r($vals);





--- End Message ---
--- Begin Message ---
if($REQUEST_METHOD == "post")
{
  //do validation of data
  if($validated == "yes")
  {
    //do queries
  }
  else
  { 
    echo "not validated"; 
    include("form.html");
  }
}
else
{include("form.html");}

Maybe that'll work. I'm trying to follow your logic. That will check for
the request method first. If it's POST, go on to validation. If it's not
POST, show the form. If the validation succeeds (validation == yes),
then do your queries, otherwise give an error message and show the form
again. 

Works?

---John Holmes...

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, June 01, 2002 5:11 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] New to PHP- Form Validation Logic/Design Question
> 
> 
> I am *very* new to PHP & am trying to write a tool where a user can
add
> books to a library MySQL database.
> 
> The user fills out an HTML form. I do some form validation & if the
form
> entries are ok, I need to run some SQL queries using the form
variables.
> 
> I have the HTML form posting back to itself to do the error checking.
The
> part I am unclear on is how to handle the SQL queries.
> 
> I was thinking that if the user filled out the form correctly, I could
> redirect to a new php script/page to handle the SQL queries. The
problem
> is that if I do so, I do not have access to the form variables that I
> need. The only way I know to pass variables to a new script is through
a
> form posting & it doesn't make sense to have 2 form postings for one
form.
> 
> I suppose I could run the SQL queries from the same script although
when I
> use my below logic, the SQL queries print out underneath the HTML form
> which looks pretty bad.
> 
> I was thinking that if I approach it this way, I need some way to loop
> back through all my "if" statements so that I could catch the last one
> only ($REQUEST_METHOD == "post" && $validated == "yes")
> and therefore wouldn't get the HTML form again. I tried putting a
> while(true){ } loop around the entire thing which resulted in printing
my
> HTML table infinity times :)
> 
> I included a pseudocode form of my logic here & my actual code below.
> 
> If anyone has any thoughts, suggestions, ideas, or comments, I'd
really
> appreciate it! Also, is there a good IRC channel for php users?
> 
> Laura
> [EMAIL PROTECTED]
> Instant Messenger: lefindley
> 
> if ($REQUEST_METHOD != "POST"){
> 
>    include("./form.html");
> 
> } else if ($REQUEST_METHOD == "POST" && $validated == "no"){
> 
>    perform error checking
>    display errors at top of page
>    include("./form.html");
> 
> } else if ($REQUEST_METHOD == "POST" && $validated
> == "yes") {
> 
> **here is where I need to run the SQL queries**
> 
> }
> 
> --------------------------------------------------
> 
> <?
> 
> $err = "";
> $validated = "no";
> 
> // display form for user to fill out
> 
> if ($REQUEST_METHOD != "POST") {
> 
>    include("./form.html");
> 
> 
> } else if ($REQUEST_METHOD == "POST" && $validated == "no") {
> 
> // if user is submitting the form, do error
> // checking. if there are errors, display them at
> // the beginning of the form
> 
>    if ($book_title == ""){
>       $err .= "<LI><font color="red">Book title cannot be
> blank!</font><br>";
>    }
>    if ($author == "") {
>       $err .= "<LI><font color="red">Author cannot be left
> blank!</font><br>";   }
>    if ($author != ""){
>    if (!ereg('[a-zA-Z]', $author)){
>         $err .= "<LI><font color="red">Author name must be " .
>                                       "letters!</font><br>";
>       }
>    }
>    if ($price == ""){
>       $err .= "<LI><font color="red">Price cannot be left
> blank!</font><br>";
>    }
>    if ($price != ""){
>       if (!is_numeric($price)){
>          $err .=  "<LI><font color="red">Price must be
> numbers!</font><br>";
>       }
>    }
>    if ($isbn == ""){
>       $err .= "<LI><font color="red">ISBN cannot be left
> blank!</font><br>";
>    }
>    if ($isbn != ""){
>       if (!is_numeric($isbn)){
>          $err .= "<LI><font color="red">ISBN must be
numbers!</font><br>";
> 
>       }
>    }
>    if ($num_copies != ""){
>       if (!is_numeric($num_copies)){
>          $err .= "<LI><font color="red"># of copies must be ".
>                                         " numbers!</font><br>";
>       }
>    }
>    if ($checked_out != ""){
>       if (!is_numeric($checked_out)){
>          $err .= "<LI><font color="red"># of checked out copies must
be "
> .
> 
>   if ($checked_out != ""){
>       if (!is_numeric($checked_out)){
>          $err .= "<LI><font color="red"># of checked out copies must
be "
> .
>                                           " numbers!</font><br>";
>       }
>    }
>    if (is_numeric($checked_out) && is_numeric($num_copies)){
>       if ($checked_out > $num_copies){
>          $err .= "<LI><font color="red"># of copies checked out cannot
" .
>                  "exceed number of copies in library!</font><br>";
>       }
>    }
>    include("./form.html");
> 
>    if ($err == ""){
>       $validated = "yes";
>       break;
>     }
> 
>     print "Validated: $validated";
>   }  // end of else if
> 
> 
> if ($REQUEST_METHOD == "POST" && $validated == "yes"){
> 
> // if user has correctly filled out the form, I
> // need to run some MySQL queries using the form // variables - not
sure
> if it is best to do this // on the same page or redirect to another.
> 
> // if i run the SQL queries from the same page,
> // i need to be able to not display the HTML form
> 
> // if i redirect to another script, I need a way
> // to pass the form variables
> 
>       print "do some SQL stuff";
>    }
> 
> 
> 
> 
> ?>
> 
> 
> 
> 
> 
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Maybe you should just ask your question in Spanish, because I have no
idea what you just asked... Does it just not work?

---John Holmes...

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, June 01, 2002 2:34 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] help me....S.O.S...my php doesn't ascend
> 
> Hi:
>      I have a Big Problems for my.
>      I have a server with WINNT 4.0 and IIS 3.0, I wanted to install
PHP
> (ver. 4.2.1) and it doesn't ascend.
>      I made it like it was indicated it configures in it paginates it
> http://www.php.net/manual/fi/configuration.php
> but neither I am this way, did I lack something?,  that happen?
> 
> I make test with one it paginates call it proves .php and I write
several
> test instruction but it is not:
> 
> <?php $myvar = "  Hola. Este es mi primer script en PHP \n";   //es mi
> primer script en PHP \n";
> //Esto es un comentario
> echo $myvar;
> ?>
>           <BR>
>           <tr><td>Forma 1</a></td>
>           <? echo "Hola, este es un mensaje de Prueba con PHP"; ?>
>           <BR>
>           <tr><td>Forma 2</a></td>
>           <?php echo "Hola, este es un mensaje de Prueba con PHP"; ?>
>           <BR>
>           <tr><td>Forma 3</a></td>
>           <script language="php"> echo "Hola, este es un mensaje de
Prueba
> con PHP"; </script>
>           <BR>
>           <tr><td>Forma4</a></td>
>           <% echo "Hola, este es un mensaje de Prueba con PHP"; %>
> <BR><BR>
> <? php phpinfo() ?>
> 
> 
> Please that some of you me to help.
> 
> Oscar Mora
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
I don't know about msSQL, but in mySQL you  can do something like


$sql = "SELECT * FROM brands WHERE 1 GROUP BY field ORDER BY `sId` DESC LIMIT 6";

Philip J. Newman wrote:

>Only one value from a msSQL field.
>
>I have many values the same in a field and would like to know how i can select one of 
>each (not mating).
>
>$sql = "SELECT * FROM brands WHERE 1 ORDER BY `sId` DESC LIMIT 6";
>
>lists everything ..
>
>ANy help would be cool.
>
>Phil
>
>
>


--- End Message ---
--- Begin Message ---
This has nothing to do with PHP. Subscribe to a database list.

Use DISTINCT or GROUP BY

---John Holmes...

> -----Original Message-----
> From: Philip J. Newman [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 18, 2002 8:39 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Newman Says: Only one value from a msSQL field.
> 
> Only one value from a msSQL field.
> 
> I have many values the same in a field and would like to know how i
can
> select one of each (not mating).
> 
> $sql = "SELECT * FROM brands WHERE 1 ORDER BY `sId` DESC LIMIT 6";
> 
> lists everything ..
> 
> ANy help would be cool.
> 
> Phil
> 


--- End Message ---
--- Begin Message ---
Hi. When I've got code like the following:
 
if($this) { include("this.html"); }
elseif($that) { include("that.html"); }
 
When are the includes() evaluated? Does the Zend engine do the includes
first, pull in all of the code, then process it and produce output. Or
does the engine start processing the code and only load the includes
when it gets to them?
 
Thanks for any explanations.
 
---John Holmes.
--- End Message ---
--- Begin Message ---
Your second guess. But you could've tested it easily with two includes 
appending stuff to the same global var.

Bogdan

John Holmes wrote:

>Hi. When I've got code like the following:
> 
>if($this) { include("this.html"); }
>elseif($that) { include("that.html"); }
> 
>When are the includes() evaluated? Does the Zend engine do the includes
>first, pull in all of the code, then process it and produce output. Or
>does the engine start processing the code and only load the includes
>when it gets to them?
> 
>Thanks for any explanations.
> 
>---John Holmes.
>
>  
>



--- End Message ---
--- Begin Message ---
The global var wouldn't work. Even if both are loaded into memory before
the script is ran, only one include will actually be executed along with
the code, so only one would end up affecting a global var either way. 

What I'm looking at is if each include .html file is 50K, am I loading
100K into memory and then running the script, or running the script and
only loading the appropriate 50K into memory when it's needed?

---John Holmes...

> -----Original Message-----
> From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, June 01, 2002 11:12 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Include question
> 
> Your second guess. But you could've tested it easily with two includes
> appending stuff to the same global var.
> 
> Bogdan
> 
> John Holmes wrote:
> 
> >Hi. When I've got code like the following:
> >
> >if($this) { include("this.html"); }
> >elseif($that) { include("that.html"); }
> >
> >When are the includes() evaluated? Does the Zend engine do the
includes
> >first, pull in all of the code, then process it and produce output.
Or
> >does the engine start processing the code and only load the includes
> >when it gets to them?
> >
> >Thanks for any explanations.
> >
> >---John Holmes.
> >
> >
> >
> 


--- End Message ---
--- Begin Message ---
You're right, that wouldn't prove my point. However, you might try a 
little piece of code like the following:

<?
  $a="foo";
  $b="bar";
  $c="foobar";
  if ($a=="foo") {
    include($b."php");
  } else {
    include($c."php");
  }
?>

I hope this proves that includes are included at runtime because PHP 
wouldn't know what $b and $c are beforehand. Apart from that, I'm 
positive I read about it in a man page, but can't recall which, that's 
why I didn't direct you to it ;-)

Bogdan

John Holmes wrote:

>The global var wouldn't work. Even if both are loaded into memory before
>the script is ran, only one include will actually be executed along with
>the code, so only one would end up affecting a global var either way. 
>
>What I'm looking at is if each include .html file is 50K, am I loading
>100K into memory and then running the script, or running the script and
>only loading the appropriate 50K into memory when it's needed?
>
>---John Holmes...
>
>  
>
>>-----Original Message-----
>>From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]]
>>Sent: Saturday, June 01, 2002 11:12 PM
>>To: [EMAIL PROTECTED]
>>Cc: [EMAIL PROTECTED]
>>Subject: Re: [PHP] Include question
>>
>>Your second guess. But you could've tested it easily with two includes
>>appending stuff to the same global var.
>>
>>Bogdan
>>
>>John Holmes wrote:
>>
>>    
>>
>>>Hi. When I've got code like the following:
>>>
>>>if($this) { include("this.html"); }
>>>elseif($that) { include("that.html"); }
>>>
>>>When are the includes() evaluated? Does the Zend engine do the
>>>      
>>>
>includes
>  
>
>>>first, pull in all of the code, then process it and produce output.
>>>      
>>>
>Or
>  
>
>>>does the engine start processing the code and only load the includes
>>>when it gets to them?
>>>
>>>Thanks for any explanations.
>>>
>>>---John Holmes.
>>>
>>>
>>>
>>>      
>>>
>
>
>
>  
>



--- End Message ---
--- Begin Message ---
Is there a way to determine the overhead or memory usage of a PHP script
as it runs? 
 
What I'm looking at is say I've got this nice simple script to display
info. Now I want to add a database abstraction layer and a template
engine. Sure, this makes it easy for me to control changes, but now I'm
including a dozen other files that I may only use a percentage of. So,
yeah, it's easy to control, but now it may be taking up 10 times as much
memory as it was before. 
 
So is there a way to see how much memory/overhead a script is taking up
after it does all of its includes?
 
Let me know if I need to explain this more. 
 
I'm on a windows machine, but any ideas you have are welcome. I'm sure
it's more of an OS-type question, though.
 
---John Holmes.
--- End Message ---
--- Begin Message ---
It's more of a time-consuming issue rather than memory usage IMHO. 
However, unless you make several extra database requests, I found that 
running PHP code is generally rather fast and adding considerable extra 
code doesn't affect the speed significantly. I must reiterate however 
that if your templating engine uses a database, that might increase 
parsing duration considerably. For your own tests, take a look at 
microtime() on php.net.

Bogdan

John Holmes wrote:

>Is there a way to determine the overhead or memory usage of a PHP script
>as it runs? 
> 
>What I'm looking at is say I've got this nice simple script to display
>info. Now I want to add a database abstraction layer and a template
>engine. Sure, this makes it easy for me to control changes, but now I'm
>including a dozen other files that I may only use a percentage of. So,
>yeah, it's easy to control, but now it may be taking up 10 times as much
>memory as it was before. 
> 
>So is there a way to see how much memory/overhead a script is taking up
>after it does all of its includes?
> 
>Let me know if I need to explain this more. 
> 
>I'm on a windows machine, but any ideas you have are welcome. I'm sure
>it's more of an OS-type question, though.
> 
>---John Holmes.
>
>  
>



--- End Message ---
--- Begin Message ---
hi all,

looking for some advice on the best way to approach this:

i have a guestbook running on a few sites, and occasionally we get
"creative" people who think it's a good idea to post messages with really
long words or URLs into the text, which totally mess up the layout of the
page.

what I need is an efficient way of checking the input for extremely long
words (say about 60-odd characters +)

I assume I just split the input by " " (space) into an array, and check that
each "word" isn't longer than 60 chars, but this seems like a lot of work
for the server... although I am limiting the entire input to 2000 chars, so
maybe this isn't too much work for the server?


this is what I'm using:
<?
$word_length = 5;
$error = 0;

$str = "cat dog bird mouse elephant"; // illegal
$str = explode(" ", $str);

foreach($str as $key => $word)
    {
    if(strlen($word) > $word_length)
        { $error = 1; }
    }
if($error)
    { echo "sorry"; }
else
    {
    $str = implode(" ", $str);
    echo $str."<BR>";
    }
?>

any ways to improve it?


Justin

--- End Message ---
--- Begin Message ---
First, you don't need to explode and then implode - just use a different 
var for the exploded array and use the original after the test.

My suggestion for testing (but you really must test it and see if it's 
faster or slower than your method) is using wordwrap() with your max 
word length and then check if any line is longer than your max allowed 
length. The advantage may be that you probably use 10-15 as the max 
length in real life and you would skip quite a few checks because you're 
going to end up with several words on a typical line. I guess it *might* 
be slightly fatser because wordwrap() is native to PHP - the job however 
is more complicated, so you may end up with a slower version than your 
current one.

Bogdan

Justin French wrote:

>hi all,
>
>looking for some advice on the best way to approach this:
>
>i have a guestbook running on a few sites, and occasionally we get
>"creative" people who think it's a good idea to post messages with really
>long words or URLs into the text, which totally mess up the layout of the
>page.
>
>what I need is an efficient way of checking the input for extremely long
>words (say about 60-odd characters +)
>
>I assume I just split the input by " " (space) into an array, and check that
>each "word" isn't longer than 60 chars, but this seems like a lot of work
>for the server... although I am limiting the entire input to 2000 chars, so
>maybe this isn't too much work for the server?
>
>
>this is what I'm using:
><?
>$word_length = 5;
>$error = 0;
>
>$str = "cat dog bird mouse elephant"; // illegal
>$str = explode(" ", $str);
>
>foreach($str as $key => $word)
>    {
>    if(strlen($word) > $word_length)
>        { $error = 1; }
>    }
>if($error)
>    { echo "sorry"; }
>else
>    {
>    $str = implode(" ", $str);
>    echo $str."<BR>";
>    }
>?>
>
>any ways to improve it?
>
>
>Justin
>
>
>  
>



--- End Message ---
--- Begin Message ---
Thanks!

Justin



on 02/06/02 1:18 PM, Bogdan Stancescu ([EMAIL PROTECTED]) wrote:

> First, you don't need to explode and then implode - just use a different
> var for the exploded array and use the original after the test.
> 
> My suggestion for testing (but you really must test it and see if it's
> faster or slower than your method) is using wordwrap() with your max
> word length and then check if any line is longer than your max allowed
> length. The advantage may be that you probably use 10-15 as the max
> length in real life and you would skip quite a few checks because you're
> going to end up with several words on a typical line. I guess it *might*
> be slightly fatser because wordwrap() is native to PHP - the job however
> is more complicated, so you may end up with a slower version than your
> current one.
> 
> Bogdan
> 
> Justin French wrote:
> 
>> hi all,
>> 
>> looking for some advice on the best way to approach this:
>> 
>> i have a guestbook running on a few sites, and occasionally we get
>> "creative" people who think it's a good idea to post messages with really
>> long words or URLs into the text, which totally mess up the layout of the
>> page.
>> 
>> what I need is an efficient way of checking the input for extremely long
>> words (say about 60-odd characters +)
>> 
>> I assume I just split the input by " " (space) into an array, and check that
>> each "word" isn't longer than 60 chars, but this seems like a lot of work
>> for the server... although I am limiting the entire input to 2000 chars, so
>> maybe this isn't too much work for the server?
>> 
>> 
>> this is what I'm using:
>> <?
>> $word_length = 5;
>> $error = 0;
>> 
>> $str = "cat dog bird mouse elephant"; // illegal
>> $str = explode(" ", $str);
>> 
>> foreach($str as $key => $word)
>> {
>> if(strlen($word) > $word_length)
>> { $error = 1; }
>> }
>> if($error)
>> { echo "sorry"; }
>> else
>> {
>> $str = implode(" ", $str);
>> echo $str."<BR>";
>> }
>> ?>
>> 
>> any ways to improve it?
>> 
>> 
>> Justin
>> 
>> 
>> 
>> 
> 
> 
> 

--- End Message ---
--- Begin Message ---
Also, if you are really worried about placing too much load on the server,
you could use JavaScript to check the form submission on the client side
using the same technique...

Mikey

"Bogdan Stancescu" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> First, you don't need to explode and then implode - just use a different
> var for the exploded array and use the original after the test.
>
> My suggestion for testing (but you really must test it and see if it's
> faster or slower than your method) is using wordwrap() with your max
> word length and then check if any line is longer than your max allowed
> length. The advantage may be that you probably use 10-15 as the max
> length in real life and you would skip quite a few checks because you're
> going to end up with several words on a typical line. I guess it *might*
> be slightly fatser because wordwrap() is native to PHP - the job however
> is more complicated, so you may end up with a slower version than your
> current one.
>
> Bogdan
>
> Justin French wrote:
>
> >hi all,
> >
> >looking for some advice on the best way to approach this:
> >
> >i have a guestbook running on a few sites, and occasionally we get
> >"creative" people who think it's a good idea to post messages with really
> >long words or URLs into the text, which totally mess up the layout of the
> >page.
> >
> >what I need is an efficient way of checking the input for extremely long
> >words (say about 60-odd characters +)
> >
> >I assume I just split the input by " " (space) into an array, and check
that
> >each "word" isn't longer than 60 chars, but this seems like a lot of work
> >for the server... although I am limiting the entire input to 2000 chars,
so
> >maybe this isn't too much work for the server?
> >
> >
> >this is what I'm using:
> ><?
> >$word_length = 5;
> >$error = 0;
> >
> >$str = "cat dog bird mouse elephant"; // illegal
> >$str = explode(" ", $str);
> >
> >foreach($str as $key => $word)
> >    {
> >    if(strlen($word) > $word_length)
> >        { $error = 1; }
> >    }
> >if($error)
> >    { echo "sorry"; }
> >else
> >    {
> >    $str = implode(" ", $str);
> >    echo $str."<BR>";
> >    }
> >?>
> >
> >any ways to improve it?
> >
> >
> >Justin
> >
> >
> >
> >
>
>
>


--- End Message ---
--- Begin Message ---
I was happily coding when I came across a mysterious error.  I've traced it
to this line

if ($player_password != $player_password_verify) { $errmsg .= 'Password
don't match.  Please try again<BR>'; $error = 1; }

commented out the script runs fine, if this line is active an error is
produced.  My eyes are going bug eyed trying to find what the problem is and
I'm hoping a second pair of eyes may point out my error.

I've provided the entire script in case by chance the error is actually
stemming from elsewhere in the script and I'm missing that as well.  The
error message from the compiler states the error is stemming from line 15
(which is the line I posted above). Any suggestions?

<?php
require('config.inc.php');
authenticate();

if ($action == 'add') {
// The connection/query commands will need to be modified once the db
abstraction layer is ready
mysql_connect($mysql_host, $mysql_user, $mysql_pass);
mysql_select_db($mysql_database);
$errmsg = '';

if (mysql_num_rows(mysql_query("SELECT player_id FROM eq_guildmembers WHERE
player_name = '$player_name'")) > 0) { $errmsg .= 'Player name already
exists<BR>'; $error = 1; }
if (!$player_password) { $errmsg .= 'You must specify a password for this
user<BR>'; $error = 1; }

# For some weird reason the line below produces an error...I can't find
anything wrong
if ($player_password != $player_password_verify) { $errmsg .= 'Password
don't match.  Please try again<BR>'; $error = 1; }

if (!$error) {
mysql_query("INSERT INTO eq_guildmembers (player_name, date_joined,
player_email_address, player_icq, priv_admin, player_password) VALUES
('$player_name',NOW(),
'$player_email_address','$player_icq','$priv_admin','$player_password')");
else { echo 'Submission successful...<A HREF="admin_roster.php">click here
to return to the roster</A>'; exit; }
}
}
?>


--- End Message ---
--- Begin Message ---
What is the exact error message are you seeing?

> -----Original Message-----
> From: Craig Vincent [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, June 01, 2002 11:29 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Baffled, line producing error
> 
> 
> I was happily coding when I came across a mysterious 
> error.  I've traced it
> to this line
> 
> if ($player_password != $player_password_verify) { 
> $errmsg .= 'Password
> don't match.  Please try again<BR>'; $error = 1; }
> 
> commented out the script runs fine, if this line is 
> active an error is
> produced.  My eyes are going bug eyed trying to find 
> what the problem is and
> I'm hoping a second pair of eyes may point out my error.
> 
> I've provided the entire script in case by chance the 
> error is actually
> stemming from elsewhere in the script and I'm missing 
> that as well.  The
> error message from the compiler states the error is 
> stemming from line 15
> (which is the line I posted above). Any suggestions?
> 
> <?php
> require('config.inc.php');
> authenticate();
> 
> if ($action == 'add') {
> // The connection/query commands will need to be 
> modified once the db
> abstraction layer is ready
> mysql_connect($mysql_host, $mysql_user, $mysql_pass);
> mysql_select_db($mysql_database);
> $errmsg = '';
> 
> if (mysql_num_rows(mysql_query("SELECT player_id FROM 
> eq_guildmembers WHERE
> player_name = '$player_name'")) > 0) { $errmsg .= 
> 'Player name already
> exists<BR>'; $error = 1; }
> if (!$player_password) { $errmsg .= 'You must specify 
> a password for this
> user<BR>'; $error = 1; }
> 
> # For some weird reason the line below produces an 
> error...I can't find
> anything wrong
> if ($player_password != $player_password_verify) { 
> $errmsg .= 'Password
> don't match.  Please try again<BR>'; $error = 1; }
> 
> if (!$error) {
> mysql_query("INSERT INTO eq_guildmembers (player_name, 
> date_joined,
> player_email_address, player_icq, priv_admin, 
> player_password) VALUES
> ('$player_name',NOW(),
> '$player_email_address','$player_icq','$priv_admin','$p
> layer_password')");
> else { echo 'Submission successful...<A 
> HREF="admin_roster.php">click here
> to return to the roster</A>'; exit; }
> }
> }
> ?>
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
--- End Message ---
--- Begin Message ---
If the "error" is a warning about undefined variable, then set a default
value for $errmsg before you start adding strings to it.

$errmsg .= "this";

That by itself means $errmsg = $errmsg . "this";, but if $errmsg isnt'
defined, you'll get the warning.

Set $errmsg = ''; at the beginning of your script if that is the
problem...

For future reference, always give the exact error when posting.

Trying to be psychic,

---John Holmes...

> -----Original Message-----
> From: Craig Vincent [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, June 01, 2002 11:29 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Baffled, line producing error
> 
> I was happily coding when I came across a mysterious error.  I've
traced
> it
> to this line
> 
> if ($player_password != $player_password_verify) { $errmsg .=
'Password
> don't match.  Please try again<BR>'; $error = 1; }
> 
> commented out the script runs fine, if this line is active an error is
> produced.  My eyes are going bug eyed trying to find what the problem
is
> and
> I'm hoping a second pair of eyes may point out my error.
> 
> I've provided the entire script in case by chance the error is
actually
> stemming from elsewhere in the script and I'm missing that as well.
The
> error message from the compiler states the error is stemming from line
15
> (which is the line I posted above). Any suggestions?
> 
> <?php
> require('config.inc.php');
> authenticate();
> 
> if ($action == 'add') {
> // The connection/query commands will need to be modified once the db
> abstraction layer is ready
> mysql_connect($mysql_host, $mysql_user, $mysql_pass);
> mysql_select_db($mysql_database);
> $errmsg = '';
> 
> if (mysql_num_rows(mysql_query("SELECT player_id FROM eq_guildmembers
> WHERE
> player_name = '$player_name'")) > 0) { $errmsg .= 'Player name already
> exists<BR>'; $error = 1; }
> if (!$player_password) { $errmsg .= 'You must specify a password for
this
> user<BR>'; $error = 1; }
> 
> # For some weird reason the line below produces an error...I can't
find
> anything wrong
> if ($player_password != $player_password_verify) { $errmsg .=
'Password
> don't match.  Please try again<BR>'; $error = 1; }
> 
> if (!$error) {
> mysql_query("INSERT INTO eq_guildmembers (player_name, date_joined,
> player_email_address, player_icq, priv_admin, player_password) VALUES
> ('$player_name',NOW(),
>
'$player_email_address','$player_icq','$priv_admin','$player_password')"
);
> else { echo 'Submission successful...<A HREF="admin_roster.php">click
here
> to return to the roster</A>'; exit; }
> }
> }
> ?>
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
> If the "error" is a warning about undefined variable, then set a default
> value for $errmsg before you start adding strings to it.
>
> $errmsg .= "this";
>
> That by itself means $errmsg = $errmsg . "this";, but if $errmsg isnt'
> defined, you'll get the warning.
>
> Set $errmsg = ''; at the beginning of your script if that is the
> problem...
>
> For future reference, always give the exact error when posting.
>
> Trying to be psychic,

You'll notice a few lines up I have defined $errmsg =)  It's a standard
parsing error I'm getting

Parse error: parse error in admin_add_player.php on line 15

Since this message does not arise when line 15 is removed I can only assume
the error is actually on that line and not a missing quote or bracket
somewhere else in the script.

Sincerely,

Craig Vincent


--- End Message ---
--- Begin Message ---
You have:

if ($player_password != $player_password_verify) { 
  $errmsg .= 'Password don't match.  Please try again<BR>'; 
  $error = 1; 
}

Notice the ' inside the '', this is bad syntax.  For more 
information on using strings in PHP, see:

  http://www.zend.com/zend/tut/using-strings.php
  http://www.php.net/manual/en/language.types.string.php

One thing you can do is escape it: \'

regards,
Philip Olson


On Sun, 2 Jun 2002, Craig Vincent wrote:

> > If the "error" is a warning about undefined variable, then set a default
> > value for $errmsg before you start adding strings to it.
> >
> > $errmsg .= "this";
> >
> > That by itself means $errmsg = $errmsg . "this";, but if $errmsg isnt'
> > defined, you'll get the warning.
> >
> > Set $errmsg = ''; at the beginning of your script if that is the
> > problem...
> >
> > For future reference, always give the exact error when posting.
> >
> > Trying to be psychic,
> 
> You'll notice a few lines up I have defined $errmsg =)  It's a standard
> parsing error I'm getting
> 
> Parse error: parse error in admin_add_player.php on line 15
> 
> Since this message does not arise when line 15 is removed I can only assume
> the error is actually on that line and not a missing quote or bracket
> somewhere else in the script.
> 
> Sincerely,
> 
> Craig Vincent
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
> Notice the ' inside the '', this is bad syntax.  For more
> information on using strings in PHP, see:

Sheesh you're right, as I said it was probably a dumb error, three other
people have looked at this that I'm aware of and missed it too....lol glad
your eyes are better than ours.  Thank you for pointing out the mistake

Sincerely,

Craig Vincent


--- End Message ---
--- Begin Message ---
http://www.faqts.com/knowledge_base/view.phtml/aid/186

Hugo Gallo wrote:

>I an effort to deter fraudulent credit cards, I'd like to display the
>client's IP address. Anyone know how this is done with PHP scripting?
>
>There is SSI code & Perl code for this, but I need to have this be a .php
>page since it's talking to MySQL.
>
>Any help would be much appreciated.
>
>Hugo
>
>
>
>  
>



--- End Message ---
--- Begin Message ---
The answer...

the php.ini did not accept the value 2M.  it would, however accept 2097152.

Aaron

"Aaron" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am trying to upload files to a server.  I have the script and it works
on
> other servers but when I try to upload to this paticular server, I get the
> following:
>
> Warning: Max file size of 2 bytes exceeded - file [userfile] not saved in
> Unknown on line 0
>
>
> I have checked the php.ini file and the upload_max_filesize = 2M.  I
checked
> with phpinfo and verified that it is set for 2M.
>
> Any ideas?
>
>


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

I know that there are more complex functions and classes out there for
validating email address', but some of them do return "invalid" on
*technically* valid, although uncommon email address', so all I want is a
simple test for:

(anything)@(anything) followed by 1 or more (.anything)

ie
foo@foo : invalid
[EMAIL PROTECTED] : valid
[EMAIL PROTECTED] : valid

i wish to allow ANYTHING really -- not just a-z,A-z,0-9,_,- technically
spaces, brackets, and all sorts of crap are valid in the user portion of the
email address :)


this will return true for [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]
etc etc... i'm aware that the results will not necessarily BE valid email
address', but at least they'll *look* like valid email address'.

it's for a simple guestbook/message board where some creative people have
put in "lalaland" or "myplace" as an email address, rather than entering
something that at least LOOKS like a valid address, or optionally leaving
the field blank.

my aim will be to strip out anything that doesn't at least LOOK like like an
email address.


regards,

justin french

--- End Message ---
--- Begin Message ---
Maybe I'm biased, but if you grab validateEmailFormat.php from
www.killersoft.com, you'd be able to do something as simple as this:

<?php
include("/path/to/validateEmailFormat.php");

$email = "[EMAIL PROTECTED]";
$isValid = validateEmailFormat($email);
if($isValid) {
    // do whatever you need to do
} else {
    echo "sorry, that address isn't formatted properly.";
}
?>

validateEmailFormat.php is a translation of the Perl regular expression
that's widely considered to be the defintive test of a valid RFC822 address.
Can't go wrong with that. : )


-Clay


> From: Justin French <[EMAIL PROTECTED]>
> Date: Sun, 02 Jun 2002 14:13:40 +1000
> To: php <[EMAIL PROTECTED]>
> Subject: [PHP] simple email validation ereg
> 
> Hi,
> 
> I know that there are more complex functions and classes out there for
> validating email address', but some of them do return "invalid" on
> *technically* valid, although uncommon email address', so all I want is a
> simple test for:
> 
> (anything)@(anything) followed by 1 or more (.anything)
> 
> ie
> foo@foo : invalid
> [EMAIL PROTECTED] : valid
> [EMAIL PROTECTED] : valid
> 
> i wish to allow ANYTHING really -- not just a-z,A-z,0-9,_,- technically
> spaces, brackets, and all sorts of crap are valid in the user portion of the
> email address :)
> 
> 
> this will return true for [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]
> etc etc... i'm aware that the results will not necessarily BE valid email
> address', but at least they'll *look* like valid email address'.
> 
> it's for a simple guestbook/message board where some creative people have
> put in "lalaland" or "myplace" as an email address, rather than entering
> something that at least LOOKS like a valid address, or optionally leaving
> the field blank.
> 
> my aim will be to strip out anything that doesn't at least LOOK like like an
> email address.
> 
> 
> regards,
> 
> justin french
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
My script is:
<html>
<body>
<?php
session_start();
printf("<P> loggin on as ");
printf ("<P>user name: ");
printf ($HTTP_POST_VARS['User']);
printf ("<P>Password: ");printf ($HTTP_POST_VARS['Password']);
printf ("<P>");


    /* Connecting, selecting database */
    $link = mysql_pconnect("localhost", $HTTP_POST_VARS['User'],
$HTTP_POST_VARS['Password'])
        or die("Could not connect");
    print "Connected successfully<P>";
    printf ("<BR>");
    print "Setting Global variables<BR>";
    $_SESSION_VARS["dbauser"]=($HTTP_POST_VARS['User']);
    $_SESSION_VARS["dbapassword"]=($HTTP_POST_VARS['Password']);
    printf ($_SESSION_VARS["dbauser"]);
    printf ("<BR>");
    printf ($_SESSION_VARS["dbapassword"],"<BR>");
?>
<P>
</body>
</html>
  The errors I get are:
Warning: Cannot send session cookie - headers already sent by (output
started at c:\usr\www\my-domain\databaselogin.php:3) in
c:\usr\www\my-domain\databaselogin.php on line 4

Warning: Cannot send session cache limiter - headers already sent (output
started at c:\usr\www\my-domain\databaselogin.php:3) in
c:\usr\www\my-domain\databaselogin.php on line 4

loggin on as

user name: stampuser

Password: vantwest

Connected successfully


Obviously I have something not configured correctly, or I am calling the
function in the wrong place.  Any advice on how to overcome this would be
very useful.


Regards


Peter Goggin

----- Original Message -----
From: "John Holmes" <[EMAIL PROTECTED]>
To: "'Peter Goggin'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Sunday, June 02, 2002 12:09 AM
Subject: RE: [PHP] Apache, html, php and global variables


> Sessions use cookies, which use headers, which have to be sent before
> any output. <html> is output. So, put session_start() before that.
>
> <?
> Session_start();
>
> ...
>
> ?>
> <html>
> <body>
> ...
>
> Where are you putting dbauser and dbapassword into the session?
>
> Your sessions still aren't going to work because the session.save_path
> isn't set correctly in your PHP.ini. Set it to a directory on your
> computer that the web server has access to write to.
>
> ---John Holmes...
>
> > -----Original Message-----
> > From: Peter Goggin [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, June 01, 2002 9:54 AM
> > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Subject: Re: [PHP] Apache, html, php and global variables
> >
> > I am not clear what you mean by this. I have set session_start() on in
> the
> > php script that logs onto the database initially.  i then call a test
> php
> > script from a button on the menu frame. This is the output it gives:
> >
> > Test php variables
> >
> > Warning: Cannot send session cookie - headers already sent by (output
> > started at c:\usr\www\my-domain\maintenance.php:4) in
> > c:\usr\www\my-domain\maintenance.php on line 5
> >
> > Warning: Cannot send session cache limiter - headers already sent
> (output
> > started at c:\usr\www\my-domain\maintenance.php:4) in
> > c:\usr\www\my-domain\maintenance.php on line 5
> >
> > Warning: open(/tmp\sess_593732809e269f91e78e7406d4a22808, O_RDWR)
> failed:
> > No
> > such file or directory (2) in c:\usr\www\my-domain\maintenance.php on
> line
> > 5
> > Test of global variables
> > DBA USER:
> > DBA Password;
> > Warning: open(/tmp\sess_593732809e269f91e78e7406d4a22808, O_RDWR)
> failed:
> > No
> > such file or directory (2) in Unknown on line 0
> >
> > Warning: Failed to write session data (files). Please verify that the
> > current setting of session.save_path is correct (/tmp) in Unknown on
> line
> > 0
> >
> >
> > The script is:
> > <HTML>
> > <BODY>
> > Test php variables<BR>
> > <?php
> > session_start();
> >     printf ("Test of global variables<BR>");
> >     printf ("DBA USER: ",$_SESSION_VARS["dbauser"],"<BR>");
> >     printf ("<BR>");
> >     printf ("DBA Password; ",$_SESSION_VARS["dbapassword"],"<BR>");
> > ?>
> > </BODY>
> > </HTML>
> >
> > Is there a problem with how I am using sessiot_start, or is there a
> php
> > config problem?
> >
> > Regards
> >
> > Peter Goggin
> >
> > ----- Original Message -----
> > From: "John Holmes" <[EMAIL PROTECTED]>
> > To: "'Peter Goggin'" <[EMAIL PROTECTED]>; <php-
> > [EMAIL PROTECTED]>
> > Sent: Saturday, June 01, 2002 2:04 PM
> > Subject: RE: [PHP] Apache, html, php and global variables
> >
> >
> > > You still have to connect to a database every time a script is run,
> > > whether it's loaded in a frame or run by itself. If you start a
> session
> > > and save the username and password in it, then you can use that
> login
> > > and password on every other page that you call session_start() on.
> > >
> > > ---John Holmes...
> > >
> > > > -----Original Message-----
> > > > From: Peter Goggin [mailto:[EMAIL PROTECTED]]
> > > > Sent: Friday, May 31, 2002 11:12 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Re: [PHP] Apache, html, php and global variables
> > > >
> > > > I am not certain how this helps me, since it appears the data is
> only
> > > > carried to pages called directly from where it is set.  The page
> where
> > > the
> > > > user logs onto the database does not link to other pages. This is
> done
> > > > from
> > > > the top frame of the form. The top frame of the inital page
> contains
> > > the
> > > > menu, one option of which is to log onto the data base to start a
> > > session.
> > > > The user will then select another page from the top form.
> > > >
> > > > This new page is displayed in the bottom frame of the intial page,
> and
> > > > there
> > > > may be futher links within this page on the bottom fram.Generally
> > > however
> > > > main navigation is from the top frame which remains in place
> through
> > > out.
> > > > What I wabt to do is to have the login information available at
> all
> > > times
> > > > once the user is logged in, nomattar how the current page is
> called.
> > > >
> > > > Is this possible?
> > > >
> > > > If so how is this done?
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: "Stuart Dallas" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Saturday, June 01, 2002 11:56 AM
> > > > Subject: Re: [PHP] Apache, html, php and global variables
> > > >
> > > >
> > > > > On Saturday, June 1, 2002 at 2:42:40 AM, you wrote:
> > > > > > Is there any way of caryying the login information from one
> web
> > > page
> > > > to
> > > > the
> > > > > > next in global variables so that the username and password
> entered
> > > in
> > > > the
> > > > > > login screen is available to all other web pages in the site
> or do
> > > I
> > > > have to
> > > > > > ask the user to re-enter this information at every screen?
> > > > >
> > > > > Sessions: http://www.php.net/session
> > > > >
> > > > > --
> > > > > Stuart
> > > > >
> > > > >
> > > > > --
> > > > > 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
> > >
> > >
> > > --
> > > 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 ---
Did you read my reply at all? Call session_start() before any output to
the browser. 

---John Holmes...

> -----Original Message-----
> From: Peter Goggin [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, June 02, 2002 1:20 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP] Apache, html, php and global variables
> 
> My script is:
> <html>
> <body>
> <?php
> session_start();
> printf("<P> loggin on as ");
> printf ("<P>user name: ");
> printf ($HTTP_POST_VARS['User']);
> printf ("<P>Password: ");printf ($HTTP_POST_VARS['Password']);
> printf ("<P>");
> 
> 
>     /* Connecting, selecting database */
>     $link = mysql_pconnect("localhost", $HTTP_POST_VARS['User'],
> $HTTP_POST_VARS['Password'])
>         or die("Could not connect");
>     print "Connected successfully<P>";
>     printf ("<BR>");
>     print "Setting Global variables<BR>";
>     $_SESSION_VARS["dbauser"]=($HTTP_POST_VARS['User']);
>     $_SESSION_VARS["dbapassword"]=($HTTP_POST_VARS['Password']);
>     printf ($_SESSION_VARS["dbauser"]);
>     printf ("<BR>");
>     printf ($_SESSION_VARS["dbapassword"],"<BR>");
> ?>
> <P>
> </body>
> </html>
>   The errors I get are:
> Warning: Cannot send session cookie - headers already sent by (output
> started at c:\usr\www\my-domain\databaselogin.php:3) in
> c:\usr\www\my-domain\databaselogin.php on line 4
> 
> Warning: Cannot send session cache limiter - headers already sent
(output
> started at c:\usr\www\my-domain\databaselogin.php:3) in
> c:\usr\www\my-domain\databaselogin.php on line 4
> 
> loggin on as
> 
> user name: stampuser
> 
> Password: vantwest
> 
> Connected successfully
> 
> 
> Obviously I have something not configured correctly, or I am calling
the
> function in the wrong place.  Any advice on how to overcome this would
be
> very useful.
> 
> 
> Regards
> 
> 
> Peter Goggin
> 
> ----- Original Message -----
> From: "John Holmes" <[EMAIL PROTECTED]>
> To: "'Peter Goggin'" <[EMAIL PROTECTED]>; <php-
> [EMAIL PROTECTED]>
> Sent: Sunday, June 02, 2002 12:09 AM
> Subject: RE: [PHP] Apache, html, php and global variables
> 
> 
> > Sessions use cookies, which use headers, which have to be sent
before
> > any output. <html> is output. So, put session_start() before that.
> >
> > <?
> > Session_start();
> >
> > ...
> >
> > ?>
> > <html>
> > <body>
> > ...
> >
> > Where are you putting dbauser and dbapassword into the session?
> >
> > Your sessions still aren't going to work because the
session.save_path
> > isn't set correctly in your PHP.ini. Set it to a directory on your
> > computer that the web server has access to write to.
> >
> > ---John Holmes...
> >
> > > -----Original Message-----
> > > From: Peter Goggin [mailto:[EMAIL PROTECTED]]
> > > Sent: Saturday, June 01, 2002 9:54 AM
> > > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > > Subject: Re: [PHP] Apache, html, php and global variables
> > >
> > > I am not clear what you mean by this. I have set session_start()
on in
> > the
> > > php script that logs onto the database initially.  i then call a
test
> > php
> > > script from a button on the menu frame. This is the output it
gives:
> > >
> > > Test php variables
> > >
> > > Warning: Cannot send session cookie - headers already sent by
(output
> > > started at c:\usr\www\my-domain\maintenance.php:4) in
> > > c:\usr\www\my-domain\maintenance.php on line 5
> > >
> > > Warning: Cannot send session cache limiter - headers already sent
> > (output
> > > started at c:\usr\www\my-domain\maintenance.php:4) in
> > > c:\usr\www\my-domain\maintenance.php on line 5
> > >
> > > Warning: open(/tmp\sess_593732809e269f91e78e7406d4a22808, O_RDWR)
> > failed:
> > > No
> > > such file or directory (2) in c:\usr\www\my-domain\maintenance.php
on
> > line
> > > 5
> > > Test of global variables
> > > DBA USER:
> > > DBA Password;
> > > Warning: open(/tmp\sess_593732809e269f91e78e7406d4a22808, O_RDWR)
> > failed:
> > > No
> > > such file or directory (2) in Unknown on line 0
> > >
> > > Warning: Failed to write session data (files). Please verify that
the
> > > current setting of session.save_path is correct (/tmp) in Unknown
on
> > line
> > > 0
> > >
> > >
> > > The script is:
> > > <HTML>
> > > <BODY>
> > > Test php variables<BR>
> > > <?php
> > > session_start();
> > >     printf ("Test of global variables<BR>");
> > >     printf ("DBA USER: ",$_SESSION_VARS["dbauser"],"<BR>");
> > >     printf ("<BR>");
> > >     printf ("DBA Password;
",$_SESSION_VARS["dbapassword"],"<BR>");
> > > ?>
> > > </BODY>
> > > </HTML>
> > >
> > > Is there a problem with how I am using sessiot_start, or is there
a
> > php
> > > config problem?
> > >
> > > Regards
> > >
> > > Peter Goggin
> > >
> > > ----- Original Message -----
> > > From: "John Holmes" <[EMAIL PROTECTED]>
> > > To: "'Peter Goggin'" <[EMAIL PROTECTED]>; <php-
> > > [EMAIL PROTECTED]>
> > > Sent: Saturday, June 01, 2002 2:04 PM
> > > Subject: RE: [PHP] Apache, html, php and global variables
> > >
> > >
> > > > You still have to connect to a database every time a script is
run,
> > > > whether it's loaded in a frame or run by itself. If you start a
> > session
> > > > and save the username and password in it, then you can use that
> > login
> > > > and password on every other page that you call session_start()
on.
> > > >
> > > > ---John Holmes...
> > > >
> > > > > -----Original Message-----
> > > > > From: Peter Goggin [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Friday, May 31, 2002 11:12 PM
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: Re: [PHP] Apache, html, php and global variables
> > > > >
> > > > > I am not certain how this helps me, since it appears the data
is
> > only
> > > > > carried to pages called directly from where it is set.  The
page
> > where
> > > > the
> > > > > user logs onto the database does not link to other pages. This
is
> > done
> > > > > from
> > > > > the top frame of the form. The top frame of the inital page
> > contains
> > > > the
> > > > > menu, one option of which is to log onto the data base to
start a
> > > > session.
> > > > > The user will then select another page from the top form.
> > > > >
> > > > > This new page is displayed in the bottom frame of the intial
page,
> > and
> > > > > there
> > > > > may be futher links within this page on the bottom
fram.Generally
> > > > however
> > > > > main navigation is from the top frame which remains in place
> > through
> > > > out.
> > > > > What I wabt to do is to have the login information available
at
> > all
> > > > times
> > > > > once the user is logged in, nomattar how the current page is
> > called.
> > > > >
> > > > > Is this possible?
> > > > >
> > > > > If so how is this done?
> > > > >
> > > > >
> > > > > ----- Original Message -----
> > > > > From: "Stuart Dallas" <[EMAIL PROTECTED]>
> > > > > To: <[EMAIL PROTECTED]>
> > > > > Sent: Saturday, June 01, 2002 11:56 AM
> > > > > Subject: Re: [PHP] Apache, html, php and global variables
> > > > >
> > > > >
> > > > > > On Saturday, June 1, 2002 at 2:42:40 AM, you wrote:
> > > > > > > Is there any way of caryying the login information from
one
> > web
> > > > page
> > > > > to
> > > > > the
> > > > > > > next in global variables so that the username and password
> > entered
> > > > in
> > > > > the
> > > > > > > login screen is available to all other web pages in the
site
> > or do
> > > > I
> > > > > have to
> > > > > > > ask the user to re-enter this information at every screen?
> > > > > >
> > > > > > Sessions: http://www.php.net/session
> > > > > >
> > > > > > --
> > > > > > Stuart
> > > > > >
> > > > > >
> > > > > > --
> > > > > > 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
> > > >
> > > >
> > > > --
> > > > 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 ---
On Sunday 02 June 2002 13:31, John Holmes wrote:
> Did you read my reply at all? Call session_start() before any output to
> the browser.

> >   The errors I get are:
> > Warning: Cannot send session cookie - headers already sent by (output
> > started at c:\usr\www\my-domain\databaselogin.php:3) in
> > c:\usr\www\my-domain\databaselogin.php on line 4
> >
> > Warning: Cannot send session cache limiter - headers already sent

Also searching the list archives for "headers already sent" would (should) 
result in umpteen billions of hits with the solution.

If you're intelligent enough to be writing a website then you should be 
intelligent enough to use a search engine.

Heck, google -> "headers already sent" brings up the answer straight away.

So to all those lazy people out there, use your loaf and not someone else's.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
INSIDE, I have the same personality disorder as LUCY RICARDO!!
*/

--- End Message ---
--- Begin Message ---
Thanks, well said.

John

> -----Original Message-----
> From: Jason Wong [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, June 02, 2002 2:10 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Apache, html, php and global variables
> 
> On Sunday 02 June 2002 13:31, John Holmes wrote:
> > Did you read my reply at all? Call session_start() before any output
to
> > the browser.
> 
> > >   The errors I get are:
> > > Warning: Cannot send session cookie - headers already sent by
(output
> > > started at c:\usr\www\my-domain\databaselogin.php:3) in
> > > c:\usr\www\my-domain\databaselogin.php on line 4
> > >
> > > Warning: Cannot send session cache limiter - headers already sent
> 
> Also searching the list archives for "headers already sent" would
(should)
> result in umpteen billions of hits with the solution.
> 
> If you're intelligent enough to be writing a website then you should
be
> intelligent enough to use a search engine.
> 
> Heck, google -> "headers already sent" brings up the answer straight
away.
> 
> So to all those lazy people out there, use your loaf and not someone
> else's.
> 
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development
*
> 
> /*
> INSIDE, I have the same personality disorder as LUCY RICARDO!!
> */
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
I have a question about global vars.  Why is it that I have to declare a var 
global if I'm using it across included files.  For example the only why I 
can get this var to work is by making it global.

main.php
<?php
include loader.inc;
include builder.inc;
include render.inc;
?>

loader.inc
<?php
global $obj;
$obj = new Whiz_bang();
?>

builder.inc
<?php
global $obj;
$obj->build_whizzer();
?>

render.inc
<?php
render->html();
?>

considering that if you took the could and just inserted the code form the 
included files into the main you would not need to make the var global why 
is that I need to when I cross files.  I don't think I have  read a good 
reasoning for this anywhere.  My goal is simple to use as few global vars as 
possible which is why I ask.

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

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

global $var; does nothing outside of a function.  You 
do not need to use global for this.

$foo = 'bar';
include 'something_that_uses_foo.inc';

http://www.php.net/manual/en/language.variables.scope.php

regards,
Philip Olson


On Sun, 2 Jun 2002, Anzak Wolf wrote:

> I have a question about global vars.  Why is it that I have to declare a var 
> global if I'm using it across included files.  For example the only why I 
> can get this var to work is by making it global.
> 
> main.php
> <?php
> include loader.inc;
> include builder.inc;
> include render.inc;
> ?>
> 
> loader.inc
> <?php
> global $obj;
> $obj = new Whiz_bang();
> ?>
> 
> builder.inc
> <?php
> global $obj;
> $obj->build_whizzer();
> ?>
> 
> render.inc
> <?php
> render->html();
> ?>
> 
> considering that if you took the could and just inserted the code form the 
> included files into the main you would not need to make the var global why 
> is that I need to when I cross files.  I don't think I have  read a good 
> reasoning for this anywhere.  My goal is simple to use as few global vars as 
> possible which is why I ask.
> 
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Hola
             Resulta que tengo problemas para que funcione PHP en un
servidor NT 4.0 con IIS 3.0 y este no funciona PHP ver. 4.2.1) ya que al
hacer alguno de los ejemplos que adjunte (codigos) ninguno funciona.
Hicela prueba con Apache/Win98/PHP y ahí me funciono.
            No entinedo que es lo que pasa?; ademas segui instruciones de
la pagina Web http://www.php.net/manual/fi/configuration.php y aun asi no
Funciono.
      Si alguien me puede Ayudar se lo agradecería, ya que esto me tiene
muy complicado.

Saludos.
Oscar Mora

PD: Con este codigo, hago test con una pagina llamada prueba.php y me di
cuenta de que en NT no funcionó, pero si en W98.

<?php $myvar = "Hola. Este es mi primer script en PHP \n";
//es mi primer script en PHP \n";
echo $myvar; ?>
<BR>
<tr><td>Forma 1</a></td>
<? echo "Hola, este es un mensaje de Prueba con PHP"; ?>
<BR>
<tr><td>Forma 2</a></td>
<?php echo "Hola, este es un mensaje de Prueba con PHP";?>
<BR>
<tr><td>Forma 3</a></td>
<script language="php"> echo "Hola, este es un mensaje de
Prueba
con PHP"; </script>
<BR>
<tr><td>Forma4</a></td>
<% echo "Hola, este es un mensaje de Prueba con PHP"; %>
<BR><BR>
<? php phpinfo() ?>

--- End Message ---
--- Begin Message ---
Hola
             Resulta que tengo problemas para que funcione PHP en un
servidor NT 4.0 con IIS 3.0 y este no funciona PHP ver. 4.2.1) ya que al
hacer alguno de los ejemplos que adjunte (codigos) ninguno funciona.
Hicela prueba con Apache/Win98/PHP y ahí me funciono.
            No entinedo que es lo que pasa?; ademas segui instruciones de
la pagina Web http://www.php.net/manual/fi/configuration.php y aun asi no
Funciono.
      Si alguien me puede Ayudar se lo agradecería, ya que esto me tiene
muy complicado.

Saludos.
Oscar Mora

PD: Con este codigo, hago test con una pagina llamada prueba.php y me di
cuenta de que en NT no funcionó, pero si en W98.

<?php $myvar = "Hola. Este es mi primer script en PHP \n";
//es mi primer script en PHP \n";
echo $myvar; ?>
<BR>
<tr><td>Forma 1</a></td>
<? echo "Hola, este es un mensaje de Prueba con PHP"; ?>
<BR>
<tr><td>Forma 2</a></td>
<?php echo "Hola, este es un mensaje de Prueba con PHP";?>
<BR>
<tr><td>Forma 3</a></td>
<script language="php"> echo "Hola, este es un mensaje de
Prueba
con PHP"; </script>
<BR>
<tr><td>Forma4</a></td>
<% echo "Hola, este es un mensaje de Prueba con PHP"; %>
<BR><BR>
<? php phpinfo() ?>

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

Hola:

Tienes la misma version de PHP en el servidor Win98?

Sabes que hay diferencias importantes en versiones de PHP mas de 4.1.0
(creo ... seguramente, mas de 4.2.0)? Estas diferencias tienen que ver con 
'arrays' superglobales y 'register globals' etc.

Puede ser que una programa PHP que se escribio con version 4.0.1 por
ejemplo no funcionara con version 4.2.1 sin cambios al codigo o al
servidor.

Miguel 


On Sun, 2 Jun 2002 [EMAIL PROTECTED] wrote:

> Hola
>              Resulta que tengo problemas para que funcione PHP en un
> servidor NT 4.0 con IIS 3.0 y este no funciona PHP ver. 4.2.1) ya que al
> hacer alguno de los ejemplos que adjunte (codigos) ninguno funciona.
> Hicela prueba con Apache/Win98/PHP y ahí me funciono.
>             No entinedo que es lo que pasa?; ademas segui instruciones de
> la pagina Web http://www.php.net/manual/fi/configuration.php y aun asi no
> Funciono.
>       Si alguien me puede Ayudar se lo agradecería, ya que esto me tiene
> muy complicado.
> 
> Saludos.
> Oscar Mora
> 
> PD: Con este codigo, hago test con una pagina llamada prueba.php y me di
> cuenta de que en NT no funcionó, pero si en W98.
> 
> <?php $myvar = "Hola. Este es mi primer script en PHP \n";
> //es mi primer script en PHP \n";
> echo $myvar; ?>
> <BR>
> <tr><td>Forma 1</a></td>
> <? echo "Hola, este es un mensaje de Prueba con PHP"; ?>
> <BR>
> <tr><td>Forma 2</a></td>
> <?php echo "Hola, este es un mensaje de Prueba con PHP";?>
> <BR>
> <tr><td>Forma 3</a></td>
> <script language="php"> echo "Hola, este es un mensaje de
> Prueba
> con PHP"; </script>
> <BR>
> <tr><td>Forma4</a></td>
> <% echo "Hola, este es un mensaje de Prueba con PHP"; %>
> <BR><BR>
> <? php phpinfo() ?>
> 
> 
> 

-- 
--------------------------------
n   i   n   t   i  .   c   o   m
php-python-perl-mysql-postgresql
--------------------------------
Michael Hall     [EMAIL PROTECTED]
--------------------------------

--- End Message ---
--- Begin Message ---
On Sunday 02 June 2002 05:54, Nick Patsaros wrote:
> Okay so this is what I'm trying, basically for the
> purposes of posting a news article I want to be able
> to upload supporting text files with the content of
> the article.  Here's what I've got so far... I think
> I've totally missed the mark or understood the
> documentation in the manual on this... Someone please
> set me straight:

[snip]

I'm sorry if I missed it, but what is your problem? Posting a bunch of code 
without saying what is wrong with it does not help us to help you. I'm 
assuming (from the subject of your post) that this is a follow-up to one of 
your previous posts. In that case you should've continued with your previous 
thread because:

a) it is logical to do so
b) people who have been helping you before would know what was happening and 
the "story so far".
c) when people search on the list archives in the months and years to come 
they would have one complete thread with the problem and solution that they 
can refer to.

But as you have started a new thread you shouldn't assume people have read 
your previous threads and know about whatever problems you may have. Thus you 
should state your problem clearly and explicitly.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
It's union rules. There's nothing we can do about it. Sorry.
*/

--- End Message ---
--- Begin Message ---
Hi PPL,
Please see if you can solve this problem as its driving me crazy..its for a
small affiliate program.

I have a table with the folling structure:
** table stats(Id bigint,Month tinyint,Year int,Hits bigint)



The client will be given a link like this
** http://mysite.com/affiliates/hit.php?id=155



then this will execute in the script (the connection part is done)
** update table stats set hits=hits+1 where Id=$Id and MONTH(now())=Month
and YEAR(current_date)=Year

/*The logic in the above is that I am updating "hits" by one only if "month"
and "Year" match up, so I can track which affiliate has given me the most
traffic, just 12 records for each client per year and excellient dynamic
tracking......? */



but if the fields "Month" or "Year" do not match the update will not work
and will not return anything right? so I want to execute this SQL then
** insert into stats values($Id,MONTH(now()),YEAR(CURRENT_DATE),1)


Either i'm brain dead,tired,dumb,just overworked, or this one great
problem....but I cant figure it out......

Any help appreciated, thanks in advance.
-Ryan.

--- End Message ---
--- Begin Message ---
MySQL_affected_rows()

---John Holmes...

> -----Original Message-----
> From: r [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, June 02, 2002 3:39 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Going Crazy Logic.
> 
> Hi PPL,
> Please see if you can solve this problem as its driving me crazy..its
for
> a
> small affiliate program.
> 
> I have a table with the folling structure:
> ** table stats(Id bigint,Month tinyint,Year int,Hits bigint)
> 
> 
> 
> The client will be given a link like this
> ** http://mysite.com/affiliates/hit.php?id=155
> 
> 
> 
> then this will execute in the script (the connection part is done)
> ** update table stats set hits=hits+1 where Id=$Id and
MONTH(now())=Month
> and YEAR(current_date)=Year
> 
> /*The logic in the above is that I am updating "hits" by one only if
> "month"
> and "Year" match up, so I can track which affiliate has given me the
most
> traffic, just 12 records for each client per year and excellient
dynamic
> tracking......? */
> 
> 
> 
> but if the fields "Month" or "Year" do not match the update will not
work
> and will not return anything right? so I want to execute this SQL then
> ** insert into stats values($Id,MONTH(now()),YEAR(CURRENT_DATE),1)
> 
> 
> Either i'm brain dead,tired,dumb,just overworked, or this one great
> problem....but I cant figure it out......
> 
> Any help appreciated, thanks in advance.
> -Ryan.
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Maybe a little off-topic, but does anyone have one of those USB thumb
drives? Is it possible to load up Apache, PHP, and MySQL onto one of
them? If you stripped things down, could it be installed on a 64MB drive
(with a little space left over for MySQL data and PHP scripts)? Does
anyone know if this works?
 
It seems like this would be a great way to give presentations and demos
of scripts you wrote. Just plug it into their USB port and show them
what you made.
 
Thanks for any info.
 
---John Holmes.
--- End Message ---
--- Begin Message ---
Hello,

i'm using sessions in my application but i found something strange.

when creating new session:

define('S_USER', 0);
define('S_USER_ID', 0);
define('S_USER_NAME', 1);

session_start();
$_SESSION[S_USER][S_USER_ID] = 1;
$_SESSION[S_USER][S_USER_NAME] = 'Michal';

when redirect on next page - session is empty but when a change first define to:
define('S_USER', 'user');

everything works ok.

So in session isn't possible use numeric indexes ?

Regards,
Michal Dvoracek                          [EMAIL PROTECTED]

Sorry if this question was here answered.

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

I did configure php with ldap and everything worked fine!

Then I stoped apache and started it. This cause folloving error:

Syntax error on line 205 of /usr/local/apache/conf/httpd.conf:
Cannot load /usr/local/apache/libexec/libphp4.so into server:
/usr/local/apache/libexec/libphp4.so: undefined symbol: ldap_first_reference
/usr/local/apache/bin/apachectl start: httpd could not be started

Can anybody help me in this case?

Any help is appreciated,

Andy


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

I did recompile php with different flags. Phpinfo() tells me that I am still
running the old insatllation! I did restart apache after compiling. So whats
wrong. Did I forget something?

I did
configure with some flags
make
make install

restart apache

Thanx for any help,

Andy




--- End Message ---
--- Begin Message ---
On Sunday 02 June 2002 17:32, Andy wrote:
> Hi there,
>
> I did recompile php with different flags. Phpinfo() tells me that I am
> still running the old insatllation! I did restart apache after compiling.
> So whats wrong. Did I forget something?
>
> I did
> configure with some flags
> make
> make install
>
> restart apache

1) To avoid any complications I always compile from a freshly unpacked tar.gz.
2) Stop apache before doing "make install" (not sure whether it makes any 
difference but it doesn't hurt to do so).

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
There are two ways of disliking poetry; one way is to dislike it, the
other is to read Pope.
                -- Oscar Wilde
*/

--- End Message ---
--- Begin Message ---
Hey all,

        I was recently trying my luck at dabbling in some mod_rewrite
stuff, and I have run into numerious errors. Basically my aim is to
re-write my sites URLs so instead of being say,
mysite.com/thumbnails?type=funny&gallery=4 the URL is neat, similar to
many sites who would have something like mysite.com/thumbnails/funny/4

What ways are there of achieving this (excluding, redirecting the URL
and creating the page say index.htm automatically)? I have tried
mod_rewrite for two days solid to no avail. I am not sure if it is my
poor coding or the fact that I am running apache2 on a Windows platform
which are said not to support such a module well. If any alternatives
could be proposed or even better someone could suggest a mod_rewrite
routine which would transparently transform any url like
mysite.com/whatever/4/6 to mysite.com/whatever.php it would be greatly
appreciated. So far the rewrite you see below will work with
mysite.com/whatever/ however the minute you add something onto the end
i.e. mysite.com/whatever/4/ it will raise the error "Premature end of
script headers: php.exe", instead of loading whatever.php as intended.

RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteRule ^/(.+)/(.+) $1.php [L]

Thanks for your time and hopefully someone understands what I am trying
to say :), and as always any suggestions at all would be awesome!

            Regards,
 
 
                   Scott 'INtense!' Reismanis
                   Mod Database System Administrator
                   [EMAIL PROTECTED]
                   http://www.moddb.com/ - "Every Game, Every Mod, One
Site... Go Figure!"



--- End Message ---
--- Begin Message ---
You can do this with just PHP, but I think php must be installed as a
module.
Basically place a file called thumbnails.php in your site route, then
whenever a URL like
mysite.com/thumbnails/funny/4
i called the thumbnails.php is excuted, in which you chop up the URL, and
find all your varibles...

Here is a example of some URL chopping (some code I stole from my source)
/*
Sample URLs:
/s/1/2/SchoolName/StudentName/ -Shows Student Page (with ID 2)
/s/1/0/SchoolName/    -Shows Students At School (with school ID 1)
/s/1/2/       -would work as well (name in URL for search engines)
/s/1/0/       -would work as well
/s/        -Shows Schools
*/

$url_array=explode("/",$REQUEST_URI);  //BREAK UP THE URL PATH
                       //    USING '/' as delimiter
if ($url_array[1] == 's')
 {
 if (isSet($url_array[2]))
  $url_sID=$url_array[2];      //School ID
 if (isSet($url_array[3]))
  $url_stID=$url_array[3];        //Student ID
 if (isSet($url_array[4]))
  $url_sName=$url_array[4];          //School Name (not used)
 if (isSet($url_array[5]))
  $url_stName=$url_array[5];    //Student Name (not used)
 }
/*

There was a article on phpbuilder.com that explains the benefits and
pitfalls of this idea... Here is the URL:
http://www.phpbuilder.com/columns/tim19990117.php3 and I think there was a
follow up article as well

Enjoy
Andrew

----- Original Message -----
From: "Scott 'INtense!' Reismanis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 03, 2002 5:28 AM
Subject: [PHP] Smart URLs


> Hey all,
>
> I was recently trying my luck at dabbling in some mod_rewrite
> stuff, and I have run into numerious errors. Basically my aim is to
> re-write my sites URLs so instead of being say,
> mysite.com/thumbnails?type=funny&gallery=4 the URL is neat, similar to
> many sites who would have something like mysite.com/thumbnails/funny/4
>
> What ways are there of achieving this (excluding, redirecting the URL
> and creating the page say index.htm automatically)? I have tried
> mod_rewrite for two days solid to no avail. I am not sure if it is my
> poor coding or the fact that I am running apache2 on a Windows platform
> which are said not to support such a module well. If any alternatives
> could be proposed or even better someone could suggest a mod_rewrite
> routine which would transparently transform any url like
> mysite.com/whatever/4/6 to mysite.com/whatever.php it would be greatly
> appreciated. So far the rewrite you see below will work with
> mysite.com/whatever/ however the minute you add something onto the end
> i.e. mysite.com/whatever/4/ it will raise the error "Premature end of
> script headers: php.exe", instead of loading whatever.php as intended.
>
> RewriteEngine On
> Options +FollowSymlinks
> RewriteBase /
> RewriteRule ^/(.+)/(.+) $1.php [L]
>
> Thanks for your time and hopefully someone understands what I am trying
> to say :), and as always any suggestions at all would be awesome!
>
>             Regards,
>
>
>                    Scott 'INtense!' Reismanis
>                    Mod Database System Administrator
>                    [EMAIL PROTECTED]
>                    http://www.moddb.com/ - "Every Game, Every Mod, One
> Site... Go Figure!"
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Does anyone know exactly what the status is on the Verisign Payflow Pro 
support for Windows?  I've read the manual and all the user submitted 
comments.  I keep seeing some reference made to a "php_pfpro.dll" that 
doesn't seem to exist.  Is it still in development?

It seems most people just exec() the PFPRO.exe, passing the arguments on 
the command line.  This seems less than ideal and I would much rather use 
straight API calls if I can.

For anyone else in this situation, what was the best 
solution?  Unfortunately, I am tied pretty much to Windows for the 
forseeable future.  What about coding a Java object to do the dirty work 
and letting PHP interact with it?

By the way, where is a good place to find out the status on current 
development on the PHP language?

Thanks!

Justin

--- End Message ---

Reply via email to