RE: [PHP] Why would this eregi() function not work?

2003-11-14 Thread Dave G
 ... escaping isn't necessary.

Thanks so much for all the helpful advice!
Okay, included the + character, and removed the escaping. And I know I'm
supposed to checking into preg_match, but I'm looking at this as an
opportunity to learn about regular expressions, so I still have a
question. I'm confused why hyphens wouldn't still need escaping. Hyphens
are used to express a range of characters. If there's a hyphen there,
won't PHP think I'm looking for a range from nothing to nothing? Or is
it clever enough to figure out what's going on?
(!eregi('[EMAIL PROTECTED]', $email)

-- 
Cheers!
Dave G
[EMAIL PROTECTED]

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



Re: [PHP] Sessions within new windows

2003-11-14 Thread Lucian Cozma

Olinux [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

  If, as Chris wrote, this is indeed a feature/bug of
  IE, then it must be
  configurable somewhere, though I'm lost as to where
  that might be.
 
  Does anyone have any ideas how this could be
  controlled via IE's
  settings?

 I've experienced a similar problem on a php based
 system I use. I don't know what their code looks like.
 I think its an IE issue though - windows update always
 fixes the problem for me.
 http://windowsupdate.microsoft.com


 olinux

 __
 Do you Yahoo!?
 Protect your identity with Yahoo! Mail AddressGuard
 http://antispam.yahoo.com/whatsnewfree

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



[PHP] Re: greek in php-xml

2003-11-14 Thread Lucian Cozma
I've encountered this problem when developing for a greek company.
Do you create a html output from it ? If you do, make sure that you have
meta http-equiv=Content-Type content=text/html; CHARSET=utf-8 /
in the head tag of the html output.

Lucian

Pnp [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

  I want to read some texts in greek from an xml file and all i get  is
weird
 symbols..
  The Xml's encoding is utf-8 and so is the xmlparser that I create.
  Can anyone suggest anything?

 Thanx in advance,
 Panagiotis

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



[PHP] php/mysql/jpeg/rtf

2003-11-14 Thread Egil Berntsen
Mayby this is the wrong place to ask, I'll try anyway.
I have some jpeg pictures in my MySQL-db that I want to put into a rtf file.
Is there anyone out there that have done something like this?

egil

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



Re: [PHP] auto_prepend/append in htaccess....

2003-11-14 Thread Eugene Lee
On Thu, Nov 13, 2003 at 11:32:34AM -0600, Jonathan Villa wrote:
: 
: I want to prepend a configuration file which is located outside of my
: document root into my scripts.  I can use auto_prepend_file, but I'm not
: sure how do it with an htaccess file or a virtual host entry.. I would
: prefer VHost.
: 
: Anyway, this is what I am trying/assuming...
: 
: VirtualHost 127.0.0.1 127.0.0.1
: ServerAdmin [EMAIL PROTECTED]
: DocumentRoot /var/www/testdomain/www
: ServerName testdomain
: ErrorLog logs/testdomain-error_log
: CustomLog logs/testdomain-access_log combined
: IfModule mod_php4.c
: auto_prepend_file=header.inc
:   auto_append_file=footer.inc
: /IfModule
: /VirtualHost
: 
: Is it possible to append/prepend more than file?

I don't think this is possible with auto_prepend_file.

: Or would be better
: to simply include one file and in that file include the others.

This sounds workable.

: What should the file be relative to?  Or should it be an absolute value?

It can be a relative pathname, in which case PHP will search its defined
include_path.  Absolute pathnames should be okay too.

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



[PHP] Problem using substr() and strpos() functions

2003-11-14 Thread rich
Hello List,

I'm trying to extract the sub-string from a string which appears between a
pair of brackets,

e.g. from Mozart Requiem (15)
I want to extract the string 15

I tried this:

substr($s, (strpos($s, () + 1), (strpos($s, )) - strpos($s, () - 1))

but it returned the error:

Parse error: parse error, unexpected T_STRING in /.../loan-edit.php on line
15

What have done wrong?

Thanks in advance,

Richard
-- 
UEA/MUS

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



Re: [PHP] Why would this eregi() function not work?

2003-11-14 Thread Eugene Lee
On Fri, Nov 14, 2003 at 04:32:35PM +0900, Dave G wrote:
: 
:  ... escaping isn't necessary.
: 
: Thanks so much for all the helpful advice!
: Okay, included the + character, and removed the escaping. And I know I'm
: supposed to checking into preg_match, but I'm looking at this as an
: opportunity to learn about regular expressions, so I still have a
: question. I'm confused why hyphens wouldn't still need escaping. Hyphens
: are used to express a range of characters. If there's a hyphen there,
: won't PHP think I'm looking for a range from nothing to nothing? Or is
: it clever enough to figure out what's going on?
: (!eregi('[EMAIL PROTECTED]', $email)

The last part of your pattern needs to be changed because it allows for
a top-level domain to contain numbers and hyphens.  Currently, such a
thing does not exist.

Also, the 2nd part of your pattern allows for a 2nd-level domain to
start and end with a hyphen, which is also disallowed.

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



Re: [PHP] Problem with Apache 1.3.28 / PHP 4.3.3

2003-11-14 Thread Boyan Nedkov
[EMAIL PROTECTED] wrote:
I had problem in the configuration of Apache 1.3.28 and PHP 4.3.3 as SAPI module, they are run well as CGI module, I put this lines for it:

ScriptAlias /php/ D:/PHP4.3.3/
AddType application/x-httpd-php .php
Action application/x-httpd-php /php/php.exe
as SAPI module, I put this lines:

LoadModule php4_module D:\PHP4.3.3\sapi\php4apache.dll
AddModule mod_php4.c
AddType application/x-httpd-php .php
A friend told me that remove the line AddModule mod_php4.c, I got this error:

d:/program files/apache1.3.28/apache/conf/httpd.conf: Syntax OK
Cannot remove module mod_php4.c: not found in module list
If I leave the line  AddModule mod_php4.c, I get this error:

Module mod_php4.c is already added, skipping d:/program 
files/apache1.3.28/apache/conf/httpd.conf: Syntax OK
Cannot remove module mod_php4.c: not found in module list
thanks for any help. bye.

I answered your question few days ago but didn't hear any reaction, so I'm 
reposting the same text with hope this time it will be more useful

Cheers,

Boyan
--
 Original Message 
Subject: Re: [PHP] Apache1.3.28 vs PHP4.3.3
Date: Thu, 06 Nov 2003 00:59:58 +0100
From: Boyan Nedkov [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
References: [EMAIL PROTECTED]
For getting up and running php on WinXX box you need only:

LoadModule php4_module D:/PHP4.3.3/sapi/php4apache.dll
AddType application/x-httpd-php .php
To avoid the problem with removing 'mod_php4.c' try to find
'ClearModuleList' directive in httpd.conf and comment it, then restart
the server once again
Hope this help,

boyan
--
[EMAIL PROTECTED] wrote:

 Apache 1.3.28 / PHP 4.3.3

 hello, I tried to configure php as module SAPI of the apache web server, I
 put this line:

  LoadModule php4_module D:/PHP4.3.3/sapi/php4apache.dll
 AddModule mod_php4.c
 AddType application/x-httpd-php .php

 When I tested the configuration, I got this error:

 Cannot remove module mod_php4.c: not found module list

  I removed the AddModule mod_php4.c directive, restart the server, but
  remain the same problem

 Thanks for any help, I will really aprecciate your support, bye.

--
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: Problem using substr() and strpos() functions

2003-11-14 Thread rich
Oh, sorry I've worked it out!

The bug was on a different part of the line!

Cheers,
Richard
-- 
UEA/MUS

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



Re: [PHP] include/require not allowed in classes?

2003-11-14 Thread Pavel Jartsev
Ryan A wrote:
...

class ads_DB extends DB_Sql {
  var $Host = $MR_Host;
  var $Database = $MR_Database;
  var $User = $MR_User;
  var $Password = $MR_Password;
}


I think, Your problem is here. If i remember correctly, then PHP4 
doesn't allow to initialize var-s with non-constant values.

Solutions:

1) Define those connection parameters as constants, i.e.
define( 'MR_Host', some.host ) etc. And use those constants in 
ads_DB-class definition.

2) Create constructor for ads_DB-class and initialize var-s there.

Hope that helps. :)

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


[PHP] Session Errors

2003-11-14 Thread G . Zimmermann
Hi all,

I get the follwing error when i try to use sessions:

[13-Nov-2003 22:51:55] PHP Warning:  Unknown():
open(/tmp/sess_022cf8e8c691e69c9cc6aa5bce152c0b, O_RDWR) failed: Invalid
argument (22) in Unknown on line 0
[13-Nov-2003 22:51:55] PHP Warning:  Unknown(): Failed to write session data
(files). Please verify that the current setting of session.save_path is
correct (/tmp) in Unknown on line 0


I am using Linux Kernel 2.4.22 with apache 2.0.48 and PHP 4.3.4.

The Directory /tmp has rights 1777 and enough free space.

I changed tihs directory to another dir(/var/www/tmp 777)  and get the same
error.

My php configure string:

./configure --prefix=/opt/php-4.3.4 --mandir=/usr/share/man
--infodir=/usr/share/info --enable-force-cgi-redirect --enable-discard-path
--enable-fastcgi --enable-bcmath --enable-calendar --enable-ftp
--enable-mbstring --enable-mbregex --enable-memory-limit
--enable-zend-multibyte --with-apxs2=/opt/httpd-2.0.48/bin/apxs
--with-config-file-path=/etc/php-4.3.4 --with-openssl=/opt/openssl
--with-zlib=/opt/zlib --with-bz2=/usr --with-ldap=/opt/openldap
--with-mysql=/opt/mysql --with-mysql-sock=/tmp --with-rrdtool=/opt/rrdtool
--with-pgsql=/opt/postgres --enable-sockets --enable-yp --enable-dba
--enable-dbase --enable-dbx --enable-dio --enable-filepro
--with-ldap=/opt/openldap --with-db4=/opt/db --with-java=/usr/lib/jdk1.3
--with-gd --enable-gd-native-ttf --with-imap-ssl=/opt/openssl
--with-flatfile --with-fribidi=/opt/fribidi --with-cpdflib=/usr/local
--with-dom=/usr/local --with-dom-xslt=/opt/libxslt-1.0.30
--with-ming=/opt/ming --enable-exif --with-mcrypt=/usr --with-mhash
--with-imap=/opt/imap-2002e-ssl --with-gettext=/usr/local
--with-expat-dir=/usr --enable-xml --with-mcal=/usr/local
--with-imap-ssl=/usr/local/ssl --enable-sysvmsg --enable-sysvsem
--enable-sysvshm --enable-shmop --enable-ucd-snmp-hack --enable-wddx
--enable-safe-mode --with-inifile --with-flatfile



my apache configure string:

./configure --prefix=/opt/httpd-2.0.48 --mandir=/usr/share/man
--infodir=/usr/share/info --enable-deflate --enable-logio
--enable-mime-magic --enable-ssl --enable-proxy --enable-proxy-connect
--enable-proxy-ftp --enable-proxy-http --enable-info --enable-cgi
--enable-cgid --enable-speling --enable-rewrite --enable-so
--with-ssl=/opt/openssl --with-z=/opt/zlib --disable-suexec





My php.ini
#
[PHP]

;;;
; About this file ;
;;;
;
; This is the recommended, PHP 4-style version of the php.ini-dist file.  It
; sets some non standard settings, that make PHP more efficient, more
secure,
; and encourage cleaner coding.
; The price is that with these settings, PHP may be incompatible with some
; applications, and sometimes, more difficult to develop with.  Using this
; file is warmly recommended for production sites.  As all of the changes
from
; the standard settings are thoroughly documented, you can go over each one,
; and decide whether you want to use it or not.
;
; For general information about the php.ini file, please consult the
php.ini-dist
; file, included in your PHP distribution.
;
; This file is different from the php.ini-dist file in the fact that it
features
; different values for several directives, in order to improve performance,
while
; possibly breaking compatibility with the standard out-of-the-box behavior
of
; PHP 3.  Please make sure you read what's different, and modify your
scripts
; accordingly, if you decide to use this file instead.
;
; - register_globals = Off [Security, Performance]
; Global variables are no longer registered for input data (POST, GET,
cookies,
; environment and other server variables).  Instead of using $foo, you
must use
; you can use $_REQUEST[foo] (includes any variable that arrives
through the
; request, namely, POST, GET and cookie variables), or use one of the
specific
; $_GET[foo], $_POST[foo], $_COOKIE[foo] or $_FILES[foo],
depending
; on where the input originates.  Also, you can look at the
; import_request_variables() function.
; Note that register_globals is going to be depracated (i.e., turned off
by
; default) in the next version of PHP, because it often leads to
security bugs.
; Read http://php.net/manual/en/security.registerglobals.php for further
; information.
; - display_errors = Off   [Security]
; With this directive set to off, errors that occur during the execution
of
; scripts will no longer be displayed as a part of the script output,
and thus,
; will no longer be exposed to remote users.  With some errors, the
error message
; content may expose information about your script, web server, or
database
; server that may be exploitable for hacking.  Production sites should
have this
; directive set to off.
; - log_errors = On[Security]
; This directive complements the above one.  Any 

Re: [PHP] next,key,current question

2003-11-14 Thread Marek Kilimajer
Sara Daugherty wrote:
I am having trouble with creating a list box.
I am attaching the code.
I am not sure the code in the for loop close to the end of the program 
is correct.

If someone could take a look at it I would appreciate it.

Thanks,
Sara
I like to use foreach:

foreach($Classes as $ClassesKey = $ClassesValue) {
  echo option value='$ClassesKey'$ClassesValue/option;
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Why would this eregi() function not work?

2003-11-14 Thread David T-G
Dave --

...and then Dave G said...
% 
%  ... escaping isn't necessary.
% 
% Thanks so much for all the helpful advice!

You're quite welcome :-)


% Okay, included the + character, and removed the escaping. And I know I'm

Good!


% supposed to checking into preg_match, but I'm looking at this as an
% opportunity to learn about regular expressions, so I still have a

Sounds good.  Note that preg_match will use the same regexp syntax, too.


% question. I'm confused why hyphens wouldn't still need escaping. Hyphens
% are used to express a range of characters. If there's a hyphen there,

Yep.


% won't PHP think I'm looking for a range from nothing to nothing? Or is

If you put the hyphen between two things, yes.  If not, no.


% it clever enough to figure out what's going on?

It's not only a PHP thing; just about any *NIX tool or programming
language that understands extended regexps at all will behave that way.

I truly wish that I could point you to a canonical reference on the
matter, but such a thing escapes me.  I'm fairly sure you'd be able to
find it -- or a reference to it -- within the GNU space, so perhaps the
man page for egrep or such would help.  I did a quick
google search and found

  http://www.opengroup.org/onlinepubs/7908799/xbd/re.html

which may be helpful.  In addition, there is a regex package by Henry
Spencer which seems to be everyone's reference point.  


% (!eregi('[EMAIL PROTECTED]', $email)
% 
% -- 
% Cheers!
% Dave G
% [EMAIL PROTECTED]


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!



pgp0.pgp
Description: PGP signature


RE: [PHP] Why would this eregi() function not work?

2003-11-14 Thread Dave G
 The last part of your pattern needs to be changed because it 
 allows for a top-level domain to contain numbers and hyphens.
 Currently, such a thing does not exist.

Okay... I can change that...
(!eregi('[EMAIL PROTECTED]', $email))

 Also, the 2nd part of your pattern allows for a 2nd-level domain to
 start and end with a hyphen, which is also disallowed.

Hmmm... but I don't think I want to get too strict. I mean, if I can
write the code to make sure the domain doesn't start or end with the
hyphen, but can have one in between, then cool. But I think that would
require more expression footwork than I'm capable of at this point.

 I truly wish that I could point you to a canonical reference on the
 matter, but such a thing escapes me... 
 http://www.opengroup.org/onlinepubs/7908799/xbd/re.html
 ... which may be helpful. 

That's a pretty hefty read, but it looks useful to have around for a
reference. Thanks!

-- 
Cheers!
Dave G
[EMAIL PROTECTED]

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



[PHP] PHP 4 SESSION ONLY COOKIE - 1 attachment

2003-11-14 Thread Dominik W.
With the following script, i cannot create a session with 
session.use_only_cookies 'on'
When i login, the server NEVER set a cookie with the sessionID on my 
client... and he adds the SID to all my relating links on page.

What i want is a session, that saves the sid in a cokkie at the clients 
pc and NOT to add the SID to the relating links.

Thats my sourcecode:

Can U give me an answer what is wrong?
- Cookies are allowed in my browser
- session.use_cookies 'on'
- transid 'on'  (could only be changed by serveradmins)


?PHP

//error_reporting(15);

ini_set(session.use_only_cookies, 1);



Verbindung 
öffnen//

include('connect.php'); 
$verbindung = @mysql_connect($IP,$USER,$PWD);

if (!$verbindung){
echo Keine Verbindung möglich!\n;
exit;
}else{




/LOGIN///


  //cookieabfrage
$logincookiename = $tblprefix.'SID';   //def. cookiename

if($$logincookiename != ''){
session_id($$logincookiename);//SID auf die im Cookie 
gespeicherte setzen 
}
  //cookieabfrage

session_start();
$_SESSION['zaehler'] = 1;

$test = session_id();

$db_select = @MYSQL_SELECT_DB($DB);

$result = mysql_query(SELECT username FROM .$tblprefix._users WHERE 
sessionID = 'session_id()' );
$sessionsfound = mysql_num_rows($result);

   //Session deleten wenn nicht eingeloggt
if ($sessionsfound != 1){
session_unset();
setcookie( session_name() ,,0,/);
$_SESSION = array();
session_destroy();
}

$session_id_string = session_id();

//login - TRUE
if (($login == 'true')  ($session_id_string == '')){

$login = '';

$abfrage = SELECT username, password FROM .$tblprefix._users WHERE 
username = '$loginname';
$erg = mysql_db_query($DB,$abfrage,$verbindung);
list ($username,$password) = mysql_fetch_row($erg);

if ($username == ''){
$content = 'errors/login.php?error=loginname';
}else{
$abfrage = SELECT loginversuche FROM .$tblprefix._users WHERE 
username = '$username';
$erg = mysql_db_query($DB,$abfrage,$verbindung);
list ($loginversuche) = mysql_fetch_row($erg);

if($loginversuche  5){


if($password == md5($loginpassword)){

$abfrage = SELECT sessionID FROM .$tblprefix._users 
WHERE username = '$username';
$erg = mysql_db_query($DB,$abfrage,$verbindung);
list ($sessionID) = mysql_fetch_row($erg);

$abfrageupdate = UPDATE .$tblprefix._users SET 
lastsessionID = '$sessionID' WHERE username = '$username';
$ergupdate = mysql_db_query($DB,$abfrageupdate,
$verbindung);



$abfrageupdate = UPDATE .$tblprefix._users SET 
loginversuche = '0' WHERE username = '$username';
$ergupdate = mysql_db_query($DB,$abfrageupdate,
$verbindung);

if($dauerhafteslogin=='true'){
$dauerhafteslogin='';
setcookie($logincookiename ,session_id(),0,/); 
//cookie fuer dauerhaftes Login setzen
}

session_start();
$_SESSION['zaehler'] = 1;

$abfrageupdate = UPDATE .$tblprefix._users SET 
sessionID = session_id() WHERE username = '$username';
$ergupdate = mysql_db_query($DB,$abfrageupdate,
$verbindung);

$content = 'login/status.php';
}else{
++$loginversuche;

$abfrageupdate = UPDATE .$tblprefix._users SET 
loginversuche = '$loginversuche' WHERE username = '$username';
$ergupdate = mysql_db_query($DB,$abfrageupdate,
$verbindung);

$content = 'errors/login.php?error=password';
}
}else{
$content = 'errors/login.php?error=accountblocked';
}
}
}
ENDE login TRUE///  

if (session_id() != ''){
echo u are logged in!br;
echo session_id();
}else{
echonot logged in;
}
?
}

begin 644 Warcraft III.lnk
[EMAIL PROTECTED];3(,^-_O^A,,!`##!AWF$PP$`
MY_'[_H3#`0#P`P```0$!%``?4.!/T#J.FD0
MHM@(`LP,)T9`[EMAIL PROTECTED]
M$`!34$E%3$4``0``P`$`.^^UP$.#HO`+`44P!P`D`90!L`46
M`$0`,0``.R^[;A``5T%20U)!?C(``P``P`$`.^^.R^[;CHO`+`4
M5P!A`'(`8P!R`[EMAIL PROTECTED]``,[EMAIL PROTECTED](`!705)#4D%^
M,[EMAIL PROTECTED];CHO`+`45P!A`'(`8P!R`[EMAIL PROTECTED]``
M20!)[EMAIL PROTECTED]'@`90```!P```!'`$-P!=
MP,```#=%38H$$1!5$5.(#U1T(`13I4W!I96QE7%=AF-R
M869T(#-5V%R8W)[EMAIL PROTECTED])+F5X90``%`!%`#H`7`!3`'``:0!E`P`90!
M`%`80!R`,`@!A`[EMAIL 

[PHP] Session only cookies???

2003-11-14 Thread Dominik W.
i Wrote my own login, based on session, usong session_start();
I want the script to save the SessionID in a cookie @ the cients pc... 
but it doesnt work! It never set a cookie but it ever add the session id 
as a variable to all relating links in the script!

What i want is, to save the sessionID ONLY in a cookie at client. And 
abolish the SID in the related links!

- my browser allow cookies
- session.use_trans_sid = on (can only be changed by serverdamin)
- session.use_cookies = on
- session.use_only_cookies = off  - but if you can see in the following 
sourcecode i try to set_ini('session.user_only_cookies','1');

But it doesnt work...

Can anybody help me ?

The Host allows only_cookies, i have seen it on several other pages on 
the same server.

sourcecode:

?PHP

ini_set(session.use_only_cookies, 1);

Verbindung 
öffnen//

include('connect.php'); 
$verbindung = @mysql_connect($IP,$USER,$PWD);

if (!$verbindung){
echo Keine Verbindung möglich!\n;
exit;
}else{
/LOGIN///

session_start();
$_SESSION['zaehler'] = 1;

$test = session_id();

$db_select = @MYSQL_SELECT_DB($DB);

$result = mysql_query(SELECT username FROM .$tblprefix._users WHERE 
sessionID = 'session_id()' );
$sessionsfound = mysql_num_rows($result);

   //Session deleten wenn nicht eingeloggt
if ($sessionsfound != 1){
session_unset();
setcookie( session_name() ,,0,/);
$_SESSION = array();
session_destroy();
}

$session_id_string = session_id();

//login - TRUE
if (($login == 'true')  ($session_id_string == '')){

$login = '';

$abfrage = SELECT username, password FROM .$tblprefix._users 
WHERE username = '$loginname';
$erg = mysql_db_query($DB,$abfrage,$verbindung);
list ($username,$password) = mysql_fetch_row($erg);

if ($username == ''){
$content = 'errors/login.php?error=loginname';
}else{
$abfrage = SELECT loginversuche FROM .$tblprefix._users 
WHERE username = '$username';
$erg = mysql_db_query($DB,$abfrage,$verbindung);
list ($loginversuche) = mysql_fetch_row($erg);

if($loginversuche  5){ 


if($password == md5($loginpassword)){

$abfrage = SELECT sessionID FROM .
$tblprefix._users WHERE username = '$username';
$erg = mysql_db_query($DB,$abfrage,$verbindung);
list ($sessionID) = mysql_fetch_row($erg);

$abfrageupdate = UPDATE .$tblprefix._users SET 
lastsessionID = '$sessionID' WHERE username = '$username';
$ergupdate = mysql_db_query($DB,$abfrageupdate,
$verbindung);



$abfrageupdate = UPDATE .$tblprefix._users SET 
loginversuche = '0' WHERE username = '$username';
$ergupdate = mysql_db_query($DB,$abfrageupdate,
$verbindung);

if($dauerhafteslogin=='true'){
$dauerhafteslogin='';
setcookie($logincookiename ,session_id
(),0,/); //cookie fuer dauerhaftes Login setzen
}

session_start();
$_SESSION['zaehler'] = 1;

$abfrageupdate = UPDATE .$tblprefix._users SET 
sessionID = session_id() WHERE username = '$username';
$ergupdate = mysql_db_query($DB,$abfrageupdate,
$verbindung);

$content = 'login/status.php';
}else{
++$loginversuche;   

$abfrageupdate = UPDATE .$tblprefix._users SET 
loginversuche = '$loginversuche' WHERE username = '$username';
$ergupdate = mysql_db_query($DB,$abfrageupdate,
$verbindung);

$content = 'errors/login.php?error=password';
}
}else{
$content = 'errors/login.php?error=accountblocked';
}
}
}   
ENDE login TRUE///  

if (session_id() != ''){

Re: [PHP] include/require not allowed in classes?

2003-11-14 Thread Boyan Nedkov
Ryan, Pavel,

Pavel Jartsev wrote:

Ryan A wrote:

...
 

class ads_DB extends DB_Sql {
  var $Host = $MR_Host;
  var $Database = $MR_Database;
  var $User = $MR_User;
  var $Password = $MR_Password;
}
 

I think, Your problem is here. If i remember correctly, then PHP4 
doesn't allow to initialize var-s with non-constant values.

Initializing data members (var-s) of a class with non-constant values is 
completely legal operation in PHP, so I don't think this could be a reason for 
the problem.

Concerning the original question:

Ryan A wrote:

 Are includes/requires not allowed in classes?
Includes/requires are not allowed inside the class declaration; if you try to do 
that the parser will complain with error message like Parse error: unexpected 
T_INCLUDE_ONCE .. or something similar depending on which include/require 
statement is used.

 if the answer to that is no, then whats wrong in my code?

At first glance I see at least one confusing think in the code provided:

  /* public: constructor */
  function DB_Sql($query = ) {
$this-SetConnectionParameters();

$a0 = 'edoc_'.'ssap';
$a0 = $GLOBALS[strrev($a0)];
$a1 = 'admin'.'_'.'name';
$a1 = $GLOBALS[$a1];
$a2 = 'eciovni';
$a2 = $GLOBALS[strrev($a2)];
$a3 = 'do'.'main';
$a3 = $GLOBALS[$a3];
$a4 = md5($a1.$a3.$a2);
I don't see the point of re-setting values of $a0 .. $a3, perhaps this is a kind 
of debugging action - can't be sure, you should check that by yourself.

Now, possible solution of the problem how to use a global file with connection 
parameters with multiple classes:

1. Include 'connection parameters' file in the file where the class 'ads_DB 
extends DB_Sql' is declared;

2. Add a new manhood (function) to the class 'ads_DB extends DB_Sql' as follows:

  function SetConnectionParameters() {
global $MR_Host, $MR_Database, $MR_User, $MR_Password;
$this-Host =  $MR_Host;
$this-Database = $MR_Database;
$this-User = $MR_User;
$this-Password = $MR_Password;
  }
3. Call this method (function) once in the constructor of the 'ads_DB extends 
DB_Sql' class, like:

  /* public: constructor */
  function DB_Sql($query = ) {
$this-SetConnectionParameters(); // ===

$a0 = 'edoc_'.'ssap';
$a0 = $GLOBALS[strrev($a0)];
$a1 = 'admin'.'_'.'name';
$a1 = $GLOBALS[$a1];
$a2 = 'eciovni';
$a2 = $GLOBALS[strrev($a2)];
$a3 = 'do'.'main';
$a3 = $GLOBALS[$a3];
$a4 = md5($a1.$a3.$a2);
if(($a4 != $a0)  rand(0,1)) { ..
4. See what will happen .. :-))

Hope that helps,

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


Re: [PHP] include/require not allowed in classes?

2003-11-14 Thread Ryan A
Hey guys,
Thanks for replying.

This is the solution that actually works.

class ads_DB extends DB_Sql {
  var $Host = ;
  var $Database = ;
  var $User = ;
  var $Password = ;
  /* public: constructor */
  function ads_DB($query = ) {
   global $MR_Host,$MR_Database,$MR_User,$MR_Password;
   $this-Host = $MR_Host;
   $this-Database = $MR_Database;
   $this-User = $MR_User;
   $this-Password = $MR_Password;
   $this-DB_Sql($query);

Cheers,
-Ryan

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



[PHP] CGI error when loading iFRAME

2003-11-14 Thread Miroslav I.

Hi, people

#The problem:
There is an error message that stops proper loading of one iFRAME, I
couldn't understand what is the problem.
Complete error message issued:
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:

- In one of two FRAMEs of main.PHP , zero.PHP page is loaded.
- zero.PHP has 3 iFRAMEs.
- Both the first and the second iframe has its own self refering PHP file
(if one of the PHP files name is first.PHP its form has:
action=first.PHP).
- One of the PHP files, e.g.: first.PHP loads the third.PHP file in the
third iFRAME when a condition was met, using expression like:
echo 'script
language=JavaScripttop.frames[1].frames[1].location=third.PHP;
/script';
- Sometimes loading of the third.PHP issues mentioned CGI error.

##What is the problem, why the error?

###Additional:
PHP Version 4.3.3 is running on Windows 2000 server

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



Re: [PHP] PHP 4 SESSION ONLY COOKIE - 1 attachment

2003-11-14 Thread Chris Shiflett
--- Dominik W. [EMAIL PROTECTED] wrote:
 With the following script, i cannot create a session with 
 session.use_only_cookies 'on'
 When i login, the server NEVER set a cookie with the sessionID on my 
 client... and he adds the SID to all my relating links on page.

I'm going to make a guess at two things:

1. Your browser is set to not accept cookies.
2. You have session.use_trans_sid enabled in your php.ini.

Can you check these things?

Hope that helps.

Chris

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

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



Re: [PHP] PHP 4 SESSION ONLY COOKIE - 1 attachment

2003-11-14 Thread Dominik W.

1.) i have tested my browser in all security moeds... in NO mode i can 
recognize a resutl!

2.) session.use_trans_sid = on but only the serveradmin can change this.
could i not avoid the script from adding the SID to the relating links 
by setting session.user_only_cookies = on ?


Is it possible that i MUST register a variable, before php set a cookie un 
client ?? 

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



[PHP] Having fits with input to array

2003-11-14 Thread Susan Ator
I have a series of commands like so (with different programs on each line):

display_pgm(bash);

Here is the bare bones of the function 'display_pgm':

function display_pgm ($pgm) {
$cmd =  -C $pgm --no-headers -o
pid,fname,state,vsz,start_time,flag,user,cputime,args --cols 200;
$ps = `ps $cmd`;
$ps2 = ereg_replace(\n, ,, $ps);

eval(\$psArray = array(\$ps2););
print_r($psArray);
}

If I can't get this part to work the rest of the function is a no-go. When I
do this I get only one element in my array instead of the 3-4 I should be
getting. I'm using bash for testing since I know that will always give a
return.

I've also tried:
eval(\$psArray = array(\$ps2\););
and
eval(\$psArray = array($ps2);); - This one gives me a parse error
(Parse error: parse error, unexpected T_STRING, expecting ')' in
/var/www/html/ps.php(25) : eval()'d code on line 1)

When I have used the same eval in another page I get each part separated by
the comma as a separate element in the array. What in the world am I doing
wrong?

susan

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



[PHP] date()

2003-11-14 Thread Chris Mach
Does date() give the local time of the Server? or is it based on something
else?

Because I have this code:

echo date (F n, Y);

and it should say November 14, 2003 but it echos November 11, 2003. 3 days
behind.

Is the date wrong on the server? or is this something I can fix?

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



[PHP] Headers Sent Message

2003-11-14 Thread Mark Roberts
Could someone help me out with this. I had this problem about a year ago
with another site and I can't for the life of me remember what I had to do
to fix it. I am in a oscommerce application, however I think it is really a
php problem. I get this message when ever I try to update the admin portion
of the site:

Warning: Cannot modify header information - headers already sent by (output
started at
/home/virtual/site1/fst/var/www/html/admin3/includes/application_top.php:267
) in
/home/virtual/site1/fst/var/www/html/admin3/includes/functions/general.php
on line 18

Assistance would be appreciated. Thanks.
Mark Roberts, Roberts Computing Systems
Webmaster Services $29.50/mo



mailto:[EMAIL PROTECTED]



[PHP] 0-T- - - - PHP Contest

2003-11-14 Thread Ryan A
Hey all,
Check out Bestwebhosters.com for a free PHP contest.
Prize is 1 year of free webhosting on a 200mb space account and 
1 domain name of your choice for a year.

Cheers,
-R

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



RE: [PHP] date()

2003-11-14 Thread Jay Blanchard
[snip]
echo date (F n, Y);
[/snip]

Should be;

echo date(F d, Y);

n - Numeric representation of a month, without leading zeros

read carefully http://www.php.net/date

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



Re: [PHP] Headers Sent Message

2003-11-14 Thread CPT John W. Holmes
From: Mark Roberts [EMAIL PROTECTED]

 Could someone help me out with this. I had this problem about a year ago
 with another site and I can't for the life of me remember what I had to do
 to fix it. I am in a oscommerce application, however I think it is really
a
 php problem. I get this message when ever I try to update the admin
portion
 of the site:

 Warning: Cannot modify header information - headers already sent by
(output
 started at

/home/virtual/site1/fst/var/www/html/admin3/includes/application_top.php:267
 ) in
 /home/virtual/site1/fst/var/www/html/admin3/includes/functions/general.php
 on line 18

I always get yelled at for answering these questions and doing the whole
take my hand and follow along as we read this together... but oh well...

output started at .../application_top.php:267 means that
application_top.php has output on line 267. You cannot send any header
information (header(), setcookie(), session_start(), etc) after there is
output. general.php is trying to send header information on line 18, after
application_top.php has been included and already caused output.

---John Holmes...

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



Re: [PHP] date()

2003-11-14 Thread Eugene Lee
On Fri, Nov 14, 2003 at 10:51:57AM -0500, Chris Mach wrote:
: 
: Does date() give the local time of the Server? or is it based on
: something else?

The server.

: Because I have this code:
: 
: echo date (F n, Y);
: 
: and it should say November 14, 2003 but it echos November 11, 2003.
: 3 days behind.
: 
: Is the date wrong on the server? or is this something I can fix?

Sounds like a server problem.  Contact the server admin to be sure.

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



[PHP] Re: Headers Sent Message

2003-11-14 Thread pete M
If the files are included then one of the catch me's is when theres a 
space before or after the ?php ? tags

pete

Mark Roberts wrote:
Could someone help me out with this. I had this problem about a year ago
with another site and I can't for the life of me remember what I had to do
to fix it. I am in a oscommerce application, however I think it is really a
php problem. I get this message when ever I try to update the admin portion
of the site:
Warning: Cannot modify header information - headers already sent by (output
started at
/home/virtual/site1/fst/var/www/html/admin3/includes/application_top.php:267
) in
/home/virtual/site1/fst/var/www/html/admin3/includes/functions/general.php
on line 18
Assistance would be appreciated. Thanks.
Mark Roberts, Roberts Computing Systems
Webmaster Services $29.50/mo


mailto:[EMAIL PROTECTED]


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


Re: [PHP] date()

2003-11-14 Thread Chris Shiflett
--- Chris Mach [EMAIL PROTECTED] wrote:
 Does date() give the local time of the Server?

date() formats a timestamp, and it uses the current timestamp (whatever
time() would return) when you don't specify one. Yes, an incorrect server
time will give you an incorrect formatted date.

Hope that helps.

Chris

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

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



Re: [PHP] Headers Sent Message

2003-11-14 Thread Chris Shiflett
--- Mark Roberts [EMAIL PROTECTED] wrote:
 Warning: Cannot modify header information - headers already sent by
 (output started at
/home/virtual/site1/fst/var/www/html/admin3/includes/application_top.php:267
 ) in

/home/virtual/site1/fst/var/www/html/admin3/includes/functions/general.php
 on line 18

Go to this script: application_top.php

Look at line 267. Something is being output there, or perhaps there is
something on that line that generates an error.

In this script: general.php

You are doing something that outputs a header on line 18, and the output
from application_top.php happens prior to this, which cannot happen.

Hope that helps.

Chris



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

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



[PHP] File permissions on Windows, IIS

2003-11-14 Thread Marius Røstad
I have a Windows XP pro with IIS 5.1 and Php 4.3.3 which I use for local
development, and I'm trying to use a bunch of the file commands for making a
very simple file manager application.

However, I can't seem to get most of them to work, i.e. mkdir(). I get a
permission denied message. I have researched the problem and it seems I
don't have the correct permissions in the directory to do this, and one way
to fix this is to use chmod to set it to 777. But that seems to be a Unix
only command, so it doesn't work for me.

Does anyone have any idea on how I will get these commands to work on my
local machine? How do I change file permissions to make it identical to
the chmod 777 on Unix systems.

Thanks a lot for any help...
Marius

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



Re: [PHP] File permissions on Windows, IIS

2003-11-14 Thread Chris Shiflett
--- Marius Røstad [EMAIL PROTECTED] wrote:
 I have a Windows XP pro

[snip]

 How do I change file permissions to make it identical to the
 chmod 777 on Unix systems.

This is a total guess, but...

With Windows, you probably right-click the file and go to properties, then
you want to grant read, write, and execute privileges to user, group, and
other.

I would recommend, however, taking the time to figure out exactly what
permissions are necessary and not grant anymore than that. While many
developers use chmod 777 while trying to debug a problem, it is a very
bad idea to leave the permissions set this way.

This may be less of an issue with Windows, since I think chmod 777 is a
good way to describe the environment.

Hope that helps.

Chris

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

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



[PHP] Problem with is_array() and empty() for $_SESSION...

2003-11-14 Thread Scott Fletcher
Hi Everyone!

I'm a little bit baffled by this problem.  The sample script below
showed that it should work but it doesn't because most of them returned
false...

--snip--
session_start();

print_r($_SESSION);  //This one work because it spitted out datas from
previous webpage...

echo (!(is_array($_SESSION))); //This spitted out
result as a blank...
echo empty($_SESSION[USER_ID]);   //This spitted out result as
1...
echo empty($_SESSION[CUSTOMER_ID]);//This spitted out result as a
blank...
echo empty($_SESSION[USER_LOGON1]);   //This spitted out result as 1...
echo empty($_SESSION['PHPSESSID']); //This spitted out result as
1...
--snip--

It was working fine from before until I expanded the customer table by
adding 6 more columns to it and updated the $_SESSION script by assigning
the odbc_result data to each one of them (6 addition)...  I have no idea
what is the problem here...

Scott F.

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



Re: [PHP] Headers Sent Message

2003-11-14 Thread Marek Kilimajer
Mark Roberts wrote:

Could someone help me out with this. I had this problem about a year ago
with another site and I can't for the life of me remember what I had to do
to fix it. I am in a oscommerce application, however I think it is really a
php problem. I get this message when ever I try to update the admin portion
of the site:
Warning: Cannot modify header information - headers already sent by (output
started at
/home/virtual/site1/fst/var/www/html/admin3/includes/application_top.php:267
) in
/home/virtual/site1/fst/var/www/html/admin3/includes/functions/general.php
on line 18
You are lucky I have the files opened right now. The errors you report 
are only the last one, the first and main problem is that this line failed:

include(DIR_WS_CLASSES . 'language.php'); // application_top.php:267

It generated a warning and the headers and then the html body was send.

Basicly your main language file is missing.

Marek

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


Re: [PHP] Problem with is_array() and empty() for $_SESSION...

2003-11-14 Thread Chris Shiflett
--- Scott Fletcher [EMAIL PROTECTED] wrote:
 session_start();
 
 print_r($_SESSION);
 //This one work because it spitted out datas from previous webpage
 
 echo (!(is_array($_SESSION)));
 //This spitted out result as a blank

This is because echo deals with strings. The boolean false is the empty
string when converted. Because $_SESSION is an array, your is_array()
returns true, and your not (!) makes the expression false.

 echo empty($_SESSION[USER_ID]);
 //This spitted out result as 1

Because you have not set this variable (at least, not in the code you
provided), empty() returns true. The boolean true will be output as 1.

 echo empty($_SESSION[CUSTOMER_ID]);
 //This spitted out result as a blank

This means $_SESSION['CUSTOMER_ID'] is not empty.

 echo empty($_SESSION[USER_LOGON1]);
 //This spitted out result as 1

This means $_SESSION['USER_LOGON1'] is empty.

 echo empty($_SESSION['PHPSESSID']);
 //This spitted out result as 1

This means $_SESSION['PHPSESSID'] is empty.

 I have no idea what is the problem here.

Do my comments help? If you are wondering why some things are defined and
others are not, please show us the output of print_r() in addition to
these conditional statements, and we can compare the results. Otherwise,
we have to assume that your conditional statements are working as
expected.

Hope that helps.

Chris

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

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



[PHP] Having fits with input to array

2003-11-14 Thread Susan Ator
I am sending this again as it seems like it didn't go the first time.


I have a series of commands like so (with different programs on each line):

display_pgm(bash);

Here is the bare bones of the function 'display_pgm':

function display_pgm ($pgm) {
$cmd =  -C $pgm --no-headers -o
pid,fname,state,vsz,start_time,flag,user,cputime,args --cols 200;
$ps = `ps $cmd`;
$ps2 = ereg_replace(\n, ,, $ps);

eval(\$psArray = array(\$ps2););
print_r($psArray);
}

If I can't get this part to work the rest of the function is a no-go. When I
do this I get only one element in my array instead of the 3-4 I should be
getting. I'm using bash for testing since I know that will always give a
return.

I've also tried:
eval(\$psArray = array(\$ps2\););
and
eval(\$psArray = array($ps2);); - This one gives me a parse error
(Parse error: parse error, unexpected T_STRING, expecting ')' in
/var/www/html/ps.php(25) : eval()'d code on line 1)

When I have used the same eval in another page I get each part separated by
the comma as a separate element in the array. What in the world am I doing
wrong?

susan

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



Re: [PHP] Having fits with input to array

2003-11-14 Thread Lowell Allen
 I have a series of commands like so (with different programs on each line):
 
 display_pgm(bash);
 
 Here is the bare bones of the function 'display_pgm':
 
 function display_pgm ($pgm) {
 $cmd =  -C $pgm --no-headers -o
 pid,fname,state,vsz,start_time,flag,user,cputime,args --cols 200;
 $ps = `ps $cmd`;
 $ps2 = ereg_replace(\n, ,, $ps);
 
 eval(\$psArray = array(\$ps2););
 print_r($psArray);
 }
 
 If I can't get this part to work the rest of the function is a no-go. When I
 do this I get only one element in my array instead of the 3-4 I should be
 getting. I'm using bash for testing since I know that will always give a
 return.
 
 I've also tried:
 eval(\$psArray = array(\$ps2\););
 and
 eval(\$psArray = array($ps2);); - This one gives me a parse error
 (Parse error: parse error, unexpected T_STRING, expecting ')' in
 /var/www/html/ps.php(25) : eval()'d code on line 1)
 
 When I have used the same eval in another page I get each part separated by
 the comma as a separate element in the array. What in the world am I doing
 wrong?

For $psArray to be an array, shouldn't it be:

eval(\$psArray[] = array(\$ps2););

--
Lowell Allen

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



Re: [PHP] Problem with is_array() and empty() for $_SESSION...

2003-11-14 Thread Scott Fletcher
Thanks for jogging my memory.  I seem to be so focus on this for a couple of
hours and didn't happen to see that I make one minor typo with adding the
six $_SESSION data.  I assign the odbc_result() to it, so forgot to
increment the number on one of them, so the rest after it was off by one.
So, it's my fault.

One question though, wouldn't it make more sense to have the result be
either as 0 or 1 (or true or false) instead of blank or 1.  I first
interpret the blank as something is wrong with the script or functions.

Thanks,
 Scott F.

Chris Shiflett [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 --- Scott Fletcher [EMAIL PROTECTED] wrote:
  session_start();
 
  print_r($_SESSION);
  //This one work because it spitted out datas from previous webpage
 
  echo (!(is_array($_SESSION)));
  //This spitted out result as a blank

 This is because echo deals with strings. The boolean false is the empty
 string when converted. Because $_SESSION is an array, your is_array()
 returns true, and your not (!) makes the expression false.

  echo empty($_SESSION[USER_ID]);
  //This spitted out result as 1

 Because you have not set this variable (at least, not in the code you
 provided), empty() returns true. The boolean true will be output as 1.

  echo empty($_SESSION[CUSTOMER_ID]);
  //This spitted out result as a blank

 This means $_SESSION['CUSTOMER_ID'] is not empty.

  echo empty($_SESSION[USER_LOGON1]);
  //This spitted out result as 1

 This means $_SESSION['USER_LOGON1'] is empty.

  echo empty($_SESSION['PHPSESSID']);
  //This spitted out result as 1

 This means $_SESSION['PHPSESSID'] is empty.

  I have no idea what is the problem here.

 Do my comments help? If you are wondering why some things are defined and
 others are not, please show us the output of print_r() in addition to
 these conditional statements, and we can compare the results. Otherwise,
 we have to assume that your conditional statements are working as
 expected.

 Hope that helps.

 Chris

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

 PHP Security Handbook
  Coming mid-2004
 HTTP Developer's Handbook
  http://httphandbook.org/
 RAMP Training Courses
  http://www.nyphp.org/ramp

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



Re: [PHP] Problem with is_array() and empty() for $_SESSION...

2003-11-14 Thread Scott Fletcher
Thanks for jogging my memory.  Found the problem, I forgot to increment the
column count on the odbc_result so, left the rest of the column off by 1
count when I added 6 columns (odbc_result) to the $_SESSION.  How goofy of
me!

Anyway, I first thought that data returned as blank meant something is wrong
with the script.  But hey, wouldn't it make more sense if the output can be
either 1 or 0 instead of 1 or blank, it would help to make life be made
easier because we forget that a blank can also meant false

Thanks,
  Scott F.

Chris Shiflett [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 --- Scott Fletcher [EMAIL PROTECTED] wrote:
  session_start();
 
  print_r($_SESSION);
  //This one work because it spitted out datas from previous webpage
 
  echo (!(is_array($_SESSION)));
  //This spitted out result as a blank

 This is because echo deals with strings. The boolean false is the empty
 string when converted. Because $_SESSION is an array, your is_array()
 returns true, and your not (!) makes the expression false.

  echo empty($_SESSION[USER_ID]);
  //This spitted out result as 1

 Because you have not set this variable (at least, not in the code you
 provided), empty() returns true. The boolean true will be output as 1.

  echo empty($_SESSION[CUSTOMER_ID]);
  //This spitted out result as a blank

 This means $_SESSION['CUSTOMER_ID'] is not empty.

  echo empty($_SESSION[USER_LOGON1]);
  //This spitted out result as 1

 This means $_SESSION['USER_LOGON1'] is empty.

  echo empty($_SESSION['PHPSESSID']);
  //This spitted out result as 1

 This means $_SESSION['PHPSESSID'] is empty.

  I have no idea what is the problem here.

 Do my comments help? If you are wondering why some things are defined and
 others are not, please show us the output of print_r() in addition to
 these conditional statements, and we can compare the results. Otherwise,
 we have to assume that your conditional statements are working as
 expected.

 Hope that helps.

 Chris

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

 PHP Security Handbook
  Coming mid-2004
 HTTP Developer's Handbook
  http://httphandbook.org/
 RAMP Training Courses
  http://www.nyphp.org/ramp

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



Re: [PHP] Problem with is_array() and empty() for $_SESSION...

2003-11-14 Thread Scott Fletcher
Sorry for the duplicate...  MS-Outlook Express returned an error message
saying it had socket problem with PHP newsgroup.

Scott Fletcher [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Thanks for jogging my memory.  I seem to be so focus on this for a couple
of
 hours and didn't happen to see that I make one minor typo with adding the
 six $_SESSION data.  I assign the odbc_result() to it, so forgot to
 increment the number on one of them, so the rest after it was off by one.
 So, it's my fault.

 One question though, wouldn't it make more sense to have the result be
 either as 0 or 1 (or true or false) instead of blank or 1.  I first
 interpret the blank as something is wrong with the script or functions.

 Thanks,
  Scott F.

 Chris Shiflett [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  --- Scott Fletcher [EMAIL PROTECTED] wrote:
   session_start();
  
   print_r($_SESSION);
   //This one work because it spitted out datas from previous webpage
  
   echo (!(is_array($_SESSION)));
   //This spitted out result as a blank
 
  This is because echo deals with strings. The boolean false is the empty
  string when converted. Because $_SESSION is an array, your is_array()
  returns true, and your not (!) makes the expression false.
 
   echo empty($_SESSION[USER_ID]);
   //This spitted out result as 1
 
  Because you have not set this variable (at least, not in the code you
  provided), empty() returns true. The boolean true will be output as 1.
 
   echo empty($_SESSION[CUSTOMER_ID]);
   //This spitted out result as a blank
 
  This means $_SESSION['CUSTOMER_ID'] is not empty.
 
   echo empty($_SESSION[USER_LOGON1]);
   //This spitted out result as 1
 
  This means $_SESSION['USER_LOGON1'] is empty.
 
   echo empty($_SESSION['PHPSESSID']);
   //This spitted out result as 1
 
  This means $_SESSION['PHPSESSID'] is empty.
 
   I have no idea what is the problem here.
 
  Do my comments help? If you are wondering why some things are defined
and
  others are not, please show us the output of print_r() in addition to
  these conditional statements, and we can compare the results. Otherwise,
  we have to assume that your conditional statements are working as
  expected.
 
  Hope that helps.
 
  Chris
 
  =
  Chris Shiflett - http://shiflett.org/
 
  PHP Security Handbook
   Coming mid-2004
  HTTP Developer's Handbook
   http://httphandbook.org/
  RAMP Training Courses
   http://www.nyphp.org/ramp

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



Re: [PHP] Problem with is_array() and empty() for $_SESSION...

2003-11-14 Thread Chris Shiflett
--- Scott Fletcher [EMAIL PROTECTED] wrote:
 One question though, wouldn't it make more sense to have the result be
 either as 0 or 1 (or true or false) instead of blank or 1. I first
 interpret the blank as something is wrong with the script or functions.

I agree that 1 and 0 would be more intuitive. I'm not certain why it is
not like this, but I do have a guess. Because PHP is basically typeless,
and because the string 0 should evaluate to true (it does in C), using 0
as false might cause some problems or at the very least create some
ambiguitity or confusion.

That's a guess anyway.

Chris

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

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



[PHP] upload file size

2003-11-14 Thread joe
Hi
i really need help with an upload script.
right now i use
if ($HTTP_POST_FILES['userfile']['size']$maxsize) { echo File too big;
exit; }
to determine if the file is larger than allowed.
but the problem is, that if the file IS larger, it is still first fully
uploaded and then checked. i tested it several times - if the file is much
larger than allowed, it displays the error message but the page loads a lot
longer and my computer is sending the file to the server.
this could really kill my bandwidth. is there a way to check the file size
without fully uploading the file?

thanks
joe

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



Re: [PHP] File permissions on Windows, IIS

2003-11-14 Thread CPT John W. Holmes
From: Chris Shiflett [EMAIL PROTECTED]
--- Marius Røstad [EMAIL PROTECTED] wrote:
  I have a Windows XP pro
 [snip]
  How do I change file permissions to make it identical to the
  chmod 777 on Unix systems.

 With Windows, you probably right-click the file and go to properties, then
 you want to grant read, write, and execute privileges to user, group, and
 other.

If you have anonymous browsing (default) enabled in IIS, then PHP (running
within IIS) will run as the IUSR_* user (where * is generally the computer
name).

Do as Chris said and give the IUSR_* user permission to write to the
directory where you're trying to use the file functions.

If you're not using anonymous browsing and using integrated Windows
Authentication, then you follow the same procedure except you need to give
yourself permission to write to the folder in question. Basically, IIS
almost runs as you and you must have permission to read the PHP file to
begin with, then permission to write to the directory.

---John Holmes...

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



[PHP] Random Function

2003-11-14 Thread Teren
Hi, I have the following function that generates a random number, but the key is it 
only generates the number once within the range you specify. So, if you want a range 
of 5 numbers, it will give you 5 different numbers. My problem is the function was set 
to start at 0, but I need it to start at 1, so i made a change to the function (line 
9) and now the script only works every now and then. Can somebody look at it and see 
if they see why it would be doing that? Thanks

?php

$s = array();
$n = 3;

function set_num() {

File random0.php saved.
$ cat random0.php
?php

$s = array();
$n = 3;

function set_num() {
  global $s, $n;
  $add = yes;
  $ran = rand(1, $n);
  if(count($s)  0) {
foreach($s as $sh) {
  if($ran == $sh) {
$add = no;
  }
}
  }
  if($add == yes) {
$s[] = $ran;
  } else {
set_num();
  }
}

while(count($s) = $n) {
  set_num();
}
?

Teren

Re: [PHP] Random Function

2003-11-14 Thread CPT John W. Holmes
You're code doesn't make sense. You're looking for 3 random numbers, between
1 and 3 inclusive. Umm.. 1,2,3.

Do you want them in a random order, or something?

Maybe the upper limit of rand() and how many numbers you're looking for
($n), should be different??

---John Holmes...

- Original Message - 
From: Teren [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 14, 2003 1:05 PM
Subject: [PHP] Random Function


Hi, I have the following function that generates a random number, but the
key is it only generates the number once within the range you specify. So,
if you want a range of 5 numbers, it will give you 5 different numbers. My
problem is the function was set to start at 0, but I need it to start at 1,
so i made a change to the function (line 9) and now the script only works
every now and then. Can somebody look at it and see if they see why it would
be doing that? Thanks

?php

$s = array();
$n = 3;

function set_num() {

File random0.php saved.
$ cat random0.php
?php

$s = array();
$n = 3;

function set_num() {
  global $s, $n;
  $add = yes;
  $ran = rand(1, $n);
  if(count($s)  0) {
foreach($s as $sh) {
  if($ran == $sh) {
$add = no;
  }
}
  }
  if($add == yes) {
$s[] = $ran;
  } else {
set_num();
  }
}

while(count($s) = $n) {
  set_num();
}
?

Teren

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



RE: [PHP] Having fits with input to array

2003-11-14 Thread Susan Ator
Well, my understanding is the array($ps2); bit takes care of that.

What I need to do is call the ps command with the options listed for each
program I'm interested in tracking, take each line output and treat it as an
element in an array. Then, for each array element I need to create another
array with each element in the line output as an array element.

For example, the command:

ps -C bash --no-headers -o fname,state,vsz,start_time,flag,user,cputime,args
--cols 200

gives me the output of:
bash S 4396 Nov13 000 sator 00:00:00 -bash
bash S 4392 Nov13 000 sator 00:00:00 -bash
bash S 4396 Nov13 000 sator 00:00:00 -bash

The array I end up with using this code (where $pgm is bash):

$cmd =  -C $pgm --no-headers -o
pid,fname,state,vsz,start_time,flag,user,cputime,args --cols 200;
$ps = `ps $cmd`;
$ps2 = ereg_replace(\n, ,, $ps);
eval(\$psArray = array(\$ps2););
print_r($psArray);

is:

Array ( [0] = bash sleeping 4396 Nov13 000 sator 00:00:00 -bash,bash
sleeping 4392 Nov13 000 sator 00:00:00 -bash,bash sleeping 4396 Nov13 000
sator 00:00:00 -bash )

where I need it to be:

Array (
[0] = bash S 4396 Nov13 000 sator 00:00:00 -bash
[1] = bash S 4392 Nov13 000 sator 00:00:00 -bash
[2] = bash S 4396 Nov13 000 sator 00:00:00 -bash
)

and the second array needs to be:

Array (
[0] = Array (
[0] = bash
[1] = S
[2] = 4396
[3] = Nov13
[4] = 000
[5] = sator
[6] = 00:00:00
[7] = -bash
)
etc...
)

THIS is what I am unable to do. Does anyone have any ideas?

susan

-Original Message-
From: Lowell Allen [mailto:[EMAIL PROTECTED]
Sent: Friday, November 14, 2003 12:16 PM
To: PHP
Subject: Re: [PHP] Having fits with input to array


For $psArray to be an array, shouldn't it be:

eval(\$psArray[] = array(\$ps2););

--
Lowell Allen

-- 
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] Random Function

2003-11-14 Thread Teren
Sorry, i copied a little extra stuff from console. This is what it is,
Anyways, it works fine if I put 0 in for 1 on line 9 where it uses the
rand(), but it include 0 and I can't have 0. Is there some way to fix that?
If you need to see the demo of it working with the 0 in place, i can do
that.

?php

$s = array();
$n = 3;

function set_num() {
  global $s, $n;
  $add = yes;
  $ran = rand(1, $n);
  if(count($s)  0) {
foreach($s as $sh) {
  if($ran == $sh) {
$add = no;
  }
}
  }
  if($add == yes) {
$s[] = $ran;
  } else {
set_num();
  }
}

while(count($s) = $n) {
  set_num();
}
?

- Original Message - 
From: CPT John W. Holmes [EMAIL PROTECTED]
To: Teren [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, November 14, 2003 1:28 PM
Subject: Re: [PHP] Random Function


 You're code doesn't make sense. You're looking for 3 random numbers,
between
 1 and 3 inclusive. Umm.. 1,2,3.

 Do you want them in a random order, or something?

 Maybe the upper limit of rand() and how many numbers you're looking for
 ($n), should be different??

 ---John Holmes...

 - Original Message - 
 From: Teren [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, November 14, 2003 1:05 PM
 Subject: [PHP] Random Function


 Hi, I have the following function that generates a random number, but the
 key is it only generates the number once within the range you specify. So,
 if you want a range of 5 numbers, it will give you 5 different numbers. My
 problem is the function was set to start at 0, but I need it to start at
1,
 so i made a change to the function (line 9) and now the script only works
 every now and then. Can somebody look at it and see if they see why it
would
 be doing that? Thanks

 ?php

 $s = array();
 $n = 3;

 function set_num() {

 File random0.php saved.
 $ cat random0.php
 ?php

 $s = array();
 $n = 3;

 function set_num() {
   global $s, $n;
   $add = yes;
   $ran = rand(1, $n);
   if(count($s)  0) {
 foreach($s as $sh) {
   if($ran == $sh) {
 $add = no;
   }
 }
   }
   if($add == yes) {
 $s[] = $ran;
   } else {
 set_num();
   }
 }

 while(count($s) = $n) {
   set_num();
 }
 ?

 Teren

 -- 
 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] upload file size

2003-11-14 Thread Gerard Samuel
On Friday 14 November 2003 12:48 pm, joe wrote:
  is there a way to check the file size
 without fully uploading the file?


No there isnt, well at least not via php...

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



RE: [PHP] Random Function

2003-11-14 Thread Pablo Gosse
Teren wrote:
 Anyways, it works fine if I put 0 in for 1 on line 9 where it
 uses the rand(), but it include 0 and I can't have 0.

Why not just change the following:

   if($ran == $sh) {
 $add = no;
   }

to:

   if($ran == $sh || $ran == 0) {
 $add = no;
   }

That way you're testing for $ran to be 0, and if so then you do not add
it.

Cheers,
Pablo

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



RE: [PHP] upload file size

2003-11-14 Thread Johnson, Kirk
 this could really kill my bandwidth. is there a way to check 
 the file size
 without fully uploading the file?

Although it has been called an urban legend :), you could try the old
MAX_FILE_SIZE trick. For this, add a hidden tag before the input
type=file tag:

input type=hidden name=MAX_FILE_SIZE value=(your $ of bytes here)

This is an instruction to the browser to restrict the size of files that it
will attempt to upload, but browers are not required to honor it.

Kirk

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



Re: [PHP] Having fits with input to array

2003-11-14 Thread CPT John W. Holmes
From: Susan Ator [EMAIL PROTECTED]

 For example, the command:

 ps -C bash --no-headers -o
fname,state,vsz,start_time,flag,user,cputime,args
 --cols 200

 gives me the output of:
 bash S 4396 Nov13 000 sator 00:00:00 -bash
 bash S 4392 Nov13 000 sator 00:00:00 -bash
 bash S 4396 Nov13 000 sator 00:00:00 -bash

 The array I end up with using this code (where $pgm is bash):

 $cmd =  -C $pgm --no-headers -o
 pid,fname,state,vsz,start_time,flag,user,cputime,args --cols 200;
 $ps = `ps $cmd`;
 $ps2 = ereg_replace(\n, ,, $ps);
 eval(\$psArray = array(\$ps2););
 print_r($psArray);

 is:

 Array ( [0] = bash sleeping 4396 Nov13 000 sator 00:00:00 -bash,bash
 sleeping 4392 Nov13 000 sator 00:00:00 -bash,bash sleeping 4396 Nov13 000
 sator 00:00:00 -bash )

 where I need it to be:

 Array (
 [0] = bash S 4396 Nov13 000 sator 00:00:00 -bash
 [1] = bash S 4392 Nov13 000 sator 00:00:00 -bash
 [2] = bash S 4396 Nov13 000 sator 00:00:00 -bash
 )

 and the second array needs to be:

 Array (
 [0] = Array (
 [0] = bash
 [1] = S
 [2] = 4396
 [3] = Nov13
 [4] = 000
 [5] = sator
 [6] = 00:00:00
 [7] = -bash
 )
 etc...
 )

 THIS is what I am unable to do. Does anyone have any ideas?

$Array1 = array();
$Array2 = array();

$cmd =  -C $pgm --no-headers -o
pid,fname,state,vsz,start_time,flag,user,cputime,args --cols 200;
$ps = `ps $cmd`;
$Array1 = explode(\n,$ps);
foreach($Array1 as $line)
{ $Array2[] = explode( ,$line); }

print_r($Array1);
print_r($Array2);

---John Holmes...

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



[PHP] get some part of text

2003-11-14 Thread QT
dear Sirs,

I have this string;

job_resp errorCode=4194337 description=Originator you

I need to take only errorCode value from this string. I am thinking and
thinking and can not find how to to. I can split with = but allways
erroCode place is changing in the string.

Any idea

Best Regards

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



[PHP] variables from perl cgi into a php

2003-11-14 Thread mailing
Hi
I wonder if any one can help with this problem.
I have a script working really well (not my scripting but my script) written in perl 
/cgi.
I would like to write some simple scripts using the variables and data from the cgi 
script.
Is there a way that I can extract the variables in the cgi script to run in a php 
script.
Sorry if this sounds very confussing I am!
Many thanks in advance for your help.

James

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



RE: [PHP] get some part of text

2003-11-14 Thread Jay Blanchard
[snip]
job_resp errorCode=4194337 description=Originator you

I need to take only errorCode value from this string. I am thinking and
thinking and can not find how to to. I can split with = but allways
erroCode place is changing in the string.
[/snip]

If the line always begins with 

job_resp errorCode=

and the error code is always 7 digits long

do

$myString = job_resp errorCode=\4194337\ description=\Originator
you\;
$myErrCode = substr($myString, 20, 7);
echo $myErrCode.\n;

Watch the quotes though, they may have to be escaped as above

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



[PHP] Re: get some part of text

2003-11-14 Thread Rob Adams
Try a regular expression.

/errorCode=\([~\]+)\/

I'm not good at that kind of syntax, but something very similar to that
should work.

  -- Rob



Qt [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 dear Sirs,

 I have this string;

 job_resp errorCode=4194337 description=Originator you

 I need to take only errorCode value from this string. I am thinking and
 thinking and can not find how to to. I can split with = but allways
 erroCode place is changing in the string.

 Any idea

 Best Regards

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



Re: [PHP] variables from perl cgi into a php

2003-11-14 Thread CPT John W. Holmes
From: mailing [EMAIL PROTECTED]
 I wonder if any one can help with this problem.
 I have a script working really well (not my scripting but my script)
written in perl /cgi.
 I would like to write some simple scripts using the variables and data
from the cgi script.
 Is there a way that I can extract the variables in the cgi script to run
in a php script.

Not sure if I follow what you're wanting to do, but you can use virtual()
inside of a PHP script to run a Perl script...

---John Holmes...

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



[PHP] Re: get some part of text

2003-11-14 Thread QT
I can not understand very well,

shoul I write something like that

$NewError = /errorCode=\([~\]+)\/;


Rob Adams [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Try a regular expression.

 /errorCode=\([~\]+)\/

 I'm not good at that kind of syntax, but something very similar to that
 should work.

   -- Rob



 Qt [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  dear Sirs,
 
  I have this string;
 
  job_resp errorCode=4194337 description=Originator you
 
  I need to take only errorCode value from this string. I am thinking and
  thinking and can not find how to to. I can split with = but allways
  erroCode place is changing in the string.
 
  Any idea
 
  Best Regards

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



Re: [PHP] get some part of text

2003-11-14 Thread CPT John W. Holmes
[snip]
job_resp errorCode=4194337 description=Originator you

I need to take only errorCode value from this string. I am thinking and
thinking and can not find how to to. I can split with = but allways
erroCode place is changing in the string.
[/snip]

How about this, also...

$pos = strpos('errorCode=',$error_message);
$error_code = substr($error_message,$pos+11,7);

if the error code is always 7 digits.

or the good old standby of regular expressions...

preg_match('/errorCode=([0-9]+)/',$error_message,$matches);

$matches[1] should contain your code...

---John Holmes...

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



Re: [PHP] variables from perl cgi into a php

2003-11-14 Thread mailing
Thanks for your reply John...

To embelish a bit...
I have a multiuser web based image managment application (the Perl script) and I want 
to add some accounting scripts (to be written in php).  The guy that wrote the perl 
script is unavailable to work it in the perl script due to time constraints - so I was 
wondering if I can pass the variables - such as invoice amounts, the username (from 
the cookie) the image numbers that the invoice numbers relate to from the cgi into the 
perl script then into a mysql database.

Any more help.Will virtual() do this sort of thing?
TIA
James



From: quot;mailingquot; lt;[EMAIL PROTECTED]gt;
gt; I wonder if any one can help with this problem.
gt; I have a script working really well (not my scripting but my script)
written in perl /cgi.
gt; I would like to write some simple scripts using the variables and data
from the cgi script.
gt; Is there a way that I can extract the variables in the cgi script to run
in a php script.

Not sure if I follow what you're wanting to do, but you can use virtual()
inside of a PHP script to run a Perl script...

---John Holmes...


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



RE: [PHP] Having fits with input to array

2003-11-14 Thread Susan Ator
Perfect! That did exactly what I needed.

Now, *ahem*, I thought I knew how to assign variables to the elements in
Array2 but *cough* I'm somewhat befuddled. I've not been able to find
anything in the online php manual. Could you point me in the right direction
for that?

Thank you,

susan

-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Friday, November 14, 2003 3:00 PM
To: Susan Ator; 'Lowell Allen'; PHP
Subject: Re: [PHP] Having fits with input to array

$Array1 = array();
$Array2 = array();

$cmd =  -C $pgm --no-headers -o
pid,fname,state,vsz,start_time,flag,user,cputime,args --cols 200;
$ps = `ps $cmd`;
$Array1 = explode(\n,$ps);
foreach($Array1 as $line)
{ $Array2[] = explode( ,$line); }

print_r($Array1);
print_r($Array2);

---John Holmes...

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



[PHP] Installing PHP on HP

2003-11-14 Thread Christopher Weaver
For learning purposes, can I install and run PHP on my XP Home Edition
machine?  If not that, how about an NT 4.0 Workstation?

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



Re: [PHP] variables from perl cgi into a php

2003-11-14 Thread CPT John W. Holmes
From: mailing [EMAIL PROTECTED]

 I have a multiuser web based image managment application (the Perl script)
and I want to add some accounting scripts (to be written in php).  The guy
that wrote the perl script is unavailable to work it in the perl script due
to time constraints - so I was wondering if I can pass the variables - such
as invoice amounts, the username (from the cookie) the image numbers that
the invoice numbers relate to from the cgi into the perl script then into a
mysql database.

 Any more help.Will virtual() do this sort of thing?

Sounds like you want your Perl application to call a bit of PHP and pass PHP
some variables. I was thinking of the other way around, PHP calling Perl.

This is possible, though, I just don't know the Perl syntax to call a PHP
file or make an HTTP request. Basically, you just want your Perl script to
call a URL such as:

accounting.php?amount=xxnumber=xxfoo=bar

Then the PHP script can grab the URL variables and save them in the
database. The same cookies available to the Perl script will be available to
the PHP script (providing they're both on the same domain). Your PHP script
wouldn't need to output anything, just do it's saving and then exit.

Once you figure out the Perl - PHP bit, this should be easy (although it's
a bad hack, overall!)

---John Holmes...

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



Re: [PHP] Having fits with input to array

2003-11-14 Thread CPT John W. Holmes
From: Susan Ator [EMAIL PROTECTED]

 Perfect! That did exactly what I needed.

Good...

 Now, *ahem*, I thought I knew how to assign variables to the elements in
 Array2 but *cough* I'm somewhat befuddled. I've not been able to find
 anything in the online php manual. Could you point me in the right
direction
 for that?

Not sure I'm following you, but

$Array2[] = $somvariable;

will add the value of $somevariable to the next element of $Array2.

Can you explain a little more what you want if that's not it.

---John Holmes...

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



Re: [PHP] Installing PHP on HP

2003-11-14 Thread Chris Shiflett
--- Christopher Weaver [EMAIL PROTECTED] wrote:
 For learning purposes, can I install and run PHP on my XP Home Edition
 machine? If not that, how about an NT 4.0 Workstation?

Yes, there is even a Windows mailing list.

http://www.php.net/mailing-lists.php
http://marc.theaimsgroup.com/?l=php-windows
http://news.php.net/group.php?group=php.windows

Hope that helps.

Chris

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

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



[PHP] can I license a php script?

2003-11-14 Thread Chris
I am planning on writing a program in PHP and, hopefully sell it for a few
dollars. Are there any licensing issues I should be concerned about when I
distribute the program. What confuses me is, I'm not distributing PHP only
code that uses PHP, so what am I to license, my intellectual property?

Thanks
Chris

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



RE: [PHP] can I license a php script?

2003-11-14 Thread Dan Joseph
Hi,

Its like any program written in any language.  You are licensing the
product you created with the language, the functionality, the int property,
etc..  Stick a price on it, and sell it.  There are some tools for
protecting your source of the code too.  Check www.zend.com, I don't
remember what it was called.

-Dan Joseph

 -Original Message-
 From: Chris [mailto:[EMAIL PROTECTED]
 Sent: Friday, November 14, 2003 5:28 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] can I license a php script?


 I am planning on writing a program in PHP and, hopefully sell it for a few
 dollars. Are there any licensing issues I should be concerned about when I
 distribute the program. What confuses me is, I'm not distributing PHP only
 code that uses PHP, so what am I to license, my intellectual property?

 Thanks
 Chris

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



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



RE: [PHP] can I license a php script?

2003-11-14 Thread Robert Cummings
On Fri, 2003-11-14 at 16:33, Dan Joseph wrote:
 Hi,
 
   Its like any program written in any language.  You are licensing the
 product you created with the language, the functionality, the int property,
 etc..  Stick a price on it, and sell it.  There are some tools for
 protecting your source of the code too.  Check www.zend.com, I don't
 remember what it was called.

Be careful though, if your code incorporates other peoples code, for
instance Smarty, or PEAR::DB then it may fall under their license. For
instance if your code depends and I believe the key here is depends,
on GPL code, then it falls under the GPL, even if you don't package GPL
code with it. Feel free to correct me if I'm wrong.

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

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



[PHP] Re: get some part of text

2003-11-14 Thread Kim Steinhaug
You could ofcourse to the easyway out splitting, hehe.

example :
$yourstring = 'job_resp errorCode=4194337 description=Originator you';
$temp = explode('errorCode=',$yourstring);
$temp2=explode('',$temp[0]);
echo $temp2[0];

Voila!

Should always work, aslong as there there are always  around the text.

-- 
Kim Steinhaug
---
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
---


Qt [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 dear Sirs,

 I have this string;

 job_resp errorCode=4194337 description=Originator you

 I need to take only errorCode value from this string. I am thinking and
 thinking and can not find how to to. I can split with = but allways
 erroCode place is changing in the string.

 Any idea

 Best Regards

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



Re: [PHP] 0-T- - - - PHP Contest

2003-11-14 Thread David T-G
Ryan --

...and then Ryan A said...
% 
% Hey all,
% Check out Bestwebhosters.com for a free PHP contest.

Just did; didn't see it.  Got a full URL?


TIA  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!



pgp0.pgp
Description: PGP signature


Re: [PHP] can I license a php script?

2003-11-14 Thread Kim Steinhaug
Robert has some interesting thoughts aswell here.

I just wanted to complement the stuff about securing your scripts.

Zend has Zend Encoder, rather expensive - and with windows GUI.
IonCube also has encoder, much more affordable, CommandLine.

www.zend.com
The first encodes and optimizes your code, and your server has
2 have the Zend Optimizer installed on its system for it to run. This
has shown in history to be complicated on some ISP, who never
gets their finger out and can install this. But usually, 4/5 it goes well.

www.ioncube.com / www.ioncube.co.uk
This one compiles and encrypts and optimizes (I think). It requires
a module installed on the server, but - It can also run on most
modern apache systems where it installs on the fly (the decoder).
Ive just purchased the licence for this product myself, and it looks
really promising. Benchmarks on their page also shows that this
software accually beats the Zend Encoder, and the price is far better
to, :)

If you are developing some sort of software, you should always protect it
so that :

1) Your competitors / resellers doesnt fuck you over by selling without
you knowing it, or fix your code to fit their needs without you
getting
credit /payd for it.
2) Your customers doesnt play developers and try jerking your scripts,
which in the long run gives you alot of extra support time as the
scripts
go bugging out.

Happy programming!

-- 
Kim Steinhaug
---
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
---


Dan Joseph [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 Its like any program written in any language.  You are licensing the
 product you created with the language, the functionality, the int
property,
 etc..  Stick a price on it, and sell it.  There are some tools for
 protecting your source of the code too.  Check www.zend.com, I don't
 remember what it was called.

 -Dan Joseph

  -Original Message-
  From: Chris [mailto:[EMAIL PROTECTED]
  Sent: Friday, November 14, 2003 5:28 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] can I license a php script?
 
 
  I am planning on writing a program in PHP and, hopefully sell it for a
few
  dollars. Are there any licensing issues I should be concerned about when
I
  distribute the program. What confuses me is, I'm not distributing PHP
only
  code that uses PHP, so what am I to license, my intellectual property?
 
  Thanks
  Chris
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



[PHP] Executing CRON from a WebForm..

2003-11-14 Thread Andres Villalobos Camacho
Hi!!.
I'm trying to give users the chance to modify its cron from a webform.
The webform let's the users choose the day, month and minutes after
hour, then, using PHP I made one long string and save it into a file
($tmpnam), it looks like this:

$content = $min $hour $day * * /tmp/parse_maillog.sh; //I obtain $min
$hour  $day earlier in my webform
$tmpfname = tempnam (/tmp/mail, $username_crontab.txt);
$handle = fopen($tmpfname, w);
fwrite($handle, $content);
fclose($handle);

system(crontab -u $username $username_crontab.txt);
unlink($tmpfname);
Debugging this part I found that the file is OK, the problem is with the
system function, obviously a user problem, how can I fix it?? any
ideas?? I use phpSecurePages as an authentication system.

Thanx..

-- 
The explanation requiring the fewest assumptions is the most likely to
be correct. -- William of Occam

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



[PHP] Re: get some part of text

2003-11-14 Thread QT
dear Kim,

Thanks for your clever soltion but;

If string will have another errorCode before 'job_resp errorCode=
It will use first one value.

What can we do better than this one?


Kim Steinhaug [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 You could ofcourse to the easyway out splitting, hehe.

 example :
 $yourstring = 'job_resp errorCode=4194337 description=Originator you';
 $temp = explode('errorCode=',$yourstring);
 $temp2=explode('',$temp[0]);
 echo $temp2[0];

 Voila!

 Should always work, aslong as there there are always  around the text.

 --
 Kim Steinhaug
 ---
 There are 10 types of people when it comes to binary numbers:
 those who understand them, and those who don't.
 ---


 Qt [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  dear Sirs,
 
  I have this string;
 
  job_resp errorCode=4194337 description=Originator you
 
  I need to take only errorCode value from this string. I am thinking and
  thinking and can not find how to to. I can split with = but allways
  erroCode place is changing in the string.
 
  Any idea
 
  Best Regards

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



Re: [PHP] Executing CRON from a WebForm..

2003-11-14 Thread Chris Hayes
At 22:52 14-11-2003, you wrote:
Hi!!.
I'm trying to give users the chance to modify its cron from a webform.
The webform let's the users choose the day, month and minutes after
hour, then, using PHP I made one long string and save it into a file
($tmpnam), it looks like this:
$content = $min $hour $day * * /tmp/parse_maillog.sh; //I 
obtain $min
$hour  $day earlier in my webform
$tmpfname = tempnam (/tmp/mail, $username_crontab.txt);
$handle = fopen($tmpfname, w);
fwrite($handle, $content);
fclose($handle);

system(crontab -u $username $username_crontab.txt);
unlink($tmpfname);
Debugging this part I found that the file is OK, the problem is with the
system function, obviously a user problem, how can I fix it?? any
ideas?? I use phpSecurePages as an authentication system.
You forgot to tell what the problem is.

Does the crontab command work when you try to parse it directly?

Wasn't there something in the manual about using `bacticks` instead of 
quotes with the system command?

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


[PHP] Re: get some part of text

2003-11-14 Thread Kim Steinhaug
Well, still no problem.

If there are only one instance of the job_resp errorCode you
just alter the explode() abit.

Else, the clever part with array_push()

Let me do some online coding here, might contain some errors though, :)

$error = new array();
$yourstring = 'job_resp errorCode=4194337 description=Originator you';
$temp = explode('errorCode=',$yourstring);
$count = count($temp);
if($temp1){

for ($i = 0; $i  $count; $i++) { // Loop through the errors / exploded
ones step 1/2
$temp2=explode('',$temp[$i]);
array_push($error,$temp2[0]);// Push all the errors variables into
an array step 2/2
}
for ($i = 0; $i  count($error); $i++) {// Print out all the errors
echo $error[0];
}

} else {
$temp2=explode('',$temp[0]);
echo $temp2[0];
}

- - - -

The above example I use alot, I find pushing things into array beeing
a very handy way of doing things, as its very nice and handles n
occurencies.

-- 
Kim Steinhaug
---
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
---


Qt [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 dear Kim,

 Thanks for your clever soltion but;

 If string will have another errorCode before 'job_resp errorCode=
 It will use first one value.

 What can we do better than this one?


 Kim Steinhaug [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  You could ofcourse to the easyway out splitting, hehe.
 
  example :
  $yourstring = 'job_resp errorCode=4194337 description=Originator
you';
  $temp = explode('errorCode=',$yourstring);
  $temp2=explode('',$temp[0]);
  echo $temp2[0];
 
  Voila!
 
  Should always work, aslong as there there are always  around the text.
 
  --
  Kim Steinhaug
  ---
  There are 10 types of people when it comes to binary numbers:
  those who understand them, and those who don't.
  ---
 
 
  Qt [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
   dear Sirs,
  
   I have this string;
  
   job_resp errorCode=4194337 description=Originator you
  
   I need to take only errorCode value from this string. I am thinking
and
   thinking and can not find how to to. I can split with = but allways
   erroCode place is changing in the string.
  
   Any idea
  
   Best Regards

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



Re: [PHP] Executing CRON from a WebForm..

2003-11-14 Thread Andres Villalobos Camacho
Sorry. The problem is that I cannot get the crontab command executed.
I did try with the backsticks, but it didn't work either.
I have different users, login in to the website using phpSecurePages,
how can I let them change their crontab? Is my approach too wrong??
Any ideas??
Thanx..

On Fri, 2003-11-14 at 16:06, Chris Hayes wrote:
 At 22:52 14-11-2003, you wrote:
 Hi!!.
 I'm trying to give users the chance to modify its cron from a webform.
 The webform let's the users choose the day, month and minutes after
 hour, then, using PHP I made one long string and save it into a file
 ($tmpnam), it looks like this:
 
  $content = $min $hour $day * * /tmp/parse_maillog.sh; //I 
  obtain $min
 $hour  $day earlier in my webform
  $tmpfname = tempnam (/tmp/mail, $username_crontab.txt);
  $handle = fopen($tmpfname, w);
  fwrite($handle, $content);
  fclose($handle);
 
  system(crontab -u $username $username_crontab.txt);
  unlink($tmpfname);
 Debugging this part I found that the file is OK, the problem is with the
 system function, obviously a user problem, how can I fix it?? any
 ideas?? I use phpSecurePages as an authentication system.
 
 You forgot to tell what the problem is.
 
 Does the crontab command work when you try to parse it directly?
 
 Wasn't there something in the manual about using `bacticks` instead of 
 quotes with the system command?
-- 
The explanation requiring the fewest assumptions is the most likely to
be correct. -- William of Occam

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



RE: [PHP] msession - giving me a hard time

2003-11-14 Thread Guillaume Dupuis
Hi John,

I've tried your suggestion and yes, I am transferring the SID variable to
the next page... but I don't know if I am doing the this right.

This is the code I use:
---
?php
session_start();
$SID = session_id();
echo $SID;
?

a href=http://192.0.1.7/use.session.php?SID=?php echo
$SID?LinuxBox2/a
---

This seems to work, since when I open the page on LinuxBox2, ?php
$_GET['SID'];echo $SID ? will return me the same SID, without doing any
session_connect, msession_create, etc (according to the LITTLE documentation
there is, this should be correct... right?).

Where I get confused is that I thought that we needed to do a
session_start() at the beginning of each pages (to get a working session),
and that if you already had a working session session_start() would return
you this ID, unchanged, and if you did not have any started, session_start()
would create you a new one. When I do this on the second page of the example
above, I always get assigned a new SID: am I using msession properly?

Then I started doubting that maybe I had to use msession_connect/create/etc
to get this working (even if the docs said If msession is used as the PHP
session handler, this call should not be made., which is the case of my
php.ini)... but alas, nothing improved, it even got worst: $SID was
inexistent... so the documentaion was right after all.

So to recap:
1- Do I need session_start() at the beginning of each php pages?
2- Do I need msession_connect/create?
3- Am I right to use $SID as a good tracking assumption (if I get the same
SID thru several pages, this means msession works well???)?

Thanks to all in advance, your help is greatly appreciated,
Guillaume

-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 13, 2003 3:16 PM
To: Guillaume Dupuis; [EMAIL PROTECTED]
Subject: Re: [PHP] msession - giving me a hard time


From: Guillaume Dupuis [EMAIL PROTECTED]
 Now, I am testing the interaction of 2+ servers working together. From
 SERVERA I create and echo the my SID using echo session_start(); echo
 session_id();echo $SID;, and then I follow a link (within the same
browser
 session) to SERVERB and then do the exact same 3 calls.

 They give me different $SID ???

When you go from SERVERA to SERVERB, you do not carry over the same session
ID, though. SERVERB, not seeing a session id passed to it, starts it's own
session. You need to pass SID in the URL when linking to the different
servers. No way around this. The session id can be carried in the cookies
once you're operating on the same server, but when going from one server to
another, you must manually pass it.

a href=http://SERVERB??=SID?SERVERB/a

---John Holmes...

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

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



Re: [PHP] Re: get some part of text

2003-11-14 Thread Chris Hayes
Could you please adjust your computer time or the timezone setting? Your 
mail arrives as if it was send tomorrow morning. Quite confusing when 
replies arrive at an earlier time and hard to follow this list.

At 07:24 15-11-2003, you wrote:
I can not understand very well,

shoul I write something like that

$NewError = /errorCode=\([~\]+)\/;
Check the regular expressions part of the manual on www.php.net\preg_match 
or so.
$searchpattern=|errorCode=\([[:digit:]]+)\|;
the result(s) will be somewhere in the resulting array. Check the 
documentation.



Rob Adams [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Try a regular expression.

 /errorCode=\([~\]+)\/

 I'm not good at that kind of syntax, but something very similar to that
 should work.

   -- Rob



 Qt [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  dear Sirs,
 
  I have this string;
 
  job_resp errorCode=4194337 description=Originator you
 
  I need to take only errorCode value from this string. I am thinking and
  thinking and can not find how to to. I can split with = but allways
  erroCode place is changing in the string.
 
  Any idea
 
  Best Regards
--
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] PHP fopen function

2003-11-14 Thread Sushmita Roy
Hi,
I am developing a web application using PHP and I am facing a funny
kind of  problem with the PHP fopen function. I have a webscript,
which has a function in which a file has to be opened in the directory
of the webserver.
The function takes the file path as a parameter.
The fopen function fails, when the parameter is passed into the
fopen function, but when I hardcode the same file name, the fopen
function succeeds. I am sure it is not a permission problem,
because I can open the same file when I hardcode its path.
The php error log file says

PHP Warning:  
fopen(/usr/local/base/data/rawdata/batchdata/testhyb2/Slide1.gpr)

[http://www.php.net/function.fopen]: failed to create stream: No such file
or directory in /usr/local/base/include/classes/wizzzard.inc.php on 
line 566

I would appreciate any suggestions or thoughts.

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


Re: [PHP] msession - giving me a hard time

2003-11-14 Thread CPT John W. Holmes
From: Guillaume Dupuis [EMAIL PROTECTED]
 I've tried your suggestion and yes, I am transferring the SID variable to
 the next page... but I don't know if I am doing the this right.

 This is the code I use:
 ---
 ?php
 session_start();
 $SID = session_id();
 echo $SID;
 ?

 a href=http://192.0.1.7/use.session.php?SID=?php echo
 $SID?LinuxBox2/a
 ---

If you used

session_start($_GET['SID']);

on your pages, this would work. The session ID that PHP is looking for is
named PHPSESSID by default. That's why you should use the SID _constant_

a href=http://192.0.1.7/use.session.php??php echo SID; ?LinuxBox2/a

If PHP doesn't pick up a session id, you'll just end up with a new one
created the next time you call session_start().

 So to recap:
 1- Do I need session_start() at the beginning of each php pages?

Yes, you need it on any page you want to access the session in.

 2- Do I need msession_connect/create?

Dunno about that...

 3- Am I right to use $SID as a good tracking assumption (if I get the same
 SID thru several pages, this means msession works well???)?

If you get the same session id after calling session_start() on your pages,
then yes, it should be working. Using the above method with SID should get
you this.

---John Holmes...

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



Re: [PHP] 0-T- - - - PHP Contest

2003-11-14 Thread Ryan A
Hey David,

Just did; didn't see it.  Got a full URL?

yep, http://www.bestwebhosters.com 
heheheeh

theres a contest link on the top right.. under resources,showcase etc

HTH.

Cheers,
-Ryan

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



RE: [PHP] msession - giving me a hard time

2003-11-14 Thread Guillaume Dupuis
This is now my initial page:

?php
session_start($_GET['SID']);
echo SID;
?

And it returns nothing to me. I must be retarded, your explanation is s
simple!

Thanks again,
Guillaume
-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Friday, November 14, 2003 5:57 PM
To: Guillaume Dupuis; [EMAIL PROTECTED]
Subject: Re: [PHP] msession - giving me a hard time


From: Guillaume Dupuis [EMAIL PROTECTED]
 I've tried your suggestion and yes, I am transferring the SID variable to
 the next page... but I don't know if I am doing the this right.

 This is the code I use:
 ---
 ?php
 session_start();
 $SID = session_id();
 echo $SID;
 ?

 a href=http://192.0.1.7/use.session.php?SID=?php echo
 $SID?LinuxBox2/a
 ---

If you used

session_start($_GET['SID']);

on your pages, this would work. The session ID that PHP is looking for is
named PHPSESSID by default. That's why you should use the SID _constant_

a href=http://192.0.1.7/use.session.php??php echo SID; ?LinuxBox2/a

If PHP doesn't pick up a session id, you'll just end up with a new one
created the next time you call session_start().

 So to recap:
 1- Do I need session_start() at the beginning of each php pages?

Yes, you need it on any page you want to access the session in.

 2- Do I need msession_connect/create?

Dunno about that...

 3- Am I right to use $SID as a good tracking assumption (if I get the same
 SID thru several pages, this means msession works well???)?

If you get the same session id after calling session_start() on your pages,
then yes, it should be working. Using the above method with SID should get
you this.

---John Holmes...

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



RE: [PHP] msession - giving me a hard time

2003-11-14 Thread Guillaume Dupuis

Quote from PHP Manual:
PHP is capable of transforming links transparently. Unless you are using
PHP 4.2 or later, you need to enable it manually when building PHP. Under
UNIX, pass --enable-trans-sid to configure. If this build option and the
run-time option session.use_trans_sid are enabled, relative URIs will be
changed to contain the session id automatically.

I have 4.1.2 installed.

Thanks,
Guillaume

-Original Message-
From: Guillaume Dupuis [mailto:[EMAIL PROTECTED]
Sent: Friday, November 14, 2003 6:20 PM
To: CPT John W. Holmes; [EMAIL PROTECTED]
Subject: RE: [PHP] msession - giving me a hard time


This is now my initial page:

?php
session_start($_GET['SID']);
echo SID;
?

And it returns nothing to me. I must be retarded, your explanation is s
simple!

Thanks again,
Guillaume
-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Friday, November 14, 2003 5:57 PM
To: Guillaume Dupuis; [EMAIL PROTECTED]
Subject: Re: [PHP] msession - giving me a hard time


From: Guillaume Dupuis [EMAIL PROTECTED]
 I've tried your suggestion and yes, I am transferring the SID variable to
 the next page... but I don't know if I am doing the this right.

 This is the code I use:
 ---
 ?php
 session_start();
 $SID = session_id();
 echo $SID;
 ?

 a href=http://192.0.1.7/use.session.php?SID=?php echo
 $SID?LinuxBox2/a
 ---

If you used

session_start($_GET['SID']);

on your pages, this would work. The session ID that PHP is looking for is
named PHPSESSID by default. That's why you should use the SID _constant_

a href=http://192.0.1.7/use.session.php??php echo SID; ?LinuxBox2/a

If PHP doesn't pick up a session id, you'll just end up with a new one
created the next time you call session_start().

 So to recap:
 1- Do I need session_start() at the beginning of each php pages?

Yes, you need it on any page you want to access the session in.

 2- Do I need msession_connect/create?

Dunno about that...

 3- Am I right to use $SID as a good tracking assumption (if I get the same
 SID thru several pages, this means msession works well???)?

If you get the same session id after calling session_start() on your pages,
then yes, it should be working. Using the above method with SID should get
you this.

---John Holmes...

--
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] Having fits with input to array

2003-11-14 Thread Susan Ator
Actually, what I need to do is:

  $var1 = $Array2[1]
  $var2 = $Array2[2]
  etc...

but I just seem to get

  Array

as the output of $var1, $var2, etc...

susan

-Original Message-
From: CPT John W. Holmes
To: Susan Ator; 'Lowell Allen'; PHP
Sent: 11/14/03 4:01 PM
Subject: Re: [PHP] Having fits with input to array

From: Susan Ator [EMAIL PROTECTED]

 Perfect! That did exactly what I needed.

Good...

 Now, *ahem*, I thought I knew how to assign variables to the elements
in
 Array2 but *cough* I'm somewhat befuddled. I've not been able to find
 anything in the online php manual. Could you point me in the right
direction
 for that?

Not sure I'm following you, but

$Array2[] = $somvariable;

will add the value of $somevariable to the next element of $Array2.

Can you explain a little more what you want if that's not it.

---John Holmes...

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



RE: [PHP] msession - giving me a hard time

2003-11-14 Thread Chris Shiflett
--- Guillaume Dupuis [EMAIL PROTECTED] wrote:
 ?php
 session_start($_GET['SID']);
 echo SID;
 ?

I think SID is a constant that will be something like this:

?PHPSESSID=12345

or nothing. It is this way so that you can use it to append to a URL, and
it will not add anything to the URL if there is no session defined. So,
something like this:

http://example.org/? echo SID; ?

I missed the first part of this thread, so my apologies if this answer
misses the mark.

Hope that helps.

Chris

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

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



RE: [PHP] can I license a php script?

2003-11-14 Thread Chris W. Parker
Robert Cummings mailto:[EMAIL PROTECTED]
on Friday, November 14, 2003 1:34 PM said:

 Be careful though, if your code incorporates other peoples code, for
 instance Smarty, or PEAR::DB then it may fall under their license. For
 instance if your code depends and I believe the key here is depends,
 on GPL code, then it falls under the GPL, even if you don't package
 GPL code with it. Feel free to correct me if I'm wrong.

Ok so let's assume this is true (which it sounds like it is). So if you
wanted to make a profit (or break even, whatever the case may be) you
wouldn't necessarily be able to charge for the software itself but you
*could* charge for support and stuff like that right? I guess that's
like what RedHat and other vendors do?

So let's say, the code if free to download, but you could offer (1)
packaged versions with documentation, (2) a support contract, (3) a
setup fee (if the customer doesn't feel they are technically capable of
installing the software), (4) and whatever else you can come up with.


Sound about right?



Chris.
--
Don't like reformatting your Outlook replies? Now there's relief!
http://home.in.tum.de/~jain/software/outlook-quotefix/

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



Re: [PHP] 0-T- - - - PHP Contest

2003-11-14 Thread David T-G
Ryan --

...and then Ryan A said...
% 
% Hey David,

Hi!


% 
% Just did; didn't see it.  Got a full URL?
% 
% yep, http://www.bestwebhosters.com 
% heheheeh

*snort*  That's not good enough.


% 
% theres a contest link on the top right.. under resources,showcase etc

Well, I saw that, and it took me down to the contest section at the
bottom, but all I see is

 Announcements, Contests and News
  
  05-11-03 - Planned start of small advertising campaign on Google,
  Yahoo,
  Alltheweb,Altavista,Ask and other search engines via indexing.
  
  10-11-03 - Planned start of advertising campaign on a host of sites
  and paid advertising on google/yahoo and other popular search engines.
  Contests:
  Monthly/bi-monthly , BestWebHosters.com will conduct a contest,
  contests are open to anybody who has a myList account (and at least 1
  package/plan saved in your myList account, myList accounts are free.)
  Details of the contest/s and the contest rules  regulations can be
  found in your mylist control panel from 31-OCT-03.
  Don't have a mylist account? Click here to open a free mylist account.
  Contest
  sponsors: Offer free packages / domain registeration / software  get
  free advertising on bestwebhosters.com, click here for details.
  
 [EMBED]
  
  
  C o n t a c t   u s  ::  P r i v a c y   p o l i c y  ::  A d v e r t
i s e ::  L e g a l  ::  A d d / E d i t   L i s t i n g s
  ©2003 BestWebHosters.com , NewClea Productions
   All rights reserved.

which says nothing to me about a PHP contest...


% 
% HTH.

Not yet :-)


% 
% Cheers,
% -Ryan


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!



pgp0.pgp
Description: PGP signature


Re: [PHP] 0-T- - - - PHP Contest

2003-11-14 Thread Ryan A
Hey again David,


% Just did; didn't see it.  Got a full URL?
%
% yep, http://www.bestwebhosters.com
% heheheeh

?*snort*  That's not good enough.

Hehe maybe not, but you gotto admit, pretty funny :-)


% theres a contest link on the top right.. under resources,showcase etc

Well, I saw that, and it took me down to the contest section at the
bottom, but all I see is

#
  contests are open to anybody who has a myList account (and at least 1
  package/plan saved in your myList account, myList accounts are free.)
  Details of the contest/s and the contest rules  regulations can be
  found in your mylist control panel from 31-OCT-03.
#

Click on mylist in to top navigation bar, open a mylist account and you
will have all the details in the first screen as you login.
Incase you missed itMylist accounts are free :-)


which says nothing to me about a PHP contest...
Not just PHP actually, nearly any language...login and you will get all the
details you need.




%
% HTH.

Not yet :-)

Now?

Cheers,
-Ryan

P.S Any idea why I always get your mail as an attachment and I have to
double click your attachment to open up in a new screen...same damn thing
happens when i get forwards...i have to open one embedded forward after
another. Am using outlook.




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



[PHP] Re: greek in php-xml

2003-11-14 Thread pnp
I tried that, but still i got weird symbols.
The xml, the xmlparser are set for utf-8 and so are the html pages.

I used the code which is in the chm file ...
Any ideas?


Lucian Cozma [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I've encountered this problem when developing for a greek company.
 Do you create a html output from it ? If you do, make sure that you have
 meta http-equiv=Content-Type content=text/html; CHARSET=utf-8 /
 in the head tag of the html output.

 Lucian

 Pnp [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Hi,
 
   I want to read some texts in greek from an xml file and all i get  is
 weird
  symbols..
   The Xml's encoding is utf-8 and so is the xmlparser that I create.
   Can anyone suggest anything?
 
  Thanx in advance,
  Panagiotis

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



Re: [PHP] can I license a php script?

2003-11-14 Thread Eugene Lee
On Fri, Nov 14, 2003 at 03:54:33PM -0800, Chris W. Parker wrote:
: 
: Robert Cummings mailto:[EMAIL PROTECTED]
: on Friday, November 14, 2003 1:34 PM said:
: 
:  Be careful though, if your code incorporates other peoples code, for
:  instance Smarty, or PEAR::DB then it may fall under their license. For
:  instance if your code depends and I believe the key here is depends,
:  on GPL code, then it falls under the GPL, even if you don't package
:  GPL code with it. Feel free to correct me if I'm wrong.
: 
: Ok so let's assume this is true (which it sounds like it is). So if you
: wanted to make a profit (or break even, whatever the case may be) you
: wouldn't necessarily be able to charge for the software itself but you
: *could* charge for support and stuff like that right? I guess that's
: like what RedHat and other vendors do?

Phase 1: write PHP scripts.

Phase 2:

Phase 3: profit!

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



Re: [PHP] PHP fopen function

2003-11-14 Thread Raditha Dissanayake
Hi,
fopen usually takes two arguments, the filenames is expected to be a
string and check your register_globals settings.
Sushmita Roy wrote:

Hi,
I am developing a web application using PHP and I am facing a funny
kind of  problem with the PHP fopen function. I have a webscript,
which has a function in which a file has to be opened in the directory
of the webserver.
The function takes the file path as a parameter.
The fopen function fails, when the parameter is passed into the
fopen function, but when I hardcode the same file name, the fopen
function succeeds. I am sure it is not a permission problem,
because I can open the same file when I hardcode its path.
The php error log file says

PHP Warning:  
fopen(/usr/local/base/data/rawdata/batchdata/testhyb2/Slide1.gpr)

[http://www.php.net/function.fopen]: failed to create stream: No such 
file
or directory in /usr/local/base/include/classes/wizzzard.inc.php on 
line 566

I would appreciate any suggestions or thoughts.

Thank you,
Sushmita


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] can I license a php script?

2003-11-14 Thread Raditha Dissanayake
Hi

Kim, You do raise a lot of valid points about protecting your software.
However we must also keep in mind that over protection makes a software
very difficult to use. Unless we balance the two there will not be any
sales.
Kim Steinhaug wrote:

Robert has some interesting thoughts aswell here.

I just wanted to complement the stuff about securing your scripts.

Zend has Zend Encoder, rather expensive - and with windows GUI.
IonCube also has encoder, much more affordable, CommandLine.
www.zend.com
The first encodes and optimizes your code, and your server has
2 have the Zend Optimizer installed on its system for it to run. This
has shown in history to be complicated on some ISP, who never
gets their finger out and can install this. But usually, 4/5 it goes well.
www.ioncube.com / www.ioncube.co.uk
This one compiles and encrypts and optimizes (I think). It requires
a module installed on the server, but - It can also run on most
modern apache systems where it installs on the fly (the decoder).
Ive just purchased the licence for this product myself, and it looks
really promising. Benchmarks on their page also shows that this
software accually beats the Zend Encoder, and the price is far better
to, :)
If you are developing some sort of software, you should always protect it
so that :
1) Your competitors / resellers doesnt fuck you over by selling without
   you knowing it, or fix your code to fit their needs without you
getting
   credit /payd for it.
2) Your customers doesnt play developers and try jerking your scripts,
   which in the long run gives you alot of extra support time as the
scripts
   go bugging out.
Happy programming!

 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Executing CRON from a WebForm..

2003-11-14 Thread Raditha Dissanayake
Hi,
reply without trying your code:
You might need suexec to achieve this, else i don't belive one user can
set the cron jobs for another user. Remember apache is usually running 
as a non privileged user.

Andres Villalobos Camacho wrote:

Sorry. The problem is that I cannot get the crontab command executed.
I did try with the backsticks, but it didn't work either.
I have different users, login in to the website using phpSecurePages,
how can I let them change their crontab? Is my approach too wrong??
Any ideas??
Thanx..
On Fri, 2003-11-14 at 16:06, Chris Hayes wrote:
 

At 22:52 14-11-2003, you wrote:
   

Hi!!.
I'm trying to give users the chance to modify its cron from a webform.
The webform let's the users choose the day, month and minutes after
hour, then, using PHP I made one long string and save it into a file
($tmpnam), it looks like this:
   $content = $min $hour $day * * /tmp/parse_maillog.sh; //I 
obtain $min
$hour  $day earlier in my webform
   $tmpfname = tempnam (/tmp/mail, $username_crontab.txt);
   $handle = fopen($tmpfname, w);
   fwrite($handle, $content);
   fclose($handle);

   system(crontab -u $username $username_crontab.txt);
   unlink($tmpfname);
Debugging this part I found that the file is OK, the problem is with the
system function, obviously a user problem, how can I fix it?? any
ideas?? I use phpSecurePages as an authentication system.
 

You forgot to tell what the problem is.

Does the crontab command work when you try to parse it directly?

Wasn't there something in the manual about using `bacticks` instead of 
quotes with the system command?
   



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP fopen function

2003-11-14 Thread Sushmita Roy
Yes, I am calling the fopen with two parameters.
The filename is also a string. The problem is when
I pass a string variable the fopen fails but succeeds
when I pass a constant string.
Raditha Dissanayake wrote:

Hi,
fopen usually takes two arguments, the filenames is expected to be a
string and check your register_globals settings.
Sushmita Roy wrote:

Hi,
I am developing a web application using PHP and I am facing a funny
kind of  problem with the PHP fopen function. I have a webscript,
which has a function in which a file has to be opened in the directory
of the webserver.
The function takes the file path as a parameter.
The fopen function fails, when the parameter is passed into the
fopen function, but when I hardcode the same file name, the fopen
function succeeds. I am sure it is not a permission problem,
because I can open the same file when I hardcode its path.
The php error log file says

PHP Warning:  
fopen(/usr/local/base/data/rawdata/batchdata/testhyb2/Slide1.gpr)

[http://www.php.net/function.fopen]: failed to create stream: No such 
file
or directory in /usr/local/base/include/classes/wizzzard.inc.php on 
line 566

I would appreciate any suggestions or thoughts.

Thank you,
Sushmita


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


RE: [PHP] can I license a php script?

2003-11-14 Thread Robert Cummings
On Fri, 2003-11-14 at 18:54, Chris W. Parker wrote:
 Robert Cummings mailto:[EMAIL PROTECTED]
 on Friday, November 14, 2003 1:34 PM said:
 
  Be careful though, if your code incorporates other peoples code, for
  instance Smarty, or PEAR::DB then it may fall under their license. For
  instance if your code depends and I believe the key here is depends,
  on GPL code, then it falls under the GPL, even if you don't package
  GPL code with it. Feel free to correct me if I'm wrong.
 
 Ok so let's assume this is true (which it sounds like it is). So if you
 wanted to make a profit (or break even, whatever the case may be) you
 wouldn't necessarily be able to charge for the software itself but you
 *could* charge for support and stuff like that right? I guess that's
 like what RedHat and other vendors do?
 
 So let's say, the code if free to download, but you could offer (1)
 packaged versions with documentation, (2) a support contract, (3) a
 setup fee (if the customer doesn't feel they are technically capable of
 installing the software), (4) and whatever else you can come up with.
 
 Sound about right?

Definitely the support contract portion works, and as you said is how
many open source companies are making their money. Also setup costs and
configuration all fall under service for which you can usually charge.
The packaging with documentation may run into issues since many licenses
have specific clauses with respect to charging for packaged versions,
often only allowing one to regain the costs of packaging itself.

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

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



Re: [PHP] msession - giving me a hard time

2003-11-14 Thread John W. Holmes
Guillaume Dupuis wrote:

This is now my initial page:

?php
session_start($_GET['SID']);
echo SID;
?
And it returns nothing to me. 
Heh... okay, let's start over.

From Server1:

If you create a link like this:

a href=server2/page.php??php echo SID; ?Server 2/a

Do you see the session ID appended to that URL? If you do, then a simple 
session_start() on the server2/page.php will be enough to continue the 
session.

Now, if you don't see any session ID appended to the URL, that means SID 
is empty and you're more than likely depending upon cookies. So, you 
need to retrieve the session id and append it to the URL yourself.

?php
$sessname = session_name();
$sessid = session_id();
echo a href=\server2/page.php?$sessname=$sessid\Server 2/a;
?
Now, you should see a link that has something like PHPSESSID=X.

Again, a simple session_start() on the next page will continue the session.

So, to recap:

1. Both servers only use session_start().

2. When linking between servers, you must pass the session ID in the URL 
using one of the above methods

3. When staying on the same server, it appears the session ID is being 
passed around in a cookie, so you don't need to do anything to those links.

Hope this helps some more... :)

--
---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


Re: [PHP] PHP fopen function

2003-11-14 Thread Raditha Dissanayake
Hi,
what's your register global settings? If this is off (which is the most 
likely) the parameters that you pass across may not be intepreted correctly.
Are you by any chance on any of these virtual hosting schemes like 
cpanle or ensim? their handling of file paths are rather wierd and that 
too could be effecting your script.

Sushmita Roy wrote:

Yes, I am calling the fopen with two parameters.
The filename is also a string. The problem is when
I pass a string variable the fopen fails but succeeds
when I pass a constant string.
Raditha Dissanayake wrote:

Hi,
fopen usually takes two arguments, the filenames is expected to be a
string and check your register_globals settings.
Sushmita Roy wrote:

Hi,
I am developing a web application using PHP and I am facing a funny
kind of  problem with the PHP fopen function. I have a webscript,
which has a function in which a file has to be opened in the directory
of the webserver.
The function takes the file path as a parameter.
The fopen function fails, when the parameter is passed into the
fopen function, but when I hardcode the same file name, the fopen
function succeeds. I am sure it is not a permission problem,
because I can open the same file when I hardcode its path.
The php error log file says 

--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Mulitpart form posts and mysql blobs

2003-11-14 Thread Raditha Dissanayake
Hi,

Haven't really done much work with blobs ( i always prefer to save just 
the file name in the databse) obviously this is a scenario where that 
approach is advantages. multipart/form-data isn't a very complex 
encoding scheme. Essentially what it does is combine all the files and 
other form fields together into a singe multipart message. Each file or 
data item has it's own headers.  I recommend that you take a quick look 
at RFC 1867  and RFC 2616

If your server has perl you can very easily create a form handler that 
reads in from STDIN and writes to a file to see first hand what the 
multipart/form-data looks like. If you want i can give you such a script.

John Ryan wrote:

How are files encoded when theyre sent in mulitpart forms??? Is it the same
as blob fields in mySQL databased when you use the LOAD_FILE() command??
If not, is it easy to convert from one to the other?? At the moment, Im
taking the blob from mySQL and writing it to a file and then uploading that
file through cURL! Very messy.
TIA

 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP fopen function

2003-11-14 Thread Sushmita Roy
I just set the register_global to On. But that does not seem to make a 
difference.
I know the parameters are being passed correctly because I am printing
an error message when the file cannot be opened with the filename
which is passed a parameter, and that is exactly what I had passed.

Raditha Dissanayake wrote:

Hi,
what's your register global settings? If this is off (which is the 
most likely) the parameters that you pass across may not be intepreted 
correctly.
Are you by any chance on any of these virtual hosting schemes like 
cpanle or ensim? their handling of file paths are rather wierd and 
that too could be effecting your script.

Sushmita Roy wrote:

Yes, I am calling the fopen with two parameters.
The filename is also a string. The problem is when
I pass a string variable the fopen fails but succeeds
when I pass a constant string.
Raditha Dissanayake wrote:

Hi,
fopen usually takes two arguments, the filenames is expected to be a
string and check your register_globals settings.
Sushmita Roy wrote:

Hi,
I am developing a web application using PHP and I am facing a funny
kind of  problem with the PHP fopen function. I have a webscript,
which has a function in which a file has to be opened in the directory
of the webserver.
The function takes the file path as a parameter.
The fopen function fails, when the parameter is passed into the
fopen function, but when I hardcode the same file name, the fopen
function succeeds. I am sure it is not a permission problem,
because I can open the same file when I hardcode its path.
The php error log file says 



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


Re: [PHP] Re: [PHP-DB] Re: [PHP] Mulitpart form posts and mysql blobs

2003-11-14 Thread Raditha Dissanayake
Hi John,
Your new information does make my previous post redundant :-)
However I disagree when you say.
cURL can send files when given the filename, so I have to write the 
filename from the database and then give cURL the path.

But thats messy

IMHO this is a lot less messier than the current approach . You have to also keep in mind that using blobs puts just a wee bit more load on the database server. 

Getting back to the problem at hand how about invoking one of the curl binaries and piping output from your blob into it?

best regards



John Ryan wrote:

Sorry, I should have said. Im trying to send this file to an external
multipart form script which converts the file to the desired format. Im
using cURL to do this. cURL can send files when given the filename, so I
have to write the filename from the database and then give cURL the path.
But thats messy
I want to be able to get the BINARY data from mySQL and send it via cURL
directly.
 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


  1   2   >