[PHP] user password managment

2004-12-10 Thread Josh Howe
 

Does anybody have any tips or links for creating a system for managing
user's passwords. I want to make it so that when a user is created, an
email is sent with a link that allows them to set their password. The
link should only work for a set amount of time. I have ideas for
implementing something, but I have a hunch tat there is some code
already out there for this. Does anybody know of any? Thanks! 



[PHP] session question

2004-12-07 Thread Josh Howe

Hi,

I've looked at the php session documentation, and it doesn't look like
there's any way to run code when a session expires. I'd like to do some
cleanup when a user's session expires, is there any way to trap this?
Thanks. 

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



[PHP] getting the phsyical path

2004-12-03 Thread Josh Howe
 

Hi,

 

Sorry if this is a dumb question. Is there a way in php to get the
physical path the document root of my website? I want to open a file in
the root of my web server, i.e. /, but I won't always know what the
physical path to the web root is, and it will vary depending on the
machine the web app is running on. I've tried using realpath (e.g.
realpath(/)) but it doesn't really work. Thanks.



[PHP] classes and variable scope

2004-12-01 Thread Josh Howe

Hi all,

If I have the following code:

$some_global_variable;

Class foo {

Function test() {
set_global();
echo $some_global_variable;
}

Function set_global () {
$some_global_variable = abcd;
echo $some_global_variable;
}
}

The first echo statement (the one inside the set_global function) prints
abcd, but the second prints nothing. How can I set the value of
$some_global_variable inside the set_global function so that it sticks?
I'm using PHP 4.3.3.

Thanks. 

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



[PHP] bubble sort crashing apache

2004-11-16 Thread Josh Howe

I've implemented my own bubble sort function that is crashing apache.
Can somebody either help me out with the bubble sort or help me figure
out a way to solve my problem with php's built in sorting functions?

This is my problem. I'm writing my own class for displaying html tables.
Right now, the only thing this class really abstracts is the sorting of
the table rows by any column ascending or descending. My table class
accepts an array of $row objects. Each $row object itself contains an
array of $cell objects. I've included the function I'm using to sort the
rows at the end of the email.

The problem I'm seeing is that after about the 3rd sort on a particular
column, apache crashes. Maybe bubble sort isn't the best sorting
algorithm, since when the user switches from ascending to descending
sort order on the same column or vice versa, I get the worst case
scenario for a bubble sort (the data is in reverse order). 

Any ideas? Thanks!!



private function sort() {
$col_name = $this-order_by;

/*
** Get the column number of the column we're
** ordering by.
*/
for ($i = 0; $i  count($this-col_names); $i++) {
if (strtoupper($col_name) ==
strtoupper($this-col_names[$i])) {
$col_num = $i;
break;
}   
}

/*
** bubble sort
*/  
for ($n = 0; $n  count($this-contents); $n++) {
$sorted = true;

for ($y = 0; $y  count($this-contents) - 1; $y++) {
$cell_arr_this =
$this-contents[$y]-get_cell_arr();
$cell_arr_next = $this-contents[$y +
1]-get_cell_arr();

if
($this-out_of_order($cell_arr_this[$col_num],$cell_arr_next[$col_num]))
{
$tmp_row = $this-contents[$y];
$this-contents[$y] = $this-contents[$y
+ 1];
$this-contents[$y + 1] = $tmp_row;

$sorted = false;
}
}

if ($sorted) break;
}
}

function out_of_order($val1, $val2) {
if ($this-order_dir == desc) {
if ($val2  $val1)
return true;
else 
return false;
} else {
if ($val1  $val2)
return true;
else 
return false;
}
}

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



[PHP] http response

2004-11-13 Thread Josh Howe
 

Is it possible in php to get a hold of the response stream and see what has
been sent already? I have a global php function, but it can't be called
inside html form elements, because it creates its own form, and when you
nest html forms things get weird. In this function, I want to check if there
is already an open form tag in the response without a corresponding
/form tag. Is there any way to do this? Thanks!!



RE: [PHP] http response

2004-11-13 Thread Josh Howe

That's perfect, thanks Rob.


-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED] 
Sent: Saturday, November 13, 2004 10:48 AM
To: Josh Howe
Cc: PHP-General
Subject: Re: [PHP] http response

On Sat, 2004-11-13 at 10:38, Josh Howe wrote:
  
 Is it possible in php to get a hold of the response stream and see what
has
 been sent already? I have a global php function, but it can't be called
 inside html form elements, because it creates its own form, and when you
 nest html forms things get weird. In this function, I want to check if
there
 is already an open form tag in the response without a corresponding
 /form tag. Is there any way to do this? Thanks!!

Look into ob_get_contents()

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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

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



[PHP] sending mail -- nullmailer

2004-10-08 Thread Josh Howe
 

Ok, so I came across nullmailer, which seems to do exactly what I want -
forward mail to an existing smtp server. But it isn't working. I'm using the
mail() php function, and the mails aren't arriving. The same code works fine
on a windows machine pointing to the same smtp server. Does anybody have any
experience configuring nullmailer? How do I tell linux to use nullmailer as
the default MTA? Thanks!! 



RE: [PHP] Re: sending mail -- nullmailer

2004-10-08 Thread Josh Howe

I don't want to setup and maintain a new mail server (sendmail) when we
already have an smtp server set up and maintained by our sys admin. Am I
crazy here? 

Can anybody recommend a good sendmail wrapper I can use that will work with
PHP and any other apps that use sendmail? Thanks



-Original Message-
From: Manuel Lemos [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 08, 2004 12:59 PM
To: Josh Howe
Cc: [EMAIL PROTECTED]
Subject: [PHP] Re: sending mail -- nullmailer

Hello,

On 10/08/2004 01:35 PM, Josh Howe wrote:
 Ok, so I came across nullmailer, which seems to do exactly what I want -
 forward mail to an existing smtp server. But it isn't working. I'm using
the
 mail() php function, and the mails aren't arriving. The same code works
fine
 on a windows machine pointing to the same smtp server. Does anybody have
any
 experience configuring nullmailer? How do I tell linux to use nullmailer
as
 the default MTA? Thanks!! 

I don't know why do you want to replace your Linux installation MTA. 
Usually is sendmail or compatible and can be configured to relay 
messages to a SMTP server instead of deliverying them directly.

Under Linux/Unix PHP just hands the message to the sendmail program. It 
would not make much sense to relay messages a SMTP server when sendmail 
can be more efficient by sending them directly to the SMTP of the 
recipient users, unless you are trying to send messages from a server 
that is blacklisted and the world is not accepting messages from it or 
because of some other blocking reason.

Anyway, if you really want to relay messages to a SMTP server under 
Linux/Unix, the mail function will not do that. Instead you may want to 
try this class that comes with a wrapper function named smtp_mail(). It 
emulates the mail() function and the purpose of its arguments except 
that it can relay the messages a SMTP server of choice.

http://www.phpclasses.org/mimemessage

You also need this:

http://www.phpclasses.org/smtpclass


-- 

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

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

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



[PHP] sending mail

2004-10-07 Thread Josh Howe
 

Do I need to have sendmail configured on my linux box to send mail via PHP?
Thanks!



RE: [PHP] sending mail

2004-10-07 Thread Josh Howe

I'm sorry, I don't know what and MTA is. Can I configure PHP to use any smtp
server? 


-Original Message-
From: Matthew Sims [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 07, 2004 5:58 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] sending mail



 Do I need to have sendmail configured on my linux box to send mail via
 PHP?
 Thanks!

Sendmail or any MTA will do.

So yes, you need to have a working mail server.

-- 
--Matthew Sims
--http://killermookie.org

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

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