[PHP] Is there an alternative to HTML frames?

2003-07-29 Thread Jason Barnett
I'm new to php and web development in general.  I've toyed with ASP a little
and enjoyed using "include" statements to include my navigation and heading
pages.  Does PHP provide a similar statement, or is there something else I
can do to achieve this effect?



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



[PHP] Permissions denied trying to upload a move a file...

2003-08-11 Thread Jason Barnett
I'm using PHP version 4.2.2 on a Linux system running Apache.  I am
trying to allow my users to upload a file, however I continue to receive a
"Permission denied" error when using move_uploaded_file() or copy().  The
file appears to be sent to the temporary directory successfully, but can not
be copied or moved to the uploads directory.
I've used the following code to authenticate (I enter in the same
username and password that I use for ftp -- which has the necessary
permissions to move/copy files to the destination);

--
Welcome: {$_SERVER['PHP_AUTH_USER']}";
 echo "\n";
 echo "\n";
 echo "Send this file: \n";
 echo "\n";
 echo "\n";
  }
?>
--

The code for fileUpload.php is as follows;

Welcome: {$_SERVER['PHP_AUTH_USER']}";
  echo "The file was temporarily uploaded to:
".$_FILES['userfile']['tmp_name']."";

/*
  $result = move_uploaded_file($src, $dest);
*/

  $result = copy($src, $dest);

  echo $result;

?>
--

Could someone help me to get this working?  I'd appreciate it.



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



[PHP] Re: DOMXML support should be added to PHP5

2004-07-23 Thread Jason Barnett
Scrumpy wrote:
Sorry for the repeated posts. I didn't know that they got queued awaiting 
confirmation of my email address :)
Yeah, I was wondering about the reposts.  Well you are right that if you used 
the old DOMXML functions in PHP4 that there is no clean way to move that code 
forward without rewriting / supporting two infrastructures.  I'm not a core 
developer but my guess is that they didn't mind dropping the support completely 
because in PHP4 it was all tagged as "experimental".

It's unfortunate for you, but I think making the change now makes sense because 
of the new DOM / SimpleXML support.  These two are largely interchangeable 
because they're just different ways of looking at the same underlying object.

Perhaps another solution: create a class and call it DomDocument4_3_8 or 
something that mimics the method calls / properties of the new DomDocument 
class.  Contact me off list if you need help with this.

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


[PHP] Re: Installing Php5 over Existing Php4.3.6

2004-07-23 Thread Jason Barnett
Francis Chang wrote:
Hi,
I would like to install Php5 over an existing Php4.3.6 installation on
Linux.  What is the proper procedure?  Do I need to "uninstall" the previous
version first, if so, how?  Can I install Php5 into the same location as the
previous installation or should I install it into a different PREFIX
directory?
Any tip would be much appreciated.
Francis
There isn't one *proper* way to do it.  Do you want them both running at the 
same time?  I wouldn't suggest that unless you need it, but that can be done. 
Sure, if you want to "uninstall" the old installation and then put php5 in you 
can do that, but I'd suggest creating a test server first to make sure all your 
scripts will run like you expect.

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


[PHP] Re: Changing items in $_POST

2004-07-23 Thread Jason Barnett
However, there are a few variables I need changed. For example, the 
people I'm sending it to need $rate_1m which is a mortgage rate but in 
$_POST there is $rate_1m1 (the whole number) and $rate_1m2 (the two 
numbers after the decimal). How do I get those two together and then 
discard the two numbers and only send $rate_1m? If that makes any sense.
Thanks.
Jeff
Hmmm, your question's a bit confusing.  Do you want to push the second number 
(decimal) after the first number (int)?  If so then just concatenate the values.

$_POST['rate_1m'] = $_POST['rate_1m1'] . $_POST['rate_1m2'];
unset($_POST['rate_1m1'], $_POST['rate_1m2'])
foreach($_POST as $key => $value) {
$arr[] = $key.'='.urlencode($value);
}
$URL = "https://example.com/script.asp?".implode('&',$arr);
header("Location: $URL\n");
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Code elegance and cleanliness

2004-07-23 Thread Jason Barnett
Depends on the project.  Generally I try to use something more like the first 
code block unless I really need to optimize for the server.  Getting another 
server is usually cheaper than the extra time (read: money) spent debugging.

Robb Kerr wrote:
Just a quick question. Does it really matter how long your code is or how
many variables you use? For instance you can enter the following...
$imgBkgrnd = array("1"=> "bkgrnd-default.gif", "2" =>
"bkgrnd-positive.gif", "3" => "bkgrnd-negative.gif");
$imgNeeded = table['field'];
$imgName = $imgBkgrnd[$imgNeeded];
or, you can code the same thing as...
$imgBkgrnd = array("1"=> "bkgrnd-default.gif", "2" =>
"bkgrnd-positive.gif", "3" => "bkgrnd-negative.gif");
$imgName = $imgBkgrnd[$table['field']];
The first example uses one more variable and a longer code block but is
easier to read and debug. The second example uses one less variable and a
shorter code block but is harder to debug later. Should I be striving for
the shortest most compact code utilizing the fewest possible variables. Or,
can I code in a style which is easier to read and debug?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: replace n first occurences of a char in a string

2004-07-23 Thread Jason Barnett
Then, once I have determined there are more than one dot, how can I 
remove all the dots but the right most one?

You can replace a limited number of matches using preg_replace().

$number = '123.456.789.10';
$count = substr_count($number, '.');
$number = preg_replace('/\./', '', $number, $count - 1);
echo $number;
?>
so 123.456.789.01 would become 123456789.01 with just the dot before the 
zero.

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


Re: [PHP] Weeeeee! ;)))

2004-07-24 Thread Jason Barnett
Comex wrote:
but there isn't any archive..
Let's see I shake my magic 8-ball and it says... PEAR?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: include_path ???

2004-07-24 Thread Jason Barnett
When I run "phpinfo()" the include_path points to ".;c:\php\PEAR" but that
is incorrect the correct path is "c:\inetpub\php5\PEAR".
Are you *certain* you're looking at the correct ini file?  phpinfo() should show 
the settings currently in use for your server (assuming you're calling the 
phpinfo in a page served by IIS instead of for example the CLI version of PHP). 
 Magic 8-ball says: you have an old php.ini from PHP4 and it is in your 
system32 folder.

My question is, is it correct to set the include_path to
"c:\inetpub\php5\PEAR" or just leave it as is???
If this is the path to your PEAR files then you'll need to change your 
include_path.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Learning Regex

2004-07-24 Thread Jason Barnett
This helped me get started with Perl-compatible regular expressions:
http://www.weitz.de/regex-coach/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How to get all links from a webpage?

2004-07-25 Thread Jason Barnett
Wudi wrote:
This script can replace links:
$text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "\\0", $text);
But it cannot get the links.
Magic 8-ball says... go read ereg() in your manual.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: include_path ???

2004-07-25 Thread Jason Barnett
Lester Caine wrote:
D_angle wrote:
This is taken right out of the download of PHP 5 zip file
"php-5.0.0-Win32.zip". Opening the "php.ini-recommended" it states the
following configuration
php.ini-recommended is probably not the one being used... if you want to use 
this you most likely just need to strip of the -recommended from the file name. 
 PHP does this because you could be using this in production vs. development.

Magic 8-ball says:
!!!Search your hard drive for php.ini!!!

What is in the php.ini in your windows directory?
THAT is the copy that PHP is using.
( Is there something missing in the install notes - this is the second 
time I've had to mention where the php.ini is located ;) )

php.ini can actually be located in a number of places.  I keep mine located in 
the same directory as my apache.conf file, some put theirs into the system32 
folder, some keep it with the CGI binary.  There's a specific ordering to where 
PHP looks first, etc. and that could make a difference if you have several ini 
files scattered about.  So for instance when I upgraded from 4.3.7 to 5.0 I just 
added a few lines to my already-existent php.ini file.

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


[PHP] Re: class help (PLEASE)

2004-07-25 Thread Jason Barnett
No offense intended, but I'm not going to read through all of that.  Narrow down 
the code block that gives you problems and then post that one block here... not 
the entire class.

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


[PHP] Re: PHP function speed testing

2004-07-25 Thread Jason Barnett
Shawn McKenzie wrote:
O.K.  So I've written my application and debugged it, and now I want to 
try and optimize the speed.  I have written a little test script to test 
Several profilers / debuggers will help you optimize on speed... by telling you 
how much time the parser spends inside a function.  There are really a lot of 
them out there, try google for "PHP profiler" and stick with what you like.

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


Re: [PHP] Re: class help (PLEASE)

2004-07-25 Thread Jason Barnett
Hey Jason,
No offense at all taken, am happy you read part of my
help-email.
Problem is, like I said, I dont have a clue about the
workings of a class and all the pointing like this
$this-> blah
(->) means blah is a property of the class.  ($this) means an instance of the 
class.
gets me totally confused so I really dont know which
part IS the problem part.
Anybody knowing of a good class tutorial...would be
appreciated.
phpfreaks have a lot of tutorials, so do codewalkers.  You can probably find 
class tutorials at one of those sites.

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


[PHP] Re: Sticky session after session_destroy...

2004-07-26 Thread Jason Barnett
Since you're using cookies, are you remembering to destroy the cookie as well? 
Check your web browser to see if the cookie is still there - then do your logout 
script - and then immediately check to see if the cookie is still there. 
Firefox makes this easy... just another reason why I love that browser.

BTW: your english is fine, and the information you provided for your problem was 
excellent :)

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


[PHP] Re: totally new to PHP

2004-07-27 Thread Jason Barnett
phpfreaks.com and codewalkers.com
Or check the mailing list archives, others have been mentioned before.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Organising PHP projects

2004-07-27 Thread Jason Barnett
One of the new options that I am playing with is the __autoload() handler.  If 
you keep each of your main classes in a separate file then it will try to load 
the class file the first time you try to create an instance of an undefined class.

There is a little bit of documentation out there about this, along with a few 
examples.  In fact you can check out the archives from a few weeks ago, I posted 
the __autoload function I'm using there.

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


[PHP] Re: Problem with circular include statement

2004-07-27 Thread Jason Barnett
I *believe* that include_once will be all that is necessary.  However if that 
doesn't stop the problem, you can use a DEFINE and at the top of each script:

if (!defined(FILE1)) {
  include_once 'file1.php';
}
-- file1.php -
define ('FILE1', TRUE);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Urgent..my MYSQL dies..

2004-07-27 Thread Jason Barnett
[EMAIL PROTECTED] wrote:
please give me a command line to startup 
MySQL using safe_mysqld

C:\>
---John Holmes...

HAHAHA  How'd you guess they would have a drive letter for their prompt :)
Oh, us poor, poor windows users.  Microsoft has "protected" us from it for so 
long that we've forgotten what the ol' command prompt looked like!

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


[PHP] Call for XML / XPATH examples

2004-07-27 Thread Jason Barnett
I'm working on a project that makes use of the DOMXPath class in PHP5.  I have
some test xml documents / queries, but it would be good to test my project with
other people's documents / xpath queries that do things mine don't.  Please
reply off list though, since I doubt most of the people here want a bunch of XML
documents in their inbox.
I'm probably going to regret this request... but what the heck.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Installing PEAR on Windows

2004-07-28 Thread Jason Barnett
[EMAIL PROTECTED] wrote:
Hi Matt (et al),
I've added the c:\www\pear path to both the windows path and also the path in
the php.ini file.  However it's still coming up with the same error.  Is there
a way of putting in a temporary path in the go-pear.php file?
Yes... ini_set('include_path', 'yourpath').
When I installed PHP5 I had a slight problem... my existing pear installation 
(with different path etc. from PHP4) was changing the path every time that it 
ran.  If you are also upgrading, it could happen at several points:

Your environment variables (PHP_INSTALL_DIR, others)
Your pear.bat file
Your PEAR.php file
Rogue php.ini file (perhaps in system root)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] For Loop Problems

2004-07-28 Thread Jason Barnett
[EMAIL PROTECTED] wrote:
Hello Everyone,
I'm building a hotel management system and I can't seem to figure out why my
for() loop doesn't work the way it should. I'm using patTemplate to create
the HTML Template (I like using it and I don't want to start a pro/con
template war). Here is the script:
for ($j = 0; $j < 32; $j++) {
for ($i = 0; $i < count($num_days); $i++) {
$template->addVar("room_num", "ROOM_NUM", '101');
$template->addVar("room_type", "ROOM_TYPE", 'NQQ');
$template->addVar("guest_NameRate", "GUEST_NAME", 'NAVID YAR');
$template->addVar("guest_NameRate", "GUEST_ID", 'fname');
$template->addVar("guest_NameRate", "CLASS_GUEST", 'fname');
$template->addVar("guest_NameRate", "ROOM_RATE", '49.95');
$template->parseTemplate("guest_NameRate", "a");
}
I'm not aware of what patTemplate does, but my guess is that when you addVar() 
each time it is just pushing each variable into an array.  In other words, you 
keep adding 7 elements onto the end of an array WITHOUT removing old elements. 
There is probably a removeVar method or something similar to help you with this. 
 If not, then you probably need to have a different template variable for each 
row and then populate those template variables with 1 week's data.

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


[PHP] Re: Accessing a variable from inside a local function

2004-07-28 Thread Jason Barnett
Something like this is probably better handled by a class.  Then you can access 
class properties to do what you want.

Class yourclass
{
  function foo()
  {
$this->my_foo_local = 10;
  }
  function bar($var_bar)
  {
return $this->my_foo_local+$var_bar+1;
  }
}
$object = new yourclass();
$object->foo();
echo $object->bar(12);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] strpos mystery

2004-07-28 Thread Jason Barnett
Because === and !== check the type as well. Of you set $string =
'blah' you'll still get the same result.
If you were using != and == both would print.
strpos() returns an int, so comparing it to false with === is always
false. The same would be true for true.

That's half right.  strpos actually *can* return false as opposed to 0, so 
checking doing the === check might be necessary for your application.


$string = 'blah';
if (strpos($string, 'not in the original $string') === false){
  echo 'False check succeeded - not in $string.';
}
if (strpos($string, $string) === true) {
  echo 'True check succeeded - in string';
} else {
  echo 'True check failed - because strpos was at offset 0.';
}
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] strpos mystery

2004-07-28 Thread Jason Barnett
Heck, even I got it wrong ;)  True check below should always fail...
Jason Barnett wrote:
Because === and !== check the type as well. Of you set $string =
'blah' you'll still get the same result.
If you were using != and == both would print.
strpos() returns an int, so comparing it to false with === is always
false. The same would be true for true.

That's half right.  strpos actually *can* return false as opposed to 0, 
so checking doing the === check might be necessary for your application.


$string = 'blah';
if (strpos($string, 'not in the original $string') === false){
  echo 'False check succeeded - not in $string.';
}
if (strpos($string, $string) === true) {
  echo 'True check succeeded - in string';
} else {
  echo 'True check failed - because strpos was at offset 0.';
}
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Conversion of Field Value to Hyperlink

2004-07-29 Thread Jason Barnett
Harlequin wrote:
Afternoon...
I have a table generated by some code that returns certain field values and
drops them into a table. On of these values is ID and I'd like to convert it
I wouldn't let users create their own primary key for any type of inserts, if 
that's what you're using ID for.  Users could easily fake a form ID and put 
whatever data into an existing row with that ID.

to a hyperlink that people can use to go to another page to view further
information about a record. However:
The fields are not individually identified as I use a for statement and I
think I might need to redesign the table but don't know where to start.
Even with a for statement, you could create element names for each item in an 
array.  But another solution is to create an array with the indexes you want to 
show and then foreach () over that array.

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


Re: [PHP] Conversion of Field Value to Hyperlink

2004-07-30 Thread Jason Barnett
Funny... for the short time I've been on the list, it seems like our most 
popular topics are the ones that involve flaming.  I guess I need to get some 
charcoal for my barbecue pit, lest I be the one on the end of the fork ;)

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


Re: [PHP] Browser reload problem

2004-07-30 Thread Jason Barnett
Is there a question here?  Or is this a resolution?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: PHP5 Manual in PDF and for Pocket PCs

2004-07-31 Thread Jason Barnett
As far as I know, no one has done that yet.  Although all of the PHP manual 
pages are written in XML so if you were so inclined you could do it yourself. 
And I'm sure others would appreciate it if you shared it :)

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


[PHP] Re: Advise on parsing XML

2004-08-07 Thread Jason Barnett
I assume you are using PHP4's DOMXML functions?  If that's the case then you 
have a bit of a problem.  XML support changed between 4.0 and 5.0, we use 
libxml2 (which supports UTF-8), but the object model / methods changed to better 
conform with the DOM standard.  Also AFAIK the experimental tag has been dropped 
for PHP5.  I reckon that upgrading scripts to work with PHP5 and fixing any bugs 
that pop up is far easier than writing your own validating XML parser.  Hell, 
even libxml2 doesn't fully support XML Schemas yet.

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


[PHP] instanceof / __CLASS__ question

2004-08-31 Thread Jason Barnett
It's only a minor nuisance, but in order to use __CLASS__ with instanceof I have 
to assign __CLASS__ to a variable first.  Should I bother submitting a bug 
report for this?  Or am I perhaps missing something...


class Test {
  function checkObj2()
  {
//workaround
$class = __CLASS__;
if ($this instanceof $class) {
  return TRUE;
} else {
  return FALSE;
}
  }
  function checkObj()
  {
// this causes a parsing error
// return ($this instanceof __CLASS__);
  }
}
$t = new Test();
echo $t->checkObj2() ? 'TRUE' : 'FALSE';
echo $t->checkObj();  // can't even test it
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] help with crc32

2004-08-31 Thread Jason Barnett
I've been able to use md5 / md5_file to verify file integrity.  However when I 
try to check crc32's I'm running into some problems.  As an example I download 
and extract the PHP package for Windows, then when I try to crc32() the file 
contents I get a totally different value from what I think I should be getting. 
 Obviously I'm missing out on some crucial detail(s) here...


echo '';
// This is the extracted install.txt from PHP-5.0.1.Win32.zip
$file = 'C:\Downloads\install.txt';
// crc for the file - got from my unzip utility
echo $crc = 'EEED9D44' . "\n";
// reading all at once - buffer added line by line produced same results
$contents = file_get_contents($file);
printf ("%u\n", crc32($contents));
// result: 4008549700
// by the way, how can we cast to unsigned integer instead of using printf?
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Broken data within an Array

2004-08-31 Thread Jason Barnett
Harlequin wrote:
Hi all.
Having a problem echoing a broken date. Here's where I'm at:
$DateAdvertisedBroken = explode("-", $DateAdvertised);
So this contains an array of (year, month, day) or something similar?  You 
should be able to grab the values here if that's the case.

later, in a table, I use:
$result[DateAdvertised]
How can I change this so I can call the broken date...?
implode(' ', $DateAdvertisedBroken)
or use   if needed.
Or did you mean $DateAdvetisedBroken[2] ?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: help with crc32 [SOLVED]

2004-08-31 Thread Jason Barnett
I hate when this happens all I needed was dechex().  *sigh*
I could have sworn I'd tried that already, ah well.

Jason Barnett wrote:
I've been able to use md5 / md5_file to verify file integrity.  However 
when I try to check crc32's I'm running into some problems.  As an 
example I download and extract the PHP package for Windows, then when I 
try to crc32() the file contents I get a totally different value from 
what I think I should be getting.  Obviously I'm missing out on some 
crucial detail(s) here...


echo '';
// This is the extracted install.txt from PHP-5.0.1.Win32.zip
$file = 'C:\Downloads\install.txt';
// crc for the file - got from my unzip utility
echo $crc = 'EEED9D44' . "\n";
// reading all at once - buffer added line by line produced same results
$contents = file_get_contents($file);
printf ("%u\n", crc32($contents));
// result: 4008549700
// by the way, how can we cast to unsigned integer instead of using printf?
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] is_a (WAS: Re: instanceof / __CLASS__ question [SOLVED])

2004-08-31 Thread Jason Barnett
Greg Beaver wrote:
Hi,
I'm not sure I understand why you would use instanceof on $this.  Try 
this code:

Kind of complicated (so probably not the best way) but I have objects I'm 
creating with a factory method - and all of these objects *should* be extending 
a parent class.  It's in the parent class where I'm using $this instanceof 
__CLASS__ and alternatives are welcome.  I thought is_a was being deprecated 
(correct me if I'm wrong) ?


instanceof defines whether an object is or descends from a class (like 
is_a()).

If you want to check whether $this is the Test class or a descendant 
class, the simplest way I know is

if (get_class($this) == 'Test')

Yes, it probably makes more sense to do it this way.  Reflections would be 
overkill, all I need is to test for inheritance.

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


Re: AW: [PHP] Parsing pdf file

2005-02-09 Thread Jason Barnett
Mirco Blitz wrote:
Thank you for that huge code. I will try.
Greetings
Mirco Blitz
-Ursprüngliche Nachricht-
Von: Matt M. [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 9. Februar 2005 22:39
An: Mirco Blitz
Cc: php-general@lists.php.net
Betreff: Re: [PHP] Parsing pdf file
did you try this?
...
Code worked fine for me as well, thanks for that extremely useful
snippet!  I ran it on a test .pdf document and it pulled everything out.
In fact, this snippet gives me almost exactly the missing
functionality that I needed to work on a new project of mine!
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Foreach problem.

2005-02-09 Thread Jason Barnett
Since you didn't post how you created the array, I went ahead and (ugh!)
did it myself.  This works fine.

$elementsarr = Array ('knr', 'subject', 'title', 'kat', 'pages',
'access', 'dofile', MAX_FILE_SIZE, 'pdf', 'dolink', 'link', 'erstam',
'endless', 'from', 'until', 'openbem', 'history', 'closedbem', 'b',
'br', 'bw', 'bay', 'h', 'hb', 'hh', 'mv', 'n', 'nw', 'rp', 's', 'sa',
'sh', 'sn', 't', 'bund' );
print_r($elementsarr);
foreach ($elementsarr as $k => $v) {
  echo "$k => $v\n";
}
?>
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] fireing function with onChange

2005-02-10 Thread Jason Barnett
Richard Lynch wrote:
...
In honor of our recent Super Bowl, here is a slow-motion instant replay:
Bob: "Well, it's a great day so far for PHP today, isn't it Jim?"
Jim: "You've got that right, Bob!  Now let's check out this play."
Bob: "Watch as the user surfs right to that web page!"
Jim: "Yeah, smooth!"
Bob: "Then, Apache detects the .php in the URL and hands off the action to
PHP!"
Jim: "PHP has been really strong today, hasn't it?"
Bob: "Sure has, Jim!"
Jim: "Then, PHP builds up some HTML and JavaScript and sends it out!"
Bob: "Yeah, and then PHP says 'Job Done.'"
Jim: "You've got that right, Bob! PHP is outta the game for now, resting."
Bob: "Now watch carefully as the user interacts with the browser."
Jim: "Pay particular attention as they change items in the filelist box."
Bob: "Oh! What a fumble!!!"
Jim: "Yeah, it's definitely much too late to be handing off to PHP!"
Bob: "Sure is, Jim. PHP has been out of the game now for awhile!"
Copyright Richard Lynch and the NFL.
Unauthorized re-broadcast is a violation of Federal Law.
:-)
LMAO!
Bob: "Now let's go to Kate on the sidelines to get PHP's reaction.  Kate?"
Kate: "Thanks Bob.  I'm here with Quarterback PHP to find out exactly
what happened.   PHP, what was Coach OP thinking when he tried to get
you to run that Javascript?"
PHP: "Well Kate I wouldn't exactly call it a trick play, unless you mean
OP didn't get what he wanted.  Here I had just finished passing this
great HTML and Javascript to Browser and thought everything was great.
But then all of a sudden Browser makes this Filelist Box move.  Too bad
I was already on the sidelines or I would have helped."
Kate: "PHP what exactly was going through your mind when you saw what
fumble?"
PHP: "That's just it Kate, I didn't even see it.  It's like Browser was
trying to pass some Javascript back to me, but I was already sitting on
the sidelines drinking some Gatorade with Randy Moss.  Man, what a
fumble that must have been."
Kate: "And there you have it folks... PHP didn't even see what happened.
 I guess this is why PHP and Randy Moss aren't going to the Super Bowl
any time soon.  Back to you Bob."
Copyright Jason Barnett and the NFL.
Unauthorized re-broadcast is a violation of Federal Law.
:-)
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Re: Multi-Page Forms

2005-02-10 Thread Jason Barnett
Gh wrote:
Question. Does the Tabs and Divs work under Mozilla Based Browsers?

Generally speaking... if it's a part of a standard / RFC then it will be
supported by Mozilla.  If not, then probably not.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: php in free() error

2005-02-10 Thread Jason Barnett
Gerard Samuel wrote:
...

$array = array(0 => array('world'));
class RecursiveArrayIterator extends ArrayIterator implements
RecursiveIterator
{
   function hasChildren()
   {
   return (is_array($this->current()));
   }
   function getChildren()
   {
   return new self($this->current());
   }
}
$it = new RecursiveIteratorIterator(new RecursiveArrayIterator($array));
foreach($it as $key => $val)
{
   var_dump($key, $val);
}
?>
This may be a platform-specific bug.  I ran your test script on my box
(Win2000, php 5.0.3) and it executed with no errors.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] [Fwd: Re: [PHP-WIN] Re: SESSION]

2005-02-11 Thread Jason Barnett
Please send responses to the newsgroup.  I am usually happy to help you
out, but I do need to keep things organized / slightly sane on my end :)
The short answer to your question below: yes you can use Word with PHP
and depending on your needs this might happen on the server or you might
just send a Word document to a browser with the correct mime-type.
Based on what you say in your message what you want to do is read the
file's contents on the server side.  You don't even need to open Word to
do this.  Then when you get the file contents you can send the MIME
header and the content of the file to the browser.  Note that this
doesn't *force* the user to open the file through Adobe etc. but it
gives the browser an idea of what to do with the file and gives the user
that option.
Oh, and be careful which files you decide to make public and be
*especially* careful which files you allow people to edit and put on the
server.  You probably already know that, but it doesn't hurt to be
reminded from time to time :)
 Original Message 
Subject: Re: [PHP-WIN] Re: SESSION
Date: Fri, 11 Feb 2005 11:43:24 +0530
From: Vaibhav Sibal <[EMAIL PROTECTED]>
Reply-To: Vaibhav Sibal <[EMAIL PROTECTED]>
To: php , Jason Barnett
<[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
Thanks Jason ! It'll be great if you could also tell me whether I can
launch applications like MS WORD using COM or any other technology.
Basically I want the user sitting on a client machine  to select a
file from a list and press the open button (which I will provide) and
the action linked to the open button should be that of opening the
file in the appropriate software . For eg. The user sitting on the
client side select a file image001.jpg and presses open, and it
automatically gets opened in Adobe photoshop. That kind of thing I am
talking about. The only thing to be taken in mind is that the client
does not have a PHP parser installed and is not running a webserver
either. The file list comes from the server only, which is actually
running  the webserver and the PHP parser also. ! Please provide some
insight on this.
On Thu, 10 Feb 2005 17:36:05 -0500, Jason Barnett
<[EMAIL PROTECTED]> wrote:
Vaibhav Sibal wrote:
> I wanted to ask, where is the Session information stored ? That is at
> the server or on the client. Because I need to give the
> session.save_path value in the php.ini. I would give it according to
> people's reply of this question. Thank you.
>
> Vaibhav
session.save_path is located on the server.  Session data is stored on
the server; typically the only thing that gets sent to the user is they
will have a cookie written (wherever the web browser writes its cookies).
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


--
Jason Barnett
Destiny Capital LLC
Phone: 937.832.6900 x1054
Fax: 937.832.1570
GPG Public Key ID: 0x74D2856A
CONFIDENTIALITY NOTICE: "The information in this email is confidential
and may be legally privileged. It is intended solely for the addressee.
Access to this email by anyone else is unauthorized. If you are not the
intended recipient, an disclosure, copying, distribution or any action
taken or omitted to be taken in reliance on it is prohibited and may be
unlawful."


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Creating a varable with a name held in a string

2005-02-11 Thread Jason Barnett
Ben Edwards wrote:
...
What exactly is a simble table?
Ben
The symbol table is the where, deep down inside the guts of the Zend
Engine, your variables are stored.  There are symbol tables for
different scopes (function, class, global)
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] quotemeta() question...

2005-02-11 Thread Jason Barnett
Richard Lynch wrote:
Steve Kaufman wrote:
Why does
 quotemeta("pat:1$WRW")
return
 pat:1
instead of
 pat:1\$WRW
What am I misunderstanding about quotemeta function?

You usually would use quotemeta on data coming from the database, or the
user, or externally, or, errr, basically things you haven't typed in to
PHP, that you need to pass into Regular Expressions.
In those cases, you've already got the $ (and other characters)
successfully embedded in the string, but you want to escape them for
whatever reason.
A better example code would be:
$string =
'period.backslash\\plus+star*question?lbracket[rbracket]carat^lparen(rparen)dollar$';
echo "", quotemeta($string), "";
Interesting aside... with the test string above, I noticed that
backslash\\ only resolved to two backslashes.  I thought there would be
4.  It seems that quotemeta will resolve \ and \\ to \\, \\\ and 
resolve to , etc.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: How can I read the output from a local php file [fopen()]?

2005-02-11 Thread Jason Barnett
Al wrote:
...
But, but, it doesn't work when my script is started from a cronjob, only
from a remote browser.
Any suggestions?
Thanks.
cURL extension:
http://www.php.net/manual/en/ref.curl.php
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Uploading products in database using zip file?

2005-02-11 Thread Jason Barnett
[EMAIL PROTECTED] wrote:
One more thing" marketing person use Windows and he will probably use Winzip.
Is this still ok, or it's better to use some other application?
First of all I would suggest using 7zip on Windows.  Its usage is 100%
free (you can of course donate to the project if you feel it is worthy).
 Your sales guy can then create zip's / tgz's / whatever archiving
scheme supported by 7zip.


Hi,
right now in my firm, to upload new products to web site, marketing person
has to, in admin area, upload csv file (then php read content and store
info in DB), and then ftp all images in temp directory. And then, using
other php script, resize images and put them in product_images directory.
Does the other script do all the resizing automagically, or is the sales
guy necessary in this step of the process?
Whole process works just fine.
But, I was wondering, if is possible this "scenario":
marketing person zip images and csv file together, then in admin area
uload zip file to server, and php then unzip file and do the job.
Sure... PHP can unzip the archive to a temp directory.  Then you glob
the files in this temp directory and have PHP perform the action(s)
matching that type of file.  Rinse and repeat for images.
Alternatively you can have PHP try checking the contents of each
individual file to guesstimate what type of file it is and handle it
accordingly.  If you go this route it may also be worthwhile to check
the file's contents for possible XSS exploits, or PHP code, or ...
Even if the images are stored in a database / other server this
shouldn't be too tough for PHP to handle.  :)

Actually, instead doing two operations (upload csv file and ftp images) he
has to do just one thing: upload zip file.
???
Or, if somebody has an idea about this whole process?
Thanks!
-afan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] quotemeta() question...

2005-02-11 Thread Jason Barnett
Jochem Maas wrote:
...
A better example code would be:
$string =
'period.backslash\\plus+star*question?lbracket[rbracket]carat^lparen(rparen)dollar$';
echo "", quotemeta($string), "";
Interesting aside... with the test string above, I noticed that
backslash\\ only resolved to two backslashes.  I thought there would be

thats correct...
echo "\\"; // shows one backslash
Well in the example above it was a single quote, not a double quote.
But either way... I would have thought there would be a 1:1 relationship
in the quotemeta translation (either quote all of them, or assume they
are all quoted already).

4.  It seems that quotemeta will resolve \ and \\ to \\, \\\ and 
resolve to , etc.
See above.  I would think (given my own common sense as well as the man
page for quotemeta) that there would be a quote added to each of these.
 But the results don't quite match this...
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Re: [NEWBIE GUIDE] For the benefit of new members

2005-01-25 Thread Jason Barnett
Jochem Maas wrote:
Jay Blanchard wrote:
...
Jay, great list BTW - I was thinking maybe we could drop it on a site/wiki
or something which could also contain stuff that comes up again and again,
or stuff that even the 6month y/o newbie finds trivial or just good stuff
thats been condensed from the list (kind of a good practice/cool code
repository). I know there are lots of places out there already but I think
I think that Justin Patrin started up a wiki for PHP, but he hasn't been 
on the list in a while and I can't remember what the url for his wiki 
was.  But he had a fair amount of useful code in there that would be a 
great start for this project.

,for instance, the mail archives suck for searching - and often there is
plenty of FUD in among the cherries. someone could then send out a weekly
NEWBIE email that points them to said site - which in turns introduces them
to netiquette, list faqs, etc. having a Wiki type thing would relieve the
list of lots of 'O-T' stuff on 'NEWBIE email enhancements'?
Yeah the list is pretty high volume... it would be great if we could 
help relieve the stress on the servers a bit.

--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY | 
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

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


[PHP] Re: Question: re: Session-only cookies and Firefox

2005-02-14 Thread Jason Barnett
Rgl wrote:
Question:
Has anybody else noticed session-only cookies not disappearing when using
Firefox? Is this a Firefox bug (should they be notified/ or I get latest
Firefox) ?
They finally released 1.0, and yet you still use 0.8?  I
use Firefox quite regularly, but I don't experience the problem that you
describe.  Then again I use 1.0 now (though I used 0.8 for a while and
don't recall having this problem at that time either...)
Using IE6 I can:
setcookie('sesvar', 'this session only', 0, "", "www.mypersonaldomain.net");
This can be read and disappears after the browser has been closed.
Doing the same with Firefox 0.8 the cookie can be read, but also can be read
when the browser has been closed and a new one opened. It can also be read
after logging out, closing the browser and reopening a new browser.
Very strange indeed!  I honestly can't think of why the browser would
store the cookie longer than a session, *especially* if your PHP script
used cookie destruction.
Any ideas
Many Thanks
Roger
PS - I hope that this is the correct place to ask this question
A better place is the Firefox online forum:
http://forums.mozillazine.org/viewforum.php?f=38
There are a lot of knowledgeable people (more knowledgeable than me at
least!) on that forum and it is *very* active.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: php/mysql url validation methods...

2005-02-14 Thread Jason Barnett
Darren Kirby wrote:
Hello all,
On the main page of my website I have written a very simple comments feature
that allows people to leave a message under my posts, much like a blog. I
have purposely kept this very simple...
On the main page I have simple text links that someone can click on if they
want to leave a note. Clicking the link passes a variable $postid (a simple
int) to the backend script, which tells the database which 'blog entry' the
comment is attached to.
The problem is that after playing around with this a bit, it is clear that
someone can craft a url with an arbitrary $postid that is not in the database
yet. Now naively, it would seem that the worst someone could do is just
create arbitrary entries in the DB that may come back to bite me when I
actually _use_ the arbitrary postid down the road.
Well a couple of things that I can think of here...
- Doing this seems like an easy way to get "orphaned" posts i.e. blogs
that are stored in the database, but because there is no thread that
corresponds to this blog then it would be a waste of DB storage
- Might allow a malicious user to change an already-created post.  They
might even be able to stick in some PHP / Javascript code that could
compromise the security of anyone that happens to read that blog!
What I want to do is make sure that someone cannot create a post with a
$postid value greater than the largest $postid I have used so far.
And you want to be sure that they cannot create a post with a $postid
that has already been used.
Now, I thought about using a quick sql query to get the largest postid from
the DB and check that, but this will not work because of my own bad DB design
How about... instead of generating *any* $postid in your form, you just
let MySQL handle it when it's ready to insert a new message.  Just have
the ID be an auto-increment in the DB... and this ID never needs to go
to the browser (unless you're allowing a user to edit their *own* post).
 In the case of an edit you then check that the username in MySQL
matches the username attached to the $_SESSION (or just don't let people
edit ;)
(I'm really just a hobbyist here...) in that if there are no comments
attached to a blog entry, then the postid for that entry is _not_ in the DB
until I get one.
So, I guess my option is to either create another DB table with only the valid
postid's in it and check that, or perhaps use a regexp to grab the highest
postid from the html link (which would be the one closest to the top of the
page).
I really don't want to have to change the current DB table, or have to update
one manually when I ad a new post on the main page.
I guess my question is if there is an easier way to validate the postid value
passed in the url. How would you do it?
Again... unless I'm missing something here the only thing you might want
 to send into a form / validate on the server would be a "thread ID" to
figure out which thread this post belongs to.
If you need more info, please just ask...
Thanks,
Darren Kirby

--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: calling php function when submit button is pressed

2005-02-14 Thread Jason Barnett
[EMAIL PROTECTED] wrote:
Can anyone show me how to call a function when submit is pressed or a form
is submitted.
"When submit is pressed"... as in instantly / on the web browser's side?
 You need Javascript for that; PHP simply won't do that.
Or did you mean "when a form gets posted to the server"?  Because you
can run just about anything in the target script when it receives a
$_POST['your_submit'] value...
I  am for an alternative to $php_self which refreshes the whole page. I want
to run the function which displays the errors on a form and only do a
$php_self when the form is filled out correctly.
Based on this, sounds like you want some Javascript to do the error
checking.
thanks
Ross

--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Delete all files in DIR every 20 days

2005-02-14 Thread Jason Barnett
Tim Burgan wrote:
Hello,
How can I delete ALL files within a specified directory every 20 days?
Does anyone know of any code-snippets that are around at the moment that
are able to do this? (And where I can find them?)
Thanks
Tim
Please give the list longer than an hour to respond to your request ;)
I would recommend a cron job (*nix) or a scheduled task (Windows) to do
this.  Search the web for whichever of these applies to you.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: who's on-line application - php

2005-02-14 Thread Jason Barnett
Jacques wrote:
I would like to indicate the particulars (from a MySQL database) of all
those users that are currently on-line (those whom have successfully signed
in). How should I go about achieving this? Does it have something to do with
Sessions?
Jacques: the best solutions that I have seen involve
session_set_save_handler:
http://www.php.net/manual/en/function.session-set-save-handler.php
Yes you are correct.  The basic idea here is: you create functions that
will read / write / etc. session data into a database.  The database
you'll need is fairly simple (sess_id, data, timestamp).
Then once you have sessions stored in a database table you just do a
count of the records in that table.  It won't be 100% accurate (the
accuracy depends on how long you let sessions go inactive before they
get destroyed), but it's a clean and easy way to do it.
I suppose if you *really* wanted to you could do all of this through the
filesystem session handler (counting files in that directory), but why
would you when this job is already done so well with a database?  :)
Not only that, but moving sessions to a database has some other
benefits... but that is another discussion for another day.  :)
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: PHP book recommendations>

2005-02-14 Thread Jason Barnett
Dave Bosky wrote:
I'm looking for an easy to read PHP book that will help me learn a solid
foundation in PHP.
I'm already familiar with the language but want to make sure I'm coding in
the most efficient manner.
What's a few of the better books out there?

HTC Disclaimer:  The information contained in this message may be privileged 
and confidential and protected from disclosure. If the reader of this message 
is not the intended recipient, or an employee or agent responsible for 
delivering this message to the intended recipient, you are hereby notified that 
any dissemination, distribution or copying of this communication is strictly 
prohibited.  If you have received this communication in error, please notify us 
immediately by replying to the message and deleting it from your computer.  
Thank you.
Advanced PHP Programming by George Schlossnagle is for you.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] User Passwords: checking for unique chars

2005-02-14 Thread Jason Barnett
Chris W. Parker wrote:
Alex Gemmell 
on Monday, February 14, 2005 7:24 AM said:

Hello!

Hi!
Bonjour!


# Code:


Do you also have a label on your computer that says
"Computer"?
No, but I do have a label that says "My Computer".  Close enough, isn't
it?  ;)
Some questions (because I'm curious):
1. Why would you *not* allow special characters? Wouldn't allowing
special characters make the password stronger?
Agreed.
2. Why are you forcing the password to have all unique characters? I
don't think I've ever read this as being a recommendation for strong
passwords.
If anything unique characters would make a password less secure (from
the perspective of a dictionary attack).  Because once you know where
the "A" is, and where the "B" is, etc. that only leaves you with the
rest of the characters on the next cycle...

Chris.

--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Re: Delete all files in DIR every 20 days

2005-02-14 Thread Jason Barnett
Tim Burgan wrote:
Jason Barnett wrote:
Please give the list longer than an hour to respond to your request ;)

Thanks for the suggestion.. I've just given the list 6 hours at the moment.
Why do you say this?
Tim
Only because I saw your message listed twice... and there was only 50
minutes in between the messages.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] php products licensing system

2005-02-15 Thread Jason Barnett
Jad Madi wrote:
as I said, we are willing to have our product open source, but No
free. and that fair enough, thats why I'm asking about a good method
to protect our products from being used illegaly and keeping it open
source
It's a tough balancing act.  Encoding / closing the source with one of
the packages out there is an option.  The license that you use is
important and always be certain that LICENSE is included in every code
distribution.
Without knowing a little more about the exact product you sell it's
tough to give good advice, but some things that I have seen:
- Open up part of the source, but keep the valuable code closed
- Different licenses for different parts of the code
- Open source it all and charge for 24/7 support services
- Open source it all and charge for consulting / specialty services
- Open source it all, but only for a client application.  Then you have
the client connect to a server side app on your site and you charge per
usage.
My advice: look at some of the *successful* and more importantly
*profitable* open source companies out there.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Running PHP from inside another application!

2005-02-15 Thread Jason Barnett
Mikael Andersson wrote:
Hi,
I've a case where I have to run a lots of php-scrips, in a short time, from
inside a delphi-application. Every script connects to the same databas.
Today I use CreateProcess to start php.exe and then I'm using pipes to get
the php-result. I'm doing this for each php-script I want to run, and it's
timeexpensive because every script has to establish a database-connection.
I'm new in the PHP-world, but I'm sure that there is a better way to solve
this case.
There is.  :)  From what you say I think the Embed SAPI will be a good
way for you to go - it allows you to embed a PHP parser within another
application.  *NOTE* This is not for the faint of heart!
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: How to make use of the billing token the right way???

2005-02-15 Thread Jason Barnett
Scott Fletcher wrote:
I created the token via Javascript where the billing can be controlled
better and to prevent the mixed up of the billing such as incorrect
statements or calculation.  I use the billing lock file for that purpose.  I
found that it doesn't alway work that way when the browser is refreshed or
submitted, so I customized the Javascript to make it work better.  That
solve my problem but I found that some browsers acted too soon or too late
with it's use of Javascript coding to unlocking the file, so the billing
lock doesn't get released.  So, I decided to do it all in PHP so the
browsers' issues can be removed.  I haven't decided how to best make use of
the token via PHP, so I'm wondering if anyone of you can come up with one
that is better than what I can come up with.
Call me crazy... but what about just using a cookie / session mechanism
for this?  One browser, one cookie, your site.  Heck they even generate
tokens for you.  :)
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Set a timeout on file_get_contents?

2005-02-15 Thread Jason Barnett
Brian Dunning wrote:
Is there any way to specify a timeout on a file_get_contents()? I'm
trying to verify a URL but I don't want to spend more than a few seconds
on it.
- Brian
Note that using file_get_contents to do this is only going to work if
your php.ini has allow_url_fopen = 1.  Actually I think we just
discussed a solution last week that would work for you.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: How to make use of the billing token the right way???

2005-02-15 Thread Jason Barnett
Scott Fletcher wrote:
I can do the Session Token but problem is two browser windows can have the
same Session Token via "File --> New Window" or Browser Tab.  I have thought
about using the Database Table instead but it all go back to the original
problem with 2 same browser windows that use the same Session.
OK, I get your concern.  In that case why not pass a uniqid() as a
hidden form field in a POST form?  (GET would work also, but not I would
go POST).  If it's a multipage form you can keep passing this uniqid
from one page on to the next.
I'm thinking of a random number or brower's window serial number of some
sort but I don't see how.
Scott
"Jason Barnett" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: How to make use of the billing token the right way???

2005-02-15 Thread Jason Barnett
Scott Fletcher wrote:
Never heard of the uniqid() before and looked it up on the php.net.  It look
very promising.  I can do that.  That leave me with 2 questions.  How do I
do (or how does it work) this with a token if
1) The webpage is submitted (goes from page 1 to page 2) with the uniqid().
2) The 2nd browser window appear with the uniqid().
An example or something would help if you can.

/** Page 1 of the form (uniqid.php) */
$id = uniqid(rand(), true);
?>

  


  



/** Page 2 of the form (uniqid2.php) */
if(!$_POST['id']) {
  header('Location: http://yourdomain/uniqid.php');
  exit;
}
?>

  

Your id is 

  

--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Delete a file immediately after download

2005-02-15 Thread Jason Barnett
Shaun wrote:
Hi Marek,
Thanks for your reply, could you tell me how I would go about this please?

header('Content-type: text/csv');
header('Content-Disposition: attachment; filename="download.csv"');
/** Now you perform the MySQL query, DECODE the information and echo it
to the screen.  Hopefully this is actually in CSV format :) */
?>
"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Shaun wrote:
Hi,
I have a database that contains encrypted data using Mysql function
ENCODE(). Certain users will be allowed to view this data and I will
allow them to download a CSV file contain the decrypted data using the
Mysql DECODE() function. However I don't want this file to be left on the
server, is there a way to ensure that the file is deleted immediately
after it has been downloaded?
Don't put the file to a file at all, simply output the right header and
echo the content.

--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] other mhash hashes

2005-02-16 Thread Jason Barnett
Burhan Khalid wrote:
...

David:
  You should really post this at the mhash manual entry in php.net. I'm
sure others would find it useful.  Good find :)
Cheers,
Burhan
[ snippity snip snip ]
Agreed!  I found it very, very useful.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: php login

2005-02-16 Thread Jason Barnett
William Stokes wrote:
Hello,
I need to create solution for user authentication/recognition in my web
page. I think it would be a good idea to use mysql database for storing the
user info because the user info is later used to determine what parts of
site the recognized user is allowed to update.
Sounds like a fine idea to me.
The site is for a soccer club that has some 30+ teams. I want to give each
team the ability to update their own information but I don't want them to be
able to mess with others info. So each team has one named "admin" to whom I
need to give the access to their team info.
I'm willing to learn to write my own scripts if I can get some info how
these things are normally handled or I can use free ready scripts if someone
can reccoment me one
The basic process might go something like this:
- Create the user database
  - Build DB so that each user record needs a unique ID (auto-increment
number is usually best), a team name, user type (user / admin), and password
- Create a login function (user / password)
  - Query the user database; see if password matches stored password
- If login succeeds:
  - Start session: session_start()
  - Store username / team / user type in $_SESSION
  - Go to team home page (or whatever)
- If login fails:
  - Redirect user to the login page
- Create all of the individual web pages you want (show team / edit team
/ etc.)
- At the beginning of each web page you check for the user type in
$_SESSION.  Also, check for the user team in $_SESSION.
  - If the user isn't the required team / user type then send an error
message to the user
Rough outline, but this should be enough to get you started and to let
you know which parts of the manual you will need to read.  ;)
http://www.php.net/manual/en/index.php

BTW I am quite rookie with PHP.
Thanks a lot
-Will

--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] other mhash hashes

2005-02-16 Thread Jason Barnett
Richard Lynch wrote:
...
http://www.schneier.com/blog/archives/2005/02/sha1_broken.html

Before we get a hundred posts about SHA-1 being "broken" would eveyrbody
please read:
http://nuglops.com/blog/index.php?p=1021
and maybe *ALL* the contributions way down at the bottom of the original
post link?
Why do you always have to ruin our fun, Richard?  Do you have something
against Chicken Little?  :)
You're still looking at thousands of years or millions of dollars to break
SHA-1 if you want to start TODAY.
The wise reader will put "Upgrade to SHA-256" on their "ToDo" list and go
back to work now. :-)
Exactly.  While I'm not sure about the time it would take to actually
make use of the "exploit" found, it is certainly a long enough period of
time that I'm not going to worry about it any time soon.  Even with a
significant increase in CPU performance it's going to be a while before
this is a concern.
Though I did find the post to add meta-data such as the character
distribution to the hash interesting...
I believe this is being reviewed as a possible addition to the OpenPGP
standard.  Then again I am no crypto expert (nor do I pretend to be,
that stuff makes my head spin!).  I am getting a bit OT here, but for
those of you that use code that implements OpenPGP then you might want
to read this:
http://www.pgp.com/library/ctocorner/openpgp.html
Short version: be careful about automatically decrypting OpenPGP
messages; if you do this it is possible for your private key to be
easily compromised.
The odds on a SHA-1 being the same for two plain-texts *AND* having the
same number of E's in the plain-texts?  Really really really low, seems to
me.

--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Dynamic/runtime object creation

2005-02-16 Thread Jason Barnett
joe Lovick wrote:
> Hi,
> forgive me if this is a complete noob question
> What i want to do is create an object at runtime with members and
> methods based on the result of queries from my db back end. is this (a)

Creating an object based on the result of a query shouldn't be a
problem.  I'm not sure what logic you want to use exactly, but it is
more or less like this:

if ($some_condition) {
  $obj = new FirstObject($arg1, $arg2);
  $obj->prop1 = 'test';
  $obj->prop2 = 1234.56;
} else {
  $obj = new SecondObject($arg2);
  $obj->prop1 = 'I am second object';
}

*HOWEVER* adding methods at runtime is only implemented in PHP4.

http://www.php.net/manual/en/function.aggregate-methods.php

Currently there is no explicit support for this in PHP5, although you
could probably make something usable with the __call() magic function.

> possible? or (b) something i should get out of my head and go and find a
> better solution?

Creating objects at runtime based upon certain conditions is sometimes
the best way.  I don't suggest this in all cases mind you, but in some
cases this is quite useful (for example, database abstraction).

*HOWEVER* I do *not* recommend trying to aggregate methods dynamically.
 I mean you can do this, but if possible just create a specialized class
that will do what you want instead of trying to add methods at runtime.

class DB {
  function connect() {}
  function query() {}
  /** whatever other methods */
}

class MySQL extends DB {
}

class MySQL_4_1 extends MySQL {
  function query() {}
  function silly_function_only_relevant_to_MySQL_4_1() {}
}


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Dynamic/runtime object creation

2005-02-17 Thread Jason Barnett
joe Lovick wrote:
> Thanks for your help Jason, yes aggregating methods was what i had in mind,
> but now as i explore it as a option i realise that it would work best is if
> their was a way for me to pull my object out of the database variables,
> data,

This is certainly do-able.  You serialize() an object and store this in
the DB...

> methods and all and then instantiate them some how, with out any of the
> code

... however, you *must* include a class definition for an object before
the object can be instantiated.  When an object gets serialized it is
only the object's properties (*not* its methods) that become serialized.

> being prewritten.
> 
> a bit like create_function() for lambada type functions, but in this
> case for
> my more general object code... and searching the hell out of all these
> formums

So long as you have the (potential) class definitions already included,
you can use unserialize() to create the object (whatever type it happens
to be).  You don't even need to know what kind of object it's going to
be.  :)

>  gives me the classkit functions, so i guess i will try and install and
> give
> them a try...
> anyhow
> cheers
>  joe


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: map internal extension name to actual file

2005-02-17 Thread Jason Barnett
Zac Barton wrote:
> Hi,
> 
> Does anyone have any good ideas of how to find out what extension was 
> loaded/enabled from what actual file.
> 
> For example the "ming" extension (thats its internal name) could come from 
> php_ming.dll in my extensions dir. But if the file name is say mingFlash.dll 
> how can i determine (in php) that my ming functions come from the 
> mingFlash.dll file?
> 
> I had thoughts of getting the name of the first function from 
> get_extension_funcs("ming") and then seeing if the text of the function name 
> appeared in the actual content of mingFlash.dll, but it seems a bit 
> inaccurate and slow. Can unpack help me here?
> 
> To re-cap id love to be able to say (from within php), yea the ming extension 
> was loaded by enabling the mingFlash.dll in php.ini.
> 

If you just want to know that an extension was loaded then the easiest
way would be this function:

http://www.php.net/manual/en/function.extension-loaded.php

If you really need more specific information about an
extension (such as where the extension library is stored on disk) then
you might be able to pull it out of the PHP class ReflectionExtension


http://www.php.net/manual/en/language.oop5.reflection.php

> Hope that makes sense
> 
> Zac


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Hashing strings

2005-02-17 Thread Jason Barnett
Gerard Samuel wrote:
...
>>> Im trying to determine if md5() would be the fastest,
>>> *cheapest* solution.
...
> What Im looking for is something where the generated hashes can
> be reproduced.
> For example, md5('foo') today, will be equal to md5('foo') tomorrow.
> Thanks

AFAIK crc32() is the fastest hashing function in PHP.  I don't have
actual results on hand still, but I created a filesystem plugin that
auto-generates hashes for each file in a directory.  crc32() was faster
than md5() and sha1().

FYI the benchmarking that I did was for a Windows XP system... YMMV

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Date() reporting wrong on OS X server intermittently

2005-02-17 Thread Jason Barnett
Rowan Hick wrote:
...
> 
> Has anyone out there seen weird problems like this before ?
> 
> Many Thanks, 
> Rowan

The other suggestions are good.  If they don't pan out, check to see if
you use the function strtotime().  It has been buggy in a few versions
of PHP and may not be acting properly in your build...

http://www.php.net/manual/en/function.strtotime.php

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Problems with print html to pdf

2005-02-17 Thread Jason Barnett
Juan Antonio Garrido wrote:
> Hi everybody:
> 
> Does it exists someone library I can print html files to pdf without it loss 
> information about my property css classes(background,color,width...)?
> 
> With GPL library HTML_To_PDF3.3 it isn't possible... 
> 
> If the library is GPL much better.
> 
> Thank you for all...

A couple of ways you might go about doing this... You could probably get
the fpdf library to fill this need.

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Storing formulas

2005-02-17 Thread Jason Barnett
Mike Smith wrote:
...
> 
> TopMeasurment+1.6875+OutOfPlumbWall
> 
...
> static). Other formulas have 10 and 12 "variables" in them. How have
> others gone about storing formulas that require such modifications?
> 
> TIA,
> Mike Smith

If I was programming this I would probably create 16 functions for
whatever the formula is supposed to produce.  If you believe that a
constant will usually work you can have that as a default.



-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Crontab for Windows

2005-02-18 Thread Jason Barnett
[EMAIL PROTECTED] wrote:
> On W3K you could use this as the run line in
> Scheduled Tasks and probably the same in XP
> although I have not tested this. The same
> components exist in the W2K version although
> may be in different locations/names.
> 
> Run: cmd /c "c:\php\php.exe -q c:\path\to\php\file.php"

This is *very* close to what I use with Windows XP (actually I use this
for file types so that I can right click and run a PHP file on the
command line).

cmd /K "C:\php\php.exe -f %1"

The %1 is a variable that gets replaced.  If you set this up for the
file type then the %1 is the name of the file.

So to apply this knowledge to scheduled tasks, you can do:
cmd /K "C:\php\php.exe -f C:\path\to\your\file.php"

> 
> Start in: C:\path\to\php\file\
> 
> Run as: username/pass with security acess to
> both php.exe and the file.php

Agreed... it is much easier to manage it this way although it is
*possible* to use the command "runas" to execute PHP as a different user.

For help on these commands, just use:
cmd /?
runas /?

> 
> YMMV
> 
> pjn
> 


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] XHTML 1.1 + php sessions = :(

2005-02-19 Thread Jason Barnett
Your Name wrote:
> Thank you very much for that solution however I need something slitely 
> different.  This is a CMS for distribution... not everybody that's 
> going to use it can go in and edit the config files.  I've heard of a 
> command called ini_set(); which temporarily changes it just for the 

http://www.php.net/manual/en/function.ini-set.php

> script.  Would you mind letting me know how to use ini_set(); with the 
> use only sessions command?  Thank-you very very much!
> 

The "only sessions" command?  Not exactly sure what you mean there.
*IF* you use sessions then there a few things that you can do to control
the way those sessions work.  You should probably read the manual page:

http://www.php.net/manual/en/ref.session.php

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Destroying the Session Object

2005-02-19 Thread Jason Barnett
pete M wrote:
> here's the way I do it

Depends on what you're going for exactly.  Based on what the OP said I
believe he'll also want to destroy the session cookie.  If you want to
completely destroy the session you need the extra step that I copied and
pasted from the manual.  :)

> 
> logout.php
>  session_start();
> $_SESSION = array();
> session_destroy();

// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (isset($_COOKIE[session_name()])) {
   setcookie(session_name(), '', time()-42000, '/');
}

> header('Location: login.php');
> ?>
> 
> 
> Jacques wrote:
> 
>> I am developing an application. When the user signs in a Session ID is
>> created (for argument sake: 123). I have a sign out page that has the
>> script session_destroy() on it. This page directs me to the sign in
>> page. When I sign the same or any other user in again I get the same
>> session id (123).
>>
>> However, when I close the browser window and sign in again as any
>> member, the session id changes.
>>
>> How does this work and how can I ensure that a unique session id is
>> allocated to every new user that signs in?
>>
>> Jacques 


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] XHTML 1.1 + php sessions = :(

2005-02-19 Thread Jason Barnett
b1nary Developement Team wrote:
> Oh I'm sorry, that was just a typo, I meant the "use only cookies"
> one... god I'm an idiot, thank-you.
> 

Not an idiot... we all had to learn it once.  And some of us a few times
more than that!

You're welcome.

Jason


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Unable to load extension (was Re: PHP to C interface?)

2005-02-21 Thread Jason Barnett
N Deepak wrote:
> On Fri, Feb 18, 2005 at 09:20:02AM -0800, Richard Lynch wrote:
> 
>>N Deepak wrote:
>>
>>>  Is there a way to invoke C functions in a library (.so) from PHP?
>>>  Like Xs in Perl?
>>
>>By definition, then, all you have to do is learn how to write a PHP
>>extension, which Rasmus tells you how to do in a one-hour lecture at any
>>PHP/Linux/Apache/OpenSource conference you care to name :-)
>>
> 
> I downloaded php-4.3.10 off http://www.php.net/ and am trying to build a
> simple helloworld extension.
> 
> I ran ext_skel, modified config.m4 where it had the PHP_ARG_ENABLE line:
> 
> PHP_ARG_ENABLE(foo, whether to enable foo support,
> dnl Make sure that the comment is aligned:
> [  --enable-foo   Enable foo support])
> 
> I followed the remaining steps too, (./buildconf --force, ./configure
> --with-foo, make)
> 
> Now when I say
> ../sapi/cli/php -f ext/foo/foo.php
> 
> I get this error:
> 
> Warning: dl(): Unable to load dynamic library

Were you actually trying to dl() the library in your PHP code?  If you
compiled the extension into PHP this shouldn't be necessary.  In fact,
unless you build an extension to be a DSO you shouldn't be able to use
dl() with that extension anyways!

Mind you that I am no internals expert though... so this is about as
much help as I can give you.  :(

> '/usr/local/lib/php/extensions/no-debug-non-zts-20020429/foo.so' -
> /usr/local/lib/php/extensions/no-debug-non-zts-20020429/foo.so: cannot
> open shared object file: No such file or directory in
> /home/deep/php-4.3.10/ext/foo/foo.php on line 3
> Functions available in the test extension:
> 
> Warning: Invalid argument supplied for foreach() in
> /home/deep/php-4.3.10/ext/foo/foo.php on line 8
> 
> Module foo is not compiled into PHP
> [EMAIL PROTECTED] php-4.3.10]$
> 
> I tried in vain to look up the Web for solutions, but to no avail.
> 
> Could anyone help me please?
> 
> Thanks,
> Deepak
> 


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Fatal error: Maximum execution time

2005-02-21 Thread Jason Barnett
Stanislav Kuhn wrote:
...
> 
> PHP Fatal error:  Maximum execution time of 30 seconds exceeded in .php
> on line 130
> 
> Has somebody seen something like this or has an idea what's going on there?

When I get this error it is often because I found myself running into an
infinite loop someplace.  Checking your while loops in your code may
provide an answer...

> 
> PHP Version => 4.3.10-2
> Running with apache on Linux..
> 
> Thanks a lot.
> Stan


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] [NEWBIE] PEAR::Mail Help Please

2005-02-21 Thread Jason Barnett
Jay Blanchard wrote:
> [snip]
> Hello all.  I am new to using PEAR, but not so much to PHP.  I was
> looking
> for a little help.
> [/snip]
> 
> Have you tried a PEAR mailing list?
> http://pear.php.net/support/lists.php

Agreed... some of us on this list use PEAR, but PEAR developers will
often watch the pear general list to help out with problems using their
packages.

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: cannot remove cookies

2005-02-22 Thread Jason Barnett
Bruno Santos wrote:
> Hello.
> 
> I'm using 2 cookies to control some user environmente.
> every time the user logs in, the cookie is set, but when i try to change
> the value of that cookie,
> deleting it firts and then setting a new one with another value, when i
> print the value of that cookie
> the value is never the new one, but always the firts.
> 
> im setting the cookie with:
> setcookie ("cookie_name",cookie_value,time()+time-to-expiration);
> 
> when deleting it, i do
> setcookie ("cookie_name");
> or
> setcookie ("cookie_name","",time()-time-to-expiration);

time-to-expiration may as well be something fixed and fairly large...
this way you account for a computer's clock being off from the actual
time.  3600 is good.  I'm guessing that this is the cause of your problem...

> 
> but it never works

If this is a session cookie that you are trying to destroy then you
should go ahead and destroy both the session as well as the cookie.

> 
> the browser im testing it is firefox (linux)
> but in IE is not working either...
> 
> PHP version is PHP-5.0.3
> 
> Apache version is Apache-2.0.52
> 
> Cheers
> 
> Bruno Santos
> 


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Writing PNG Images to File from Command Line

2005-02-22 Thread Jason Barnett
Richard Lynch wrote:
... Good stuff ...
> All that said:
> If you only have a handful of color coded flags, and you are using GD to
> re-draw an image every time, that's kinda silly...
> 
> Perhaps I'm missing something here, but:
> 
> Just use your query to decide which flag to *USE* instead of drawing a new
> one every time.
> 
> 
>   
>/* db query to determine flag color here */
>   echo "";
> ?>
>   
> 
> 
> No need to fire up GD on every image if you only have a handful of
> possible outputs.
> 
> Or does a single image consist of many many many flags?  Oh, okay.  GD is
> the answer then.  Probably.  An HTML table of a bunch of tiny images
> *might* be faster/smoother.
> 

Agreed... you should create a bunch of tiny images if you have a fixed
set of flags that you will need to output.  If there are too many
possible combinations to make this practicable then using GD on-the-fly
is a good, but in general I try to serve static content where possible.

Now this doesn't mean you shouldn't use GD to create the images that you
will need... it just means that you should do it and then save these
images to the server for later use.  That way the image creation is a
one-time hit and all future use is just reading from disk.


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: uploading > remote server

2005-02-22 Thread Jason Barnett
Sebastian wrote:
> i have some php forms which uploads files/images and i would like to know if
> its possible to upload them to a remote server instead, if so, how?
> 
> cheers

Yes it is possible.  This is a bit of reading, but it is exactly what
you need to read:

http://php.net/manual/en/features.file-upload.php
http://php.net/manual/en/features.remote-files.php

After you read the above links you should have a pretty clear idea of
how it works (in general).  If you have a specific question about your
FTP server or whatever, feel free to come back and ask us that detailed
question instead.  :)

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: [Pear] go-pear.php

2005-02-23 Thread Jason Barnett
James Nunnerley wrote:
> Hi,
> 
>  
> 
> I'm having two problems:
> 
>  
> 
> Firstly, the new update of go-pear.php I believe is not working.  Does
> anyone know when a new "fixed" one is being released?
> 

Not sure.  What error are you getting?  It is possible that it is trying
to look for the PEAR scripts in the wrong directory (e.g. if you
installed PHP in a directory other than C:\php5)

>  
> 
> Also, I'm having problems signing up to the pear.php.net lists - again,
> anyone any ideas?
> 

I joined with no problems.  The newserver is the same one that hosts
php.general.  The group that you want on the server is php.pear.general

>  
> 
> Cheers
> 
> Nunners
> 
> 


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Bug or undocumented functionality of unset()?

2005-02-23 Thread Jason Barnett
[EMAIL PROTECTED] wrote:
> Hi All,
> 
> Does unset() create a copy of the array and then overwrite the 
> original
> somehow 
> destroying the reference?
...
> ---
>  $stuff = array(array('one','two'),
> array('one','two'),
> array('three','four'),
> array('five','six'),
> array('seven','eight'),
> array('nine','ten'));
> 
> print ''; print_r($stuff); print '';
> 
> foreach ($stuff as $key => &$values) {

This kind of array manipulation only works in PHP5... which I assume you
are using?

> print "on key:$key";
>   if(($key%2)==0){
>   print "Running unset for $key ";
>   unset ($stuff[$key]);

This works fine for me... again, using PHP5 here.

>   }else{
>   print "Running change for $key ";
>   $values[1]='foo';

Now this is an interesting problem.  It seems that $values[1] is not
being changed.  I don't know if this is a quirk or not, but since
$values should be a reference I would expect it to work for values that
are arrays (and not just scalars).  Check out bugs.php.net for this part
of the problem.

Seems the root issue here is that array references only work for scalar
values.  This is also a PHP5-only issue (since foreach references wasn't
a feature of PHP4).

> //$stuff[$key][1] = 'foo';

Using foreach in PHP4 you would have to do something like the line above
to change a value.  It appears that this is also the only way to do it
in PHP5? ... but IMO this shouldn't be the way it is...

>   }
> }
> print ''; print_r($stuff); print '';
> ?>


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Server includes and Absolute URL

2005-02-24 Thread Jason Barnett
Jacques wrote:
> Can make use of an absolute URL when using require() or require_once()?
> 

Yes, as long as you have allow_url_fopen = 1 in your php.ini

> Regards
> 
> Jacques 


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Problem with XML

2005-02-24 Thread Jason Barnett
Juan Antonio Garrido wrote:
> Hi everybody
> 
> What functions should be use for XML in PHP 4? I've tried with DOM Functions 
> but it appears an error "not class", DOM-XML Functions(experimental) don't 
> work well. 
> 
> Thank you...

You want the xml_* functions.  You start out with xml_parser_create() to
create an XML parser.  Not being mean, just making
a point that most PHP functions do what you expect them to do.  This
function (as well as related functions) can be found here:

http://php.net/manual/en/function.xml-parser-create.php

DOM is what you use in PHP5.  If you're working on a new project I
highly recommend that you upgrade to PHP5 and use the XML facilities
there instead...

http://php.net/manual/en/ref.dom.php

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: Fwd: [PHP] Word file to PDF

2005-02-24 Thread Jason Barnett
Rory Browne wrote:
> Sorry - forgot to cc this to the list. 
> 
> [off-topic] Any idea if there is any way to set up gmail so that it
> automaticly replys to the list.
> 
> -- Forwarded message --
> From: Rory Browne <[EMAIL PROTECTED]>
> Date: Thu, 24 Feb 2005 13:12:15 +
> Subject: Re: [PHP] Word file to PDF
> To: Kevin Javia <[EMAIL PROTECTED]>
> 
> 
> You could check out wvware. I believe you can find it at
> http://wvware.sourceforge.net although I'm not sure.
> 
> Alternatively you could probably find some way of automating
> openoffice to do it for you. I reckon that OOo has a better filter for
> converting them than wvware. If you don't need this urgently, then you
> could wait until mid-march for OOo 2.0, which will aparently have
> better MSOffice compatability, and use that instead.

Thanks for this tip BTW, I'll be on the lookout for the update...

> 
> If you're on a Windows box, and have MSWord installed, you could
> probably install the PDF Printer driver, and then have MSWord open the
> file, and 'print' it to the PDF driver, using OLE automation.

I will second this suggestion.  There is a great library out there
called *PDFCreator* that will take print jobs in WinXP and convert them
into PDFs.  I use it all the time.

http://sourceforge.net/projects/pdfcreator/

*WARNING* PDFCreator is under the GPL.  If this works for you then
great, but just want you to know it isn't a PHP-style of license...

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Hi ALL

2005-02-25 Thread Jason Barnett
Chris Shiflett wrote:
> --- Jochem Maas <[EMAIL PROTECTED]> wrote:
> 
>>
>>1. total number of posts
>>2. highest average no. of posts/week
>>3. longest post
>>4. total no. of words written
>>5. highest average no. of words/post
> 
> 
> Richard certainly contributes a lot, and I think he's in the top 10 (Curt
> Zirzow actually compiled these statistics a while back), but no one comes
> close to John Holmes.

With any luck Mr. Holmes record is going to get smashed by a small,
cute looking little parrot.  0:)

> 
> Chris
> 
> =
> Chris Shiflett - http://shiflett.org/
> 
> PHP Security - O'Reilly HTTP Developer's Handbook - Sams
> Coming Soon http://httphandbook.org/


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] PHP slowness

2005-02-25 Thread Jason Barnett
Gerard wrote:
> Hi Brent,
> 
>>I noticed  you have your error_reporting level set really high (2039),
>>which is pretty close to everything. That may be fine on a development
>>server, but I wouldn't set it that high on a production server. I'd be
>>curious what you log looks like. Perhaps this is causing your slowness,
>>perhaps not.
>>
> 
> This is obviously not it, I changed the reporting level to nothing and still
> no go.
> 
> 
>>Also, you seem to use the short open tag style '>causing your problem, but for compatibility you should probably use the
>>long style '>
> 
> Thanks for the tip, I'll keep that in mind.
> 
> Update on the issue:
> I just upgraded to PHP5 in an attempt to get the speed under control, it
> didn't work.
> What I did notice is that even www.debuginc.com/test2.php (which has NO code
> in it at ALL, only text) takes 5 seconds to load! Upon closer investigation,
> it seems that with both PHP4 and PHP5, any page that ends on .php takes 5
> seconds doing NOTHING before it starts to process and actually load...
> What could delay any given .php page for 5 seconds on both PHP4 and PHP5? It

Are you using auto_prepend_file in your php.ini?  It will load up the
named file before *every* php script and could be your culprit.  Yes,
it's been around since PHP4 too.

> doesn't seem to make any sense. I already removed unused CGI modules from
> the Apache load process, but still a 5 second delay.
> 
> Another interesting note; if you click from page to page fast enough, it
> doesn't take as long to load. For some reason, after the initial 5 second
> startup hic, it loads consequent pages smoothly. If you wait for 10 seconds
> and then click a link, it loads for 5 seconds again.

That seems backward to me, but maybe that's just because I don't
understand Apache well enough (Rasmus, where are you? :)  Does Apache
cache the content of CGI scripts and/or is it able to look for the
compiled script in memory?

I would expect script startup time would decrease for scripts running
through the Apache module, but not the CGI.  Or am I missing something here?

> 
> I don't get this, especially since it seems to affect both PHP4 and PHP5...
> 
> - Gerard
> 


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: what does this mean?

2005-02-25 Thread Jason Barnett
Diana Castillo wrote:
> on which page of php.net can I find out what this code does?
> $a  = $b? $a :"dian";

This is the "tertiary operator".  It's a shorthand version of



-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: What's up with the list?

2005-02-25 Thread Jason Barnett
John Nichel wrote:
> Haven't gotten anything from the list since yesterday...is it me, or is
> it the list.  Fix it Jay!!! ;)
> 

Sorry, I had to give the server a good kick, then once more for good
measure.  Nothing like a swift reboot ;)

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Help Required: How to call .vbs file from .php file?

2005-02-25 Thread Jason Barnett
Lef1 wrote:
> Hi, 
> I am in desperate need of some help in calling a vbscript file from a php 
> file.

A vbscript file?  Do you mean you want PHP to send vbscript to the web
browser?  If that's the case then just echo the vbscript in some script
tags.

Or did you mean that you were hoping to run some ASP code through a PHP
interpreter?  If that's the case you can give asp2php a try... although
it's so outdated at this point that I doubt it's going to work unless
your script is really, really simple.

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: [NEWBIE] How to allow for tags but no others?

2005-02-25 Thread Jason Barnett
The solution for this problem (doing it in the matter that you are
suggesting) is certainly going to involve preg_replace().  However, this
will require you to match only the tags you want to let through (which
is always dangerous) and then strip out all of the rest of them.  This
can be very tricky to say the least.

A common way that forums deal with this problem is that rather than
letting users create url links they create their own "specialized"
format for letting users create urls.  For instance:

[url=http://somesite.com/path/to/somepage.php]

This way you can still strip out all < and > characters as well as the
text in between them.  And now you've limited the problem text to
everything inside the pattern [url=*].  You'll still have to look out
for MySQL commands, but you've at least limited the problem with tags.

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] what does this mean?

2005-02-25 Thread Jason Barnett
Leif Gregory wrote:
> Hello Diana,
> 
> Friday, February 25, 2005, 7:07:29 AM, you wrote:
> D> on which page of php.net can I find out what this code does?
> D> $a  = $b? $a :"dian";
> 
> 
> It's called a ternary operator, basically an if-else statement.

Note to self: write "ternary" on the blackboard 100 times.

Yep, it's just a fancy if-else statement.


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Like ternary but without the else.

2005-02-25 Thread Jason Barnett
Chris W. Parker wrote:
> Hello,
> 
> I couldn't find this anywhere on google or PHP's site but I'm pretty
> sure there's an answer to it.
> 
> How can I turn the following into something that resembles the ternary
> operator?
> 
>  
>   if($something)
>   {
> $this = $that;
>   }
> 
> ?>
> 

$this = $something ? $that : null;

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Authentication fails

2005-03-01 Thread Jason Barnett
John Swartzentruber wrote:
> Somehow my PHP 5.0.3 or something is configured incorrectly. When I try
> to get past an authentication input, nothing happens. For example, I
> have phpMyAdmin configured now to use mysqli, but when I enter the
> username and password, the screen doesn't change. In previous testing, I
> saw that an incorrect authentication was detected and reported, but a
> correct authentication had no affect.

Not sure if this is a phpMyAdmin bug or not, but you might try to clear
out all cookies that your browser has from john.swartzentruber.us.  For
that matter you should see if you *have* any cookie set from
john.swartzenruber.us.  I'm not pointing fingers at phpMyAdmin, but just
tossing out a possible solution.

> 
> My phpinfo() output is at http://john.swartzentruber.us/test.php
> 
> For example, I'm trying to use a simple file upload script called "file
> thingie" that is at http://www.solitude.dk/filethingie/download.php
> 
> I have edited the original file only to decrease the maximum file size
> to 500 bytes and limit uploads to text files. I hope no one here tries
> to be nasty. The user name is "USERNAME2" and the password is "PASSWORD".

Yeah... I wouldn't suggest putting user / pw combos onto the web even if
you intend on changing it later.  You just never know.

> 
> Can anyone check this out and give me some clues or things to look into?
> Is there some setting that would cause _POST data to disappear? How
> would I go about debugging this?

Start by going to the form page's action page (since your test.php page
only displays phpinfo() I'm not sure what this is going to be).  We'll
call this page action.php.

The simplest way to debug this (but it's effective) is to
var_dump($_POST) at the top of action.php.  Insert this at the very top
of the page (likely to cause a lot of errors :) and then gradually cut /
paste that code throughout the action page.  Do this until you narrow
down the problem code.

Since this is a file upload script you are doing you will probably want
to var_dump($_FILES) as well.  Heck, if you're having *session* problems
then you should be looking into the $_SESSION array and (possibly) the
$_COOKIE array.

> 
> Thanks for any help or pointers.


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Program flow?

2005-03-01 Thread Jason Barnett
Richard Davey wrote:
> Hello Rory,
> 
> Tuesday, March 1, 2005, 4:58:20 PM, you wrote:
> 
> rw> Hi I have a one simple question that I need to sort out before I
> rw> continue writing any PHP scripts. Every time I call a script are the
> rw> variables reset to the default values?
> 
> Yes this is nearly always the case unless you code around it.
> 
> Best regards,
> 
> Richard Davey

Yep.  The only thing that might change would be $_SESSION variables, but
that's kind of the point of using a session.  :)  Or you could do
something crazy like create a specialized extension for storing state,
but almost no one does that and it certainly won't be in PHP by default.

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Current dilema for Novice

2005-03-01 Thread Jason Barnett
I know that you were posting a lot of detail because you wanted to make
it clear what you were doing, but next time you might try to be a little
more succinct in your description.  Give us the most relevant facts...
not a flame, just some friendly advice to get you (more) answers to your
question.

James Marcinek wrote:
> Hello Everyone,
...
> 
> - The server has been set up with SSL and is working properly
> - The SSL site goes to $DOCUMENT_ROOT (which is currently a blank index.htm)
> file, preventing users from drilling down
> - Each site is currently configured to use Apache Digest Authentication. 
...
> - My original index.php script (that I need to debug as it's not working yet)
> was designed to be placed in each respective directory directly under
> DOCUMENT_ROOT. 
...

So I assume this is the script we are helping you to debug?  Great.

> 
> What's needed:
> - Simple but effective. It's not going to be feasible to add a lot of .php 
> files
> to subdirectories. These directories are really working directories so this 
> is a
> headache. There are more that just .htm files. That is not the problem. Just
> don't want the people to have to dig down.

Well it sounds like you want to use something like a filemap.  Go
through each subdirectory and cache this result somehow (XML, array,
object, DB?).  If you go this route you will also want the following
features:

- a way to update the filemap (deletions / file moves / etc.)
- a way to force regeneration of the filemap (in case files become
orphaned and/or you have ghost files that don't really exist on disk)
- a way to read from the filemap (i.e. the recursive listing)
- possibly with a filtering feature for .htm or whatever (be careful
with those PCRE's ;)

Why go to this trouble?  Because if there are really an unlimited number
of files / directories / users... and you are trying to manually
reconstruct this array (read through all subdirectories) for each user
each time... well, you get the picture.  I wasted a lot of time trying
to go that route before.  :(

> -A single sign-on would be great. Each user only needs to access one directory
> under DOCUMENT_ROOT. I know that SSL uses the IP address and I can't break up
> the SSL into multiple virtual hosts so I can't do that. The security must
> provide protection from somebody trying to get in from a subdirectory

See this list's previous discussions about verifying users.

> 
> From my limited knowledge of PHP, I would think that creating a solution to
> support this would take some time. But like I said I sure don't know 
> everything.

A good place to start if you're serious about this project is this page:
http://www.php.net/~helly/php/ext/spl/classRecursiveDirectoryIterator.html

*Note* This is a PHP5 only feature, but it is quite handy for this task.
   If PHP5 is an option for your site then I would recommend it.  If
it's not then you could certainly hack up something that would do
exactly the same thing... but that would take a lot longer than
piggybacking on PHP's SPL.  :)  How long I don't know for sure, but you
could probably contact the author of RecursiveDirectoryIterator for an
idea...

> 
> If anyone has any suggestions (and estimations of time it would take) I would
> appreciate it.
> 
> Thanks,
> 
> James

Time required is going to depend on a few factors:
- is PHP5 / SPL an option for your site?
- Are you familiar with other SPL classes (esp. iterator)

Answering yes to both of these questions is going to cut down your
development time... and (probably) your maintenance time as well.

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Self calling PHP

2005-03-01 Thread Jason Barnett
Phillip Armitage wrote:
> I'm working on an ftp login form using PHP. I'm trying to set it up so that
> the PHP file is self calling. eg. file FTP.PHP displays an html form in
> which the form action setting calls FTP.PHP. Essentially the program does
> the following:
> 
...

The $_REQUEST array is rebuilt on every request.  It sounds to me like
you need to look into storing user info in sessions:

http://php.net/manual/en/ref.session.php

So basically your user submits user / pw info on the first request and
if the authentication succeeds you can start a session for the user.

> 
> Does PHP support the writing of scripts which with forms whose actions are
> self calling? eg. the form created by ftp.php calls ftp.php.

Absolutely!  The lazy man's way of doing this:

/** HTML File */


/** PHP File */
echo "";

> 
> If so, is there anything I need to do to flush the $_REQUEST buffer between
> presses of the SUBMIT button?

It is flushed on *every* request.  $_REQUEST is "stateless" meaning that
it doesn't remember what the user passed through the browser on the last
SUBMIT.


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


  1   2   3   4   5   6   7   >