[PHP] Form and php

2004-03-24 Thread Tassos T
Hello,

I use a html form and php with global registers off how do I get the names
and values from that form?

I use $_POST[FIELD NAME]; but I have much more fields. 

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



RE: [PHP] Form and php

2004-03-24 Thread Clifford W. Hansen
T,

Couple of things to try:

  $_REQUEST[Field Name]

or you could extract the values http://www.php.net/extract

Till We Meet Again...

Clifford W. Hansen
Operations Support Developer
Aspivia (Pty) Ltd.

+27 (0) 11 259-1150 (Switchboard)
+27 (0) 11 259-1019 (Fax)
+27 (0) 83 761-0240 (Mobile)
[EMAIL PROTECTED] (EMail)
http://chansen.aspivia.com (Web)

Registered Linux user number 343424 on http://counter.li.org/

We have seen strange things today! Luke 5:26

This message contains information intended for the perusal, and/or use (if
so stated), of the stated addressee(s) only. The information is confidential
and privileged. If you are not an intended recipient, do not peruse, use,
disseminate, distribute, copy or in any manner rely upon the information
contained in this message (directly or indirectly). The sender and/or the
entity represented by the sender shall not be held accountable in the event
that this prohibition is disregarded.

If you receive this message in error, notify the sender immediately by
e-mail, fax or telephone and return and/or destroy the original message.

The views or representations contained in this message, whether express or
implied, are those of the sender only, unless that sender expressly states
them to be the views or representations of an entity or person, who shall be
named by the sender and who the sender shall state to represent. No
liability shall otherwise attach to any other entity or person.

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



[PHP] eMail mirror

2004-03-24 Thread Lester Caine
OK can someone with access to the list system please help me.

Up until Xmas I was quite happily working to four lists via 
eMail, but now all eMails are bounced back. I've switched to 
newsgroup - which I can't stand - but at least I can work.

The problem - sending the reply to cancel the eMail 
subscription is BOUNCED - so how do I unsubscribe 

This is happening for db, general, install, and internals !!!

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Problems with PHP5 RC1

2004-03-24 Thread Michael G
I have also created an environment to test php5 - first impressions - its
good and fast - but still a bit ropey - especially in the installation,
extensions and configuration side of things.

My test environment:
Windows 2000, IIS, php5 RC1, mySQL

One thing I would really like to see is the ability to have multiple php.ini
files and I can use a script to point to the php.ini I want to use for a
particular application/user.

michael at phpdevshed dot com

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 19 March 2004 14:38
To: [EMAIL PROTECTED]
Subject: [PHP] Problems with PHP5 RC1

I'm writing this message in the hope that some of the people responsible for
PHP5 will eventually read it.

I have just downloaded and installed PHP5 RC1 according to the instructions
found in the package (which are basically the same as for previous releases
of PHP). Before relating the problems I've had, I should say that I've been
using PHP for about four years now and have successfully performed dozens of
installations, under Windows, Linux and FreeBSD, so I'm not exactly a newbie
having a go at his first install.

I'm trying to run PHP5 RC1 on a Windows 2000 test server with Apache 2.0.47.

Upon installation, when I first started Apache again, I got an error message
to the effect that php4ts.dll could not be found in the c:\winnt\system32
directory. This is curious for two reasons: first and foremost, if anything
is missing, it should be php5ts.dll, not php4ts.dll; second, php4ts.dll
never used to be in the system32 directory and that never caused any
problems. But it's no use cursing PHP5, so I copied php4ts.dll to the
system32 directory and stopped getting the error message. Not a pretty
solution, though.

I then edited php.ini to load the extensions I need, and noticed that the
php_domxml extension is no longer an option, so I assumed that DOM XML is
now bundled with PHP. As a matter of course, phpinfo() tells me that DOM/XML
is enabled and that the libxml version is 2.5.11. However, when trying to
use domxml_version(), domxml_new_doc(), domxml_open_mem() or any other DOM
XML function, I get a call to undefined function error. If these functions
now have new names, they're not listed in the online documentation.

Am I doing something seriously wrong or are these problems with PHP5 RC1?

Thanks,

Erik

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



RE: [PHP] Image Storage

2004-03-24 Thread Michael G
Best to use the filesystem for images - 

Michael 

-Original Message-
From: David T-G [mailto:[EMAIL PROTECTED] 
Sent: 23 March 2004 22:04
To: PHP General list
Cc: Matt Palermo
Subject: Re: [PHP] Image Storage

Matt --

...and then Matt Palermo said...
%
% I am creating a system to allow users to upload images to the site.  Would
% it be better to store the images in a MySQL table, or having it save the %
images to a directory on the server?  Anyone have any suggestions on this?
% Pros? Cons?

This has been debated to death; check the archives.  Although there are
passionate arguments for both approaches, I *think* that the consensus for
general applications where you don't have a specific reason to put them in
the DB is to go with the filesystem -- but, then, I'm also a subscriber of
that camp :-)


%
% Thanks,
%
% Matt
% http://sweetphp.com/


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

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



RE: [PHP] session.bug_compat_42

2004-03-24 Thread Ralph
It's great to see you on the list Rasmus! 

Anxiously awaiting for official release of PHP5...I haven't been this
excited since the release of PHP4!!! :-)

Many thanks go out to you and the others who make PHP possible.


-Original Message-
From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 23, 2004 9:12 AM
To: James E Hicks III
Cc: PHP-General
Subject: Re: [PHP] session.bug_compat_42

This has nothing to do with the browser.  Instead of using 
session_register(last_time) and setting $last_time, do this:

  $_SESSION['last_time'] = time();

It's shorter and it will make the warning go away.

-Rasmus

On Tue, 23 Mar 2004, James E Hicks III wrote:

 What does the code look like that is causing this error? I know I can turn
the 
 error off but how do I fix the code that is causing it?
 
 Warning: Unknown(): Your script possibly relies on a session side-effect
which 
 existed until PHP 4.2.3. Please be advised that the session extension does

 not consider global variables as a source of data, unless register_globals
is 
 enabled. You can disable this functionality and this warning by setting 
 session.bug_compat_42 or session.bug_compat_warn to off, respectively. in 
 Unknown on line 0
 
 It only seems to appear when viewed using MSIE, Konqueror and Mozilla do
not 
 display this error, why?
 
 Here is some example code that I am using.
 ?php
 if (!session_is_registered('U_SI')) {
   #do some stuff.
 }
 session_register(last_time);
 $last_time = time();
 echo $_SESSION['last_time'];
 ?
 
 Here are some settings from php.ini from the server that is giving the
error.
 
 /etc/php4/php.ini
 
 register_globals = Off
 [Session]
 session.save_handler = files
 session.save_path = /tmp
 session.use_cookies = 1
 session.name = PHPSESSID
 session.auto_start = 1
 session.cookie_lifetime = 0
 session.cookie_path = /
 session.cookie_domain =
 session.serialize_handler = php
 session.gc_probability = 1
 session.gc_divisor = 100
 session.gc_maxlifetime = 1440
 session.bug_compat_42 = 1
 session.bug_compat_warn = 1
 session.referer_check =
 session.entropy_length = 0
 session.entropy_file =
 session.cache_limiter = nocache
 session.cache_expire = 180
 session.use_trans_sid = 0
 url_rewriter.tags = a=href,area=href,frame=src,input=src,form=,fieldset=
 
 
 PHP 4.3.2 (cli) (built: Aug 12 2003 14:25:22)
 Copyright (c) 1997-2003 The PHP Group
 Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
 with Turck MMCache v2.3.20, Copyright (c) 2002-2003 TurckSoft, St. 
 Petersburg, by Dmitry Stogov
 
 
 James Hicks
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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

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



Re: [PHP] PHPSESSID in passthru

2004-03-24 Thread Guillouet Nicolas
Sorry, but I tried this : session.use_cookies = 0 in php.ini
 and I have always the bug.
And if I use htmldoc on command line with same args it works fine.

Could php forbidden using of PHPSESSID ?

Nicolas



Le mar 23/03/2004 à 16:37, Raditha Dissanayake a écrit :
 Guillouet Nicolas wrote:
 
 Hi,
 I discover a surprising thing with PHPSESSID, I try something like this
 : 
 
 $var=htmldoc -t html --quiet ''
 'https://login:[EMAIL 
 PROTECTED]/file.php?documentIdent=157typeAffiche=3PHPSESSID=068dd351a106bb6ead80e11a27f75100';
 echo 'var='.$var;
 passthru($var);
 
 
 passthru is waiting for and don't give the result.
 
 In the other hand, if I use an other word than PHPSESSID it works. It
 seems to be a security constraint, how can I do to forcing PHP to use it
 ?
 
   
 
 Could be that your sessions are set up to work with cookies, this 
 mechanism that you are using will not send the cookie to the browser and 
 thus it causes the wait state.
 
 
 
 
 
 -- 
 Raditha Dissanayake.
 -
 http://www.radinks.com/print/upload.php
 SFTP, FTP and HTTP File Upload solutions 

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



[PHP] apsell on Fedora and php 4.3.4

2004-03-24 Thread Owen Williams
Hi,
  I posted a while ago about problems I was having with aspell-0.50.3-16.
I didn't mention that it was Fedora.  This is where the problem might come
up.  Anyway, the new aspell prefers LANG and --lang and --jargon using
things like: en_GB.  The current php-4.3.4 as far as I can tell still
prefers the --language-tag, --spelling and --jargon.  I wrote this to fix
it for me.  Its probably fixed in later versions anyway:

./ext/pspell/php_pspell.h

45a46
 PHP_FUNCTION(pspell_config_replace_part);

./ext/pspell/pspell.c

71a72
   PHP_FE(pspell_config_replace_part,  NULL)
857a859,884
 /* {{{ proto int pspell_config_replace_part(int conf, string confpart, string repl)
   Replace part of the config */
 PHP_FUNCTION(pspell_config_replace_part)
 {
 int type;
 zval **sccin, **confpart, **repl;
 int argc;
 
 PspellConfig *config;
 
 argc = ZEND_NUM_ARGS();
 if (argc != 3 || zend_get_parameters_ex(argc,sccin,confpart,repl) == FAILURE) 
 {
 WRONG_PARAM_COUNT;
 }
 
 convert_to_long_ex(sccin);
 config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), type);
 if(!config){
 php_error(E_WARNING, %ld is not a PSPELL config index,Z_LVAL_PP(sccin));
 RETURN_FALSE;
 }
 
 pspell_config_replace(config, Z_STRVAL_PP(confpart), Z_STRVAL_PP(repl));
 }
 /* }}} */
 

This is how I used it in my PHP:

$pspell_config = pspell_config_create(en);

pspell_config_replace_part($pspell_config, lang, en_GB);
pspell_config_replace_part($pspell_config, jargon, $dict);

$this-pspell = pspell_new_config($pspell_config);

This allows me to use different dictionaries for different parts of my
work.

Hope its useful:

Owen.

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



[PHP] ldap_8859_to_t61

2004-03-24 Thread Juan Angel Martin
Hi all,

I'm trying to use the LDAP function ldap_8859_to_t61() but I get this error:
PHP Fatal error: Call to undefined function: ldap_8859_to_t61()

The PHP version is 4.3.3 and I use others LDAP functions like ldap_connect()
without any problem.

Can anyone help me?

Thanks in advance
Juanan

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



[PHP] SimpleXML node detection.

2004-03-24 Thread William Bailey
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Morning all,

Hopefully a quick question i need to check if a node exists for a
SimpleXML object but no matter how i try i simple cant find a way to do
this as it always creates a new object even if the node dosen't exist in
the xml document.
	My peoblem is that i have something like the following xml...

~section
~namefoo/name
~contentfoo/content
~ignore /
~/section
~section
~nameblah/name
~contentblah/content
~/section
	Where there is an ignore tag to specify that i ignore that item

	Any ideas on how i can check to see it the ignore node exists or not?

- --
Regards,
William Bailey.
Pro-Net Internet Services Ltd.
http://www.pro-net.co.uk/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFAYV7azSfrYDJMXmERAlSQAJ40wLIRmbSy0vKy0bdLSqU/JGnqbACfd/Hc
114wFBzKu+Z6JvsosvuRKBA=
=lhbH
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Java script prompt - help

2004-03-24 Thread Nadim Attari
 I would like to have a yes \ no prompt displayed and depending on which
button is pressed take the right course of action.

http://www.devguru.com/Technologies/ecmascript/quickref/win_confirm.html

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



Re: [PHP] session_register vs. $_SESSION superglobal

2004-03-24 Thread Kim L. Laage
Once again, thanks for the replies...

But I'm afraid I'm not getting this right... I've tested with the various
versions of $_SESSION syntax which I've been recommended by the people on
this group. i.e.:
$_SESSION['s_user'] = $_POST['s_user'];
$_SESSION['s_pass'] = $_POST['s_pass'];

or

$_SESSION['s_user'] = s_user;
$_SESSION['s_pass'] = s_pass;

None of this seems to really make a difference I was wondering if this
was due to the nature of the array being used...
If I understand you right
session_register(s_user);
session_register(s_pass);
adds the values s_user and s_pass to an array, I suppose by index so the
key/value pairs would look like this 0/s_user and 1/s_pass - correct?

Now when I use the $_SESSION syntax as mentioned above I would think the
array changed nature so the key value pairs would look like this instead
s_user/s_user and s_pass/s_pass, is that right?
How would this affect the use of the session variables in the
application/site?

As I said I'm not getting any real headway here, so I've posted the relevant
pages below in the hope that someone had the time and inclination to take a
look at them.
I've added a few comments of my own and removed the MySQL credentials 8-)


--- START session.php START ---
?php
session_start();

include(_include/loginFunc.php);

/* ==
* When we got this code, it looked like this:
*
* session_register(s_user);
* session_register(s_pass);
*
* ===
*/
$_SESSION['s_user'] = s_user;
$_SESSION['s_pass'] = s_pass;


/* =
 * General variables
 *
 * I added this section because I got warnings about undeclared
 * variables, when I ran this earlier.
 *
 * =
*/
 $user = ;
 $pass = ;

drawhtmlhead();
dologin($user,$pass);
if($sub == logout)
  dologout();
?
--- END session.php END ---



--- START loginfunc.php START ---
html
head
 titlePAGE TITLE/title
  script language=javascript
function doSubmit(sub)
{
  document.form.sub.value = sub;
  document.form.submit();
}
  /script
/head

?php
# generic stuff
/* =
 * Password and  Username directly in the code?!?!?
 *
 * I commented on this earlier in the thread, but I would like to
 * your comments on this... personally I think it's a terrible way
 * of handling security!
 *
 * =
*/

$LOGIN_INFO = centerLOGIN/center;
$HEADER = ADMIN;
$USER = admin;
$PASS = admin;
$WIDTH = 600;
$logout_text = centerh3You have now logged out from the Admin
Application/h3/center;
$login_page = adminHome.php;

  #-#
  # login functions #
  #-#

function checklogin($s_user, $s_pass)
{
  global $USER,$PASS;
  if($s_user == $USER  $s_pass == $PASS)
return OK;
  else
return 0;
}

function drawlogin()
{
  global $LOGIN_INFO,$HEADER,$PHP_SELF;
?
  centerbr
  form name=form method=post action=? echo $PHP_SELF; ?
  input type=hidden name=sub
  table border=0 cellpadding=1 cellspacing=0 width=1trtd
bgcolor=#44
  table border=0 cellpadding=16 cellspacing=0trtd bgcolor=white
table border=0 cellpadding=0 cellspacing=0 bgcolor=white
  tr
 td colspan=2centerb? echo $HEADER; ?b/centernbsp;/b/b/td
  /tr
  tr
tdusername: /td
tdinput type=text name=user/td
  /tr
  tr
tdpassword: /td
tdinput type=password name=pass/td
  /tr
  tr
tdnbsp;/td
tda href=javascript:doSubmit('login');[
login ]/anbsp;nbsp;a href=javascript:document.form.reset();[
clear ]/a/td
  /tr
  tr
td
colspan=2center__/centernbsp;br
   ? echo $LOGIN_INFO; ?
 /td
  /tr
/table
/td/tr/table
/td/tr/table
  /form
  /center
?php
}

function dologout()
{
 global $logout_text,$login_page;
  session_destroy();
  echo $logout_text;
  echo a href='$login_page'centerh3Log in/h3/center/a;
}

function dologin($user,$pass)
{
  global $s_user, $s_pass;
  if($user  $pass)
  {
$s_user = $user;
$s_pass = $pass;
  }
  if($s_user  $s_pass)
  {
if(!checklogin($s_user,$s_pass))
{
  if($user  $pass)
 echo wrong username/password;
  else
drawlogin();
  die();
}
  }
  else
  {
drawlogin();
die();
  }
}
  #-#
  # end login functions #
  #-#
  #-#
  # basic functions #
  #-#
function drawhtmlhead()
{ global $style_page,$title;
?
p

?php
}

function drawhtmltail()
{
?
p
?php
}

function drawloggedintop()
{
  global $HEADER, $WIDTH;
?
center
  table width=? echo $WIDTH; ? cellpadding=0 cellspacing=0 border=0
tr
  td align=rightsmall? echo $HEADER; ?/small/td
/tr
  /table
/center
  nbsp;
?
}

function drawloggedinhead()
{
  global $HEADER, $WIDTH, $PHP_SELF;
?
  center
  table width=? echo $WIDTH; ? border=0 cellpadding=1
cellspacing=0trtd 

RE: [PHP] session_register vs. $_SESSION superglobal

2004-03-24 Thread Ford, Mike [LSS]
 -Original Message-
 From: Kim L. Laage [mailto:[EMAIL PROTECTED] 
 Sent: 24 March 2004 10:52
 
 Once again, thanks for the replies...
 
 But I'm afraid I'm not getting this right... I've tested with 
 the various
 versions of $_SESSION syntax which I've been recommended by 
 the people on
 this group. i.e.:
 $_SESSION['s_user'] = $_POST['s_user'];
 $_SESSION['s_pass'] = $_POST['s_pass'];

Those assignments look good.
 
 or
 
 $_SESSION['s_user'] = s_user;
 $_SESSION['s_pass'] = s_pass;

So do those (assuming you want the value of the s_user session variable to
be s_user and the s_pass session variable to be s_pass!).
 
 None of this seems to really make a difference I was 
 wondering if this
 was due to the nature of the array being used...
 If I understand you right
 session_register(s_user);
 session_register(s_pass);

Don't do that. If you're using the $_SESSION[] array, you shouldn't use
session_register() (or any of its friends such as session_unregister(),
session_is_registered(), etc.).  Just assign values to the $_SESSION[]
array, and test its elements directly with, e.g., isset().

 adds the values s_user and s_pass to an array, I suppose 
 by index so the
 key/value pairs would look like this 0/s_user and 
 1/s_pass - correct?

No.  If anything, these would give you $_SESSION['s_user']==NULL and
$_SESSION['s_pass']==NULL -- but, like I said, just don't bother.
Effectively, $_SESSION[] *is* your session -- assigning a value to an
element of $_SESSION implicitly registers that elements key as a session
variable.
 
[...]

 As I said I'm not getting any real headway here, so I've 
 posted the relevant
 pages below in the hope that someone had the time and 
 inclination to take a
 look at them.
 I've added a few comments of my own and removed the MySQL 
 credentials 8-)
 
 
 --- START session.php START ---
 ?php
 session_start();
 
 include(_include/loginFunc.php);
 
 /* ==
 * When we got this code, it looked like this:
 *
 * session_register(s_user);
 * session_register(s_pass);
 *
 * ===
 */
 $_SESSION['s_user'] = s_user;
 $_SESSION['s_pass'] = s_pass;

Using $_SESSION{}, you don't need an equivalent of session_register(), so
just forget these lines.
 
[...]

 ?php
 # generic stuff
 /* =
  * Password and  Username directly in the code?!?!?
  *
  * I commented on this earlier in the thread, but I would like to
  * your comments on this... personally I think it's a terrible way
  * of handling security!
  *
  * =
 */

I agree with that.  I'd definitely set these up in an include file which is
*outside* the Web server hierarchy (or alternatively in my database, or a
config file which I fread).
 
 $LOGIN_INFO = centerLOGIN/center;
 $HEADER = ADMIN;
 $USER = admin;
 $PASS = admin;
 $WIDTH = 600;
 $logout_text = centerh3You have now logged out from the Admin
 Application/h3/center;
 $login_page = adminHome.php;
 
   #-#
   # login functions #
   #-#
 
 function checklogin($s_user, $s_pass)
 {
   global $USER,$PASS;
   if($s_user == $USER  $s_pass == $PASS)
 return OK;
   else
 return 0;
 }

Ugh!  Any function which returns a straight yes/no value should return
Boolean TRUE or FALSE, since that's what those are designed for.  The above
could then be written much more simply as:

   return ($s_user == $USER  $s_pass == $PASS);

[...]

 function dologout()
 {
  global $logout_text,$login_page;
   session_destroy();

I'd add a session_write_close() here, I think.

   echo $logout_text;
   echo a href='$login_page'centerh3Log in/h3/center/a;
 }
 
 function dologin($user,$pass)
 {
   global $s_user, $s_pass;
   if($user  $pass)
   {
 $s_user = $user;
 $s_pass = $pass;
   }

I can't see anywhere in what you've posted that you assign *real* values to
$_SESSION['s_user'] and $_SESSION['s_pass'], so I assume that's what's
supposed to be happening here -- so these two lines should be:

$_SESSION['s_user'] = $user;
$_SESSION['s_pass'] = $pass;

Incidentally, you also don't seem to unpack $user and $pass from the
$_POST[] array, so either you're running with register_globals=On (bad) or
these variables will be undefined (also bad!).  In any case, I'd probably
prefer to access the $_POST[] array directly, and write something like:

if (@$_POST['user']  @$_POST['pass']):
   $_SESSION['s_user'] = $_POST['user'];
   $_SESSION['s_pass'] = $_POST['pass'];
else:
   ...
endif;
   
Which makes it pellucidly clear what's going on (and also eliminates the
need for the ugly global statement).

I also notice you appear to have variables called $USER and $user, as well
as $PASS and $pass.  This is *terrible* programming style -- differentiating
purely by case is a disaster waiting to happen, and should be avoided by
renaming one of each pair appropriately.

Hope this 

RE: [PHP] $_POST not working with str_replace

2004-03-24 Thread Ford, Mike [LSS]
 -Original Message-
 From: PHP Email List [mailto:[EMAIL PROTECTED] 
 Sent: 24 March 2004 00:13
 
 
 what happens if you do the following?
 
 ?php
 
 $name = $_POST['FNAME'];
 
 echo ::$name::;
 
 $output = str_replace(FNAME, $name, $output);
 
 ?
 
 ??
 
 I tried that, but I know I can get the values from the $_POST 
 array as per John's email about using print_r($_POST) to see 
 what was showing. And yes I get the value I wanted in between 
 the :: ::.
 
 Thanks for trying though,
 
 Anyone else have any ideas on this problem?

OK, if $name is ok, what's in $output at this point?  Try var_dump()-ing that.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services, JG125, James Graham 
Building, Leeds Metropolitan University, Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

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



[PHP] API Documentation Via Comments

2004-03-24 Thread Hawkes, Richard
Hi,
 
As you may be aware, languages like Java allow you to add comments in a
certain format, which can then be translated into a full HTML API Document
later. Does PHP have a facility like this? If not, has anyone written anything
to do something similar? I hope so?!
 
Thanks all
Richard

==
This message is for the sole use of the intended recipient. If you received
this message in error please delete it and notify us. If this message was
misdirected, CSFB does not waive any confidentiality or privilege. CSFB
retains and monitors electronic communications sent through its network.
Instructions transmitted over this system are not binding on CSFB until they
are confirmed by us. Message transmission is not guaranteed to be secure.
==


Re: [PHP] API Documentation Via Comments

2004-03-24 Thread Duncan Hill
On Wednesday 24 March 2004 11:37, Hawkes, Richard wrote:
 Hi,

 As you may be aware, languages like Java allow you to add comments in a
 certain format, which can then be translated into a full HTML API Document
 later. Does PHP have a facility like this? If not, has anyone written
 anything to do something similar? I hope so?!

phpdoc

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



[PHP] octet-stream in https

2004-03-24 Thread Ago
I want to download a text file in binary mode using the function
header(Content-type: application/octet-stream); so the browser open the
popup window to let me save the file. It works very well when the connection
is in http mode but when the connection is in https the browser (IE) tells
me that is not possible to download the file. Any idea about how to solve
this problem?
Thanks in advance.

Ago

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



Re: [PHP] Session variables as array

2004-03-24 Thread John W. Holmes
Joseph Ross Lee wrote:

Hello... Is there any example that I can look at that does a session
variable as an array? thanks
session_start();
$_SESSION['somekey'] = 'somevalue';
$_SESSION['someotherkey'] = array('one','two','three','four');

$_SESSION['yetanother'] = 
array(array('one','two','three'),array(1,2,3),array('foo','bar','blah'));

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


[PHP] [Newbie Guide] For the benefit of new members

2004-03-24 Thread Ma Siva Kumar
===
This message is for the benefit of new 
subscribers and those new to PHP.  Please 
feel free to add more points and send to the 
list.
===
1. If you have any queries/problems about PHP 
try http://www.php.net/manual/en first. You 
can download a copy and use it offline also. 

Please also try 
http://www.php.net/manual/faq.php 
for answers to frequently answered questions 
about PHP (added by Christophe Chisogne).

2. Try http://www.google.com next. Searching 
for php YOUR QUERY may fetch you relevant 
information within the first 10 results.

3. There is a searchable archive of the 
mailing list discussion at 
http://phparch.com/mailinglists. Many of the 
common topics are discussed repeatedly, and 
you may get answer to your query from the 
earlier discussions. 

For example: One of the repeatedly discussed 
question in the list is Best PHP editor. 
Everyone has his/her favourite editor. 
You can get all the opinions by going through 
the list archives. If you want a chosen list 
try this link : 
http://phpeditors.linuxbackup.co.uk/ 
(contributed by Christophe Chisogne).

4. Not sure if PHP is working or you want 
find out what extensions are available to 
you?

Just put the following code into a file with 
a .php extension and access it through your 
webserver:

?php
phpinfo();
? 

If PHP is installed you will see a page with 
a lot of information on it. If PHP is not 
installed (or not working correctly) your 
browser will try to download the file.

(contributed by Teren and reworded by Chris W 
Parker)

5. If you are stuck with a script and do not 
understand what is wrong, instead of posting 
the whole script, try doing some research 
yourself. One useful trick is to print 
the variable/sql query using print or echo 
command and check whether you get what you 
expected. 

After diagnosing the problem, send the 
details of your efforts (following steps 1, 
2  3) and ask for help.

6. PHP is a server side scripting language. 
Whatever processing PHP does takes place 
BEFORE the output reaches the client. 
Therefore, it is not possible to access 
users'  computer related information (OS, 
screen size etc) using PHP. Nor can you 
modify any the user side settings. You need 
to go for JavaScript and ask the question in 
a JavaScript list.

On the other hand, you can access the 
information that is SENT by the user's 
browser when a client requests a page from 
your server. You can find details about 
browser, OS etc as reported by 
this request. - contributed by Wouter van 
Vliet and reworded by Chris W Parker.

7. Provide a clear descriptive subject line. 
Avoid general subjects like Help!!, A 
Question etc.  Especially avoid blank 
subjects. 

8. When you want to start a new topic, open a 
new mail composer and enter the mailing list 
address [EMAIL PROTECTED] instead of 
replying to an existing thread and replacing 
the subject and body with your message.

9. It's always a good idea to post back to 
the list once you've solved your problem. 
People usually add [SOLVED] to the subject 
line of their email when posting solutions. 
By posting your solution you're helping the 
next person with the same question. 
[contribued by Chris W Parker]

10. Ask smart questions  
http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)

Hope you have a good time programming with 
PHP.
-- 
Integrated Management Tools for leather 
industry
--
http://www.leatherlink.net

Ma Siva Kumar,
BSG LeatherLink (P) Ltd,
Chennai - 600106

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



[PHP] class Password can help you find lost passwords - pass.zip (0/1)

2004-03-24 Thread Rebus
I think class is self explanatory. 
However, for extra help send me an e-mail.

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



[PHP] class Password can help you find lost passwords - pass.zip (0/1)

2004-03-24 Thread Rebus
I think class is self explanatory. 
However, for extra help send me an e-mail.

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



Re: [PHP] $_POST not working with str_replace

2004-03-24 Thread Brent Baisley
A technicality, but GET/POST are not interchangeable, it depends on the 
method declared in your form. I'm sure you meant they were 
interchangeable if you changed your form method. What is 
interchangeable is $_REQUEST with $_POST or $_GET. You may try using 
$_REQUEST just for testing. If it works, then you could use $_REQUEST 
since it will work with GET or POST variables. Although that's not the 
best idea from a security standpoint.
Also, have you looked at the web page source that is delivered to the 
browser? The web server may be serving a cached version of the page 
that has the form method set to GET instead of POST.
Just throwing out some other ideas since you said you've tried most 
everything else.

On Mar 23, 2004, at 10:04 PM, PHP Email List wrote:



-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 23, 2004 7:59 PM
Like someone else said, you need to whittle your code down to a 
minimum
and do a lot of variable checking along the way. Slowly add code back
until you find what's causing the problem. There's no reason using 
$_GET
over $_POST should matter, since you're assigning it to a holding
variable, anyhow. What version of PHP are you using?


Alright I'll try it from start, but again, it doesn't make any sense 
when
all I'm doing is changing the action=GET to action=POST and on the
script side, changing all my $_GET['items'] to $_POST['items'].  I'm 
just
wondering if the RTF format is being screwed up cuz it can't read the
variables from the URL like you do with GET.  I don't know just 
guessing,
but from my experience GET/POST are interchangeable as long as 
everything in
my GET form is received with $_GET['something'].

I let everyone know what I come up with. I'm hoping it's something 
stupid
and little like missing punctuation or some easy parse error that maybe
isn't showing up under the rtf conversion.

Thanks
Wolf
PS, this reply better Chris? :)

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

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] SQL Injection check (mysql)

2004-03-24 Thread Michael Rasmussen
On Tue, 23 Mar 2004 12:05:17 -0800, Pablo Gosse wrote:

 I think you have misunderstod the concepts of making queries based on
 user input. It is not the users who should create the query, all to
 should do is provide the input to narrow down the queries.
 
 I have not misunderstood the concepts of making queries based on user
 input.
I was here refering to my definition and not in general terms. It was not
ment to offend anybody:-)

 1)  Hard coding a query into an application is good, if the situation
 permits it;
 
True.
 2)  Letting a user select (or enter) a value(s) to be used in a query is
 good, as long as you validate the hell out of said value(s);
 
Also true.
 3)  Letting a user arbitrarily enter unvalidated value(s) to be used in
 a query is very very stupid and very very bad, and done far too often.

Again, true. 
 In a broader scope I would here consider to be user input ANY input
 which is not hard coded into the application, and any input which is not
 hard coded should be thoroughly examined before being used.

I agree. 

-- 
Hilsen/Regards
Michael Rasmussen
--
Kiss me, Kate, we will be married o' Sunday.
-- William Shakespeare, The Taming of the Shrew

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



Re: [PHP] Session problem

2004-03-24 Thread Richard Davey
Hello Carlos,

Wednesday, March 24, 2004, 2:52:16 PM, you wrote:

cc I want to know how can i do to make the session dont expire?. i have an
cc application that works with sessions, when i left the browser open for a
cc while, i dont know maybe 30 minutes, when i try to go into a section it
cc throw me an error, for session expire, how can i fic that?.

You can control the default lifespan of your session by modifying your
php.ini file (look for the Session section, specifically
session.gc_maxlifetime).

You could also modify this via ini_set().

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



[PHP] Re: API Documentation Via Comments

2004-03-24 Thread Greg Beaver
phpDocumentor

http://www.phpdoc.org

Regards,
Greg
Richard Hawkes wrote:
Hi,
 
As you may be aware, languages like Java allow you to add comments in a
certain format, which can then be translated into a full HTML API Document
later. Does PHP have a facility like this? If not, has anyone written anything
to do something similar? I hope so?!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] looping variables from a file

2004-03-24 Thread Ryan A
Hi,
I have a config_inc.php file which has around 60 parameters set in it.
eg:
$db_name=something;
$db_user=root;
$db_pass=blah;
$x_installed_path=/home/blah/;
etc

I have a requirment of echoing out these statements to the client to show
him how his setup is:

eg:
echo DB_name=font color green.$db_name./font;

if I was getting variables via a POST or a GET I would use something like
this:

foreach ($_POST as $key = $val)
{ echo $key=font color green $value /font;}

as you can imagine the above loop will save a crapload of time instead of
partially hard codeing each key
and value but how do I do this while reading from a file? and the other big
problem is the file contains one or
two arrays...

Any ideas?

Thanks,
-Ryan

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



Re: [PHP] looping variables from a file

2004-03-24 Thread Richard Davey
Hello Ryan,

Wednesday, March 24, 2004, 5:29:33 PM, you wrote:

RA as you can imagine the above loop will save a crapload of time
RA instead of partially hard codeing each key and value but how do
RA I do this while reading from a file? and the other big problem is
RA the file contains one or two arrays...

Why not just suck in the contents of the file using file_get_contents
and they display the output? Perhaps using a regexp to search for the
= sign and anything on the left is the variable name?

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP] looping variables from a file

2004-03-24 Thread John W. Holmes
From: Ryan A [EMAIL PROTECTED]

 I have a config_inc.php file which has around 60 parameters set in it.
 eg:
 $db_name=something;
 $db_user=root;
 $db_pass=blah;
 $x_installed_path=/home/blah/;
 etc

 I have a requirment of echoing out these statements to the client to show
 him how his setup is:

 eg:
 echo DB_name=font color green.$db_name./font;

One idea is to just fopen() the actual file (not the resulting PHP, which
will be empty), and do some str_replaces to add in the font tags, etc. The
rules for that could get tricky, though.

Another option is to use get_defined_vars() before you include the file
(saved into $array1), then save the results again after you include the file
and create the new variables (saved into $array2). Now use
array_diff($array2,$array1) to find the variables that were added. Now loop
through those with foreach() and apply the formatting.

Isn't PHP fun!?

---John Holmes...

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



Re: [PHP] Re: Null Variables after session_register() ( Radio Inputs Problem )

2004-03-24 Thread Justin Patrin
Gohaku wrote:
Thanks.
Below is what I changed to session.php.
Are there any possible problems with my changes?

On Mar 23, 2004, at 4:28 PM, Justin Patrin wrote:

?
/***Session.php**/
$varcount = 0;
if($name){$varcount++;}
if($number){$varcount++;}
session_start();
session_register(name);
session_register(number);
?


?
/***Session.php**/
$varcount = 0;
if($name){$varcount++;}
if($number){$varcount++;}
$_SESSION[name] = $name;
$_SESSION[number] = $number;
?
You may also want to start using $_POST, $_GET, or $_REQUEST as they're 
generally more secure than using globals. For instance, change it to this:

?
/***Session.php**/
$varcount = 0;
if($_POST['name']){$varcount++;}
if($_POST['number']){$varcount++;}
$_SESSION['name'] = $name;
$_SESSION['number'] = $number;
?
--
paperCrane Justin Patrin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Methods for creating HTML with PHP

2004-03-24 Thread Jason Giangrande
I'm looking for an easy way to write all my HTML using PHP.  I could do 
this with a bunch of print statements or the like, but that doesn't seem 
like a real good solution.  I noticed that PEAR has several packages for 
creating HTML.  Has anyone used any of these packages?  I'm particularly 
interested in the HTML_Common, HTML_Page, and HTML_CSS packages.  The 
HTML_Page package, which to me seems like the one package that actually 
outputs HTML, is marked as beta.  Anyone know if there are any 
alternative packages that do a similar thing?

Also, is it possible to download a package marked beta with PEAR, or 
does it need to be downloaded manually?

Thanks,
--
Jason Giangrande [EMAIL PROTECTED]
http://www.giangrande.org
http://www.dogsiview.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] looping variables from a file

2004-03-24 Thread Ford, Mike [LSS]
 -Original Message-
 From: Ryan A [mailto:[EMAIL PROTECTED] 
 Sent: 24 March 2004 17:30
 
 Hi,
 I have a config_inc.php file which has around 60 parameters set in it.
 eg:
 $db_name=something;
 $db_user=root;
 $db_pass=blah;
 $x_installed_path=/home/blah/;
 etc
 
 I have a requirment of echoing out these statements to the 
 client to show him how his setup is:
 
 eg:
 echo DB_name=font color green.$db_name./font;
 
 if I was getting variables via a POST or a GET I would use 
 something like
 this:
 
 foreach ($_POST as $key = $val)
 { echo $key=font color green $value /font;}
 
 as you can imagine the above loop will save a crapload of 
 time instead of partially hard codeing each key and value 
 but how do I do this while reading from a file? and the other 
 big problem is the file contains one or two arrays...

One possibility, if you're able to change the format of the config_inc file
without causing too much havoc, would be to write it something like this:

$CONFIG = array(
  'db_name' = 'something',
  'db_user' = 'root',
  'db_pass' = 'blah',
  'x_installed_path = '/home/blah/',
  ...
);

Then you have your array all neatly set up for you.  (And you can always
extract($CONFIG) whilst you convert all your other usages to $CONFIG[]...!!)

I do like John Holmes's solution, though!

As far as the arrays-within-the-array goes, this sounds like a perfect setup
for a recursive procedure.  If you write it to emit, say, an unordered list,
then each recursive call will produce a nested list and, hey presto!, you've
got nicely structured output too.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services, JG125, James
Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS,  LS6
3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

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



Re: [PHP] looping variables from a file

2004-03-24 Thread John W. Holmes
Second what Rich said, keep replies to the list, please. This can benifit
everyone.

---John Holmes...

- Original Message - 
From: John W. Holmes [EMAIL PROTECTED]
To: Ryan A [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, March 24, 2004 1:22 PM
Subject: Re: [PHP] looping variables from a file


 From: Ryan A [EMAIL PROTECTED]

  I knew this would be complicated when I started to write to the list for
  help but didnt know so
  complicatedI can just about understand (barely) what you guys are
  telling me but dont know
  where to start..can you give me some starting code example/s which I can
  build on?

 Sure...

 $array1 = get_defined_vars();
 include('yourfile.php');
 $array2 = get_defined_vars();

 $newvars = array_diff($array2,$array1);
 foreach($newvars as $name = $value)
 { echo $name = font color=\green\$value/fontbr /\n; }

 Actually, if you said there were arrays inside the include file, it may
get
 a little more complicated. If they are one dimensional arrays, you can
test
 $value with is_array() and maybe implode() the values into a string to
 display.

 if(is_array($value))
 { echo implode(',',$value); }
 else
 { echo $value; }

 If there are multi-dimensional arrays, then you'll need a recursive
 function. Have fun!

 ---John Holmes...

 PS: This is all assuming the user comments are correct and variables from
 include()'d files are captured by get_defined_vars().


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



[PHP] Re: SimpleXML node detection.

2004-03-24 Thread Gerben
couldn't you use something like. It's a bit more neat

~section ignore=true
~namefoo/name
~contentfoo/content
~/section



William Bailey [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Morning all,

 Hopefully a quick question i need to check if a node exists for a
 SimpleXML object but no matter how i try i simple cant find a way to do
 this as it always creates a new object even if the node dosen't exist in
 the xml document.

 My peoblem is that i have something like the following xml...

 ~section
 ~namefoo/name
 ~contentfoo/content
 ~ignore /
 ~/section
 ~section
 ~nameblah/name
 ~contentblah/content
 ~/section

 Where there is an ignore tag to specify that i ignore that item

 Any ideas on how i can check to see it the ignore node exists or not?


 - --
 Regards,
 William Bailey.
 Pro-Net Internet Services Ltd.
 http://www.pro-net.co.uk/
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.2.1 (MingW32)
 Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

 iD8DBQFAYV7azSfrYDJMXmERAlSQAJ40wLIRmbSy0vKy0bdLSqU/JGnqbACfd/Hc
 114wFBzKu+Z6JvsosvuRKBA=
 =lhbH
 -END PGP SIGNATURE-

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



RE: [PHP] SimpleXML node detection.

2004-03-24 Thread Rick Fletcher
   My peoblem is that i have something like the following xml...
 
 ~section
 ~namefoo/name
 ~contentfoo/content
 ~ignore /
 ~/section

   Any ideas on how i can check to see it the ignore node 
 exists or not?

You can't.  This is a bug that just recently came to the developers
attention, and is currently being discussed on the internals list.

Cheers,

Rick

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



Re: [PHP] looping variables from a file

2004-03-24 Thread Ryan A
Hey John,

 $array1 = get_defined_vars();
 include('yourfile.php');
 $array2 = get_defined_vars();

 $newvars = array_diff($array2,$array1);
 foreach($newvars as $name = $value)
 { echo $name = font color=\green\$value/fontbr /\n; }

Cool, thanks, will try it out.


 If there are multi-dimensional arrays, then
 you'll need a recursive
 function. Have fun!

Nope, I don't use multi-dimensional arrays unless absolutely no other way..
they get too complicated and gives me a headache when I try to understand
them
if I come back to the project after a long time
Definitely not my idea of fun.


 This is all assuming the user comments are correct and variables from
 include()'d
 files are captured by get_defined_vars().
Yep, will check that out, but it should..will write back to the list if it
does'nt.

Thanks again.

Cheers,
-Ryan

P.S I got the other script working where I force the download of a php file
while creating
the file dynimacally and not having the file on the server, works great.
Thanks for that idea too.
(Incase you dont remember, the subject of that was outputting php file)

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



RE: [PHP] $_POST not working with str_replace

2004-03-24 Thread PHP Email List
 -Original Message-
 From: Brent Baisley [mailto:[EMAIL PROTECTED]

 A technicality, but GET/POST are not interchangeable, it depends on the
 method declared in your form. I'm sure you meant they were
 interchangeable if you changed your form method.

Right I had mentioned that...

(all I'm doing is changing the action=GET to action=POST and on the
script side, changing all my $_GET['items'] to $_POST['items'])

 What is
 interchangeable is $_REQUEST with $_POST or $_GET. You may try using
 $_REQUEST just for testing. If it works, then you could use $_REQUEST
 since it will work with GET or POST variables. Although that's not the
 best idea from a security standpoint.
 Also, have you looked at the web page source that is delivered to the
 browser? The web server may be serving a cached version of the page
 that has the form method set to GET instead of POST.
 Just throwing out some other ideas since you said you've tried most
 everything else.

Thanks Brent for the ideas with the source, I'll try that, and I'll test
that Request idea too. :)

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



[PHP] php, mysql How to do a random selection and limit response?

2004-03-24 Thread Leonard B Burton
greetings,

I would like to do a random selection in mysql [select * from members order by rand() 
limit $limit] and then I'd like to insert the items selected into a table [named 
already_selected] with a datetime stamp to make sure one item is only sleceted once 
over a defined period of time.

Would it be best to do the select and then an insert?  Would it be best to do a left 
join in  The select statement?

Can anyone suggest a more efficient way?

Thanks,

Leonard Burton

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



[PHP] Alternatives to Flush()

2004-03-24 Thread Ron Stagg
I have a particular PHP web page that can take over an hour to process.
When visitors come to this page, I want the code to redirect them to a
separate page at my site.  After the redirection, I want the PHP script
to continue operating on its own until the process is complete.
 
I am attempting to implement this is by sending a Location header to
the client.  This header is sent out near the top of the script.  After
sending the header, I call Flush(), then the script continues into the
heavy lifting. Finally, the script quietly terminates with an exit call.
Neither the flush() or ob_flush() calls are working (I even tried
calling them both).  Regardless of what I do, the server will not send
the Location header until the script has completely terminated.  It
appears that my hosting provider has Flush() disabled.  
 
I have thought about using Chron to accomplish this.  However, the
smallest Chron resolution is minutes.  This could cause the visitor to
wait for up to a minute before Chron wakes up and starts working on the
process.  
 
There has got to be a better way.  Does anybody have any
recommendations?
 
Thanks,
 
Ron
 
 
 
 


RE: [PHP] $_POST not working with str_replace

2004-03-24 Thread PHP Email List
 -Original Message-
 From: Brent Baisley [mailto:[EMAIL PROTECTED]

 What is
 interchangeable is $_REQUEST with $_POST or $_GET. You may try using
 $_REQUEST just for testing. If it works, then you could use $_REQUEST
 since it will work with GET or POST variables. Although that's not the
 best idea from a security standpoint.
 Also, have you looked at the web page source that is delivered to the
 browser? The web server may be serving a cached version of the page
 that has the form method set to GET instead of POST.
 Just throwing out some other ideas since you said you've tried most
 everything else.


Ok here's the deal, I cut out the middle man, went straight to the script,
assigned my variable a string, and loaded the rtf page, NADA, ZIP, ZILCH!!
The string replace function isn't even picking up the variable from within
the same script! Here's the code

(I added --- to show where the variable is)
rtf1.php

?php
//print_r($_POST);
//$na = $_GET['f'];
$na == Me;
$filename = fname.rtf;

header('Content-Type: application/msword');

header('Content-Disposition: inline, rtftest.rtf');

$fp = fopen($filename, r);

$output = fread($fp, filesize($filename));

$output = str_replace('N', $na, $output);
echo $output;
?

So I have now determined that this has NOTHING to do with Get vs Post,
however, LOL, funny thing is, I put in my $na = $_GET['f']; from the form,
press submit and it works fine. This is seriously screwed up!!
For the sake of sanity, here is all of the form html

rtf.html

HTML
BODY
FORM Action=rtf1.php Method=GET
Input type=text name=f length=5
Input type=submit name=submit value=Test
/FORM
/Body
/Html

That's IT! And yes I have changed all the GET and POST parameters 5 times.
But this new find is what has really got me, why doesn't the str_replace();
function even pick up the $na variable from within the same script?

SERIOUSLY CONFUSED
Wolf :-/ (sigh...)

PS. For the sake of simplicity, I made my rtf file from word show this
N, on load it pulls out the N as it should but isn't replacing
anything there at all it shows this  on load. Thanks in advanced for
this huge issue.  Because now, I can't even do my work around by loading
everything into a database first and then loading variables from there, as
str_replace() isn't even picking up on a straight variable either.  BUG??
I'm beginning to believe it is.  Maybe I should try pregmatch or some other
string swapping function. I don't knowPlease help...

Thanks again!!

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



[PHP] tutorials for login system...

2004-03-24 Thread Andy B
hi...

dont mean to bring up the subject again...but does anybody know of a real good login 
system tutorial that uses sessions/php4/sessions?? looked at google and found some but 
dont know how good they really are (the comments on some of them are really bad)...

tnx



[PHP] Re: http webmail problems.

2004-03-24 Thread Tom Reed
thanks for the FYI on PEAR, installing now.

I'd still be interested in understanding why the header data in my code
didn't work.

-tom
Justin Patrin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Tom Reed wrote:

  On some webmail programs, when I send them an email from php, they
appear as
  being blank emails.
 
  Here's the code I am using:
 
$headers .= From: \$WEBSITE_name\ $ADMIN_email\n;
$headers .= X-Sender: $ADMIN_email\n;
$headers .= X-Mailer: $WEBSITE_name Mailer\n; // mailer
$headers .= X-Priority: 1\n; // Urgent message!
$headers .= Return-Path: $ADMIN_email\n;  // Return path for
errors
 
$headers .= MIME-version: 1.0\n;
$headers .= Content-type: multipart/mixed; ;
$headers .= boundary=\Message-Boundary\\n;
$headers .= Content-transfer-encoding: 7BIT\n;
 
$message = --Message-Boundary\n;
$message .= Content-Type: text/html; charset=iso-8859-1\n; // Mime
type
$message .= Content-transfer-encoding: 7BIT\n;
$message .= Content-description: Mail message body\n\n;
 
$message .= bTest message with html/b;
 
mail($email, Test HTML message., $message, $headers);

 Try using PEAR's Mail_MIME class. It will do this kind of thing for you.
 http://pear.php.net/package/Mail_MIME

 -- 
 paperCrane Justin Patrin

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



RE: [PHP] Alternatives to Flush()

2004-03-24 Thread Ron Stagg

Rich,

Thanks for taking the time to respond.  

I do have a database and have considered using it in conjunction with
cron.  However, I don't like the disconnected nature of the solution.
There could be up to a minute delay before cron picks up the request.

There's got to be another method similar to using flush(), that causes
the lengthy processing to immediately start as well as redirecting the
visitor to another page.

Any ideas?

Ron



-Original Message-
From: Rich Gray [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 24, 2004 2:38 PM
To: Ron Stagg
Subject: RE: [PHP] Alternatives to Flush()

 I have a particular PHP web page that can take over an hour to
process.
 When visitors come to this page, I want the code to redirect them to a
 separate page at my site.  After the redirection, I want the PHP
script
 to continue operating on its own until the process is complete.
 I am attempting to implement this is by sending a Location header to
 the client.  This header is sent out near the top of the script.
After
 sending the header, I call Flush(), then the script continues into the
 heavy lifting. Finally, the script quietly terminates with an exit
call.
 Neither the flush() or ob_flush() calls are working (I even tried
 calling them both).  Regardless of what I do, the server will not send
 the Location header until the script has completely terminated.  It
 appears that my hosting provider has Flush() disabled.

 I have thought about using Chron to accomplish this.  However, the
 smallest Chron resolution is minutes.  This could cause the visitor to
 wait for up to a minute before Chron wakes up and starts working on
the
 process.

Not sure what you're trying to do here - the web page should just be
responsible for initiating this hour long process right? If you have a
database then can you not create a suitably formatted 'request' in the
db
(then redirect the user if you want). Then when cron wakes up it will
pick
up the request, deletes it and does the grunt work...

HTH
Rich

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



[PHP] Re: http webmail problems.

2004-03-24 Thread Justin Patrin
Tom Reed wrote:

thanks for the FYI on PEAR, installing now.

I'd still be interested in understanding why the header data in my code
didn't work.
-tom
Justin Patrin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Tom Reed wrote:


On some webmail programs, when I send them an email from php, they
appear as

being blank emails.

Here's the code I am using:

 $headers .= From: \$WEBSITE_name\ $ADMIN_email\n;
 $headers .= X-Sender: $ADMIN_email\n;
 $headers .= X-Mailer: $WEBSITE_name Mailer\n; // mailer
 $headers .= X-Priority: 1\n; // Urgent message!
 $headers .= Return-Path: $ADMIN_email\n;  // Return path for
errors

 $headers .= MIME-version: 1.0\n;
 $headers .= Content-type: multipart/mixed; ;
 $headers .= boundary=\Message-Boundary\\n;
 $headers .= Content-transfer-encoding: 7BIT\n;
 $message = --Message-Boundary\n;
 $message .= Content-Type: text/html; charset=iso-8859-1\n; // Mime
type

 $message .= Content-transfer-encoding: 7BIT\n;
 $message .= Content-description: Mail message body\n\n;
 $message .= bTest message with html/b;

 mail($email, Test HTML message., $message, $headers);
Try using PEAR's Mail_MIME class. It will do this kind of thing for you.
http://pear.php.net/package/Mail_MIME
--
paperCrane Justin Patrin
Perhaps the lines need to be ended with \r\n?

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


RE: [PHP] $_POST not working with str_replace

2004-03-24 Thread Rick Fletcher
 Ok here's the deal, I cut out the middle man, went straight 
 to the script, assigned my variable a string, and loaded the 
 rtf page, NADA, ZIP, ZILCH!!

At least as far as this test is concerned, I hope you have a nice soft desk
to bang your head on.  Check your assignment operator one more time.

 ?php
 //print_r($_POST);
 //$na = $_GET['f'];
 $na == Me;

If your script has the same == where a plain ol' = should be, that'd
account for the replacement being empty (since it's replaced with $na, which
wasn't assigned).

As far as the original troubles you're trying to diagnose, I loosely
replicated your setup and everything worked as expected. (I just made up a
Lettertest.rtf file.)  Below are the working files, see if they work for
you:

Cheers,

Rick

Form.html:
=
HTML
BODY
FORM action=rtf1.php method=POST
INPUT type=text name=fname
INPUT type=submit value=Test
/FORM
/BODY
/HTML
=

rtf1.php:
=
?php
$name = $_POST['fname'];

$filename = Lettertest.rtf;

header( 'Content-Type: application/msword' );
header('Content-Disposition: inline, rtftest.rtf');

$fp = fopen( $filename, r );

$output = fread( $fp, filesize( $filename ) );

$output = str_replace( 'FNAME', $name, $output );

echo $output;
?
=

Lettertest.rtf:
=
a line of test
Hello, FNAME
another line
=

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



Re: [PHP] php, mysql How to do a random selection and limit response?

2004-03-24 Thread John W. Holmes
From: Leonard B Burton [EMAIL PROTECTED]

 I would like to do a random selection in mysql
 [select * from members order by rand() limit $limit]
 and then I'd like to insert the items selected into a
 table [named already_selected] with a datetime
 stamp to make sure one item is only sleceted once
 over a defined period of time.

 Would it be best to do the select and then an
 insert?  Would it be best to do a left join in  The select statement?

 Can anyone suggest a more efficient way?

I'd avoid duplicating the data in another table. Any way you do this, you're
going to have to lock the table between the SELECT and the UPDATE to prevent
problems / duplicates.

Lock the tables, select your random X rows, update a already_selected
and/or datetime column in those X rows (using a primary key), then unlock
the tables.

You'll also have to check if there are X unselected rows in the table
before you begin, too. You'll also have to periodically clear the selected
rows so you can begin over, too.

---John Holmes...

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



RE: [PHP] tutorials for login system...

2004-03-24 Thread Chris W. Parker
Andy B mailto:[EMAIL PROTECTED]
on Wednesday, March 24, 2004 1:28 PM said:

 dont mean to bring up the subject again...but does anybody know of a
 real good login system tutorial that uses sessions/php4/sessions??
 looked at google and found some but dont know how good they really
 are (the comments on some of them are really bad)...   

i didn't read this one article i'm pointing out but the title seems
good. :)

http://www.sitepoint.com/article/users-php-sessions-mysql

also, were you looking for code or general guidelines?


chris.

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



RE: [PHP] Alternatives to Flush()

2004-03-24 Thread Rich Gray
 I do have a database and have considered using it in conjunction with
 cron.  However, I don't like the disconnected nature of the solution.
 There could be up to a minute delay before cron picks up the request.

 There's got to be another method similar to using flush(), that causes
 the lengthy processing to immediately start as well as redirecting the
 visitor to another page.

Hi Ron

Well if it is really critical that the batch job runs within seconds of
being requested by the web process then you have several alternatives apart
from using database/cron ... here's a few examples with various levels of
simplicity of implementation...

. Kick off a cli script to run the batch job using exec() or similar..
. Implement a web service using XML-RPC or SOAP - i.e. call an API on the
XML-RPC/SOAP server and let it do its stuff...
. Have a custom background script listening on a socket - send a request to
that socket from your web page...
. IPC through shared memory...
. probably loads more...

Rich

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



RE: [PHP] Alternatives to Flush()

2004-03-24 Thread Michal Migurski
Thanks for taking the time to respond.

I do have a database and have considered using it in conjunction with
cron.  However, I don't like the disconnected nature of the solution.
There could be up to a minute delay before cron picks up the request.

There's got to be another method similar to using flush(), that causes
the lengthy processing to immediately start as well as redirecting the
visitor to another page.

Any ideas?

I thought you might place the flush() in a while() loop, and keep
outputting whitespace until you cross whatever buffering limit the server
imposes, but of course this won't work since you can't send output before
the Location: header. That's probably the source of the problem you have -
with nothing to flush, flush() won't work.

Two options I immediately thought of to drop into the background: start a
command line php process, using exec() or the like with the usual '' at
the end to drop into the background -- I see Rich has just suggested this.
If you want to avoid the database route, use a filesytem queue to signal
cron on its next run. Tell the user that their request will be handled in
the order in which it was received and then cron can check a file or
directory for new requests, and process them.

I don't think the minute delay is an issue, because the whole thing takes
an hour, so what's a minute or two here or there? Jus let the user know
they're in good hands and get to it when you get to it.

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



[PHP] problem with the function mssql_list_tables()

2004-03-24 Thread German
Hello, it wanted to know how as profit to supplant the function mysql_list_tables() 
for SQL server server or like the tables of one db of SQL server in php...

thank you very much


[PHP] problem with the function mysql_list_tables()

2004-03-24 Thread German
Hello, it wanted to know how as profit to supplant the function mysql_list_tables() 
for SQL server or like the tables of one db of SQL server in php...

thank you very much


[PHP] RE:tutorials for login system...

2004-03-24 Thread Andy B
[snip]
also, were you looking for code or general guidelines?
[/snip]

more importantly is the code so i can see how it is physically written but
both code and guidelines wouldnt hurt at all...

tnx for the link in last msg will check it out

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



RE: [PHP] $_POST not working with str_replace

2004-03-24 Thread PHP Email List
 -Original Message-
 From: Rick Fletcher [mailto:[EMAIL PROTECTED]

 If your script has the same == where a plain ol' = should be, that'd
 account for the replacement being empty (since it's replaced with
 $na, which
 wasn't assigned).

Well your correct, that put me to ease some, as now I can default on my
original idea, store everything in a database then pull it out and assign it
a variable, which is what I assumed was along the same lines as a form POST,
guess not.

As far as the rest of your email. I copied and pasted everything from the
email and setup new files with just those lines and still nothing, changed
POST to GET and works great, even on your info. POST will not work on
this server for some reason. Which brings me to another idea...Does the file
that I am working on, the .rtf file that is also on the server, does that
have to have special permissions with POST as opposed to GET? (ie, read,
write and execute?)

And ? #2 are there any settings within PHP that would limit my ability to
visually display the contents of a POST variable on a .rtf document as
opposed to being displayed on the browser?

I'm sorry this one is so weird.

Also I guess I should throw this out since I believe John asked... I'm
running PHP 4.3.4 on Linux 2.4.24 powered by Zend Engine v1.3.0.  This is a
hosting service, so I can't make really any changes to the versions right
now. Maybe that in itself is a problem? *shrugs*
Thanks again for everyone's help on this!
Wolf

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



RE: [PHP] RE:tutorials for login system...

2004-03-24 Thread Chris W. Parker
Andy B mailto:[EMAIL PROTECTED]
on Wednesday, March 24, 2004 2:20 PM said:

 [snip]
 also, were you looking for code or general guidelines?
 [/snip]
 
 more importantly is the code so i can see how it is physically
 written but both code and guidelines wouldnt hurt at all...

in either case, are there any specific questions you have? it's possible
that there aren't any login system tutorials that meet your requirements
and that's why there haven't been many responses yet. but what do i
know?



chris.

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



Re: [PHP] problem with the function mssql_list_tables()

2004-03-24 Thread John W. Holmes
From: German [EMAIL PROTECTED]

 Hello, it wanted to know how as profit to 
 supplant the function mysql_list_tables() for 
 SQL server server or like the tables of one 
 db of SQL server in php...

It has no idea what you just said. 

---John Holmes...

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



Re: [PHP] problem with the function mssql_list_tables()

2004-03-24 Thread Roger B.A. Klorese
John W. Holmes wrote:

From: Roger B.A. Klorese [EMAIL PROTECTED]
 

How do you do the equivalent of mysql_list_tables() in PHP when running
against a SQL Server database?
   

Ah... I assume there's no SHOW TABLES query in MSSQL? Isn't there a system
table in each database that you can query for the table names?
 



I was translating (or rather, untangling the bogus auto-translation), 
not asking.  :)

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


[PHP] the problem in if

2004-03-24 Thread German
the problem consists of which I must list all the tables of a data base under SQL 
server, but I do not have idea of like doing it...


Re: [PHP] problem with the function mssql_list_tables()

2004-03-24 Thread John W. Holmes
From: Roger B.A. Klorese [EMAIL PROTECTED]
 John W. Holmes wrote:
 From: German [EMAIL PROTECTED]
 Hello, it wanted to know how as profit to
 supplant the function mysql_list_tables() for
 SQL server server or like the tables of one
 db of SQL server in php...
 
 It has no idea what you just said.

 How do you do the equivalent of mysql_list_tables() in PHP when running
 against a SQL Server database?

Ah... I assume there's no SHOW TABLES query in MSSQL? Isn't there a system
table in each database that you can query for the table names?

---John Holmes...

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



Re: [PHP] problem with the function mssql_list_tables()

2004-03-24 Thread Roger B.A. Klorese
John W. Holmes wrote:

From: German [EMAIL PROTECTED]

 

Hello, it wanted to know how as profit to 
supplant the function mysql_list_tables() for 
SQL server server or like the tables of one 
db of SQL server in php...
   

It has no idea what you just said. 

 



How do you do the equivalent of mysql_list_tables() in PHP when running 
against a SQL Server database?

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


[PHP] Ways to make PDF docs

2004-03-24 Thread Brian Dunning
Hi all,

Which is the favorite module for creating PDF documents on the fly with 
PHP: ClibPDF, PDFlib, or the iText java class libraries?

All feedback appreciated. TIA,

- Brian

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


RE: [PHP] the problem in if

2004-03-24 Thread Pablo Gosse
German wrote:
 the problem consists of which I must list all the tables of a data
 base under SQL server, but I do not have idea of like doing it... 

Quick and dirty way:

Download ADOdb (http://php.weblogs.com/adodb#downloads) and use their
MetaTables() method

http://phplens.com/lens/adodb/docs-adodb.htm#metatables

HTH.

Pablo

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



[PHP] RE:tutorials for login system...

2004-03-24 Thread Andy B
[snip]
in either case, are there any specific questions you have? it's possible
that there aren't any login system tutorials that meet your requirements
and that's why there haven't been many responses yet. but what do i
[/snip]

questions...hmmm... cant think of any questions at the minute but i do have
some physical standards of a login system that im looking for:

1. as normal it needs to carry the session from private section to public
section and back again if user is already logged in
2. it needs various access levels i.e. system admin/full access/module admin
and so on
3. it needs to be modular in the sense that it needs to be able to accept
modules to it i.e. a guestbook admin section/news admin section/events
admin section and so on
4. system admins (basic system admins) have the lowest login access
possible i.e. they have admin access to the admin sections of the modules
and say site admin/owners have access to user database/change user
id's/pwd/add user/delete user and stuff
5. all users have a way to change their password or user info...

if you want i can setup a spec outline for it and post it...

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



[PHP] Re: Alternatives to Flush()

2004-03-24 Thread speedfreak
Ron Stagg wrote on 24/03/04 22:02:
I have a particular PHP web page that can take over an hour to process.
When visitors come to this page, I want the code to redirect them to a
separate page at my site.  After the redirection, I want the PHP script
to continue operating on its own until the process is complete.
 
I am attempting to implement this is by sending a Location header to
the client.  This header is sent out near the top of the script.  After
sending the header, I call Flush(), then the script continues into the
heavy lifting. Finally, the script quietly terminates with an exit call.
Neither the flush() or ob_flush() calls are working (I even tried
calling them both).  Regardless of what I do, the server will not send
the Location header until the script has completely terminated.  It
appears that my hosting provider has Flush() disabled.  
 
I have thought about using Chron to accomplish this.  However, the
smallest Chron resolution is minutes.  This could cause the visitor to
wait for up to a minute before Chron wakes up and starts working on the
process.  
 
There has got to be a better way.  Does anybody have any
recommendations?
 
Thanks,
 
Ron
 
 
 
 

I could be completely misreading the issue here, but it is
perfectly possible to use a Location header redirect in
combination with further script execution in the background using
PHP's register_shutdown_function(). The specifics and complexity
of your actual script are unknown to the list, so I can only refer
you to the manual (and the user contributed notes) for further 
inspiration and investigation:

http://www.php.net/manual/en/function.register-shutdown-function.php

HTH,

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


RE: [PHP] RE:tutorials for login system...

2004-03-24 Thread Chris W. Parker
Andy B mailto:[EMAIL PROTECTED]
on Wednesday, March 24, 2004 3:27 PM said:

 questions...hmmm... cant think of any questions at the minute but i
 do have some physical standards of a login system that im looking for:

alright let's see...

 1. as normal it needs to carry the session from private section to
 public section and back again if user is already logged in

done automatically if the site uses the same domain (iirc). in other
words, going from http to https (i assume this is what you mean by
public and private) does not present any problems under normal
circumstances.

 2. it needs various access levels i.e. system admin/full
 access/module admin and so on

after the user authenticates store the users access level in a session
variable. at each point where the users access level comes into play
perform a test on this value.

?php

$_SESSION['al'] = AL_PLUS_USER;

?

i suggest you use constants to define your access levels.

?php

// AL stands for Access Level
define(AL_USER,  1);
define(AL_PLUS_USER, 2);
define(AL_ADMIN, 3);
...
?

then you can do the following in your secure pages:

?php
include al_constants.php;

if($_SESSION['al'] = AL_PLUS_USER)
{
// let them in
}
else
{
// keep them out
}

?

 3. it needs to be modular in the sense that it needs to be able to
 accept modules to it i.e. a guestbook admin section/news admin
 section/events admin section and so on

hmm.. as long as you use the same scheme/naming convention throughout
each module you should be fine.

 4. system admins (basic system admins) have the lowest login access
 possible i.e. they have admin access to the admin sections of the
 modules and say site admin/owners have access to user database/change
 user id's/pwd/add user/delete user and stuff

this is up to you and will be defined with the al_constants.php file.
you can of course call it whatever you want.

 5. all users have a way to change their password or user info...

in this case don't put a restriction on the password changing
page/function.

 if you want i can setup a spec outline for it and post it...

feel free.



hth,
chris.

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



[PHP] PHP and MSSQL-Server

2004-03-24 Thread Ivone Uribe
Hi all!
I know that I can use php with mssql-server, but it
isn't common as using php with mysql. 
So, I want to know is someone is using this structure,
and is it stable? don't you have any kind of problems?

Thanks and Regards,
Ivone

__
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

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



[PHP] Attach Image to email

2004-03-24 Thread Mike Mapsnac
Hello

I know how to use mail function in php to send an email with text. But I 
want to add new feature to my website that allow to send email with 
attachment ( image). Any ideas how to do this?

Thanks

_
Get reliable access on MSN 9 Dial-up. 3 months for the price of 1! 
(Limited-time offer) 
http://join.msn.com/?page=dept/dialuppgmarket=en-usST=1/go/onm00200361ave/direct/01/

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


Re: [PHP] PHP and MSSQL-Server

2004-03-24 Thread Ivone Uribe
Sorry,I forget to mention that I have a linux Red Hat
7.3 and PHP 4, and a SQL Server 2000.

Regard and Thanks a lot!
--- Ivone Uribe [EMAIL PROTECTED] wrote:
 Hi all!
 I know that I can use php with mssql-server, but it
 isn't common as using php with mysql. 
 So, I want to know is someone is using this
 structure,
 and is it stable? don't you have any kind of
 problems?
 
 Thanks and Regards,
 Ivone
 
 __
 Do you Yahoo!?
 Yahoo! Finance Tax Center - File online. File on
 time.
 http://taxes.yahoo.com/filing.html
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

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



Re: [PHP] problem with the function mssql_list_tables()

2004-03-24 Thread Tom Rogers
Hi,

Thursday, March 25, 2004, 8:12:41 AM, you wrote:
G Hello, it wanted to know how as profit to supplant the function
G mysql_list_tables() for SQL server server or like the tables of one
G db of SQL server in php...

G thank you very much

This may be it:

USE dbname
SELECT Name FROM sysobjects

-- 
regards,
Tom

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



[PHP] Re: Attach Image to email

2004-03-24 Thread Elliot J. Balanza
Send it in HTML form, and use an img meta tag... now if you want to do is an
attachement that is a different story.

Vamp
Mike Mapsnac [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
 Hello

 I know how to use mail function in php to send an email with text. But I
 want to add new feature to my website that allow to send email with
 attachment ( image). Any ideas how to do this?

 Thanks

 _
 Get reliable access on MSN 9 Dial-up. 3 months for the price of 1!
 (Limited-time offer)

http://join.msn.com/?page=dept/dialuppgmarket=en-usST=1/go/onm00200361ave/direct/01/

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



[PHP] RE:tutorials for login system...

2004-03-24 Thread Andy B
tnx for the ideas... that helped some for now anyways... i will get to
writing the spec outline for what i want/need to do and post it (might be a
few hours) or a day or so since i have to create it (and it could be quite
large)

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



Re: [PHP] Attach Image to email

2004-03-24 Thread Marek Kilimajer
Use this class, there is even an example of the feature you want:

http://www.phpclasses.org/mimemessage

Mike Mapsnac wrote:
Hello

I know how to use mail function in php to send an email with text. But 
I want to add new feature to my website that allow to send email with 
attachment ( image). Any ideas how to do this?

Thanks

_
Get reliable access on MSN 9 Dial-up. 3 months for the price of 1! 
(Limited-time offer) 
http://join.msn.com/?page=dept/dialuppgmarket=en-usST=1/go/onm00200361ave/direct/01/ 


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


RE: [PHP] Re: Attach Image to email

2004-03-24 Thread Mike Mapsnac
Yes. I want to make it as attachment.

Any ideas how that's can be done?

Thanks


From: Elliot J. Balanza [EMAIL PROTECTED]
Reply-To: Elliot J. Balanza [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Attach Image to email Date: Wed, 24 Mar 2004 18:12:18 
-0600

Send it in HTML form, and use an img meta tag... now if you want to do is 
an
attachement that is a different story.

Vamp
Mike Mapsnac [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
 Hello

 I know how to use mail function in php to send an email with text. But 
I
 want to add new feature to my website that allow to send email with
 attachment ( image). Any ideas how to do this?

 Thanks

 _
 Get reliable access on MSN 9 Dial-up. 3 months for the price of 1!
 (Limited-time offer)

http://join.msn.com/?page=dept/dialuppgmarket=en-usST=1/go/onm00200361ave/direct/01/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_
Get rid of annoying pop-up ads with the new MSN Toolbar – FREE! 
http://toolbar.msn.com/go/onm00200414ave/direct/01/

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


Re: [PHP] Methods for creating HTML with PHP

2004-03-24 Thread Raditha Dissanayake
How about just escaping out of php :-) and embedding the html direct?



Jason Giangrande wrote:

I'm looking for an easy way to write all my HTML using PHP.  I could 
do this with a bunch of print statements or the like, but that doesn't 
seem like a real good solution.  I noticed that PEAR has several 
packages for creating HTML.  Has anyone used any of these packages?  
I'm particularly interested in the HTML_Common, HTML_Page, and 
HTML_CSS packages.  The HTML_Page package, which to me seems like the 
one package that actually outputs HTML, is marked as beta.  Anyone 
know if there are any alternative packages that do a similar thing?

Also, is it possible to download a package marked beta with PEAR, or 
does it need to be downloaded manually?

Thanks,


--
Raditha Dissanayake.
-
http://www.radinks.com/print/upload.php
SFTP, FTP and HTTP File Upload solutions 

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


[PHP] PHP and GD

2004-03-24 Thread Patrik Fomin
Hi,

Is there anyway to split a picture with PHP (GD) ?

Im uploading lots of pictures and i want to split them in 6 pieces
to make em load faster, is there anyway to do this in PHP ?

regards
patrick

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



RE: [PHP] Re: Attach Image to email

2004-03-24 Thread Vail, Warren
I understand many virus filters eliminate .jpg or .jpeg attachments (see
macafee for cert for details).  Do you think that will be a problem for you
(a fly in the ointment so to speak)?

Warren Vail


-Original Message-
From: Mike Mapsnac [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 24, 2004 4:41 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] Re: Attach Image to email


Yes. I want to make it as attachment.

Any ideas how that's can be done?

Thanks


From: Elliot J. Balanza [EMAIL PROTECTED]
Reply-To: Elliot J. Balanza [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Attach Image to email Date: Wed, 24 Mar 2004 18:12:18 
-0600

Send it in HTML form, and use an img meta tag... now if you want to do is 
an
attachement that is a different story.

Vamp
Mike Mapsnac [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
  Hello
 
  I know how to use mail function in php to send an email with text. But

I
  want to add new feature to my website that allow to send email with
  attachment ( image). Any ideas how to do this?
 
  Thanks
 
  _
  Get reliable access on MSN 9 Dial-up. 3 months for the price of 1!
  (Limited-time offer)
 
http://join.msn.com/?page=dept/dialuppgmarket=en-usST=1/go/onm00200361ave
/direct/01/

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


_
Get rid of annoying pop-up ads with the new MSN Toolbar - FREE! 
http://toolbar.msn.com/go/onm00200414ave/direct/01/

-- 
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] Sessions and PHP

2004-03-24 Thread Patrik Fomin
Hi,,

is there anyway to get the number of people connected to the site?
in asp you just use Application and session_terminate to accomplish this
is there anyway to do this in PHP ?

regards
patrick

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



Re: [PHP] Sessions and PHP

2004-03-24 Thread Filip de Waard
On Mar 25, 2004, at 2:05 AM, Patrik Fomin wrote:
is there anyway to get the number of people connected to the site?
in asp you just use Application and session_terminate to accomplish 
this
is there anyway to do this in PHP
Hi Patrick,

As far as I know this is not possible with default PHP sessions, but 
when you store your sessions in a database using your own session 
handler (http://nl.php.net/session_set_save_handler) this can be 
achieved easily.

Regards,

Filip de Waard

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


Re: [PHP] Methods for creating HTML with PHP

2004-03-24 Thread Jason Giangrande
Raditha Dissanayake wrote:
How about just escaping out of php :-) and embedding the html direct?

Jason Giangrande wrote:

I'm looking for an easy way to write all my HTML using PHP.  I could 
do this with a bunch of print statements or the like, but that doesn't 
seem like a real good solution.  I noticed that PEAR has several 
packages for creating HTML.  Has anyone used any of these packages?  
I'm particularly interested in the HTML_Common, HTML_Page, and 
HTML_CSS packages.  The HTML_Page package, which to me seems like the 
one package that actually outputs HTML, is marked as beta.  Anyone 
know if there are any alternative packages that do a similar thing?

Also, is it possible to download a package marked beta with PEAR, or 
does it need to be downloaded manually?

Thanks,
That's the thing.  I'm looking for an alternative way of writing HTML 
into PHP pages.  I did a few simple pages a while ago just using print 
statements instead of closing the PHP tag and then writing HTML.  It 
made the code a little easier to follow.  The problem is that print 
statements can add up fast, so using to many of them in one page is 
probably just as hard to follow as closing a PHP block, so you can write 
some HTML.  That was why I was looking for an alternative way to write 
HTML in PHP pages.

I tried the HTML_Page class from PEAR, but it seems to have some issues 
still.  I guess that's why it's still in beta.  I've decided I'll try 
and write something on my own for now that incorporates a few things 
I've seen in other classes (mainly HTML_Common, and HTML_Page).

--
Jason Giangrande [EMAIL PROTECTED]
http://www.giangrande.org
http://www.dogsiview.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Re: Attach Image to email

2004-03-24 Thread Vail, Warren
I probably should elaborate;

http://www.kb.cert.org/vuls/id/443699 there are several others as well
http://www.mcafee.com couldn't find the old database, guess they're charging
for access now.

But to answer you original question.  I use the following to build complex
emails (html and text with attachments, imbedded images, etc).

Class: MIME E-mail message composing and sending

available at;

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

good luck,

Warren Vail


-Original Message-
From: Vail, Warren 
Sent: Wednesday, March 24, 2004 5:07 PM
To: 'Mike Mapsnac'; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] Re: Attach Image to email


I understand many virus filters eliminate .jpg or .jpeg attachments (see
macafee for cert for details).  Do you think that will be a problem for you
(a fly in the ointment so to speak)?

Warren Vail


-Original Message-
From: Mike Mapsnac [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 24, 2004 4:41 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] Re: Attach Image to email


Yes. I want to make it as attachment.

Any ideas how that's can be done?

Thanks


From: Elliot J. Balanza [EMAIL PROTECTED]
Reply-To: Elliot J. Balanza [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Attach Image to email Date: Wed, 24 Mar 2004 18:12:18 
-0600

Send it in HTML form, and use an img meta tag... now if you want to do is 
an
attachement that is a different story.

Vamp
Mike Mapsnac [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
  Hello
 
  I know how to use mail function in php to send an email with text. But

I
  want to add new feature to my website that allow to send email with
  attachment ( image). Any ideas how to do this?
 
  Thanks
 
  _
  Get reliable access on MSN 9 Dial-up. 3 months for the price of 1!
  (Limited-time offer)
 
http://join.msn.com/?page=dept/dialuppgmarket=en-usST=1/go/onm00200361ave
/direct/01/

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


_
Get rid of annoying pop-up ads with the new MSN Toolbar - FREE! 
http://toolbar.msn.com/go/onm00200414ave/direct/01/

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

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

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



[PHP] Re: PHP and GD

2004-03-24 Thread Geir Pedersen - Activio AS

Patrik,

to split an uploaded image, I suggest you use pamdice which is one
of the programs in the Netpbm toolkit. You can read all about Netpbm
here: http://netpbm.sourceforge.net/.

---

Geir Pedersen
http://www.activio.com/

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



[PHP] mysql and md5??

2004-03-24 Thread Andy B
hi...

trying to figure out what is wrong here... the code is supposed to check an md5'd 
password from a form and compare it against an md5'd password in a mysql table... for 
some strange reason when i run the code below on my dev server (apache 2.0.47, 
php4.3.3 and mysql 4.1-A) it works. when i run it on the live site (apache 1.0.3.2, 
php 4.1.2 and mysql 3.22.5.6) it wont work and for that matter wont even return an 
error!

if i swap out the select statement that compares passwords and try it manually on 
both servers exactly as the script says then it works in both places

can anybody help??
[code]
#my sql users table
CREATE TABLE users (
  username varchar(20) default NULL,
  PWD varchar(40) binary  NULL
) TYPE=MyISAM;
#end of table

?
//login.php checks username and pwd...
session_start();//have to start session
include(libs/db.php);

mysql_connect($host, $mysqluser, $mysqlpwd)||die();
mysql_query(select * from rnjresort.users where username='$username' and 
pwd=md5($password));
//see if user exists..
if(mysql_affected_rows()==0){
//ok it didnt work so go to login screen again...
echo h1your login failed/h1;
include(login.html);
exit(); //exit()? why not just exit;?
} else {
//ok now it found the right person so lets rock...
$_SESSION[username]=$username;//we will only register username to keep it simple for 
now
//now lets redirect to the admin page...
ob_start(); //have no choice to use it...
header(location: deletepost.php);//page that requires a login...
ob_flush();
}
?
[/code]
but on the other hand if i run this command in the server itself:
select * from rnjresort.users where username='root' and pwd=md5(8104235982);
i get a valid answer

help!!

Re: [PHP] mysql and md5??

2004-03-24 Thread John W. Holmes
Andy B wrote:

mysql_query(select * from rnjresort.users where username='$username' and 
pwd=md5($password));
//see if user exists..
if(mysql_affected_rows()==0){
You're not assigning the query result to a variable.

$result = mysql_query( ... );

Then, mysql_affected_rows() is not going to return anything for a SELECT 
query. It's only for UPDATE/INSERT/DELETE queries. You need to use 
mysql_num_rows().

if(mysql_num_rows($result)==0){

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


[PHP] Problem with header

2004-03-24 Thread Phil Matt
Hello to all - just joined this list to see if I can enhance my pretty slim knowledge 
of PHP.

I have a little script I cobbled together than I modified to use as a guestbook for a 
client's site. I am trying to get the script to call a success page if the mail in 
fact gets 
sent. I plan to also add a failure page if the validation routine (haven't added 
this yet) 
doesn't work.

I have been experimenting with the statement

header(Location:thanks.shtml);

But no matter where I place it in the PHP file, I get the error message that says 
Headers already sent...

To wit:
? 
include (/file with passwords and user id's in it); 
//a bunch of stuff to pull email recipient's address and id out of MySQL db
//works fine
//$enjoy, $visit, $test vars pulled from form that follows the script, no probs there
$recipient=$to_name;
$message=$enjoy.$visit.$text;
$params['sendmail_path'] = '/usr/sbin/sendmail';
if ($submit){
mail($recipient, $subject, $message, From:\$from_name\$from_email\r\n .
Reply-to: $from_email\r\n .   
X-Mailer: PHP/ . phpversion());
   }
?

So where in the world does the

header(Location:thanks.shtml);

statement go? And if I do an if/else thing on submit, where does the other statement 
go? 

header(Location:error.shtml);

TIA for any advice you can offer. I must be really missing the point here.

Cheers --- Phil Matt

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



Re: [PHP] Problem with header

2004-03-24 Thread Tom Rogers
Hi,

Thursday, March 25, 2004, 9:17:31 AM, you wrote:
PM Hello to all - just joined this list to see if I can enhance
PM my pretty slim knowledge of PHP.

PM I have a little script I cobbled together than I modified to use as a guestbook 
for a
PM client's site. I am trying to get the script to call a
PM success page if the mail in fact gets 
PM sent. I plan to also add a failure page if the validation
PM routine (haven't added this yet) 
PM doesn't work.

PM I have been experimenting with the statement

PM header(Location:thanks.shtml);

PM But no matter where I place it in the PHP file, I get the error message that says
PM Headers already sent...

PM To wit:
PM ? 
PM include (/file with passwords and user id's in it); 
PM //a bunch of stuff to pull email recipient's address and id out of MySQL db
PM //works fine
PM //$enjoy, $visit, $test vars pulled from form that follows the script, no probs 
there
PM $recipient=$to_name;
PM $message=$enjoy.$visit.$text;
PM $params['sendmail_path'] = '/usr/sbin/sendmail';
PM if ($submit){
PM mail($recipient, $subject, $message,
PM From:\$from_name\$from_email\r\n .
PM Reply-to: $from_email\r\n .   
PM X-Mailer: PHP/ . phpversion());
PM}
?

PM So where in the world does the

PM header(Location:thanks.shtml);

PM statement go? And if I do an if/else thing on submit, where does the other 
statement go?

PM header(Location:error.shtml);

PM TIA for any advice you can offer. I must be really missing the point here.

PM Cheers --- Phil Matt


Any whitespace in any file before the ?php will cause data to be sent
to the browser forcing the headers to be sent. So make sure the first
line of your page has ?php and it is a good idea to drop the ? from
included pages as there may be blank lines following which are just as
bad. So the rule is, header() can go anywhere but before any output to
the browser.

-- 
regards,
Tom

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



Re[2]: [PHP] Problem with header

2004-03-24 Thread Tom Rogers
Hi,

TR Any whitespace in any file before the ?php will cause data to be sent
TR to the browser forcing the headers to be sent. So make sure the first
TR line of your page has ?php and it is a good idea to drop the ? from
TR included pages as there may be blank lines following which are just as
TR bad. So the rule is, header() can go anywhere but before any output to
TR the browser.

TR -- 
TR regards,
TR Tom

One other little rule: get into the habit of putting the full url in
location, it will save you grief down the line :)

To redirect to the same page for example

$url = http://.$_SERVER[HTTP_HOST].$_SERVER[PHP_SELF;];
header(Location: $url);


-- 
regards,
Tom

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



Re: [PHP] Problem with header

2004-03-24 Thread Chris Shiflett
--- Phil Matt [EMAIL PROTECTED] wrote:
 header(Location:thanks.shtml);

Two errors here:

1. There is a space after the colon.
2. The URL must be an absolute URL.

 But no matter where I place it in the PHP file, I get the error
 message that says Headers already sent...

Read this message. It tells you exactly what is wrong and where.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] Sessions and PHP

2004-03-24 Thread Chris Shiflett
--- Patrik Fomin [EMAIL PROTECTED] wrote:
 is there anyway to get the number of people connected to the site?
 in asp you just use Application and session_terminate to accomplish
 this is there anyway to do this in PHP?

Taken literally, you are asking about the number of active connections,
meaning people who happen to be in the middle of sending or receiving an
HTTP message.

I think you mean something else, which is how many people have visited
your site recently. You just have to determine what you consider to be
recently, and then count the number of active sessions whose last visit is
within that threshhold.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



[PHP] hide php extension...

2004-03-24 Thread john doe
could anyone help me with this problem ??? i try hide the .php extension in 
the url... search? interpret as php language like google, how could i make 
apache or php to interpret search?q extension as php script ?? like google
http://answer.google.com/answers/search?q=computerqtype=allbtnG=Google+Search

thanks

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



[PHP] still having login problems sigh

2004-03-24 Thread Andy B
hi...

still having login problems..
i tried just about everything i can think of to get this to work but for some strange 
reason it keeps getting stuck...

[code]
?
session_start();
include(libs/conf.db);

mysql_connect($host, $mysqluser, $mysqlpwd);
$result=mysql_query(select * from rnjresort.users where username='$username' and 
pwd=md5('$password'));


if(mysql_num_rows($result)==0) {
echo h1Login failed/h1;
header(location: login.html); }
else {
$_SESSION[username]=$username;
header(location: deletepost.php); }
?
[/code]




[PHP] Crash in PHP5RC1 but can't find where

2004-03-24 Thread David Chen
Hi,

My application crashes, but I have a hard time figuring out where because it
only happens periodically.

For some reason, it only crashes about 10% of the time. If someone who knows
how to debug PHP could assist me, that would be very nice. You may download
the package at: http://www.blesys.com/uploads/Web%20app.rar
After extracting the file, go to the file: test/Test.php
And keep refreshing until it crashes.
My system is Win XP Pro with Apache 2 with PHP5RC1 (downloaded 3/24/04)

This application is an output from a Java-PHP translator. I believe it
started crashing a month ago (but it could be a feature I added). It's a bit
slow (takes ~.5 seconds on my computer) because of an OOP persistence layer.

Right now, I include a lineLog.html output to try to find where the crash
is, but it's not too helpful.

Thanks.


David Chen

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



[PHP] Re: hide php extension...

2004-03-24 Thread Geir Pedersen - Activio AS

Hi, John!

There is an easy way to achieve what you are looking for without modifying
webserver configuration files.

Say you want to support an URL like http://www.example.com/search?foo=bar

Create a new subdirectory named search and place a default PHP script
named index.php in the new directory. The script will get called whenever
the URL above is read.

--

Geir Pedersen
http://www.activio.com/

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




[PHP] Arrays Keys?

2004-03-24 Thread John Taylor-Johnston
Am I doing this right? Is there a better way? Am I doing this key thing right?

I'm doing the language thing. I have no extra plugins or rpms to help do this
properly. So I need advice. Is this going to work? I'm trying to make sense of
http://www.php.net/manual/en/language.types.array.php

$date = getdate(mktime(0,0,0,$month_now,1,$year_now));
$month_name = $date[month];

$month_array = array(January = Janvier,
February = Février,
March = Mars,
April = Avril,
etc ...
);
-snip-

Therefore:

-snip-

if ($lang == french)
{
echo $month_array[$month_name]; // Should echo the current month: Mars?
}else{
echo $month_name;
}

Am I doing this right? Is there a better way? Am I doing this key thing right?

Still trying to learn :)

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



Re: [PHP] Methods for creating HTML with PHP

2004-03-24 Thread David OBrien
At 08:20 PM 3/24/2004, Jason Giangrande wrote:
Raditha Dissanayake wrote:
How about just escaping out of php :-) and embedding the html direct?
Jason Giangrande wrote:
I'm looking for an easy way to write all my HTML using PHP.  I could do 
this with a bunch of print statements or the like, but that doesn't seem 
like a real good solution.  I noticed that PEAR has several packages for 
creating HTML.  Has anyone used any of these packages?
I'm particularly interested in the HTML_Common, HTML_Page, and HTML_CSS 
packages.  The HTML_Page package, which to me seems like the one package 
that actually outputs HTML, is marked as beta.  Anyone know if there 
are any alternative packages that do a similar thing?

Also, is it possible to download a package marked beta with PEAR, or 
does it need to be downloaded manually?

Thanks,
That's the thing.  I'm looking for an alternative way of writing HTML into 
PHP pages.  I did a few simple pages a while ago just using print 
statements instead of closing the PHP tag and then writing HTML.  It made 
the code a little easier to follow.  The problem is that print statements 
can add up fast, so using to many of them in one page is probably just as 
hard to follow as closing a PHP block, so you can write some HTML.  That 
was why I was looking for an alternative way to write HTML in PHP pages.

I tried the HTML_Page class from PEAR, but it seems to have some issues 
still.  I guess that's why it's still in beta.  I've decided I'll try and 
write something on my own for now that incorporates a few things I've seen 
in other classes (mainly HTML_Common, and HTML_Page).
Jason
I have done this before and it worked for me not sure how much you need it 
though
?
include(header.htm)
some code
include(body.htm)
include(left_menu.htm)
more code
include(footer.htm)
?

this way just php is in the main document and all the html is pulled from 
smaller html files elsewhere.
This will also allow you to reuse the html on every page kinda like a 
template system

you could also functionize the html

include(functions.php);
print_header();
and in functions.php
?
function print_header () {
?
html here
?
}
?
This will also just let the code be in the main file and call the html from 
the functions.

-Dave

--
Jason Giangrande [EMAIL PROTECTED]
http://www.giangrande.org
http://www.dogsiview.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: hide php extension...

2004-03-24 Thread john doe
if there's other options, please let me know...

thank you
Geir Pedersen - Activio As [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 Hi, John!

 There is an easy way to achieve what you are looking for without modifying
 webserver configuration files.

 Say you want to support an URL like http://www.example.com/search?foo=bar

 Create a new subdirectory named search and place a default PHP script
 named index.php in the new directory. The script will get called whenever
 the URL above is read.

 --

 Geir Pedersen
 http://www.activio.com/ 

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



Re: [PHP] Re: hide php extension...

2004-03-24 Thread Justin French
On Thursday, March 25, 2004, at 04:37  PM, john doe wrote:

if there's other options, please let me know...
At some level, you have to make a change *somewhere* :)

If not through script naming and placement, then through web server 
configuration.  However, most of these configurations for Apache can be 
done through a .htaccess file in your web root, assuming your host 
allows them -- most do.

1. Options +MultiViews

MultiViews will ask Apache to look for the requested resource eg 
/foo/bah/boo/, and if not available, it will step backwards down the 
path until it finds something.  It also ignores extensions  (forgive my 
crude / quick description). So,

foo.php/?id=2 and foo/?id=2 are the same resource

There's downside, which is that requesting foo/bah/boo may result in 
foo.php being called (which is great), but if foo/bah/boo was never 
intended to exist, Apache will not generate a 404 error -- it will 
leave it upto foo.php to decide what to do.

2. mod_rewrite

You could use mod_rewrite to rewrite your URLs so that foo/?id=2 is 
internally rewritten to foo.php?id=2

3. Forcing type

You could name your script just 'foo' instead of 'foo.php', and force 
'foo' to be parsed through PHP:

Files foo
ForceType application/x-httpd-php
/Files
Similarly, if you were worried about anyone knowing you were running 
PHP, or having your URLs tied to PHP permantently, you could force all 
.html files through PHP.

Files ~ \.html$
ForceType application/x-httpd-php
/Files
There's plenty Apache can do to solve your problem -- if your host 
doesn't allow it, move hosts... there's only two ways out of this that 
I'm aware of:

1. change apache
2. severely rework your file structure (as discussed already)
---
Justin French
http://indent.com.au
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] ? Sub Directories

2004-03-24 Thread Labunski
This script reads the content of the directory and turns it into the array.
The problem is, that this script reads the names of the subdirectories in
this directory too!

if ($directory = opendir('data/start')) {
   while (false !== ($faila_nos = readdir($directory))) {
   if ($faila_nos != .  $faila_nos != ..) {
   return $faila_nos;
   }
   }
   closedir($direktorija);
}

// For example the array outputs:

other files
notes
my directory
flowers.txt
cars.txt
animals.txt

// and not just:

flowers.txt
cars.txt
animals.txt


How to solve this problem?

Thanks,
Lab.

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



[PHP] Re: Arrays Keys?

2004-03-24 Thread Nadim Attari
 I'm doing the language thing.

Is this what u r looking for ?
http://www.php.net/manual/en/function.setlocale.php

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



Re: [PHP] ? Sub Directories

2004-03-24 Thread - Edwin -
Hi,

On Thu, 25 Mar 2004 09:07:06 +0200
Labunski [EMAIL PROTECTED] wrote:

 This script reads the content of the directory and turns it
 into the array. The problem is, that this script reads the
 names of the subdirectories in this directory too!

...[sample code and result]...

 How to solve this problem?

  http://www.php.net/manual/en/function.is-dir.php

--

- E -

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



[PHP] Re: still having login problems sigh

2004-03-24 Thread - Edwin -
Hi,

On Wed, 24 Mar 2004 23:59:30 -0500
[EMAIL PROTECTED] (Andy B) wrote:

 hi...
 
 still having login problems..
 i tried just about everything i can think of to get this to
 work but for some strange reason it keeps getting stuck...

What do mean by keeps getting stuck? Where? What? Any error
messages?

 [code]
 ?
 session_start();
 include(libs/conf.db);
 
 mysql_connect($host, $mysqluser, $mysqlpwd);
 $result=mysql_query(select * from rnjresort.users where
 username='$username' and pwd=md5('$password'));

Where's $username coming from? $_GET? $_POST? Check the
manual/archives for more info...

 if(mysql_num_rows($result)==0) {
 echo h1Login failed/h1;
 header(location: login.html); }
 else {
 $_SESSION[username]=$username;
 header(location: deletepost.php); }
 ?
 [/code]

Use an absolute URL for header(Location ...

And, your echo shouldn't come before your header. Again, you
can check the manual/archives for more info...

And, maybe there's something else, I didn't really check
everything :)

--

- E -

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



[PHP] Re: PHP and GD

2004-03-24 Thread - Edwin -
Hi,

On Thu, 25 Mar 2004 02:03:26 +0100
[EMAIL PROTECTED] (Patrik Fomin) wrote:

 Hi,
 
 Is there anyway to split a picture with PHP (GD) ?
 
 Im uploading lots of pictures and i want to split them in 6
 pieces to make em load faster, is there anyway to do this in
 PHP ?

You mean, split them using PHP? *Before* uploading? Then, no.
(Unless of course you have PHP installed on the client then there
must be a way...)

--

- E -

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



Fw: [PHP] Re: still having login problems sigh

2004-03-24 Thread Andy B
What do mean by keeps getting stuck? Where? What? Any error
messages?

0 errors and 0 messages of any kind and what i meant by getting stuck was
every time the login.html is filled out and submitted i either get the
login.html page again (expected if user gave wrong pwd and stuff) or browser
will get stuck on a blank page and show nothing at all

Where's $username coming from? $_GET? $_POST? Check the
manual/archives for more info...

$_POST... but the way the web space is set up the admins somehow disabled
$_POST?? is that even possible?? $_POST[username] --- for some strange
reason php on server complains that it is an undefined variable/array???
anyways...

Use an absolute URL for header(Location ...
didnt think i needed to but...ok i will

And, your echo shouldn't come before your header. Again, you
can check the manual/archives for more info...
hmmm didnt think that part would work but saw it in a tutorial about this
stuff (matter of fact this is almost an exact copy of that tutorial) just
dont remember what one it was...

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



  1   2   >