Fw: [PHP] Implement PHP within a string

2002-07-25 Thread Kevin Stone

Sure.  You want the eval() function.  Can be a little tricky but you'll get
it.
http://www.php.net/manual/en/function.eval.php
-Kevin


- Original Message -
From: "Joshua E Minnie" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 25, 2002 12:54 PM
Subject: [PHP] Implement PHP within a string


> Is it possible to run PHP that is embedded within a string?  I have a file
> that is read into a string and returned to the browser, how can I run that
> PHP?
>
> i.e.
>
>  function something() {
> // this is set earlier by other functions
> // $str = "some html codegetForm("guest"); ?>some
more
> html code";
>
> return ($str);
> }
>
> echo $obj->something();
>
>
> --
> Joshua E Minnie/CIO
> [EMAIL PROTECTED]
> Phone: 616.276.9690
> Fax: 616.342.8750
> Nextel: 616.862.2847
>
> "Don't work for recognition, but always do work worthy of recognition."
>
>
>
> --
> 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




Fw: [PHP] mySQL Queries using PHP's SESSION variables

2002-07-25 Thread Kevin Stone

You might be making it more difficult than it needs to me.  You're not
dealing with a huge number of queries here so why not just loop it?  I would
simply loop through the $_SESSION array and query the dbase for each item.

foreach ($_SESSION as $key => $val)
{
$query = "SELECT * FROM inventory WHERE itemnumber = '$val'";
$result = mysql_query($query, $db);
// .. blah blah blah...
}

-Kevin

- Original Message -
From: "Anup" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 25, 2002 12:51 PM
Subject: [PHP] mySQL Queries using PHP's SESSION variables


> Hello, I am stuck here. In the name of efficiency I want to lower the
number
> of callls to the database. So I am trying to give the most stringent query
> possible. This is the problem: I have stored the surfers shopping cart,
> where each item is stored as a session variable.Now on the database I have
> ALL inventory items, but I want to only display the details of what the
user
> has in his cart.
> eg. : I want something like this:
>
> $result = mysql_query("SELECT * from Inventory where ItemNumber is in
> $HTTP_SESSION_VARS");
> //  I need proper syntax to replace "is in"
>
> where Inventory has, ItemNumber (unique), Price, ItemName.
> So say the surfer has three items in the Session, then I stored the three
> unique ItemNumbers.
> Then with the above query I can get the rest of the information to
represent
> to the user.
> I am looking down the avenues of a Set datastyp or maybe Enum, but I don't
> know if it will help.
>
>
>
> --
> 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




Re: [PHP] Help with msql_fetch_array()

2002-07-24 Thread Kevin Stone

That should definitely be working.  Only thing I can think of is that you're
database name isn't correct.  You're certain "news" is the full name of the
database.. I mean it's not "news_com" or something like that?  The $link
must be valid becuase the script isn't ending with "Couldn't make
connection".  So that just leaves the mysql_select_db() function.  And the
only thing that will make that function return FALSE is if it can't find the
database name for that user on the specified server.
-Kevin

- Original Message -
From: "Matthew Bielecki" <[EMAIL PROTECTED]>
To: "PHPCoder" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Cc: "php-general" <[EMAIL PROTECTED]>
Sent: Wednesday, July 24, 2002 2:07 PM
Subject: Re: [PHP] Help with msql_fetch_array()


> Well I think you were correct about not connecting to the db, but I don't
> understand why.  I wrote another little script just to test the
> connection.
>
> 
> $link = mysql_connect("servername","username","password")
>   or die("Couldn't make connection.");
> $diditwork = mysql_select_db("news", $link);
>
> if ($diditwork <> FALSE)
>{
>   echo "got the db..yea!";
>   echo $link;
>}
>else
>{
>   echo "didnt get db...bo";
>   echo $link;
>}
> ?>
>
> This returns "didnt get db...booResource id #1
>
> I don't understand how I can get a resource ID but then not be able to use
> the "news" database.  Like I described earlier, this happens with my other
> db as well.  I can connect to the db through the console or any other
> client I have on the physical server and do whatever I want with the db's,
> I'm just having problems with php.
>
> Thanks again for your help!!
>
>
>
>
>
>
>
>
>
> PHPCoder <[EMAIL PROTECTED]>
> 07/24/02 01:50 PM
>
>
> To: Matthew Bielecki <[EMAIL PROTECTED]>
> cc: php-general <[EMAIL PROTECTED]>
> Subject:Re: [PHP] Help with msql_fetch_array()
>
>
> I can almost guarantee that it's not the second line that is "failing",
> the problem here is that $result is not containing naything, and that is
> normally due to the fact that you are not connecting to the db, or the
> table "tablename" is not there.
>
> I use the following format as my "standard" MySQL connect and query
> snippet:
>
> $link = @mysql_connect("localhost",$username,$password) or die ('Could
> not connect!'); //@ suppresses the default error message generated by
> this function and the "or die()" bit kills the script right then and
> there should it not be able to connect.
> mysql_select_db("YOUR_DB_NAME",$link);
> $sql = "select * from your_table_name";
> if ( $result = mysql_query($sql)) {  // checks to see if $result
> contains anything before it even tries to fetch an associative array
> from it.
>  $row = mysql_fetch_assoc($result);
> } else {
> echo "Empty result set!";
>
> Note also that I use mysql_fetch_assoc and NOT mysql_fecth_array, as 9
> out of 10 times, you don't need the array element id's that is returned
> by mysql_fetch_array.
>
> Matthew Bielecki wrote:
>
> >I have a couple of scripts that fail with the error of:
> >Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
> result
> >resource in...
> >
> >I'm new to both SQL and PHP and I'm wondering if I have some setting
> >turned off or what.
> >
> >Here's the piece of code that is failing (the second line fails):
> >
> >$result = mysql_db_query($dbname, "SELECT * FROM tablename ORDER BY id");
> >$row = mysql_fetch_array($result);
> >
> >
> >Thanks for your help in advance!!
> >
>
>
>
>
>


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




Re: [PHP] Help with msql_fetch_array()

2002-07-24 Thread Kevin Stone

You beat me too the punch and I think you explained it better than me, but
just one minor little thing to note.  Where you said..

"if ( $result = mysql_query($sql)) "

This is not a valid way to check if the query has returned anything.
mysql_query() returns FALSE on error.  So if there was no error but there
also wasn't anything returned then the object stored in $result wiill more
than likely evaluate to TRUE.  For the determining factor you should count
the number of rows with mysql_num_rows($result).  If the returned value is
zero then you know it hasn't returned anything.

-Kevin

- Original Message -
From: "PHPCoder" <[EMAIL PROTECTED]>
To: "Matthew Bielecki" <[EMAIL PROTECTED]>
Cc: "php-general" <[EMAIL PROTECTED]>
Sent: Wednesday, July 24, 2002 11:50 AM
Subject: Re: [PHP] Help with msql_fetch_array()


> I can almost guarantee that it's not the second line that is "failing",
> the problem here is that $result is not containing naything, and that is
> normally due to the fact that you are not connecting to the db, or the
> table "tablename" is not there.
>
> I use the following format as my "standard" MySQL connect and query
snippet:
>
> $link = @mysql_connect("localhost",$username,$password) or die ('Could
> not connect!'); //@ suppresses the default error message generated by
> this function and the "or die()" bit kills the script right then and
> there should it not be able to connect.
> mysql_select_db("YOUR_DB_NAME",$link);
> $sql = "select * from your_table_name";
> if ( $result = mysql_query($sql)) {  // checks to see if $result
> contains anything before it even tries to fetch an associative array
> from it.
>  $row = mysql_fetch_assoc($result);
> } else {
> echo "Empty result set!";
>
> Note also that I use mysql_fetch_assoc and NOT mysql_fecth_array, as 9
> out of 10 times, you don't need the array element id's that is returned
> by mysql_fetch_array.
>
> Matthew Bielecki wrote:
>
> >I have a couple of scripts that fail with the error of:
> >Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
result
> >resource in...
> >
> >I'm new to both SQL and PHP and I'm wondering if I have some setting
> >turned off or what.
> >
> >Here's the piece of code that is failing (the second line fails):
> >
> >$result = mysql_db_query($dbname, "SELECT * FROM tablename ORDER BY id");
> >$row = mysql_fetch_array($result);
> >
> >
> >Thanks for your help in advance!!
> >
>
>
>
> --
> 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




Re: [PHP] Help with msql_fetch_array()

2002-07-24 Thread Kevin Stone

Try using mysql_query(); instead of mysql_db_query();  The SQL query is the
first parameter in this function.  The second parameter is a pointer
connecting to the mysql server.  The pointer is generated by mysql_connect()
and you'll also need to select the database with mysql_select_db().  But
it's the standard way..

$db = mysql_connect("localhost", "username", "password");// connect to
mysql server
mysql_select_db("mytable", $db);
// select database by name
$query = "SELECT * FROM mytable ORDER BY id"; // define query to
submit
$result = mysql_query($query, $db);  //
submit query
if (mysql_num_rows($result) > 0)
// skip if no rows were found
{
while ($row = mysql_fetch_array($result))
{
// .. do whtever..
}
}
mysql_close($db);

It's also a common practice to put the first couple of lines in a file to
include() back into your main script so that you can protect your useranme
and password.

Good luck.
-Kevin

- Original Message -
From: "Matthew Bielecki" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 24, 2002 10:34 AM
Subject: [PHP] Help with msql_fetch_array()


> I have a couple of scripts that fail with the error of:
> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
result
> resource in...
>
> I'm new to both SQL and PHP and I'm wondering if I have some setting
> turned off or what.
>
> Here's the piece of code that is failing (the second line fails):
>
> $result = mysql_db_query($dbname, "SELECT * FROM tablename ORDER BY id");
> $row = mysql_fetch_array($result);
>
>
> Thanks for your help in advance!!


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




Fw: [PHP] Getting the day if given a date

2002-07-23 Thread Kevin Stone

A combination of the strtotime() function and date() or getdate() functions
should do what you want..
http://www.php.net/manual/en/function.strtotime.php

-Kevin

- Original Message -
From: "Cirkit Braker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 23, 2002 6:24 PM
Subject: [PHP] Getting the day if given a date


> Is there any way to get the day of the week given a date.
>
> For example if the date is the 22nd July 2003 I want to know if it will be
a
> Monday or Wednesday, etc..
>
> Any help appreciated.
>
>
>
> --
> 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




Re: [PHP] Re: parsing

2002-07-23 Thread Kevin Stone

Lee, yes you're right.  Using single quotes to denote a litteral string does
speed things up a bit.  My bench sped up by about .08 seconds over 10,000
echos.  That's about 5 pages worth of text.  Is .08 seconds worth worrying
about?  I'm gonna go out a limb here and say.. no.  :)
-Kevin


- Original Message -
From: "Lee Doolan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 23, 2002 1:40 PM
Subject: [PHP] Re: parsing


> > "Dave" == Dave At Sinewaves Net <[EMAIL PROTECTED]> writes:
>
> Dave> Okay, I want to know if anybody has a clue which is more
> Dave> efficient, processorwise/parsingwise:
>
> Dave> this: -- echo
> Dave>
"".$somevar."".$somevardesc."";
>
> Dave> or this: -- echo
> Dave>
"{$somevar}{$somevardesc}";
>
>
> Dave> I almost always use the first method (just seems more
> Dave> readable to me), but with all of the discussion popping up
> Dave> about curly brackets, i was wondering if it really makes a
> Dave> difference?  Any vets out there care to put in their $0.02?
>
> I bet that this would beat the pants off of both:
>
> echo ''. $somevar . '' . $somevardesc .
'';
>
>
> --
> When the birdcage is open,   | donate to causes I care about:
> the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25
> but the virtuous one stays.  |
>
> --
> 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




Re: [PHP] parsing

2002-07-23 Thread Kevin Stone

I just benched it.  If there is a difference in performance then it is too
small to detect with microseconds.  I'd say there's no need to parse the
vars by hand unless the syntax requires it.
-Kevin

- Original Message -
From: "Dave at Sinewaves.net" <[EMAIL PROTECTED]>
To: "PHPlist" <[EMAIL PROTECTED]>
Sent: Tuesday, July 23, 2002 1:01 PM
Subject: [PHP] parsing


> Okay,
>
> I want to know if anybody has a clue which is more efficient,
> processorwise/parsingwise:
>
> this:
> --
> echo
>
"".$somevar."".$somevardesc."";
>
> or this:
> --
> echo
"{$somevar}{$somevardesc}";
>
>
> I almost always use the first method (just seems more readable to me), but
> with all of the discussion popping up about curly brackets, i was
wondering
> if it really makes a difference?  Any vets out there care to put in their
> $0.02?
>
> Dave Tichy
> http://sinewaves.net/
>
>
> --
> 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




Re: [PHP] Comma question

2002-07-22 Thread Kevin Stone

Curly braces {} are sometimes required for PHP to properly parse variables
within quoted strings.  Good example might be defining variable-variables
within a quoted string  "${$myvarvar}".  However I do not believe that curly
braces are required in this particular string.

As for the comma I believe it does the same thing as the period.  It will
concatonate the quoted string with the output of the htmlspecialchars()
function within the echo statement.

-Kevin

- Original Message -
From: "B i g D o g" <[EMAIL PROTECTED]>
To: "PHP GEN" <[EMAIL PROTECTED]>
Sent: Monday, July 22, 2002 4:34 PM
Subject: [PHP] Comma question


> Tried to check the archive, but it is offline...
>
>
> What does the "," and "{}" do in this type of statement?
>
> Example:  echo "{$strName}", htmlspecialchars(
$teststr );
>
> Thanks,
>
>
> .: B i g D o g :.
>
>
>
> --
> 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




Re: [PHP] Refreshing session variables

2002-07-18 Thread Kevin Stone

I think you're missing some fundamental concepts of sessions here.  You must
think of the session as a file that you're going to include into the script
(becuase.. that's litteraly what it is).  But instead of using include()
you're going to use session_start();

(refresh)";
?>

When you activate this script for the first time three things happen..
1) the session file is created on the server
2) a cookie with the Session ID is stored on your computer
3) $myvar = 'peek a boo';  is added to the session file

When you click refresh to reactivate the script, PHP will match the session
id stored in the cookie to the file stored on the server, and include the
variables into the actively running script.  $myvar is now available and the
contents are printed to the screen then unregistered (removed) from the
session file.  The third time around it's going to stop in the if() portion
and reregister the variable.  Adding and removing lines from a file and
including them into your script..  it's no more complicated than that.

Hopefully now you'll be able to fix your problem and learn to use sessions
reliably and effectively.   :)

-Kevin

- Original Message -
From: "N. Pari Purna Chand" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 18, 2002 3:36 PM
Subject: [PHP] Refreshing session variables


> Hi guys,
>
> I got a problem with refreshing session variables.
> When the following code is run , for the first time
> both $z and $secretstring are showing same values.
>
> But when page is refreshed, the $secretstring variable
> is still having the old value no matter how many times
> I click refresh.
>
> Am I missing some thing  ?
>
>  $x = mt_rand (1000,1);
> $y = mt_rand (1000,1);
>
> $text = $x.$y;
> $secretstring =$x.$y;
>
> session_start();
> if(session_is_registered("secretstring")){
> session_unregister("secretstring");
> }
> session_register("secretstring");
>
> echo "".$text;
> echo "".$secretstring;
>
> ?>
>
>
> --
> 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




Re: [PHP] Check for Associative Array

2002-07-18 Thread Kevin Stone

foreach ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
//...
}

Is this what you need?
http://www.php.net/manual/en/function.mysql-fetch-array.php

-Kevin

- Original Message -
From: "Henning Sittler" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 18, 2002 10:57 AM
Subject: [PHP] Check for Associative Array


> What's the best way to check for an Associative Array?  There is no
> is_assoc() or similiar function listed in the manual (I don't think
anyway).
>
> I'm using mysql_fetch_array() and I want to foreach only the assoc. part
of
> the array without using mysql_fetch_assoc():
>
> foreach ($arr as $key=>$value) {
> echo "$key:$value";
> }
>
> But of course it show both the indexed array and the assoc array contents.
> Is there an existing function to check this, or should I do one of these
> things inside the foreach loop:
>
> A) set $last=value and just check if $value = $lastval
>
> B) check if the $key is just a number or just a string
>
> C) $key += 1
>
>
> ?? Thanks,
>
>
> Henning Sittler
> www.inscriber.com
>
> --
> 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




Re: [PHP] sorting and searching an Array

2002-07-17 Thread Kevin Stone

Instead of an indexed array build an associative array and sort with one of
the built-in PHP functions..

$myary = array (
'mrgouldian' => '[EMAIL PROTECTED]',
'myname'=> '[EMAIL PROTECTED]');
ksort($myary);

-Kevin

- Original Message -
From: <[EMAIL PROTECTED]>
To: "php-general" <[EMAIL PROTECTED]>
Sent: Wednesday, July 17, 2002 1:52 PM
Subject: [PHP] sorting and searching an Array


> After I read this file into an array (small sample of file below) I need
to sorted it by the name at
>  the end of each line and then echo out only the ones that the name
>  equals the name in a search variable.
>
>  Also could somebody recommend a PHP book that covers a lot of info on
>  working with text files. It seams to be very little info in any of the
>  boos I have now. It is sort of skipped over a lot
>
> [EMAIL PROTECTED]   mrgouldian
> [EMAIL PROTECTED]   myname
> [EMAIL PROTECTED] mrgouldian
> [EMAIL PROTECTED] mrgouldian
> [EMAIL PROTECTED]   myname
> [EMAIL PROTECTED] mrgouldian
> [EMAIL PROTECTED]   myname
> [EMAIL PROTECTED]   myname
> [EMAIL PROTECTED] mrgouldian
> [EMAIL PROTECTED]   myname
>
>
> --
> 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




Fw: [PHP] Someone Help please

2002-07-17 Thread Kevin Stone

Parse all lines of a txt file into an array..
$ary = explode("\n", $results);
-Kevin

- Original Message -
From: "Chris Crane" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 17, 2002 11:16 AM
Subject: [PHP] Someone Help please


> I am getting data froma website for stock information. If I type in the
> brower the URL I get a text file display list this;
>
> Date,Open,High,Low,Close,Volume
> 16-Jul-02,7.92,8.10,7.68,7.82,605500
> 15-Jul-02,7.98,8.02,7.59,8.02,577200
> 12-Jul-02,7.80,8.00,7.57,7.95,411100
> 11-Jul-02,7.82,7.94,7.34,7.80,802400
>
> Now I want to break each line and then seperate each line by the commas.
The
> amount of linesin the file is never known so I assume I have to use
> something like a foreach or while statement,but I am not sure the best way
> to do it. This is what I have so far.
>
>  $Symbol = "IKN"; $LookupUrl =
> "http://demos.inxdesign.com/download?sym=$Symbol&format=.txt";; $Results =
> implode('', file("$LookupUrl"));
>  $Data = array(); split("\n", $Results) = array_push($Data, $line)
>
> The end result I am trying to get is each line to be an element in an
array.
> Later I will go back and stepthrough each element of the array and then
> split that by the commas and have it output into an HTML table.At least
this
> is the best way I can think to deal with it. I suppose a better way to do
> this would be to make this an associative array and have the data of each
> line be associated with the date then I could producea variable something
> like $StockData[16-Jul-02][value], but I don't know how to do any of that.
>
>
>
>
>
>
>
>
>
>
> --
> 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




Fw: [PHP] Timer

2002-07-16 Thread Kevin Stone

Store a timestamp in a file.  When the bot is activated retrieve the old
timestamp and calculate the difference between then and how.  Store that
value in another file or database.  Update the file with a fresh timestamp.
-Kevin

- Original Message -
From: "Thomas "omega" Henning" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 16, 2002 11:22 AM
Subject: [PHP] Timer


> Is this possible:
>
> Im making a bot in PHP and i need a timer. Lets say noone ses anything for
> 2mins in the channel after that the bot ses something. And if the bot
> recieves an msg the timer clears. Is this possible 2 be done?
>
> Thomas "omega" Henning
>
>
>
>
> --
> 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




Re: [PHP] Online Document

2002-07-15 Thread Kevin Stone

I would recommend applying a simple templating system to the file.  Anything
that needs to be extracted out of the page for navigation purposes will be
enclosed in special characters such as a chapter title.. [:chapter =
"CHAPTER 2: Beating a Dead Horse":].  A very simple script parses the file
and extracts these strings to build an interactive Table of Contents.
-Kevin

- Original Message -
From: "Glenn Antoine" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 15, 2002 3:19 PM
Subject: [PHP] Online Document


> We are currently looking to put a very sizable document on a website so
> that it will be easily.  The document is currently maintained by a
> single user in a MS Word format.  Ideally it would be very nice if the
> index would take the user to the index of the appropriate section of the
> document, which would then drill down to the exact contents of that
> section.  The document should also be easily updateable, via her web
> browser, by the user that has been tasked with maintaining the manual.
> Any suggestions for the design of such a project would be greatly
> appreciated.
>
> TIA
> Glenn
>
>
> --
> 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




Re: [PHP] cleaning HTML TAGS (headed)

2002-07-15 Thread Kevin Stone

Sorry.. I screwed up my preg_match string.  It should have $file as the
second parameter and also included an 'i' after the closing delimeter for a
case-insensitive search.

preg_match('/(.*)<\/title>/i', $file, $result);

- Original Message -
From: "Kevin Stone" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Juan Pablo Aqueveque" <[EMAIL PROTECTED]>
Sent: Monday, July 15, 2002 2:33 PM
Subject: Re: [PHP] cleaning HTML TAGS (headed)


> This isn't any more effective but it is fewer lines of code..
>
> $file = implode('', file("file.html"));
> preg_match('/(.*)<\/title>/', $result);
> $title = $result[1];
>
> -Kevin
>
> - Original Message -
> From: "Juan Pablo Aqueveque" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, July 15, 2002 8:07 AM
> Subject: [PHP] cleaning HTML TAGS (headed)
>
>
> > Hi everyone.
> > Sorry for the trivial question.
> >
> > I want insert a .html inside of one .php file but without 
and
> >  tags.
> >
> > I built a routine (shown it down) it's running OK but show me the title
> > () of my html.
> >
> > somebody can help with a routine a little me more effective than mine?
> >
> > Thanks in advance.
> >
> > --jp
> >
> >  > My Routine:
> >
> > if ($myFile = fopen("html.html","r"))
> > {
> >  while(!feof($myFile))
> >  {
> >  $myLine = fgetss($myFile, 256,"");
> >  $myLine = ereg_replace("\n","",$myLine);
> >  print($myLine);
> >
> >
> >  }
> > }
> > else
> >  {
> >  echo  "file no found ";
> >
> >  }
> >
> >
> >
> > 
> > Juan Pablo Aqueveque <[EMAIL PROTECTED]>
> > Ingeniero de Sistemas
> > Departamento de Redes y Comunicaciones http://www.drc.uct.cl
> > Universidad Católica de Temuco.
> > Tel:(5645) 205 630 Fax:(5645) 205 628
> >
> >
> > --
> > 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




Re: [PHP] cleaning HTML TAGS (headed)

2002-07-15 Thread Kevin Stone

This isn't any more effective but it is fewer lines of code..

$file = implode('', file("file.html"));
preg_match('/(.*)<\/title>/', $result);
$title = $result[1];

-Kevin

- Original Message -
From: "Juan Pablo Aqueveque" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 15, 2002 8:07 AM
Subject: [PHP] cleaning HTML TAGS (headed)


> Hi everyone.
> Sorry for the trivial question.
>
> I want insert a .html inside of one .php file but without  and
>  tags.
>
> I built a routine (shown it down) it's running OK but show me the title
> () of my html.
>
> somebody can help with a routine a little me more effective than mine?
>
> Thanks in advance.
>
> --jp
>
>  > My Routine:
>
> if ($myFile = fopen("html.html","r"))
> {
>  while(!feof($myFile))
>  {
>  $myLine = fgetss($myFile, 256,"");
>  $myLine = ereg_replace("\n","",$myLine);
>  print($myLine);
>
>
>  }
> }
> else
>  {
>  echo  "file no found ";
>
>  }
>
>
>
> 
> Juan Pablo Aqueveque <[EMAIL PROTECTED]>
> Ingeniero de Sistemas
> Departamento de Redes y Comunicaciones http://www.drc.uct.cl
> Universidad Católica de Temuco.
> Tel:(5645) 205 630 Fax:(5645) 205 628
>
>
> --
> 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




Re: [PHP] PHP codes and variables

2002-07-12 Thread Kevin Stone

In that case you'll have to use the output buffering method ob_start();  The
include() function parses and executes any valid PHP code within the file
and produces output (if any).  Output buffering captures the display output
and stores it until you clean the buffer or the script terminates.

ob_start();
include ("header.php");
include ("body.php");
include ("footer.php");
$out = ob_get_contents();
ob_end_clean();

echo $out;

Note: instead of ob_end_clean() you can also do ob_end_flush() to send the
output to the display and destroy the buffer simultaneously.

-Kevin


- Original Message -
From: "J. Alden Gillespy" <[EMAIL PROTECTED]>
To: "PHP-general" <[EMAIL PROTECTED]>
Sent: Friday, July 12, 2002 12:42 PM
Subject: Re: [PHP] PHP codes and variables


> Which method makes it possible to process any variables in the included
> file?  See, I have variables in the included file that are defined in the
> page that's calling it.
>
> J. Alden Gillespy (DJ Rage)
> Broadcasting on Test Pattern Radio
> Shock Rock!  Every Sunday 5-8pm edt (21-0 gmt)
> http://www.thetestpattern.com
>
> - Original Message -
> From: "Kevin Stone" <[EMAIL PROTECTED]>
> To: "PHP-general" <[EMAIL PROTECTED]>
> Sent: Friday, July 12, 2002 2:35 PM
> Subject: Re: [PHP] PHP codes and variables
>
>
> > Or use implode instead of join makes skips the step of extracting the
> > index..
> > $file = implode ('', file ("afile.html"));
> >
> > If you'll be sending more output than just one file then another
favorite
> > method is this..
> > ob_start();
> > readfile("file1.txt");
> > readfile("file2.html");
> > $output = ob_get_contents();
> > ob_end_clean();
> >
> > -Kevin
> >
> > - Original Message -
> > From: "Miguel Cruz" <[EMAIL PROTECTED]>
> > To: "J. Alden Gillespy" <[EMAIL PROTECTED]>
> > Cc: "Groups - PHP-General" <[EMAIL PROTECTED]>
> > Sent: Friday, July 12, 2002 12:17 PM
> > Subject: Re: [PHP] PHP codes and variables
> >
> >
> > > On Fri, 12 Jul 2002, J. Alden Gillespy wrote:
> > > > Anyone know how to do have a variable equal the contents of a file?
I
> > tried
> > > > the include function, but it just prints the file out on the screen
> > rather
> > > > than including the contents in the variable itself.  I need help
with
> > this
> > > > ASAP.  Thanks.
> > >
> > > $variable = join('', file('path/to/file'));
> > >
> > > miguel
> > >
> > >
> > > --
> > > 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




[PHP] How do I send files with HTTP socket post (PostToHost)

2002-07-12 Thread Kevin Stone

Okay enough answering questions this week, now I have a question to ask.  :)

I have a situation where two web servers need to share files with one
another.  FTP is not an option.  So I am resorting to HTTP socket
connection.  I am able to open the connection (using Rasmus's PostToHost
function) to PHP scripts running on both servers and send structured queries
back and forth.  This was easy.  The queries can trigger actions so that I
can communicate seamlessly and do work.  But I cannot for the life of me
figure out how to send whole files (mostly image files).  There's obviously
more to it than just sending the ASCII conversion.

I really don't have any meaningful code to show you.  The code is all
standard anyway so if you know what I'm talking about then you have probably
coded it yourself at one point or another.  Are there any tutorials or
examples out there that will show me how to send files using fsocketopen()
and POST method?

Much thanks!
Kevin Stone
Helpelf, Inc.


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




Re: [PHP] PHP codes and variables

2002-07-12 Thread Kevin Stone

Or use implode instead of join makes skips the step of extracting the
index..
$file = implode ('', file ("afile.html"));

If you'll be sending more output than just one file then another favorite
method is this..
ob_start();
readfile("file1.txt");
readfile("file2.html");
$output = ob_get_contents();
ob_end_clean();

-Kevin

- Original Message -
From: "Miguel Cruz" <[EMAIL PROTECTED]>
To: "J. Alden Gillespy" <[EMAIL PROTECTED]>
Cc: "Groups - PHP-General" <[EMAIL PROTECTED]>
Sent: Friday, July 12, 2002 12:17 PM
Subject: Re: [PHP] PHP codes and variables


> On Fri, 12 Jul 2002, J. Alden Gillespy wrote:
> > Anyone know how to do have a variable equal the contents of a file?  I
tried
> > the include function, but it just prints the file out on the screen
rather
> > than including the contents in the variable itself.  I need help with
this
> > ASAP.  Thanks.
>
> $variable = join('', file('path/to/file'));
>
> miguel
>
>
> --
> 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




Re: [PHP] Re: Table Making

2002-07-11 Thread Kevin Stone

Well I guess I'd better get my 2 cents in.  :)   There is a natural
progression to HTML tables so why fight it?  I think the cleanest way to do
this would be to reorder the array instead of trying to come up with a
clever way to build the table.  Set the number of table rows you want then
use that as an offset to the dates array.  Simply ask
if(isset($dates[$i+$rowoffset]))..  five lines of code in a for() loop and
you got it licked.  Then you can run through the new array and generate the
HTML table linearly without any tricks and pad with the necessary number of
cells.
-Kevin

- Original Message -
From: "Jason Soza" <[EMAIL PROTECTED]>
To: "Michael Davey" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, July 11, 2002 3:43 PM
Subject: Re: [PHP] Re: Table Making


> I really wish I was at home right now so I could test this out... I'll
> certainly give this a shot tonight. Taking someone else's earlier
> suggestion and tweaking it a bit, I was wondering if the following
> might work:
>
> $cells = 10; //set desired number of cells per column
> $numRows = mysql_num_rows($result); //determine number of rows
> $numCols = ceil($numRows/$cells); //determine number of columns needed
>
> print " cellspacing=\"0\">\n"; //start main table
>
> for($i=0; $i<$numCols; $i++) {
>
> echo "\n"; //setup main row/cell
>
> echo " \">\n"; //setup secondary table
>
> while($dataArray = mysql_fetch_array($result)) { //print
> results of SQL in secondary table
> extract($dataArray);
> $n++;
>
> printf("\n href=\"year.asp?year=%\">%s\n", $grad_year, $grad_year);
>
> if ($n==$cols) {
> echo ""\n; //close secondary table at
> 10 cells
> }
>
> echo "\n"; //close main row/cell
>
> }
>
> echo "\n"; //close main table
>
>
> Jason Soza
>
> - Original Message -
> From: "Michael Davey" <[EMAIL PROTECTED]>
> Date: Thursday, July 11, 2002 12:01 pm
> Subject: [PHP] Re: Table Making
>
> > How about working out the length of the column (by dividing the
> > number of
> > rows by the number of cols you want), dump your results into an
> > array and
> > using the col length as an offset to pick through the resulting table?
> >
> > // $data is an array of results
> >
> > $rows = count ($data)
> > $row_len = round ($rows / 3); // three cols
> >
> > print "";
> > for ($i = 0; $i < $row_len; $i++)
> > {
> >print "";
> >print "".$data[$i]."";
> >print "".($row_len + $i < $rows)?$data[$row_len +
> > $i]:" "."";
> >print "".((2 * $row_len) + $i < $rows)?$data[(2 *
> > $row_len) +
> > $i]:" "."";
> >print ""
> > }
> > print "";
> >
> > This is off the cuff code and I think the row length's might need
> > some extra
> > checking, but sth like this should work... (crosses fingers)
> >
> > Mikey
> >
> >
> >
> > --
> > 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




Re: [PHP] Re: Development Tools

2002-07-10 Thread Kevin Stone

Matt, you're little behind on the times.  Most of the Homesite 5.0 editor
has already been integrated into DreamweaverMX.  They even have a Homesite
"mode" which is what I use.  :)

There are many benefits to DreamweaverMX.  The FTP functionality in is
completely seamless and works very well.  DWMX's "site" feature is similar
to Homesite "projects" feature except that it actually works right.  The
coolest feature of DWMX is it's properties bar which makes updating HTML
tags a breeze.

That being said DWMX is not without problems.  It's slower than Homesite5..
which its self was a dog.  The code coloring doesn't work as well as in
Homesite.  There is no instant way to browse an HTML file.  There seems to
be a bug in the Find/Replace.  Then there are little user interface issues
uch as TAB which doesn't work intuitively (tab a selected line and you
expect to replace the line with a tab but no it tabs the line to the right..
it doesn't make sense).  You can't triple click a line to select it.  Line
indentation is a three key shortcut.. hardly a short cut.  Little things
like that.

Anyway there are more things I like about DWMX than dislike.  I suggest you
d'l the 30 day demo and check it out.  http://www.macromedia.com

-Kevin


- Original Message -
From: "Matthew K. Gold" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, July 10, 2002 1:51 PM
Subject: Re: [PHP] Re: Development Tools


> The difference between Dreamweaver and Homesite is that Homesite is easier
> to
> customize, and it doesn't mess with your code the way that Dreamweaver
does.
> If you're happy with Dreamweaver, you should stick with it.  But if you
want
> more control over your code, you
> should consider switching.
>
> Of course, Macromedia recently bought Allaire, so who knows what the next
> version of Homesite will look like...
>
> Matt
>
>
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, July 10, 2002 3:39 PM
> Subject: [PHP] Re: Development Tools
>
>
> > For those of you using HomeSite, is it worthwhile for me to install it
if
> I
> > already have DreamWeaver 4 on my PC?  Someone said HomeSite is basically
> > DreamWeaver without the UI interface so I'm wondering if it's possible
to
> use
> > DreamWeaver the same way I would Homesite.
> >
> > Jesse
> >
> > --
> > 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




Re: [PHP] isset

2002-07-09 Thread Kevin Stone

Look at that we get an easy question and 50 people reply.  Today has just
been our day for spam.  *LOL*  :)
-Kevin

- Original Message -
From: "Kevin Stone" <[EMAIL PROTECTED]>
To: "Preston Wade" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, July 09, 2002 4:37 PM
Subject: Re: [PHP] isset


> 
> 
> 
>
> if (isset($_POST['submit'])){}
> // or //
> if (isset($HTTP_POST_VARS['submit']))
>
> If register globals is ON you can access the variable directly..
> if (isset($submit)) {}
>
> Otherwise you can extract the post array before testing the variable..
> extract($_POST);
> if (isset($submit)) {}
>
> Hope this gets you started.  Read up on the manual.  http://www.php.net.
:)
> -Kevin
>
>
> - Original Message -
> From: "Preston Wade" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, July 09, 2002 4:20 PM
> Subject: [PHP] isset
>
>
> > Hello All,
> >
> > I am trying to use the isset function to test if the page has been
> > submitted, but it seems as though it is not working.  I am wondering is
> > there a configuration option that is messing with the functionality of
> > isset.
> >
> > Any help would be appreciated.
> >
> > Thanks,
> > Preston Wade
> >
> >
> > --
> > 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




Re: [PHP] isset

2002-07-09 Thread Kevin Stone





if (isset($_POST['submit'])){}
// or //
if (isset($HTTP_POST_VARS['submit']))

If register globals is ON you can access the variable directly..
if (isset($submit)) {}

Otherwise you can extract the post array before testing the variable..
extract($_POST);
if (isset($submit)) {}

Hope this gets you started.  Read up on the manual.  http://www.php.net.  :)
-Kevin


- Original Message -
From: "Preston Wade" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 09, 2002 4:20 PM
Subject: [PHP] isset


> Hello All,
>
> I am trying to use the isset function to test if the page has been
> submitted, but it seems as though it is not working.  I am wondering is
> there a configuration option that is messing with the functionality of
> isset.
>
> Any help would be appreciated.
>
> Thanks,
> Preston Wade
>
>
> --
> 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




Re: [PHP] dumb

2002-07-09 Thread Kevin Stone

Thank you brendan my point from the beginning.  Outlook users Message->Block
Sender.  Takes you two seconds.
-Kevin

- Original Message -
From: "Brendan P. Caulfield" <[EMAIL PROTECTED]>
To: "PHP " <[EMAIL PROTECTED]>
Sent: Tuesday, July 09, 2002 2:53 PM
Subject: [PHP] dumb


> this is dumb.  can we just ignore this and move.  we are all smart enough
> to block his posts.  let's just do it and quit wasting all of our time and
> get back to doing what we do here.
>
> respectfully,
>
> -brendan
>
>
>
> --
> 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




Re: [PHP] Trying to locate an image file name from another site

2002-07-09 Thread Kevin Stone

If the filename is in fact a timestamp then you can find it using a brute
force method.  All you need is a for() loop and fopen().  Start your search
at midnight the previous night and add one second to the timestamp each
itteration.  If the fopen() function returns something other than FALSE then
you know you've found a file.  There are only 86400 seconds in a day..
peanuts.  Probably take PHP two minutes to run through, if that.  You could
put the script on a cron job to have it give you the new filename each
morning.  You may even find that the script building the image file is also
on a timer.. so after a few days you may be able to skip the brute force
method and simply predict what the next filename will be.

Hows that sound?

-Kevin


- Original Message -
From: "Merritt, Dave" <[EMAIL PROTECTED]>
To: "'Miguel Cruz'" <[EMAIL PROTECTED]>
Cc: "PHP General (E-mail)" <[EMAIL PROTECTED]>
Sent: Tuesday, July 09, 2002 2:05 PM
Subject: RE: [PHP] Trying to locate an image file name from another site


> No.  Having any changes made to the corporate server for my ease of use is
> not an option -- too much politics involved (my use of open source
solutions
> in a Microsoft environment!!!).
>
> Dave
>
> -Original Message-
> From: Miguel Cruz [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 09, 2002 3:55 PM
> To: Merritt, Dave
> Cc: PHP General (E-mail)
> Subject: Re: [PHP] Trying to locate an image file name from another site
>
>
> On Tue, 9 Jul 2002, Merritt, Dave wrote:
> > I have a page on our intranet site that is pulling an image from our
> > corporate web server.  The corporate server & the image I am accessing
is
> > beyond my control.  The image is generated daily and appears to be named
> > with a timestamp in the file name so therefore the image name changes
> daily.
>
> Can you ask the corporate web site people to insert a distinctive HTML
> comment just before the image? It would just take them a second, have no
> impact on their users, and make your job much easier.
>
> miguel
>
> --
> 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




Re: [PHP] Ben

2002-07-09 Thread Kevin Stone

First time Ben don't worry about it.  This list is actually very adult much
more so than others I've belonged to.  But you just can't prevent things
like this on an unmoderated list.  It'll be over soon.  Hope you stick
around.  :)
-Kevin

- Original Message -
From: "Ben Ramsey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 09, 2002 1:57 PM
Subject: RE: [PHP]
??ØØ



> I've just joined this mailing list this afternoon.  Does this kind of
thing
> happen often?  If so, I'm going to leave the list.
>
> Ben
>
>
> -Original Message-
> From: Andrew Brampton [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 09, 2002 3:40 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP]
> ??``
> ``ØØ
>
>
> If you read the 3 emails he sent previous to his spam you will see that he
> tried to get the moderators to remove him but after 6 hours he is still on
> the list, so I guess he thinks that if he starts to spam he will be kicked
>
> Andrew
>
> - Original Message -
> From: "Rodolfo Gonzalez" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, July 09, 2002 8:32 PM
> Subject: Re: [PHP]
>
??ØØ
> 
>
>
> > To the kind moderator of the list: please kick off this guy (Erik
> > Hegreberg <[EMAIL PROTECTED]> ), he's really annoying. Or at least
bounce
> > his e-mails back to him ;) ).
> >
> > Thanks.
> >
> >
> > --
> > 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




Re: [PHP] PHP code optimization

2002-07-09 Thread Kevin Stone

I'm just guessing but I would think there would be no difference.  The only
way I think there would be a differnce is if you did many many echo
statements as opposed to one echo or one ?>output block
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 09, 2002 1:32 PM
Subject: [PHP] PHP code optimization


> Question on optimizing code for quicker runtimes.
> Which is quicker (this is on a webpage also..NOT
> commandline)?
>
> 
>
> OR
>
>  abc 
>
> Both do the same thing and are legit but wondering
> which is better from an optimization standpoint (NOT
> interested in readability or *proper* code here)
>
> -Peter
>
> __
> Do You Yahoo!?
> Sign up for SBC Yahoo! Dial - First Month Free
> http://sbc.yahoo.com
>
> --
> 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




Re: [PHP] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

2002-07-09 Thread Kevin Stone

You don't have to live with this.  If you're running outlook/outlook express
select one of erik's emails.. go to Message->Block Sender.  It'll delete
every file he has sent and send any new incoming to the deleted items
folder.  Be done with it.  :)
-Kevin

- Original Message -
From: "Paul Roberts" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Daniel Negron/KBE"
<[EMAIL PROTECTED]>
Sent: Tuesday, July 09, 2002 1:36 PM
Subject: Re: [PHP]
%%%)

)


> i usually click no to the read receipts i get, maybe I'll make an
exception in this case.
> - Original Message -
> From: "Daniel Negron/KBE" <[EMAIL PROTECTED]>
> To: "Erik Hegreberg" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Tuesday, July 09, 2002 8:28 PM
> Subject: Re: [PHP]
%%%)

)
>
>
>
> Is this retaliation ?
>
> **DAN**
>
>
>
>
> |+>
> ||  "Erik |
> ||  Hegreberg"|
> ||   ||  ne.no>|
> |||
> ||  07/09/02 03:27|
> ||  PM|
> |||
> |+>
>
>---
---|
>   |
|
>   |  To: <[EMAIL PROTECTED]>
|
>   |  cc:
|
>   |  Subject: [PHP]
|
>   |
%%%)
)))|
>   |   ))
|
>
>---
---|
>
>
>
>
> TT
>
>
>
>
>
> --
> 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




Re: [PHP] storing an array in mysql - what's the best data type?

2002-07-08 Thread Kevin Stone

You can store arrays as strings with..

$str = serialize($ary);

.. and turn a serialized string back into an array with..

$ary = unserialize($str);

The string can be stored in either a TEXT or TINYTEXT field.  Is this what
you wanted to know?  I had trouble following your code after the for loop.
$headline, $byline and $bodycopy are variable names stored in the database?

-Kevin

- Original Message -
From: "Steven Jarvis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 08, 2002 3:23 PM
Subject: [PHP] storing an array in mysql - what's the best data type?


> I have an array that I want to store in a field of a mysql db. I've got
> it set as type text currently, but when I retrieve it, I can't get the
> arrary to parse.
>
> If I look at the listings in the mysql cli, it just says "Array" for
> that field.
>
> Here's my retrieval code:
>
> $storyid = $_REQUEST['storyid'];
>
> $db = mysql_connect("localhost", "user", "pass") or die ("Could Not
> connect to db.");
> mysql_select_db("storiestest", $db) or die("Could not select database.");
> $query = "SELECT * FROM ADGstories WHERE (storyid='$storyid')";
> $results = mysql_query($query, $db);
> $num_results = mysql_num_rows($results);
>
> for ($i=0; $i < $num_results; $i++)
> {
> $row = mysql_fetch_array($results);
> while ($element = each($row))
> {
> echo $element["key"];
> echo ": ";
> echo $element["value"];
> echo "\n";
>
> $varname = $element["key"];
> $$varname = $element["value"];
> }
>
> echo "$headline\n
> $byline\n";
>
> // just as a test, not looping through the array. Loop code not
> included.
> echo "$bodycopy[0]\n";
> }
>
> Even with the version at the end there, I get "A" echoed to the screen.
>
> If I try a print_r($bodycopy), it says "Array".
>
> Where did I screw up?
>
> Thanks!
>
> Steven
>
> --
> Steven Jarvis
> Web Publishing Manager/Web Developer
> NWAnews.com:
> Arkansas Democrat-Gazette, Northwest Edition
> Northwest Arkansas Times
> Benton County Daily Record
>
>
> --
> 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




Re: [PHP] UNSETing Session Variables

2002-07-08 Thread Kevin Stone

I fear you're missing something fundemental here.  The active session needs to be 
requested for each script.  So session_start() needs to be called at the top of each 
script (or at least before any output).  Example..

page 1
--


page 2
-


  - Original Message - 
  From: [EMAIL PROTECTED] 
  To: Kevin Stone 
  Cc: [EMAIL PROTECTED] ; [EMAIL PROTECTED] 
  Sent: Monday, July 08, 2002 2:05 PM
  Subject: Re: [PHP] UNSETing Session Variables



  Sorry about that I should have been more detailed. 
  session_start() and all of my session_register() calls happen on login.php 
  here is a sample session_register call. 
session_register("currentbid"); 
  I am under the impression that I only need one session register call. 

  Jed 



   "Kevin Stone" <[EMAIL PROTECTED]> 
07/08/2002 02:00 PM 

   
To:<[EMAIL PROTECTED]> 
cc:<[EMAIL PROTECTED]> 
Subject:Re: [PHP] UNSETing Session Variables 



  $_SESSION['currentbid'] isn't available until you do session_start(); 

  session_start(); 
  unset($_SESSION['currentbid']); 

  Or is this what does connect.inc contains? 

  -Kevin 

  - Original Message - 
  *snip 
please see previous messages for this information 
   snip* 




Re: [PHP] UNSETing Session Variables

2002-07-08 Thread Kevin Stone

$_SESSION['currentbid'] isn't available until you do session_start();

session_start();
unset($_SESSION['currentbid']);

Or is this what does connect.inc contains?

-Kevin

  - Original Message - 
  From: [EMAIL PROTECTED] 
  To: Kevin Stone 
  Cc: [EMAIL PROTECTED] 
  Sent: Monday, July 08, 2002 1:43 PM
  Subject: Re: [PHP] UNSETing Session Variables



  I more or less figured that. below is the code for the two pages in question. 

  Page 1: 
   
   
 
   
   
  Borrowers 
   
   
  ";  echo "Name";  echo ""; 
echo "";  echo "Phone";  echo ""; 
echo "";  echo "Address";  echo ""; 
echo "";  echo "Admin";  echo ""; 
echo ""; 

if($users) 
  while($row=mysql_fetch_row($users)) 
  { 
echo ""; 
echo " $row[0] "; 
echo " $row[1] "; 
echo " $row[2] "; 
if($row[3]) 
  echo " Yes "; 
else 
  echo " No "; 
print "  
 
 
 "; 
print "  
 
 
 "; 
print "  
 
 
 "; 
echo "\n"; 
  } 
  ?> 
   
   

   

  page2: 
   
   
 User Update Page  
   
   
   
   
   

   

  Please enter the new information into the fields below. 
   
 Current Information  
 
 SIZE="30"> 
 SIZE="30"> 
 
SIZE="30"> 
  "; 
} 
  ?> 
   
   
   
   

   


  The first page gives the admin user a list of users, and three options (change their 
information, delete them, or make them and Admin).  The option we are choosing is to 
change information.  If I select user number 1 the only way to edit another user is to 
log out and log back in. 

  If any of the code is unclear please let me know.  I haven't gotten to commenting it 
all yet. 

  Jed 


   "Kevin Stone" <[EMAIL PROTECTED]> 
07/08/2002 12:47 PM 

   
To:<[EMAIL PROTECTED]> 
cc: 
Subject:Re: [PHP] UNSETing Session Variables 



  We're going to need to see some of your code to help you further.
  -Kevin
   - Original Message - 
   From: [EMAIL PROTECTED] 
   To: Kevin Stone ; [EMAIL PROTECTED] 
   Sent: Monday, July 08, 2002 12:15 PM
   Subject: Re: [PHP] UNSETing Session Variables



   I tried to enter the comand as such 
 unset ($_SESSION["choice"]); 

   I thought everything in php was double quotes. but even with single quotes it still 
isn't quite working.  If I do it on the first page then it won't let a later command 
assign anything to the variable, but if I do it on a seperate third page, it doesn't 
reset anything. 

   I have been trying to avoid unregistering variables and then reseting them.  Seems 
a little too messy for my programming tastes. 

   Jed 



"Kevin Stone" <[EMAIL PROTECTED]> 
 07/08/2002 12:01 PM 


 To:<[EMAIL PROTECTED]>, <[EMAIL PROTECTED] 
 cc: 
 Subject:Re: [PHP] UNSETing Session Variables 



   unsset($_SESSION['choice']);
   // .. or .. //
   session_unregister('choice');

   -Kevin

   - Original Message -
   From: <[EMAIL PROTECTED]>
   To: <[EMAIL PROTECTED]>
   Sent: Monday, July 08, 2002 11:54 AM
   Subject: [PHP] UNSETing Session Variables


   > I am having a slight problem unseting some session variable.
   >
   > here is an exaple of what I have
   >
   > Page1:
   > choice: 1
   > choice: 2
   > choice: 3
   > choice: 4
   > Click on Submit button after choosing 1, 2, 3, or 4
   >
   > Page 2:
   > Loads information from previoius choice.
   > Start over again
   >
   > I am using a session variable for choice and am trying at the beginning of
   > page 1 to unset the session variable, but it is never beign over written
   > or rest.
   >
   > Please Help
   >
   > Jed


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










Re: [PHP] storing data from multi-line text boxes into mysql

2002-07-08 Thread Kevin Stone

nl2br();
http://www.php.net/manual/en/function.nl2br.php

Switch beween Unix and HTML line breaks.
-Kevin

- Original Message - 
From: "Phil Schwarzmann" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 08, 2002 1:29 PM
Subject: [PHP] storing data from multi-line text boxes into mysql


> I want to store user inputed data from a HTML multi-line text box into a
> mysql database.  But unfortunately, it doesn't remember any of the hard
> returnsis there a painless why to do this?
>  
> Thanks!
> 


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




Re: [PHP] UNSETing Session Variables

2002-07-08 Thread Kevin Stone

We're going to need to see some of your code to help you further.
-Kevin
  - Original Message - 
  From: [EMAIL PROTECTED] 
  To: Kevin Stone ; [EMAIL PROTECTED] 
  Sent: Monday, July 08, 2002 12:15 PM
  Subject: Re: [PHP] UNSETing Session Variables



  I tried to enter the comand as such 
unset ($_SESSION["choice"]); 

  I thought everything in php was double quotes. but even with single quotes it still 
isn't quite working.  If I do it on the first page then it won't let a later command 
assign anything to the variable, but if I do it on a seperate third page, it doesn't 
reset anything. 

  I have been trying to avoid unregistering variables and then reseting them.  Seems a 
little too messy for my programming tastes. 

  Jed 



   "Kevin Stone" <[EMAIL PROTECTED]> 
07/08/2002 12:01 PM 

   
To:<[EMAIL PROTECTED]>, <[EMAIL PROTECTED] 
cc: 
Subject:Re: [PHP] UNSETing Session Variables 



  unsset($_SESSION['choice']);
  // .. or .. //
  session_unregister('choice');

  -Kevin

  - Original Message -
  From: <[EMAIL PROTECTED]>
  To: <[EMAIL PROTECTED]>
  Sent: Monday, July 08, 2002 11:54 AM
  Subject: [PHP] UNSETing Session Variables


  > I am having a slight problem unseting some session variable.
  >
  > here is an exaple of what I have
  >
  > Page1:
  > choice: 1
  > choice: 2
  > choice: 3
  > choice: 4
  > Click on Submit button after choosing 1, 2, 3, or 4
  >
  > Page 2:
  > Loads information from previoius choice.
  > Start over again
  >
  > I am using a session variable for choice and am trying at the beginning of
  > page 1 to unset the session variable, but it is never beign over written
  > or rest.
  >
  > Please Help
  >
  > Jed


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







Re: [PHP] Checking for a successful login and setting a global flag.

2002-07-08 Thread Kevin Stone

Okay sorry for the misunderstanding.  You can set the lifetime of the cookie
to die when the browser window is closed.  Or if you use sessions this will
happen automatically.
http://www.php.net/manual/en/function.setcookie.php
-Kevin

- Original Message -
From: "Youngie" <[EMAIL PROTECTED]>
To: "Kevin Stone" <[EMAIL PROTECTED]>
Sent: Monday, July 08, 2002 12:21 PM
Subject: Re: [PHP] Checking for a successful login and setting a global
flag.


> Hi Kevin,
>
> Firstly, thanks for your answer. I am infact only protecting my php pages.
I
> don't really care that the user
> can bring up a form on an HTML page like query.htm, sure he can submit the
> query to query.php but it's
> there I do the check to see if the cookie has been set. Problem is someone
> could log on properly
> and the cookie would be set. They could then close the browser, someone
else
> could come along
> and the cookie would still be set. How do I clear all cookies when the
> browser is closed?
>
> Thanks
>
> John.
>
> - Original Message -
> From: "Kevin Stone" <[EMAIL PROTECTED]>
> Newsgroups: php.general
> To: "PHP-general" <[EMAIL PROTECTED]>
> Sent: Monday, July 08, 2002 11:07 AM
> Subject: Fw: [PHP] Checking for a successful login and setting a global
> flag.
>
>
> > Simply put you can not protect HTML pages through your login system.
You
> > must have some kind of continuous login/check at the top of each page.
> Give
> > the page the .php extension so it can parse and execute the check.  If
> > you're using Cookies that's perfect.. you can just check for the
existance
> > of that cookie at the top of each page.  Same thing if you were using
> > sessions.  They can only get the cookie or the session from one
script...
> > your login script.  So as long as you continuously check for that you're
> > pretty much all set.
> > -Kevin
> >
> > > - Original Message -
> > > From: "Youngie" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Monday, July 08, 2002 11:54 AM
> > > Subject: [PHP] Checking for a successful login and setting a global
> flag.
> > >
> > >
> > > > Hi Follks
> > > >
> > > > I'm writing an application that requires the user to login to gain
> > access
> > > to
> > > > the rest of the site.
> > > > The login dailog is on index.html, once verified by login.php the
user
> > is
> > > > presented with a menu from
> > > > which he can select several options option1.htm which executes a
query
> > > > through option1.php etc,
> > > > option2.htm and option3.htm  and so on. But there's nothing stopping
> him
> > > > from bypassing the login completely
> > > > and just brining up option2.htm directly in the browser. I'm looking
> for
> > > > some kind of mechanism to set a
> > > > flag for a successful logon in index.php that can be tested in the
> other
> > > php
> > > > scripts.
> > > >
> > > > I tried using a cookie and got that to work but the user can close
the
> > > > browser, reopen and the cookie is still
> > > > set. I looked in to session variables but one page could seem to see
> the
> > > > session variable values set in the
> > > > login page, it saw the variable was registered but not the value it
> was
> > > set
> > > > to.
> > > >
> > > > I know this has to be a simple exercise but I'm a newbie.
> > > >
> > > > Thanks
> > > >
> > > > John.
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > 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] Executing WinZip command line not working.

2002-07-08 Thread Kevin Stone

I'm trying to executing winzip command line via the system() function.  I
know it can be done but I'm recieving a "Warning: Unable to fork" error
every time.  The server is running the latest PHP v4.21.



Warning: Unable to fork [c:\Inetpub\WinZip\WINZIP32.EXE -e
e:\NLObjects\Arches_n_Tunnels.zip e:\NLObjects\arches] in
c:\inetpub\wwwroot\exchange_tmp\unzip_test.php on line 8


The path to the WinZip executable is confirmed via fopen().  Could there be
something wrong with the way I am constructing the command?  Or maybe
there's something wrong with this method all together?  Your help is greatly
appreciated.

--
Kevin


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




Fw: [PHP] Checking for a successful login and setting a global flag.

2002-07-08 Thread Kevin Stone

Simply put you can not protect HTML pages through your login system.  You
must have some kind of continuous login/check at the top of each page.  Give
the page the .php extension so it can parse and execute the check.  If
you're using Cookies that's perfect.. you can just check for the existance
of that cookie at the top of each page.  Same thing if you were using
sessions.  They can only get the cookie or the session from one script...
your login script.  So as long as you continuously check for that you're
pretty much all set.
-Kevin

> - Original Message -
> From: "Youngie" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, July 08, 2002 11:54 AM
> Subject: [PHP] Checking for a successful login and setting a global flag.
>
>
> > Hi Follks
> >
> > I'm writing an application that requires the user to login to gain
access
> to
> > the rest of the site.
> > The login dailog is on index.html, once verified by login.php the user
is
> > presented with a menu from
> > which he can select several options option1.htm which executes a query
> > through option1.php etc,
> > option2.htm and option3.htm  and so on. But there's nothing stopping him
> > from bypassing the login completely
> > and just brining up option2.htm directly in the browser. I'm looking for
> > some kind of mechanism to set a
> > flag for a successful logon in index.php that can be tested in the other
> php
> > scripts.
> >
> > I tried using a cookie and got that to work but the user can close the
> > browser, reopen and the cookie is still
> > set. I looked in to session variables but one page could seem to see the
> > session variable values set in the
> > login page, it saw the variable was registered but not the value it was
> set
> > to.
> >
> > I know this has to be a simple exercise but I'm a newbie.
> >
> > Thanks
> >
> > John.
> >
> >
> >
> >
> > --
> > 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




Re: [PHP] UNSETing Session Variables

2002-07-08 Thread Kevin Stone

unsset($_SESSION['choice']);
// .. or .. //
session_unregister('choice');

-Kevin

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 08, 2002 11:54 AM
Subject: [PHP] UNSETing Session Variables


> I am having a slight problem unseting some session variable.
>
> here is an exaple of what I have
>
> Page1:
> choice: 1
> choice: 2
> choice: 3
> choice: 4
> Click on Submit button after choosing 1, 2, 3, or 4
>
> Page 2:
> Loads information from previoius choice.
> Start over again
>
> I am using a session variable for choice and am trying at the beginning of
> page 1 to unset the session variable, but it is never beign over written
> or rest.
>
> Please Help
>
> Jed


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




Re: [PHP] Editing Word Documents

2002-07-08 Thread Kevin Stone

Of course you can open and edit any file in PHP you just need to know the
file format.  But I highly doubt there is any method using PHP that will
allow you to prompt the opening of a file into an external application.
Editing of the file would have to be done in memory, or manually in the
browser (HTML form, textarea field).  Unfortunately Microsoft is notoriously
protective of its file formats.
-Kevin

- Original Message -
From: "Chris Hewitt" <[EMAIL PROTECTED]>
To: "David Russell" <[EMAIL PROTECTED]>
Cc: "php-general" <[EMAIL PROTECTED]>
Sent: Monday, July 08, 2002 11:51 AM
Subject: Re: [PHP] Editing Word Documents


> David Russell wrote:
>
> > snip--
> > 5. The client then closes the file, it "auto-saves" and he goes about
> > his business.
>
> By coincidence, I'd be very interested in this too, particularly from a
> linux server.
>
> Regards
>
> Chris
>
>
> --
> 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] Error: Unable to fork (PHP 4.21)

2002-07-07 Thread Kevin Stone

I've searched the entire archives and google for a solution to this.  There
are plenty of references to the "Unable to fork" error.. most having to do
with a bug in PHP 4.02.  I writing the script for a remote Windows server
running PHP 4.21 so the bug shouldn't be a problem.. I can only assume I am
not doing it correctly.  The script simply needs to convert a file using
ImageMagick stored in c:\Program Files\ImageMagick...

I've tried..
$cmd = "c:\\Program Files\\ImageMagick\\convert -quality
80 -antialias -sample '".$x."x".$y."' '$obj' '$dest'";
system($cmd);

And on a tip that I found in the list archives I tried..
$cmd = "convert /c dir c:\\Program Files\\ImageMagick -quality
80 -antialias -sample '".$x."x".$y."' '$obj' '$dest'";
system($cmd);

Both return Unable to Fork errors..
Warning: Unable to fork [convert /c dir c:\Program
Files\ImageMagick -quality 80 -antialias -sample '320x240'
'C:\PHP\uploadtemp\php43.tmp' 'e:/NLObjects/thumb.jpg'] in
c:\inetpub\wwwroot\exchange_tmp\uploadtest.php on line 72

I have used ImageMagick successfully on a UNIX server.  But I didn't have to
specify the location of the convert tool.  This is Windows server and I
really don't have a clue if I am doing this correctly.  Any help will be
greatly appreciated.

-Kevin


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




Re: [PHP] Solution to register_globals=off & existing code???

2002-07-03 Thread Kevin Stone

Or just use extract($HTTP_POST_VARS);  Same thing.  :)
-Kevin

- Original Message - 
From: "PHPCoder" <[EMAIL PROTECTED]>
To: "php-general" <[EMAIL PROTECTED]>
Sent: Wednesday, July 03, 2002 12:24 PM
Subject: [PHP] Solution to register_globals=off & existing code???


> Hi
> Already posted a question asking what to do with existing code that uses 
> register_globals=on and migrating to a new PHP with 
> register_globals=off; solution seemed to be "have to re-code";
> I came up with this code, and am basically asking the more enlightened 
> if this might be a solution, ie, plug this code in at the top of all 
> form action pages written with the "old style"... It's crude, so be nice.
> 
> 
> if (isset($HTTP_POST_VARS)) {
> $type = $HTTP_POST_VARS;
> } elseif  (isset($HTTP_GET_VARS)) {
> $type = $HTTP_GET_VARS;
> }
> foreach ($type as $key => $val) {
> $string  = "\$$key = \"$val\";";
> eval($string);
>  }
> 
> 
> If this will help, can it be written into a function? Is there a more 
> "elegant" way of doing the same?Will this actually work?
> 
> Ta
> Petre
> 
> 
> 
> 
> 
> -- 
> 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




Re: [PHP] Re: SESSION newbie question ***STILL UNRESOLVED***

2002-07-03 Thread Kevin Stone

You must understand that although it's all the same script each frame is its
own HTML page and Session vars will not be called into a frame unless you
specify it.  So..

if ($QUERY_STRING == "2.html")
{
session_start(); // call session vars into this frame.
// .. blah blah blah..
}

Also set your variables before you register them into the session.  If you
don't have register globals on it won't work the other way around.  Hope
this helps.  Very clever by the way I never thought of doing it this way.
I'd always called the PHP into the SRC tag.   :-)

Good luck
-Kevin



- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 03, 2002 11:33 AM
Subject: Re: [PHP] Re: SESSION newbie question ***STILL UNRESOLVED***


> I did as you said Richard, however I still encounter the same problem,
> you can take a look at the code in test.txt, I updated it too.
>
>
> For other people, here is the original message:
>
> Hello,
>
> I got this example of sessions: www.net.co.cr/test/test.php ,
> however, as you can see in the code at /test/text.txt , isnt $_SESSION
> ['tree'] suppose to contain a value and not be NULL?
>
> Thanks.
>
>
> > > >www.net.co.cr/test/test.php
> > >
> > >  > > if ($QUERY_STRING == "")
> > > {
> > > session_start();
> > > $_SESSION['tree'] = "green";
> > >
> > >
> > >
> > > Change the line above to these two lines:
> > > session_register('tree');
> > > $tree = 'green';
> > >
> > > Think of $_SESSION (and the other $_XXX vars) as "read-only"
> > >
> > > Use session_register() to say which variables should "live long and
> > prosper"
> > > and then just use them like regular variables.
> > >
> > >
> > > echo '
> > > 
> > >   frame session test
> > > 
> > >
> > > 
> > > > MARGINHEIGHT="0"
> > > border=0 frameborder=0 FRAMESPACING="0" NORESIZE SCROLLING="no">
> > > > border=0
> > > frameborder=0 FRAMESPACING="0">
> > >
> > > 
> > >
> > > '; }
> > >
> > > if ($QUERY_STRING == "1.html")
> > > { echo "This is just a dummy frame."; }
> > >
> > > if ($QUERY_STRING == "2.html")
> > > {
> > > echo "";
> > > echo "The value of \$_SESSION['tree'] is:";
> > > echo gettype($_SESSION['tree']);
> > > echo "";
> > > }
> > >
> > > ?>
> > >
> > >
> > > --
> > > Like Music?  http://l-i-e.com/artists.htm
> > >
> > >
> > > --
> > > 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




Re: [PHP] $_POST into a formatted string, help!

2002-07-02 Thread Kevin Stone

Oh man I hope you don't shoot yourself when you realize how easy this is..

foreach ($_POST as $key => $val)
{
$str .= "&$key=$val";
}

Then just crop the first char off and there you go.

-Kevin

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 02, 2002 4:10 PM
Subject: [PHP] $_POST into a formatted string, help!


> Hello,
> 
> I need to get _$POST into a string in this form: 
> tree=green&sky=blue&sun=yellow , how can i accomplish this?
> 
> THanks.
> 
> 
> -- 
> 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




Re: [PHP] RegEx question

2002-07-02 Thread Kevin Stone

Actually for a job like this look to substr() to extract the last three
chars as a string and compare them in an if() statment.
http://www.php.net/manual/en/function.substr.php
-Kevin

- Original Message -
From: "David Busby" <[EMAIL PROTECTED]>
To: "php-general" <[EMAIL PROTECTED]>
Sent: Tuesday, July 02, 2002 2:49 PM
Subject: [PHP] RegEx question


> List,
> How can I regex to compare the last three chars of a string to "php"?
>
> /B
>
>
> --
> 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




Fw: [PHP] Have you seen this host?

2002-07-02 Thread Kevin Stone

I suppose you haven't looked around much.  Those features are fairly
typical.  Besides what really matters is that the host has what you need at
the lowest price.  I spend $10/mo for 350MB space, 20GB/mo transfer, PHP, 10
MySQL dbs, anon FTP, CGI/Perl, SSL, SSI, SSH login, unlimited email, and
more.  Not the fastest host I've been on but I think it's a good value.
http://www.hostrocket.com
Good luck with your search.
-Kevin

- Original Message -
From: "Tony Harrison" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 02, 2002 1:50 PM
Subject: [PHP] Have you seen this host?


> Hi, if you can find a web host that offers ALL these services, i will eat
my
> hat on my webcam to the whole club:
>
> Usenet Newsgroup.
> at least 200MB space
> Perl/CGI support (optional)
> PHP - note: must have GD library installed!
> MySQL
> SHOUTcast web radio
> Reseller account option
> at least 300MB per month bandwidth
> ASP (optional)
>
>
>
> --
> 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




Re: [PHP] Test if URL is alive before including a remote JS

2002-07-02 Thread Kevin Stone

It's good programming ediquite but not required.  All fclose does is destroy
the handle which will be lost when the script terminates.. same difference.
-Kevin

- Original Message -
From: "Verdon Vaillancourt" <[EMAIL PROTECTED]>
To: "Kevin Stone" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, July 02, 2002 1:55 PM
Subject: Re: [PHP] Test if URL is alive before including a remote JS


> Thanks Kevin,
>
> Do I need to include 'fclose ($fp);' in there somewhere in this case?
>
>
> On 7/2/02 3:41 PM, "Kevin Stone" <[EMAIL PROTECTED]> wrote:
>
> > Or just fopen() would work fine.
> > -Kevin
> >
> > - Original Message -
> >> Hi :)
> >>
> >> Given I have some content embedded on my page by calling a remote JS
and
> >> occasionally the URL for the remote script is down causing my page to
be
> >> slow or fail, can I use the following example as a means to test and
> > timeout
> >> the remote server and skip the embedded JS, if the remote server isn't
> >> responding properly?
> >>
> >>  >> $fp = fsockopen ("www.theweathernetwork.com", 80, $errno, $errstr, 5);
> >> if (!$fp) {
> >> echo "sorry, not available";
> >> } else {
> >> echo "
> >>   <!-- var city = \"Muskoka_ON\"; //-->
> >>   
> >>>>
src=\"<A  HREF="http://www.theweathernetwork.com/weatherbutton/test.js\"">http://www.theweathernetwork.com/weatherbutton/test.js\"</A>;>
> >>   ";
> >>
> >> }
> >> ?>
>
>
> --
> 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




Re: [PHP] Test if URL is alive before including a remote JS

2002-07-02 Thread Kevin Stone

Or just fopen() would work fine.
-Kevin

- Original Message -
From: "Verdon Vaillancourt" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 02, 2002 1:37 PM
Subject: [PHP] Test if URL is alive before including a remote JS


> Hi :)
>
> Given I have some content embedded on my page by calling a remote JS and
> occasionally the URL for the remote script is down causing my page to be
> slow or fail, can I use the following example as a means to test and
timeout
> the remote server and skip the embedded JS, if the remote server isn't
> responding properly?
>
>  $fp = fsockopen ("www.theweathernetwork.com", 80, $errno, $errstr, 5);
> if (!$fp) {
> echo "sorry, not available";
> } else {
> echo "
>   
>   
>  src=\"http://www.theweathernetwork.com/weatherbutton/test.js\";>
>   ";
>
> }
> ?>
>
>
> TIA, verdon
>
>
> --
> 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




Fw: [PHP] $_SESSION

2002-07-02 Thread Kevin Stone

Unless you have your php.ini file configured differently, simply adding
session_start(); at the top of each page will make the session available
without having to pass the SID through the URL string.  Not that there is
anything wrong or insecure by passing the session id through the URL string.
-Kevin

- Original Message -
From: "Scott Fletcher" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 02, 2002 1:05 PM
Subject: [PHP] $_SESSION


> Hi Again!  I missed part of the past responses to the past posting over
the
> last few days because I had it cleaned from MS-Outlook folder.  So, feel
> free to provide some feedback on the transformation from the script with
> register global turned on to off.  Need some feedback on hiding the $SID
> from the URL as I saw somewhere on hte posting.  I can't find it right
now.
> I'll keep looking.  Thanks!  FletchSOD
>
> --clip-- (Old Script --> Register_Global turned on)
>
> --Page 1--
> $user['data'] = "Yes!";
> $salt = strtoupper(md5(uniqid(rand(;
> session_id($salt);
> session_start();
> session_register("user");
> header("Location:
> https://test.whatever.com/test1.php?".SID."&init_login=TRUE";);
>
> --Page 2--
> session_register("user_detail");
> --clip--
> // ###
> --clip-- (New Script --> Register_Global turned off)
>
> --Page 1
> $user['data'] = "Yes!";
> $salt = strtoupper(md5(uniqid(rand(;
> session_id($salt);
> session_start();
> $_SESSION['user'];
> header("Location:
> https://test.whatever.com/test1.php?".SID."&init_login=TRUE";);
>
> --Page 2
> $_SESSION['user'];
> --clip--
>
>
>
> --
> 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




Re: [PHP] uploading a file - here is the error message...

2002-07-01 Thread Kevin Stone

That's always possible.  Unless you have access to your temp directory you
will not be able to update the permissions.  At this point I would email
your host and ask them about the situation.  Good luck.
-Kevin

- Original Message -
From: "Phil Schwarzmann" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 01, 2002 11:13 AM
Subject: [PHP] uploading a file - here is the error message...


> Here is the error I'm receiving when attempting to upload a file
>
> Warning: Unable to create 'temp/test.txt': Permission denied in
> /home/.../www/website/upload3.php on line 11
>
>
> ..could it be that my web host isn't giving me permissions to upload
> files ?
>


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




Re: [PHP] mySQL time = year 2038 [HELP]

2002-07-01 Thread Kevin Stone

Perhaps the problem is in your translation.  NOW() records a timestamp that
is formated by MMDDHHMMSS.  If you are translating this in PHP a
function designed to take in a UNIX timestamp (that is "Unix Epoch" time ,
the number of seconds from some date 30 years ago) you will recieve a rather
confusing result.  This may not be the problem but it was just a thought.
-Kevin


- Original Message -
From: "Shane" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 01, 2002 10:38 AM
Subject: [PHP] mySQL time = year 2038 [HELP]


> Checked the archive and saw no difinitives... so... How come when I query
my clients mySQL DB and use NULL or NOW() as my default in a TIMESTAMP
record that it always comes up Jan 18, 2038?
>
> Is the clock not set properly, or am I misunderstanding some basic
principal of the time stamp?
>
> My clients version pf PHP is 4+ on a Windows IIS server.
>
> Any clues???
> Thanks
> -NorthBayShane
>
> --
> 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




Fw: [PHP] Image aliasing

2002-06-24 Thread Kevin Stone

I seriously doubt it.  Windows is going to resize all images the same crappy
way.  The fact is that Microsoft's graphics routines are abysmal. Anyone
who's ever scaled an image in Preview and then seen the same thing done on a
Mac knows what I'm talking about.  All you can do is resize the image at an
exact ratio or the actual pixel size of the image and hope it doesn't look
terrible.  Sorry for the downer. :(
-Kevin

- Original Message -
From: "Morgan Grubb" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 4:02 PM
Subject: [PHP] Image aliasing


> Morning,
>
> I'm wondering if anybody has ever figured out a way to get around the
> absolutely abysmal way that Internet Explorer resizes images?
>
> The problem is that the person I'm supplying the images to refuses to use
> two copies (a small one, and a large one) and instead uses one (just the
> large one) and when he needs a small representation of it he slaps the
large
> image in and sets the width and height tags.
>
> The problem comes in when I'm trying to supply him with good looking
images.
> Sure, the large image looks fine, but that smaller image gets aliased to
> hell and back. Can the large image be recompressed in such a way that it
> doesn't noticeably damage the large version, but improves how it looks
when
> arbitrarily shrunk in IE?
>
> --
>
>
>
> Cheers,
> Morgan Grubb.
>
>
>
> --
> 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




Re: [PHP] Insert with one button

2002-06-24 Thread Kevin Stone

In your HTML each one of those select fields needs a unique name.. they
can't all be called D1.  No wonder you're having trouble.  After that you
can print_r($_POST) to see what you're getting back from the form and adjust
your script to match.  Good luck.
-Kevin

- Original Message -
From: "Martin Kampherbeek" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 3:23 PM
Subject: [PHP] Insert with one button


Hello,

I'm making a predictions competitie for soccer.
Now I've got a form with the matches for that weekend and some selectboxes
with 1 to 9 for the goals. At the bottum of the form is a Submit button.
What I want is to insert all the scores in my table predictions with just
that one button.

Table predictions:
id
date
homeclub
awayclub
endhome
endways
halftimehome
halftimeaway

So why knows how to insert all the scores for all the selected matches in my
table predictions with just that one button?
Example what I mean (don't look at the error):
http://www.martinkampherbeek.com/voorspelling/voorspelling.php






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




Re: [PHP] real time php

2002-06-24 Thread Kevin Stone

Look into javascript location method or meta tags to performed timed
refreshes of the browser window.  Do a search on Google.  You will find
dozens of references to both techniques.
-Kevin

- Original Message -
From: "adi" <[EMAIL PROTECTED]>
To: "php-general" <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 8:04 AM
Subject: [PHP] real time php


I have a program in php, with access at mysql database.
The problem is, my users have to access Refresh button anytime when they
want to see
real time values in database.
How to make a function for refreshing values in php pages, without pressing
Refresh button. What must i read?

Any help will be deeply apreciated
adi



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




Re: [PHP] session_is_registered = secure?

2002-06-24 Thread Kevin Stone

I don't know of any exploit that can start a session remotely.  Only thing I
can recommend is that you modify the default session id to prevent local
hackers from hijacking your sessions (assuming you're on an ISP and not
running your own server).  Also you should consider testing those variables
more strictly.  If you're expecting a specific value or range of values then
you should test for that instead.  For example if $login is true or false
then you should test it directly with if($login=true) since any value other
than 0 will automatically evaluate to true.

"Would you recommend adding a sepparate "check for right user&pass" within
the SCRIPT_PART again?"

When you've cleared the user once why would you need to do it again on the
same page?  :)

-Kevin

- Original Message -
From: "Duncan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 9:53 AM
Subject: [PHP] session_is_registered = secure?


Hi there,

i created a session based login and in order to enter the selected part of
the script, i check for the passed variable and if the session is
registered, which only happens, if the user password is right.

So, currently i am checking for:

else if (($login)&&(session_is_registered('login_user')))
{
...SCRIPT_PART...
}

However, can this be exploited?
I mean, would it be possible for a user to forge the
"session_is_registered('login_user')" and so gain access to that part of the
script?

Would you recommend adding a sepparate "check for right user&pass" within
the SCRIPT_PART again?

Regards,

Duncan




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




Re: [PHP] getting anchor tags

2002-06-21 Thread Kevin Stone

PHP.net has some good examples if you search under the regex functions.  Or
you might use something like the function below.  I wrote this in a search
engine spider.  It will return a list of local html links found on the given
page.  The way I used this in my spider was to build a master list of local
links and test that against a separate array of visited links.  Combine with
a little Javascript you can index an entire website with visual feedback.

function extract_links($url)
{
 $fp = fopen($url, "r");
 if ($fp !== false)
 {
  fclose($fp);

  $contents = implode("", file($url));
  preg_match_all("|href=\"?([^\"' >]+)|i", $contents, $arrayoflinks);

  foreach ($arrayoflinks[1] as $link)
  {
   // Trim out any links with http://
   if (!ereg('http://', $link))
   {
// Make sure the links are html files.
if (ereg ('.htm', $link))
{
 // Build array of local links on this page.
 $links[] = $link;
}
   }
  }
  $links = array_unique($links);
  $links = array_values($links);
  return $links;
 }
 else
 {
  return false;
 }
}

-Kevin


- Original Message -
From: "Nick Wilson" <[EMAIL PROTECTED]>
To: "php-general" <[EMAIL PROTECTED]>
Sent: Friday, June 21, 2002 3:15 PM
Subject: [PHP] getting anchor tags


> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi
> In theory I can work out how to get  start messing with regexp though I thought I'd see if there were any
> pre-built functions or ways of doing this?
>
> I'm building a site search and have not found anything in the docs but
> am guessing there might be an easier way of proceeding?
>
> Many thanks...
> - --
> Nick Wilson //  www.explodingnet.com
>
>
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.0.6 (GNU/Linux)
>
> iD8DBQE9E5dUHpvrrTa6L5oRAtrRAJ0YqRvKl8WAAG9xYiFHa6u0Nr7RYgCcDIii
> A/dUb7p9De0J1huL+e2QPFs=
> =03Ln
> -END PGP SIGNATURE-
>
> --
> 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




Fw: [PHP] Architecture problem? Google want index files exept the main page.

2002-06-20 Thread Kevin Stone

It took me a few minutes to figure out where the /profiles link was on your
hompage.  You understand that the only way a spider can read the content on
your webpage is to fopen() and parse the contents.  Google's software cannot
"explore" your dynamic content like a human can.  If the random profiles
link does not point to A00201.html when the page is parsed for the
spider's visit then the spider will never know about that page and it won't
get indexed.  If you want these pages to be indexed then build a new page on
your website called "profiles" and have it print links to all profile pages
on the same page.  Link the to the profiles page from the home page.
-Kevin

- Original Message -
From: "Andy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 20, 2002 2:41 PM
Subject: [PHP] Architecture problem? Google want index files exept the main
page.


> Hi guys,
>
> I did recently launch my first web site and I am asking myself why google
is
> only indexing the first page.
> To get a better index on other search engines I am passing parameters a
bit
> strange and the dynamic pages
> look more like static ones. So I hope this was not a shoot in a hole :-(
>
> I am getting the parameters from the url and decode them after a certain
> key. The file looks to the visitor like
> it is a directory while I am forcing apache to parse it with php.
>
> So this is the first day google is indexing it, but as I said I tryed to
> search the site with google site search and it
> does only find the first page.
>
> A site like:
> http://www.globosapiens.net/profiles/A002021.html
>
> is not indexed at all!!
>
> Did I go the wrong path, or what else is going on? Thank you for any help,
>
> Andy
>
> --
> 
> http://www.globosapiens.net
> Global Travellers Network!
>
>
>
>
>
>
> --
> 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




Re: [PHP] table porblem in netscape!!

2002-06-18 Thread Kevin Stone

Need's whitespace..
 
 

- Original Message -
From: "Anil Garg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 18, 2002 3:34 PM
Subject: [PHP] table porblem in netscape!!


> I have made a table as shown below..
> But when i open it in netscape in shows some blank space where i have used
>  tag.
> Can anyone plz help me with this!!
> -
>cellpadding=0 cellspacing=0  height=25
> width=100%>
> 
>  
>  
> 
>  
>  
>  
>   Welcome !
>      
>  
> 
>
> 
> thanks
> anil
>
>
> --
> 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




Re: [PHP] variables not being passed from form ??

2002-06-18 Thread Kevin Stone

I've found that errors in the HTML syntax can cause similar problems.  Check
your HTML for missing or out of place quotes.
-Kevin

- Original Message -
From: "Anthony 'Crash' Ciarochi" <[EMAIL PROTECTED]>
To: "Anthony 'Crash' Ciarochi" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, June 18, 2002 3:42 PM
Subject: [PHP] variables not being passed from form ??


> I have a web page which contains a form whose action is a php script.
>
> Unfortunately, NONE of the form's variables are being passed when the form
> is submitted.
>
> For example: the submit button's name is 'submit', and the value is 'Add',
> but in the receiving php script, $submit is empty, and so is
> $HTTP_POST_VARS["submit']
>
> register_globals is On
> The form method is post.
>
> What else am I missing?
>
>
> --
> 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




Re: [PHP] disable ability to download image?

2002-06-18 Thread Kevin Stone

No, and no.  Once served to the browser the image resides on the user's
computer.  They can do whatever they want with it.  The only thing you can
do is use Javascript to disable the user's right mouse button.  However the
only effect this will have is to piss of your Windows clients, and your Mac
clients won't be effected at all.

Is the a legitimate reason why you need to do this?  Maybe there's another
way around your problem.

-Kevin

- Original Message -
From: "Steph" <[EMAIL PROTECTED]>
To: "Php-General" <[EMAIL PROTECTED]>
Sent: Tuesday, June 18, 2002 3:13 PM
Subject: [PHP] disable ability to download image?


> Is there a way to disable the users ability to download images on public
> pages. Or is this a Javascript capability?
>
> ~Steph
>
>
> --
> 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




Fw: [PHP] Session wierdness

2002-06-18 Thread Kevin Stone

I have experience similar "flakiness" using sessions but in every case
discovered that it was my code that was at fault.  In fact this happened to
me recently while I was programming a fairly complex login script.  I'd do
print_r($_SESSION) at the top of every page after session_start();  See if
you can pinpoint where the you're losing the data.
-Kevn

- Original Message -
From: "Rob Walls" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 18, 2002 11:29 AM
Subject: [PHP] Session wierdness


> Is it possible to use PHP sessions reliably?
> I get very inconsistent results.
> I register session vars after a password check.
> I use session_start at the top of every file.
> I watch the /tmp directory for session files.
> Within a few random page transitions the session data inside the
registered
> variables gets emptied. (for instance,
$userid=$HTTP_SESSION_VARS['userid'];
>  no longer returns the registered variable userid).
> The session file is still there, but the value reported by session_id() is
> different than the sessionid portion of any session filename.  At this
point
> session_destroy doesn't delete the session file either, so apparently it
> doesn't know which session it is really in.
> I've bought two books (Wrox and Vis Quickpro) and neither of these books
> addresses possible session flakiness.
> So, is it my flaky code, IE's cookie hijinks or maybe that PHP is not
really
> ready to do robust session management?
> BTW: I am using PHP ver 4.0.6 (patched for file upload bug) on
> Linux/Apache/MySQL
>
> Any suggestions would be appreciated!
> [EMAIL PROTECTED]
>
>
>
>
> --
> 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




Re: [PHP] Ascii Value

2002-06-18 Thread Kevin Stone

The functions you want are ORD() and CHR().  Search for them in the manual.
-Kevin

- Original Message -
From: "James Drabb" <[EMAIL PROTECTED]>
To: "Php-General (E-mail)" <[EMAIL PROTECTED]>
Sent: Tuesday, June 18, 2002 12:57 PM
Subject: [PHP] Ascii Value


> Hey *,
>
> In C I can cast a char 'j' to an int and get it's ascii value.  Is there a
funciton in PHP
> to do this with a string containing a single char (i.e. "j")?  I could
write a big
> switch for all the chars of the alphabet, however I was hoping for a
better approach?
>
> Jim Drabb
>
> --
> -
> Never ask a geek why, just nod your head and slowly back away
> -
> James Drabb JR
> Programmer Analyst
> Darden Restaurants
> Business Systems
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
>
> --
> 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




Re: [PHP] Question about global variables

2002-06-14 Thread Kevin Stone

I don't think this is possible to setup a global way you're thinking, but I
do believe that you can still accomplish the effect you're looking for.
First of all, exactly what kind of information will you be storing in the
array?  You say it needs to be empty the 'first time in'.  Does that mean
per user?
-Kevin

- Original Message -
From: "Don" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Friday, June 14, 2002 1:08 PM
Subject: [PHP] Question about global variables


Hi,

Don't know if this is possible but is there a way to create a single
variable (in my case, a two dimensional array) that is global to my site?
This is regardless of which page is initially loaded BUT I need to have it
empty first time in.

I am trying to implement a 'stack' feature where I can place/remove
information into/out of the array.

Thanks,
Don



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




Re: Re[3]: [PHP] sessions help

2002-06-13 Thread Kevin Stone

Hmm.  Okay.  Replace $_SESSION with $HTTP_SESSION_VARS and see if that
works.
-Kevin

- Original Message -
From: "Leston Drake" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 13, 2002 4:07 PM
Subject: Re[3]: [PHP] sessions help


> I've stripped the code down to barest bones to try to figure this out:
> [getglobal.php]
> ...
> echo "Node is {$_SESSION['node']}.";
> ...
>
> [session.php]
> ...
> $_SESSION['node'] = "10.2";
> ...
>
> Other than the standard html, head, title, body tags and the
> session_start(), there is no other code.
> I'm still getting the "...Undefined index: node ..." warning.
>
>
> >Do a print_r($_SESSION); in getglobal.php to see what the session
contains.
>
> It is: Array()
>
> > >if (!empty($_SESSION)) {
> > >extract($_SESSION);
> > >} else if (!empty($HTTP_SESSION_VARS)) {
> > >extract($HTTP_SESSION_VARS);
> > >}
> >
> >Why are you doing this? If you're accessing the session through $_sESSION
then
> >there's no need to extract the session into the global scope.
>
> With register_globals=Off, I understand that you need to extract the
$_POST
> and $_GET vars. I assumed the same for $_SESSIONS. Is this not true?
>
> TIA,
> Leston
>
>
>
> --
> 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




Re: [PHP] Code Improvement

2002-06-13 Thread Kevin Stone

Though your code isn't the cleanest I've seen I don't think there is
anything inherently wrong with your proceedure.  You're just displaying a
LOT of information.  And more importantly you're displaying this in a
browser with HTML tables.  I'd put a timer on your code to see how much time
the actual query took.  Then subtract that from the time it took to render
the information in the browser window and you can get a pretty good feel for
where your bottle neck is.  I susspect the query will be a small percentage
of the total time involved.

Look into the microtime() to setup the timer.  Good luck.

-Kevin

- Original Message -
From: "Pong-TC" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 13, 2002 3:40 PM
Subject: [PHP] Code Improvement


> Hello All
>
> I run the simple code to display data from the database.  There are around
> 5000 records and 50 fields.  It takes around 1 1/2 min to retrieve the
> data to the browser.  I'd like to know if we can improve my code.  So, I
> can retrieve the data in a shorter period of time.  I have codes as
> follows:
>
> $conn = (mssql_connect("20.23.252.3","hello","hello")) or die("Cannot
> connect to the database.");
> mssql_select_db("research",$conn);
>
> $strSQL = "Select * from dss_student order by stuidterm";
> $rs = mssql_query($strSQL,$conn) or die("Cannot connect to the table");
>
> echo "";
> echo "NO.";
>
> while($fld = mssql_fetch_field($rs)){
> echo "" . $fld->name .
> "";
> }
>
> echo "";
>
> $no_row = 1;
> while ($row = mssql_fetch_row($rs)){
> if (($no_row % 2) == 1)
> echo "";
> else
> echo "";
>
> echo "$no_row";
> for ($i=0;$i<=49;$i++)
> echo "$row[$i]";
> $no_row++;
> }
> echo "";
> mssql_close();
>
> POng
>
>
>
> --
> 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




Re: Re[2]: [PHP] sessions help

2002-06-13 Thread Kevin Stone

Your problem is here..
>  return ($_SESSION['node'] = $node_id);

I do not believe that you can both set and return a varaible on the same
line.  FYI, the variable which you're returning in this function is global..
so there's no reason to return it anyway.  Just fill the index and you're
all set.
-Kevin


- Original Message -
From: "Leston Drake" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 13, 2002 3:32 PM
Subject: Re[2]: [PHP] sessions help


> Thanks to Julie and Stuart for helping me.
>
> With your direction, I got rid of the warning about the headers by putting
> the session_start() at the beginning of the file.
>
> Now I get a different sort of error when I try to retrive the session
variable:
> ---
> Warning: Undefined index: node in c:\program files\apache
> group\apache\htdocs\wan\getglobal.php on line 17
> ---
>
> Any ideas why?
>
> (Here's the exact code I've got)
> [sessions.php]
> 
> 
> 
> A test
> 
> 
>
>   function sessionSetNode ($node_id) {
>  return ($_SESSION['node'] = $node_id);
>  }
>
>  sessionSetNode("10.2");
> ?>
>
> 
> 
>
> [getglobal.php]
> 
> 
> 
> A test
> 
> 
>
> if (!empty($_SESSION)) {
>extract($_SESSION);
>} else if (!empty($HTTP_SESSION_VARS)) {
>extract($HTTP_SESSION_VARS);
>}
>
>function sessionGetNode () {
>  return $_SESSION['node'];
>}
>
>$n = sessionGetNode();
>echo ("Node is $n.");
> ?>
>
> 
> 
>
>
> TIA,
> Leston
>
>
> --
> 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




Re: [PHP] GD Questions: Please help.

2002-06-13 Thread Kevin Stone

Shane, absolutely you can mix HTML and dynamically generated images.  You'll
actually call the image in passively via an  tag like this...



getimage.php will echo the appropriate image header (Content-type: image/png
or whatever) plus your image grabbing/generating code which you will simply
output to the browser.  Deceptively easy, yes?  :)

Hope this helps.
-Kevin


- Original Message -
From: "Shane" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 13, 2002 2:21 PM
Subject: [PHP] GD Questions: Please help.


> Greetings fellow PHPers.
>
> I am learning basic GD functionality and I have a few YES/NO questions to
ask.
> This should only take a few seconds of your time. PLEASE HELP!
>
> So far I have seen several tutorials on creating graphics on the fly.
> In each example the either send the image (by itself) to a browser (using
the HEADER line) or they save it to a directory.
>
> Can I send an image to a browser along with other HTML and PHP
information, or does my image have to be on it's own.
>
> If I want to send my image to a browser with other HTML do I have to save
it to a file first?
>
> Does my directory that I am writing to have to have "write permission" set
to TRUE for me to create an image file? and if it is NOT, will I get an
error something like...
> Warning: imagejpeg: unable to open '/images/test.jpg' for writing!
>
> Can anyone show me a chunk of sample code or function that shows how I can
embed my images created on the fly into my normal HTML files.
>
> As always, thanks in advance my friends.
>
> - NorthBayShane
>
> --
> 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




Re: [PHP] Chaching issues

2002-06-13 Thread Kevin Stone

Yes it is possible.  A good suggestion is to tell the browser not to cache
PHP output by sending the following headers..

header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
header('Expires: 0');

You can also set these headers via META tags in your HTML.  You'll have to
do a search for those however.  Of course there's no guarentee this will
work with all browsers but for the most part they do their job.

-Kevin


- Original Message -
From: "eat pasta type fasta" <[EMAIL PROTECTED]>
To: "PHP-GENERAL" <[EMAIL PROTECTED]>
Sent: Thursday, June 13, 2002 1:55 PM
Subject: [PHP] Chaching issues


> is it possible that the server/browser caches the output and the code
> changes in php are not reflected. I am having wierd problems with fixing
> the code, and it often not responding for a while. When I cause a parse
> error, the php engine does inform me, however it seems to act up on bug
> fixes with variables and calulations.
> Is that possible?
>
> Thanks in advance.
>
> R.
>
>
> --__-__-__
> eat pasta
> type fasta
>
>
> --
> 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




Re: [PHP] Emptying a Single Array Value

2002-06-12 Thread Kevin Stone

Note: using unset alone you will end up with an array containing
non-contiuguous indicies.  For the most part this is not a problem but in
some cases can cause trouble.  I'd suggest passing through the
array_values() function to reindex the array after you have unset all of the
unwanted elements.

To count the number of elements in an array using the count() function..
$size = count($array);

-Kevin

- Original Message -
From: "Martin Clifford" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, June 12, 2002 1:10 PM
Subject: Re: [PHP] Emptying a Single Array Value


> I have an online example of the progam at
http://www.recordconsulting.com/temp/shop.php.  Each of the delete links use
the corresponding index values for the array, and use the unset() function
to remove them.
>
> While I'm here... how do I find the amount of information in an array?
JavaScript parlance would be $array.length.
>
> Code is below:
>
> 
> 
> if($action == "delete") {
> unset($item[$id]);
> }
>
> $color = "#336699";
>
> var_dump($item);
>
> for($counter = 0; $counter < 7; $counter++) {
> $offset = $counter + 1;
> echo "\n";
> echo "Item " . $offset . ": " . $item[$counter];
> echo "\n";
> echo "\n";
> echo "Delete\n";
> echo "\n\n";
>
> if($color == "#336699") {
> $color = "#6699CC";
> } else {
> $color = "#336699";
> }
> }
>
> ?>
> 
>
> Thanks!
>
> >>> Philip Olson <[EMAIL PROTECTED]> 06/12/02 03:02PM >>>
>
> unset() works for this, how are you using it
> exactly?  Please post a short test script
> that misbehaves for you.
>
>   $arr = array('foo','bar');
>   unset($arr[0]);
>
>   print_r($arr); // only $arr[1] = 'bar' exists now
>
> See also: http://www.php.net/unset
>   http://www.php.net/array_splice
>
> Regards,
> Philip Olson
>
>
> On Wed, 12 Jun 2002, Martin Clifford wrote:
>
> > Howdy,
> >
> > If someone out there could tell me how to get rid of a single key/index
pair within an array, it would be great.  I've tried both unset() and
empty(), but both destroy the entire array.
> >
> > Please CC me directly, as I'm on the digest.
> >
> > Thanks in advance!
> >
> > Martin
> >
> >
> > --
> > 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




Re: [PHP] Emptying a Single Array Value

2002-06-12 Thread Kevin Stone

$nums = array ('one', 'two', 'three');
$nums = remove_array_element($nums, 1);

function remove_array_element($array, $index)
{
unset($array[$i]);  // Unset selected index
return array_values($array); // Return reindexed array
}

P.S. The empty() function returns true or false depending upon whether or
not the variable you pass to contains information, it doesn't affect the
variable.

-Kevin

- Original Message -
From: "Martin Clifford" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 12, 2002 12:48 PM
Subject: [PHP] Emptying a Single Array Value


> Howdy,
>
> If someone out there could tell me how to get rid of a single key/index
pair within an array, it would be great.  I've tried both unset() and
empty(), but both destroy the entire array.
>
> Please CC me directly, as I'm on the digest.
>
> Thanks in advance!
>
> Martin
>
>
> --
> 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




Fw: [PHP] Array into database

2002-06-11 Thread Kevin Stone

Yes I believe serialize will work with any array.  When you extract it from
the database simply do $array = unserialize($str) to rebuild the array.
-Kevin

- Original Message -
From: "Leon Mergen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 11, 2002 3:59 PM
Subject: Re: [PHP] Array into database


> So this would handle 2-demensional arrays too?
>
> So, if I have
>
> $array = (
> "foo" => "bar",
> "wom" => "bat"
> );
>
>
> it would work?
>
> And darn, that I didn't come up with this (I'm familliar with Java, and
they
> use Serializable) ...
>
> "Stuart Dallas" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > On Tuesday, June 11, 2002 at 10:25:36 PM, you wrote:
> > > I would like to know wether it's possible to put an array into a
> database?
> > > If not, what is the best way to archieve something like that?
> >
> > Yes it is. See http://www.php.net/serialize
> >
> > --
> > 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




Fw: [PHP] Array into database

2002-06-11 Thread Kevin Stone

Not directly no.   You can serialize the array and store it in a single text
field.  Or, if this array contrains data that you'll be retrieving often
then you can construct a table and store each array element in a new row.
-Kevin

- Original Message -
From: "Leon Mergen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 11, 2002 3:25 PM
Subject: [PHP] Array into database


> Hello,
>
> I would like to know wether it's possible to put an array into a database?
> If not, what is the best way to archieve something like that?
>
> Thanks in advance,
>
> Leon Mergen
>
>
>
> --
> 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




Re: [PHP] Fw: include() statement goofing me up - help

2002-06-11 Thread Kevin Stone

Doh! Sorry, Natalie not Doug, and I'm glad to see you got it working.
-Kevin

- Original Message -
From: "Kevin Stone" <[EMAIL PROTECTED]>
To: "Doug DeVries" <[EMAIL PROTECTED]>; "Leotta, Natalie (NCI/IMS)"
<[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, June 11, 2002 11:59 AM
Subject: Re: [PHP] Fw: include() statement goofing me up - help


> Doug, it seems to work fine here.  So long as the remote server has PHP
> installed (which it looks like they do) then include() should work the
same
> as a local file.  Could it be a configuration issue perhaps?
>
> Test: http://www.helpelf.com/test/test.php
> Code: http://www.helpelf.com/test/test.phps
>
> -Kevin
>
> - Original Message -
> From: "Doug DeVries" <[EMAIL PROTECTED]>
> To: "Leotta, Natalie (NCI/IMS)" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Tuesday, June 11, 2002 11:36 AM
> Subject: Re: [PHP] Fw: include() statement goofing me up - help
>
>
> > I've changed the source file on this issue. Slightly different error,
but
> > still no joy. Thanks for taking the time with this.
> >
> > 
> > 
> > 
> > 
> > test area should show 4 lines of news
> >
> >
> >  > include
> >
("http://www.gospelcom.net/mnn/includes/pubNewsTease.php?li=yes&limit=4";)
> > ?>
> >
> >
> > 
> >
> > 
> >
> > - Original Message -
> > From: "Leotta, Natalie (NCI/IMS)" <[EMAIL PROTECTED]>
> > To: "'Jay Blanchard'" <[EMAIL PROTECTED]>;
> > <[EMAIL PROTECTED]>
> > Sent: Tuesday, June 11, 2002 10:30 AM
> > Subject: RE: [PHP] Fw: include() statement goofing me up - help
> >
> >
> > > That may be the case, but I had assumed the show() was a function in
the
> > > file that should be included.
> > >
> > > When I include files and it doesn't work (I've only started trying
today
> > and
> > > discovered the beauties of the include_path) it says:
> > > Fatal error: Failed opening required 'includeFile.inc'
> > > (include_path='.:/opt/net/utils/lib/php') in /prj/web/.../file.php on
> line
> > 4
> > >
> > > So I would guess that his include() is working and there either is no
> > show()
> > > in the file or he isn't actually including it, which goes back to your
> > idea.
> > > Hopefully he'll give us more info :-)
> > >
> > > -Natalie
> > >
> > > -Original Message-
> > > From: Jay Blanchard [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, June 11, 2002 1:27 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: RE: [PHP] Fw: include() statement goofing me up - help
> > >
> > >
> > > you are getting the error
> > >
> > > Fatal error: Call to undefined function: show() in
> > > e:\solomonsporch.org\test.php on line 9
> > >
> > > show() is not a function, try include()
> > >
> > >
> > > Jay
> > >
> > > "Wouldn't it be great if lists were like the Magic 8 Ball or a Quija
> > board?"
> > >
> > >
> > >
> > > --
> > > 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
> >
> >
>
>
>
> --
> 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




Re: [PHP] Fw: include() statement goofing me up - help

2002-06-11 Thread Kevin Stone

Doug, it seems to work fine here.  So long as the remote server has PHP
installed (which it looks like they do) then include() should work the same
as a local file.  Could it be a configuration issue perhaps?

Test: http://www.helpelf.com/test/test.php
Code: http://www.helpelf.com/test/test.phps

-Kevin

- Original Message -
From: "Doug DeVries" <[EMAIL PROTECTED]>
To: "Leotta, Natalie (NCI/IMS)" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, June 11, 2002 11:36 AM
Subject: Re: [PHP] Fw: include() statement goofing me up - help


> I've changed the source file on this issue. Slightly different error, but
> still no joy. Thanks for taking the time with this.
>
> 
> 
> 
> 
> test area should show 4 lines of news
>
>
>  include
> ("http://www.gospelcom.net/mnn/includes/pubNewsTease.php?li=yes&limit=4";)
> ?>
>
>
> 
>
> 
>
> - Original Message -
> From: "Leotta, Natalie (NCI/IMS)" <[EMAIL PROTECTED]>
> To: "'Jay Blanchard'" <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Tuesday, June 11, 2002 10:30 AM
> Subject: RE: [PHP] Fw: include() statement goofing me up - help
>
>
> > That may be the case, but I had assumed the show() was a function in the
> > file that should be included.
> >
> > When I include files and it doesn't work (I've only started trying today
> and
> > discovered the beauties of the include_path) it says:
> > Fatal error: Failed opening required 'includeFile.inc'
> > (include_path='.:/opt/net/utils/lib/php') in /prj/web/.../file.php on
line
> 4
> >
> > So I would guess that his include() is working and there either is no
> show()
> > in the file or he isn't actually including it, which goes back to your
> idea.
> > Hopefully he'll give us more info :-)
> >
> > -Natalie
> >
> > -Original Message-
> > From: Jay Blanchard [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, June 11, 2002 1:27 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [PHP] Fw: include() statement goofing me up - help
> >
> >
> > you are getting the error
> >
> > Fatal error: Call to undefined function: show() in
> > e:\solomonsporch.org\test.php on line 9
> >
> > show() is not a function, try include()
> >
> >
> > Jay
> >
> > "Wouldn't it be great if lists were like the Magic 8 Ball or a Quija
> board?"
> >
> >
> >
> > --
> > 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
>
>



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




Re: [PHP] Question about tag

2002-06-11 Thread Kevin Stone

The only way to execute code stored in a varaible (string) is to send it to
the eval() function.  Assuming you're not doing this then you're perfectly
safe.  Learn more about the eval function..
http://www.php.net/manual/en/function.eval.php

-Kevin

- Original Message -
From: "Nightshade" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 11, 2002 6:39 AM
Subject: [PHP] Question about tag 


> Hi there, I'm working with PHP since 3 weeks, so I'm newbie and maybe I
> could say some bull  :-)
> That's my question:
> Let's suppose that I make a ...mmm...forum. Now, in a Textbox i write my
> comment and I add also this
>  //some instruction to erase my site's root directory
> ?>
> So I post all I wrote to db.
> Ok, when I gonna read this record from database with the other comments,
> is here the possibility that piece of code, is executed, making some
> "disaster" into my directory?
> I hope you understand my question,and sorry x my english... :)
> tia, jonny
>
> --
> 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




Re: [PHP] Help with header function

2002-06-10 Thread Kevin Stone

Don't be so sure.  :)  I did a test with two location headers, one with and
one without a space, both worked properly.  But when I purposfully
misspelled "Location" to introduce a syntax error, the page did not redirect
or give an error.  This is exactly the result he was reporting so clearly
there is a syntax error within his header text.. just not the one you
thought it was.

Why do I get the feeling I'm playing that "mind bender" game where you have
to guess the right combination within so many turns?  LOL

-Kevin

- Original Message -
From: "Lazor, Ed" <[EMAIL PROTECTED]>
To: "'Kevin Stone'" <[EMAIL PROTECTED]>; "PHP-general"
<[EMAIL PROTECTED]>
Sent: Monday, June 10, 2002 2:00 PM
Subject: RE: [PHP] Help with header function


> I'm pretty sure it was the lack of a space in the header field between
> Location: and the actual url.
>
> -Original Message-
>
> The only thing I can think of is that you have a syntax error in the
header.
> -Kevin
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

> This message is intended for the sole use of the individual and entity to
> whom it is addressed, and may contain information that is privileged,
> confidential and exempt from disclosure under applicable law.  If you are
> not the intended addressee, nor authorized to receive for the intended
> addressee, you are hereby notified that you may not use, copy, disclose or
> distribute to anyone the message or any information contained in the
> message.  If you have received this message in error, please immediately
> advise the sender by reply email and delete the message.  Thank you very
> much.
>
>



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




Fw: [PHP] Help with header function

2002-06-10 Thread Kevin Stone

The only thing I can think of is that you have a syntax error in the header.
-Kevin

- Original Message -
From: "Shane Kelly" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 10, 2002 1:43 PM
Subject: Re: [PHP] Help with header function


> I don't get an error message...but the page doesn't automatically forward
to
> the redirected url.
>
>
>
>
>
> --
> 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




Fw: [PHP] Help with header function

2002-06-10 Thread Kevin Stone

What kind of an error are you recieving?  Could it be you're sending output
prior to the header function?  The alternative solution would be to
include("file_exists.php");  then exit.
-Kevin

- Original Message -
From: "Shane Kelly" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 10, 2002 1:03 PM
Subject: [PHP] Help with header function


> I'm creating an upload form for users to upload files to my server.  but I
> don't want them to overwrite existing files if they try to upload using
the
> same file name...
>
> THE FOLLOWING SCRIPT WORKS PERFECTLY
>
> if (file_exists("uploads/documents/".$file_name)==TRUE) {
>  die ("File already exists");
>  }
>  else {
>  copy($file,"uploads/documents/".$file_name); }
>
> BUT  I WOULD RATHER HAVE IT REDIRECT THEM TO ANOTHER PAGE USING
>
> if (file_exists("uploads/documents/".$file_name)==TRUE) {
>  header("Location:http://www.mysite.com/file_exists.php";);
>  }
>  else {
>  copy($file,"uploads/documents/".$file_name); }
>
> THIS SCRIPT DOESN'T WORK...DOES ANYONE KNOW WHY???
>
> Thanks
>
> Shane
> [EMAIL PROTECTED]
>
>
>
> --
> 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




Re: [PHP] multi-line textfields don't post

2002-06-10 Thread Kevin Stone

By "multi-line" text field do you mean a  field?  Could be you're
not using it right.  Remeber this construct *requires* the closing tag.  The
vlaue goes between the two tags.





- Original Message -
From: "Phil Schwarzmann" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 10, 2002 1:09 PM
Subject: [PHP] multi-line textfields don't post


> Whenever I use a mult-line textfield, the data inside doesn't transfer
> over.  But single-line textfields work just fine.
>
> how do i fix this?
>



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




Re: [PHP] Download Page?

2002-06-06 Thread Kevin Stone

Common question becuase of it's somewhat unintuitive nature, but it is very
simple.  Do a search for keywords "header" and "Content-disposition".  That
should reveal what you want.  Good luck.
-Kevin

- Original Message -
From: "Nick Richardson" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Thursday, June 06, 2002 12:38 PM
Subject: [PHP] Download Page?


> Hi all,
>
> I was wondering how i could make a download 'landing' page, that once a
user
> has filled out the download form and submitted it, it will send the file
> they are requesting as a download (not display a link to it, or display it
> in the browser) and also render a page that says something like "thanks
for
> downloading blah blah..." behind it at the same time.
>
> I would assume i would have to use header() to do this, but i dont know
> where i should start, a/o what headers to send.
>
> Any help would be appreciated.
>
> Thanks!
>
> //Nick Richardson ([EMAIL PROTECTED])
> //SiteCommand LLC
> ---=---
> --]  SiteCommand Control Panel:  Coming June 1st, 2002  [--
> --] 'The Secure Solution To Easy Enterprise Management' [--
> ---=---
> --]  Visit http://www.sitecommand.com to PreOrder Now   [--
> ---=---
>
>
> --
> 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




Fw: [PHP] [PLEASE HELP] Passing variable to new page.

2002-06-06 Thread Kevin Stone

Question.. why are you opening up a full sized new window with the
javascript popup script?  I susspect the problem has something to do with
the javascript, although I'm not going to take the time to test it myself.
You can open a new page in an HTML link by setting target=new.  You
shouldn't have any problems.

http://www.gibsonusa.com/test/page/info.php?prod_id=35";
target="new">

-Kevin

- Original Message -
From: "Igor P." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 06, 2002 12:37 PM
Subject: [PHP] [PLEASE HELP] Passing variable to new page.


> Hello,
> I am having hard time passing the variable to the next page. May be you
can
> help me. Let me explain:
>
> I am using mySQL database to store information about images (ID, name,
> author, description, etc). I am pulling some of the information to create
> this (look at the example here:
> http://www.gibsonusa.com/test/page/index.php) Now, I want a new window
> appear when user clicks on the image. I have achieved it with the
following
> script:
>
> echo "";
> echo" function pop1() {";
> echo" window.open(\"info.php?prod_id=$result[0]\"); }"; \\ $result[0] is
> variable that stores id of the image in database
> echo "";
>
> I am calling this function in the following manner: echo" onclick=\"pop1();\"";
>
> You can see the result if you click on the image. The new page opens up,
BUT
> the id (product_id in this case) value is not passed to the next page
> correctly. If you click on the first or second image on the first page it
> shows that the ID is the same for both of them. However if you look at the
> source code you can see that the ids are assigned correctly. The same
thing
> happens if you click on any image that says "no image available" (I am
using
> different script to generate those). It seems that the script picks up and
> stores in the memory the value of an ID of the last image generated with
the
> script (I don't know if that make sense).
>
> Oh, by the way the contents of info.php that I am calling in the script
> above are as following:
>
>  $myid = $_GET['prod_id'];
> echo" Product ID: $myid";
> ?>
>
> What am I doing wrong? Can you help?
> Thank you.
>
>
>
> --
> 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




Re: [PHP] PHP as HTML

2002-06-04 Thread Kevin Stone

AddType application/x-httpd-php .html
AddType application/x-httpd-php .htm

- Original Message -
From: "Tom Ray" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 04, 2002 2:41 PM
Subject: [PHP] PHP as HTML


> Hey there-
>
> I'm trying to use an .htaccess file to parse .php files as .html does
anyone
> know how to do this? It doesn't work with the same structure as parsing
the
> .shtml files.
>
> any suggestions would be great.
>
>
>
>
> --
> 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




Fw: [PHP] keep alive refresh

2002-06-03 Thread Kevin Stone

It would help to know exactly what information you are gathering and for
what reason are you storing it.
-Kevin

- Original Message -
From: "Mauro" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 03, 2002 2:35 PM
Subject: [PHP] keep alive refresh


> Hello,
>
> I looked for some old questions about my problem in the m.l. archive but
> I did not find anything.
>
> I'm writing a php script which takes a couple of values from the web
> interface and then passes these values to a program which writes it's
output
> on a file.
> Then the output of the file is published on the web page.
>
> The problem is that this program may take 1 minute up to 1 hour to write
all
> the output on the file and the browser times out.
>
> Any suggestion on how to solve this?
>
> Many thanx
> Mauro
>
>
>
> --
> 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




Re: [PHP] Include and memory

2002-06-03 Thread Kevin Stone

No offense but what you just said made absolutely no sense.  There is no way
to perform an operation on a computer without allocating memory for that
operation.  Unlike other lower level prgramming languages (ie. C/C++) PHP
automatically allocates the necessary amount of memory for whatever
operation it is you're doing.  It is completely out of your control.  So I
don't see that there's anything for you to worry about in this regard.
-Kevin

- Original Message -
From: "Paulo Cesar" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 03, 2002 10:49 AM
Subject: [PHP] Include and memory


Hi people...

I'd like to know if the include function alocates the variables that are in
the included file in the memory... and, if it happens, if do I have a way to
access a file with some variables without alocating it in memory.


Tks...


Paulo Cesar




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




Re: [PHP] Running a script to check something before submitting a form. Can this be done?

2002-05-31 Thread Kevin Stone

I wouldn't use header() in this case, unless you plan to create an ungodly
looking URL to pass with it..  All you really need to do is point the form
to a PHP script that validates the information.  Then at the end of that
script either include() the form hander if it's valid, or print an error
message if it's not valid.  It would be this simple..

test.html
---




--

validate.php
--
 0)
include ("formhander.php");
else
echo "Email already exists.";
?>

A more appropriate place to use header() would be in the "else" statement to
return to the original .html page.  You could even brand the .html page with
the error message by placing a unique comment such as  within the
html, then do something like...

fopen($HTTP_REFERER, "r");
$file = fread($fp, 1);
$file = str_replace("", $error, $file);
echo $file;

And that's about as sophisticated as you would ever need to get in this
case.

-Kevin

- Original Message -
From: "Jim lucas" <[EMAIL PROTECTED]>
To: "Don" <[EMAIL PROTECTED]>; "php list" <[EMAIL PROTECTED]>
Sent: Friday, May 31, 2002 2:56 PM
Subject: Re: [PHP] Running a script to check something before submitting a
form. Can this be done?


> you will have to do this with javascript on the client side with an
> onClick()  call in the submit button.  but the bad thing is, you wont be
> able to check this with the mysql db, unless you load the entire field set
> into the current page.
>
> my suggestion would be to send the form to one single page no-matter what.
> do the validating and then if the email address isn't there, redirect with
> the php header() function to the custom page that you are talking about.
>
> Jim lucas
> - Original Message -
> From: "Don" <[EMAIL PROTECTED]>
> To: "php list" <[EMAIL PROTECTED]>
> Sent: Friday, May 31, 2002 1:46 PM
> Subject: [PHP] Running a script to check something before submitting a
form.
> Can this be done?
>
>
> Hi,
>
> I think I need to use PHP here which is why I'm posting to this ng.  I
have
> a form that upon the user pressing submit, calls a PHP form handler.  What
> I'd like to do is upon the user pressing submit, I need to validate an
email
> field within a MySQL database and only if it does NOT exist, call the form
> handler.  If it exists, I'll juets return a custom page and NOT call the
> form handler.  I'm wondering if I need some JavaScript here?
>
> If PHP is not involved, I apologize for the post.
>
> Don
>
>
> --
> 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




Re: [PHP] Multiple File Uploads and me....

2002-05-30 Thread Kevin Stone

Actually there is a tiny bit of information in the manual about handling
multiple uploads here..
http://www.php.net/manual/en/features.file-upload.multiple.php
-Kevin

- Original Message -
From: "Nick Patsaros" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 30, 2002 1:17 PM
Subject: [PHP] Multiple File Uploads and me


> I need to have a brief class on how to handle multiple
> file uploads (they are going to all be text files)
> from one HTML form.
>
> I've scoured the PHP manual and I've only found stuff
> relating to single file uploads.
>
> Any help is appreciated and I thank you all in
> advance!
>
>
> --Nick P
>
> __
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
>
> --
> 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




Fw: [PHP] javascript

2002-05-29 Thread Kevin Stone

Instead of all those echo statments use the concatonation operator (.) to
combine variables and quoted strings.  It'll make your code much easier to
read.  After I cleaned up your code it worked perfectly.  Looks like you may
be missing a semi-colin there on line #1 of your javascript code.  Other
than that I can find nothing wrong.

$height = 400;
$width = 400;
echo '';
echo 'WinName="test";';  //<-- there was a missing semi colin here giving me
a javascript error.
echo 'GoURL="test.html";';
echo "var hdth=$height;";
echo "var wdth=$width;";
echo 'pParams="width="+wdth+",height="+
hdth+",top="+((screen.availHeight/2)-(hdth/2))+",left="+((screen.availWidth/
2)-(wdth/2));';
echo 'newWindow = window.open(GoURL,WinName,pParams);';
echo '';

-Kevin

- Original Message -
From: "burak delice" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 29, 2002 10:33 AM
Subject: [PHP] javascript


> why is that code t working?
>
>  //I am calling this php file as
> //http://localhost/Aksu/web/getimage.php?resim=K00.jpg
> $size = GetImageSize ("images/$resim");
> echo "";
>   echo "WinName=\"";echo $resim; echo "\"
>   ";
>
>   echo "GoURL=";echo"\"images/resimgoster.php?res="; echo $resim; echo
"\";
>   ";
>   echo "var hdth="; echo $size[0]; echo ";
>   ";
>   echo "var wdth="; echo $size[1]; echo ";
>   ";
>
>   echo "pParams=\"width=\"+wdth+\",height=\"+ hdth
>
+\",top=\"+((screen.availHeight/2)-(hdth/2))+\",left=\"+((screen.availWidth/
> 2)-(wdth/2));
>  ";
>  echo "newWindow = window.open(GoURL,WinName,pParams);";
>  echo "";
> ?>
>
>
>
>
>
> --
> 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] eregi() against a binary file?

2002-05-28 Thread Kevin Stone

I'm trying to match file names associated with a 3DS file (a 3DS file is a
common 3D file format).  The file is binary by nature but as you can clearly
see in the dump below the filenames themselves are stored as plain text.
So I should be able to do a simple eregi() on the file and discover if the
filename exists within that file or not, right?



Here's a snipplet of the file dump to the screen.  You can quite plainly see
that "PYRSTN01.JPG" exists as text in this string.  Now if I copy a portion
of this string and paste it into my code of course it works and echos 'found
it'.  But if I perform the eregi() function on the raw string read directly
from the file it prints 'could not find it'... why?  Isn't it the same exact
thing?
---
.0¡„ 0 Š ‡  €?¢30d£PYRSTN01.JPGQ£S£ 
€?@vBox01AjAhƒ:oƒ:oƒ.
---

To be honest I don't know or even care about the difference between ASCII
and BINARY.  In this case all I want to do is locate the plain text,
"PYRSTN01.JPG" within the 3DS file string.  But clearly I'm missing some
vital bit of information or there's something I don't understand about binay
strings being interpreted as ASCII?  Anyone know how I can make this work?

Much thanks,
-Kevin


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




Re: [PHP] comment followed by ?> fails to parse

2002-05-28 Thread Kevin Stone

After you said the commenting worked on 4.06 I tried it again and it worked
for me too (4.12).  How odd.  The first time I tried this it gave me a parse
error.. same exact code (copied and pasted) but maybe it was a browser cache
glitch.  Hmm.. my mistake I guess.  :)
*/
echo "hello world";
?>

-Kevin

- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 28, 2002 3:14 PM
Subject: Re: [PHP] comment followed by ?> fails to parse


> On Wednesday 29 May 2002 05:03, Kevin Stone wrote:
> > Hrm.. that's possible.  I'm running v4.12
>
> Works fine on v4.0.6
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> There's such a thing as too much point on a pencil.
> -- H. Allen Smith, "Let the Crabgrass Grow"
> */
>
>
> --
> 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




Re: [PHP] comment followed by ?> fails to parse

2002-05-28 Thread Kevin Stone

Hrm.. that's possible.  I'm running v4.12
-Kevin

- Original Message -
From: "Ed Gorski" <[EMAIL PROTECTED]>
To: "Kevin Stone" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, May 28, 2002 3:01 PM
Subject: Re: [PHP] comment followed by ?> fails to parse


> What version of php are you using?  I just pasted that code in test script
> and it came out fine with 4.2.1.maybe it wasn't the case in earlier
> versions...
>
> ed
>
> At 02:57 PM 5/28/2002 -0600, Kevin Stone wrote:
> >OH NO IT WON'T.It'll comment out the   and give
you a
> >parse error.
> >
> > >/**/
> >
> >echo "hello";
> >?>
> >
> >
> >- Original Message -
> >From: "Ed Gorski" <[EMAIL PROTECTED]>
> >To: "Kevin Stone" <[EMAIL PROTECTED]>; "Jonathan Rosenberg"
> ><[EMAIL PROTECTED]>; "Johnson Kirk" <[EMAIL PROTECTED]>;
> ><[EMAIL PROTECTED]>
> >Sent: Tuesday, May 28, 2002 2:52 PM
> >Subject: Re: [PHP] comment followed by ?> fails to parse
> >
> >
> > > No, if you use /* ? */ as a comment the parser will skip right over
> > > it.if you want to use sample code in your script just use:
> > >
> > > /*
> > >  > > code here
> > > ?>
> > > */
> > >
> > > that'll work fine
> > >
> > > ed
> > >
> > > At 02:48 PM 5/28/2002 -0600, Kevin Stone wrote:
> > > >I've run into this before as well.  Pain in the ass when you want to
put
> > > >example code in your header.  It's gotta be a deisgn flaw.
> > > >
> > > >// literal.. legal
> > > >$tmp = '?>';
> > > >
> > > >// reg ex.. legal
> > > >ereg('?>', $tmp);
> > > >
> > > >// Comment.. illegal.  Why?  Makes no sense.
> > > >/*?>*/
> > > >
> > > >-Kevin
> > > >
> > > >
> > > >- Original Message -
> > > >From: "Jonathan Rosenberg" <[EMAIL PROTECTED]>
> > > >To: "Johnson, Kirk" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
> > > >Sent: Tuesday, May 28, 2002 2:46 PM
> > > >Subject: RE: [PHP] comment followed by ?> fails to parse
> > > >
> > > >
> > > > > BTW: if my last message was correct, this means that an
> > > > > occurrence of ?> embedded in a string literal will also cause
> > > > > problems.
> > > > >
> > > > > > -Original Message-
> > > > > > From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
> > > > > > Sent: Tuesday, May 28, 2002 4:08 PM
> > > > > > To: [EMAIL PROTECTED]
> > > > > > Subject: RE: [PHP] comment followed by ?> fails to parse
> > > > > >
> > > > > >
> > > > > > I have wondered for some time if this is a bug or just
> > > > > > an interesting design
> > > > > > choice ;) I agree with you, I was surprised when I
> > > > > > first encountered this.
> > > > > > But it is what it is, so code accordingly.
> > > > > >
> > > > > > Kirk
> > > > > >
> > > > > > > -Original Message-
> > > > > > > From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
> > > > > > > Sent: Tuesday, May 28, 2002 1:21 PM
> > > > > > > To: [EMAIL PROTECTED]
> > > > > > > Subject: [PHP] comment followed by ?> fails to parse
> > > > > > >
> > > > > > >
> > > > > > > If I write a comment line with // and I include in
> > > > > > it ?> then
> > > > > > > it fails to parse the rest of the page because (i'm
> > > > > > guessing)
> > > > > > > the parser gets confused and goes off PHP mode.
> > > > > > > Is this normal? Shouldn't I be able to write literally
> > > > > > > ANYTHING on a comment line?
> > > > > > >
> > > > > > > Sample Code:
> > > > > > >
> > > > > > >  > > > > > > //bla bla ?>
> > > > > > > $var=1;
> > > > > > > ?>
> > > > > > >
> > > > > > > Output:
> > > > > > >
> > > > > > > $var=1; ?>
> > > > > > >
> > > > > > >
> > > > > > > cheers,
> > > > > > > thalis
> > > > > >
> > > > > > --
> > > > > > 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
>



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




Re: [PHP] comment followed by ?> fails to parse

2002-05-28 Thread Kevin Stone

Exactly.. it doesn't seem to make any sense.  Esspecially since it's such as
absolutely incredibly undeniably easy thing to check for.  :)  If the code
doesn't end with an uncommented ?> then just parse the code as text.  That's
what it does anyway so why catch commented code at all?

- Original Message -
From: "Johnson, Kirk" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 28, 2002 2:55 PM
Subject: RE: [PHP] comment followed by ?> fails to parse


> Which begs the question, why does PHP see a '?>' in a '//' comment line,
but
> not in a multi-line comment, e.g., /* ?> */ ?
>
> > -Original Message-
> > From: Ed Gorski [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, May 28, 2002 2:46 PM
> > To: Leotta Natalie (NCI/IMS); 'Jonathan Rosenberg'; Johnson, Kirk;
> > [EMAIL PROTECTED]
> > Subject: RE: [PHP] comment followed by ?> fails to parse
> >
> >
> > No the parser sees the ?> after a // because it needs to see
> > when to quit
> > out (unlike traditional, compiled languages) but it won't
> > have this same
> > effect in a string literal.
> >
> > ed
>
> --
> 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




Re: [PHP] comment followed by ?> fails to parse

2002-05-28 Thread Kevin Stone

OH NO IT WON'T.It'll comment out the   and give you a
parse error.

*/

echo "hello";
?>


- Original Message -
From: "Ed Gorski" <[EMAIL PROTECTED]>
To: "Kevin Stone" <[EMAIL PROTECTED]>; "Jonathan Rosenberg"
<[EMAIL PROTECTED]>; "Johnson Kirk" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Tuesday, May 28, 2002 2:52 PM
Subject: Re: [PHP] comment followed by ?> fails to parse


> No, if you use /* ? */ as a comment the parser will skip right over
> it.if you want to use sample code in your script just use:
>
> /*
>  code here
> ?>
> */
>
> that'll work fine
>
> ed
>
> At 02:48 PM 5/28/2002 -0600, Kevin Stone wrote:
> >I've run into this before as well.  Pain in the ass when you want to put
> >example code in your header.  It's gotta be a deisgn flaw.
> >
> >// literal.. legal
> >$tmp = '?>';
> >
> >// reg ex.. legal
> >ereg('?>', $tmp);
> >
> >// Comment.. illegal.  Why?  Makes no sense.
> >/*?>*/
> >
> >-Kevin
> >
> >
> >- Original Message -
> >From: "Jonathan Rosenberg" <[EMAIL PROTECTED]>
> >To: "Johnson, Kirk" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> >Sent: Tuesday, May 28, 2002 2:46 PM
> >Subject: RE: [PHP] comment followed by ?> fails to parse
> >
> >
> > > BTW: if my last message was correct, this means that an
> > > occurrence of ?> embedded in a string literal will also cause
> > > problems.
> > >
> > > > -Original Message-
> > > > From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
> > > > Sent: Tuesday, May 28, 2002 4:08 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: RE: [PHP] comment followed by ?> fails to parse
> > > >
> > > >
> > > > I have wondered for some time if this is a bug or just
> > > > an interesting design
> > > > choice ;) I agree with you, I was surprised when I
> > > > first encountered this.
> > > > But it is what it is, so code accordingly.
> > > >
> > > > Kirk
> > > >
> > > > > -Original Message-
> > > > > From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Tuesday, May 28, 2002 1:21 PM
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: [PHP] comment followed by ?> fails to parse
> > > > >
> > > > >
> > > > > If I write a comment line with // and I include in
> > > > it ?> then
> > > > > it fails to parse the rest of the page because (i'm
> > > > guessing)
> > > > > the parser gets confused and goes off PHP mode.
> > > > > Is this normal? Shouldn't I be able to write literally
> > > > > ANYTHING on a comment line?
> > > > >
> > > > > Sample Code:
> > > > >
> > > > >  > > > > //bla bla ?>
> > > > > $var=1;
> > > > > ?>
> > > > >
> > > > > Output:
> > > > >
> > > > > $var=1; ?>
> > > > >
> > > > >
> > > > > cheers,
> > > > > thalis
> > > >
> > > > --
> > > > 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




Re: [PHP] comment followed by ?> fails to parse

2002-05-28 Thread Kevin Stone

I've run into this before as well.  Pain in the ass when you want to put
example code in your header.  It's gotta be a deisgn flaw.

// literal.. legal
$tmp = '?>';

// reg ex.. legal
ereg('?>', $tmp);

// Comment.. illegal.  Why?  Makes no sense.
/*?>*/

-Kevin


- Original Message -
From: "Jonathan Rosenberg" <[EMAIL PROTECTED]>
To: "Johnson, Kirk" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, May 28, 2002 2:46 PM
Subject: RE: [PHP] comment followed by ?> fails to parse


> BTW: if my last message was correct, this means that an
> occurrence of ?> embedded in a string literal will also cause
> problems.
>
> > -Original Message-
> > From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, May 28, 2002 4:08 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [PHP] comment followed by ?> fails to parse
> >
> >
> > I have wondered for some time if this is a bug or just
> > an interesting design
> > choice ;) I agree with you, I was surprised when I
> > first encountered this.
> > But it is what it is, so code accordingly.
> >
> > Kirk
> >
> > > -Original Message-
> > > From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, May 28, 2002 1:21 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP] comment followed by ?> fails to parse
> > >
> > >
> > > If I write a comment line with // and I include in
> > it ?> then
> > > it fails to parse the rest of the page because (i'm
> > guessing)
> > > the parser gets confused and goes off PHP mode.
> > > Is this normal? Shouldn't I be able to write literally
> > > ANYTHING on a comment line?
> > >
> > > Sample Code:
> > >
> > >  > > //bla bla ?>
> > > $var=1;
> > > ?>
> > >
> > > Output:
> > >
> > > $var=1; ?>
> > >
> > >
> > > cheers,
> > > thalis
> >
> > --
> > 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




Re: [PHP] Intermediate "Searching..." screen.

2002-05-28 Thread Kevin Stone

Search screens are a tricky prospect and none seem to work very well.
However you could try one of the following techniques...

Instead of the submit button initiating a search it initiates another script
that displays the 'searching...' message and only after it has outputted
that to the screen does it initiate the search.  The last line in that
script would be a redirect back to your results page.

Another way to do it would be to set up a couple of Javascript functions.
Echo one to open the 'searching...' screen prior to initiating the search.
Then at the end of the script echo the other javascript function to close
the 'searching.. ' screen.  But I've implimted a version of this for an
upload script and it didn't work so hot.

Er.. umm.. anyone got any other bright ideas?

-Kevin

- Original Message -
From: "Jeff Bearer" <[EMAIL PROTECTED]>
To: "Php-General (E-mail)" <[EMAIL PROTECTED]>
Sent: Tuesday, May 28, 2002 12:23 PM
Subject: [PHP] Intermediate "Searching..." screen.


> I have a part of my site that searches a large database and sometimes it
> takes more than a few seconds to return the results.  When searches take
> longer, people get antsy and search again.  To let them know that the
> search is working so they don't double efforts I'd like to have an
> intermediate "Searching..." screen.
>
> I don't have a good idea on how to do this and I'm looking for some
> ideas or directions. How do I show one thing while the search is running
> and another when the search is complete and also not loose the returned
> record set?
>
> --
> Jeff Bearer, RHCE
> Webmaster
> PittsburghLIVE.com
> 2002 EPpy Award, Best Online U.S. Newspaper
>
>
> --
> 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




Re: [PHP] Include (Newbie question)

2002-05-25 Thread Kevin Stone

No, not exactly.  The idea behind the include() function in PHP is to append
and execute code to the currently running script.  This is great for
organizing your code into more easier to manage chunks.  PHP will attempt to
parse and execute the included file as a PHP file regardless of the file
extension.  So you can do this for example...

-- myhtml.html --
Hello 
--

-- myphp.php --
$var = "World";

-

This will print out "Hello World".  So that answers two questions with one
stone (err.. yah).  include() is a function not a method.  And you don't
need the  tag to display included html.  The browser will
automatically assume an html header upon any textual output unless otherwise
specified.

Check out the manual for more information.
http://www.php.net/manual/en/function.include.php

Hope this helps
-Kevin

- Original Message -
From: "r" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, May 26, 2002 5:11 AM
Subject: [PHP] Include (Newbie question)


> Hey,
> I have just being going through the manual (windows version) and am a bit
> confused about "include",
> If I want the scope to affect the whole page I do this right:
>
> (example page)
> 
> 
>  include blah.php
> ?>
> some html
>  use some functions to call blah.php
> ?>
> is this correct?
>
> and my second question is if I am including a html file will that file
need
> to have a  etc etc
> or you must have the etc only in one file?
>
> Since am confused about this and it comes straight from the RTFM()
> function.any help appreciated. :-)
>
> Cheers,
> -Ryan.
>
>
>
>
> --
> 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] Extract ZIP archives

2002-05-25 Thread Kevin Stone

Hello Nurse!  (and php gurus)..

I'm building an online file exchange that will allow users to share custom 3D files 
for a game that I'm involved in.  I'd like to offer my users the oportunity to upload 
multiple files at once by allowing them to ZIP them all together and upload just the 
one file.  Then I'd expand the ZIP archive, extract the files, and store them 
individually on the server based on certain properties (which I already look for to 
validate the files being uploaded individually).

 I did my homework, found plenty of references and example code, a few classes.  Still 
a bit stumped though.  The PHP docs refer to ZZIPLIB as the solution.  Unfortunately 
webhost does not have ZZIPLIB installed.  And of course I don't have access to the PHP 
config files... just my standard web account.  Is ZZIPLIB something that I can use by 
including it into my script?  Or does it need to be compiled into PHP?  If so then is 
there another way that I can expand, extract and create ZIP files on the server?

I found one ZIP class on ZEND.com.  http://www.zend.com/codex.php?id=696&single=1  It 
looks like it should work but since it won't expand ZIP archives it's only half useful 
to me.

Finally a friend of mine briefly eluded to the 'zip' and 'unzip' operations of UNIX.  
Problem is I don't know anything about Unix commands and searching for 
guides/tutorials revealed plenty of generic, but little useful information.  Is this a 
possibility?  If so what would the unix command be to expand and create ZIP archives?  
How would I tie that into my PHP script using the system() function?

Well.. hopefully you get the gist of what I'm trying to do.  Other than my basic 
knowlege in PHP I'm starting from scratch here, so just about anything you can tell me 
will be useful.

Much Thanks,
Kevin Stone
[EMAIL PROTECTED]
or [EMAIL PROTECTED]




Re: [PHP] NewBie-UPLOADING IMAGE

2002-05-25 Thread Kevin Stone

This is a rather broad question you're asking.  I would suggest starting at
the online documentation on www.php.net.  Handeling file uploads:
http://www.php.net/manual/en/features.file-upload.php

Post back here if you have any trouble understanding any of this stuff.

-Kevin

- Original Message -
From: "Dani" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, May 25, 2002 4:57 PM
Subject: [PHP] NewBie-UPLOADING IMAGE


> Hi,
>
> I want to upload image file into a folder in webserver using HTML form.
> What function do I use fo this purpose?
>
> Thank you,
>
> Dani
>
>
> --
> 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




Fw: [PHP] gmtime?

2002-05-24 Thread Kevin Stone

I don't know what gmtime() is supposed to do.  But is gmmktime() similar?
http://www.php.net/manual/en/function.gmmktime.php
-Kevin

- Original Message -
From: "Jens Lehmann" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 24, 2002 12:51 PM
Subject: [PHP] gmtime?


> Any reasons why there's no gmtime()-function in PHP? I'd like to hear your
> thoughts.
>
> Jens Lehmann
>
>
>
> --
> 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




Re: [PHP] listing the files in the directory

2002-05-24 Thread Kevin Stone

Michael, I wrote this function for a project that I'm working on.  It
returns an indexed array of local links found on a given page.  It returns
false if the url is not a valid file.  If you want it to return all links
regardless of prefix or file extension then just return $arrayoflinks[1]
instead of doing the extra ereg() steps.  It's a very simple function, but
it may help get you started.
-Kevin

function extract_links($url)
{
 $fp = fopen($url, "r");  // fopen to check for valid file
 if ($fp !== false)
 {
  fclose($fp);

  $contents = implode("", file($url));
  // Much thanks to whomever wrote this regex!
  preg_match_all("|href=\"?([^\"' >]+)|i", $contents, $arrayoflinks);

  foreach ($arrayoflinks[1] as $link)
  {
   // Ignore links that may not be local.
   if (!ereg('http://', $link))
   {
// Make sure the link is some form of html file.
if (ereg('.htm', $link))
{
 // Build array of local links on this page.
 $links[] = $link;
}
   }
  }
  return $links;
 }
 else
 {
  return false;
 }
}

- Original Message -
From: "_michael" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 24, 2002 12:12 PM
Subject: RE: [PHP] listing the files in the directory


> well do you think you can point me in the right direction to listing the
> files on my site? - is it possible (as i said i am very new to this)
>
> thanks
>
> -Original Message-
> From: Jason Wong [mailto:[EMAIL PROTECTED]]
> Sent: 24 May 2002 19:09
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] listing the files in the directory
>
>
> On Saturday 25 May 2002 02:01, _michael wrote:
> > hi, i'm pretty new to php - i am trying to list/print a list of files
and
> > folders that are on my server:
> >
> > from my little knowledge i have got:
> >
> >  > $dir = "http://mysite.com/";;
> > $handle = opendir($dir);
> > while (($file = readdir($handle))) {
> > if ($file != "." && $file != "..") {
> > echo "- " . $file . "";
> > }
> > }
> > ?>
> >
> > i keep getting errors - will this code list the files on my site?
>
> No. You can only opendir() a local filesystem.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> It's clever, but is it art?
> */
>
>
> --
> 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




Re: [PHP] matching two form fields function?

2002-05-23 Thread Kevin Stone

Tis a tad easier than that.

function match_str($str1, $str2)
{
if ($str1 == $str2)
return true;
else
return false;
}

// If the fields don't match exit with error.
if (!match_str($field1, $field2))
{
echo "The fields must match.";
exit;
}

-Kevin

- Original Message -
From: "Jeff Field" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 23, 2002 2:09 PM
Subject: [PHP] matching two form fields function?


> I feel bad about asking a question like this, but I've spent quite a bit
of
> time trying to track down what should be a simple answer and, no luck.
> Anyway...
>
> I'm trying to create a simple function that will match two form fields
> against each other, e.g. "Email" equals "Repeat Email".  The following
> function seems to work, however, I'm a little uncomfortable because I
don't
> understand it.  Specifically, I don't understand why returning $str1 by
> itself (or $str2 by itself) makes it work.
>
> -
> /* checks two fields against each other to make sure they match and if
they
> don't match it throws an error message into the $err_text array */
>
> function CheckMatch($str1, $str2, $name)
> {
> global $err_text;
> $match = ($str1 == $str2);
> if ($match != true)
> {
> $err_text[] = "$name must match.";
> }
> return $str1;
> }
> -
>
> Any help is appreciated!  Thanks!
>
> Jeff
>
>
> --
> 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




Re: [PHP] MySQL INSERT concatonating one of my values for seemingly no reason...

2002-05-22 Thread Kevin Stone

Nevermind.  Three hours after embarking on my voyage to insanity I finally
figured it out.  If I type cast the variables as strings the error
dissapears.  I've never had this problem before though.. so its still a bit
of a mystery since the data stored in the variables are most certainly
strings and a direct comparison to an identical string (without type
casting)  returns true.

$keyword = (string)$index[$i]['word'];
$pagelist = (string)$index[$i]['pages'];

-Kevin

- Original Message -
From: "Kevin Stone" <[EMAIL PROTECTED]>
To: "PHP-general" <[EMAIL PROTECTED]>
Sent: Wednesday, May 22, 2002 4:06 PM
Subject: [PHP] MySQL INSERT concatonating one of my values for seemingly no
reason...


I have an array containing data from a search engine index.  The array
contains only two values.. "word" and "pages" which will be stored in a
MySQL table.

$index[$i]['word']   //contains the keyword.
$index[$i]['pages'] // contains a comma delimited list of pages the keyword
exists on.


If you print out the values stored in the first index in the array this is
what you get...
echo $index[0]['word'];   // prints "test"
echo $index[0]['pages']; // prints "test.html,test2.html"

However when inserting the values into the database results in a
concatonation of the 'pages' value at the first comma...

$query = "INSERT INTO `legends_search` (`keyword`, `pages`) VALUES
('".$index[0]['word']."', '".$index[0]['pages']."')";
mysql_query($query, $db);

// Let's just see what it's imputing..
echo $query; // prints "INSERT INTO `legends_search` (`keyword`, `pages`)
VALUES ('test', 'test.html,test2.html')"

results:
---
keyword   pages
test  test.html
--

Why is the pages value being concatonated!?  I thought perhaps I was
inserting an invalid character so I did a test by setting a two variables to
the desired values then inserting them into the database.

$word= 'test';
$pages = 'test.html,test2.html';

$query = "INSERT INTO `legends_search` (`keyword`, `pages`) VALUES ('$word',
'$pages')";
mysql_query($query, $db);

// Let's just see what it's imputing..
echo $query; // prints "INSERT INTO `legends_search` (`keyword`, `pages`)
VALUES ('test', 'test.html,test2.html')"

results:
---
keyword   pages
test  test.html,test2.html
--

This worked exactly as I expected.  The pages collumn was populated with the
full value and didn't get concatonated.  So why was it being concatonated
when the same value was being read from the array?  Perhaps there was
something wrong with the value in the array.  So on that premis I checked
the array value against a the static variable that I defined in the second
test...

$pages = 'test.html,test2.html';
if ($pages == $index[0]['pages'])
echo "TRUE";
else
echo "FALSE";

And it echos TRUE every time.  So it has to be an identical string.  Yet
when I insert from the array values 'pages' gets concatonated at the first
comma.  As far as I can tell both methods are inserting the same exact
values (just look at the $query echo statements above for more proof).  I
can not understand why the 'pages' value is being concatonated when inserted
from the array.  Any help?  Or are you just as baffled as me.

Much thanks,
Kevin Stone
[EMAIL PROTECTED]




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




<    1   2   3   4   5   6   >