Re: [PHP] Re: MySQL - PHP combined log

2002-07-24 Thread PHPCoder

Well, I think the solutions or ideas are maybe a bit too involved.
I was hoping that the errors I am interested in were already logged by 
default to some obscure location, and I *could* if needed just go and 
scrutinize them by hand.
But, it seems like a detailed (specially mysql) error log does not exist 
and thus cannot be scrutinized.
Reading some of the possible solutions regarding adding error_log() 
functions to existing code leads me to believe that it could be easier 
to maybe incorporate those functions into PHP by means of a switch in 
php.ini, one could theoretically have two sets of functions, a 
mysql_query() for normal use that acts as we all know it, and another 
mysql_query() (yes, with the same name), that has the error_log() 
function call built into it, and the one that gets used is determined by 
the (lets call it) mysql_error_log = on in php.ini.
This way, the entire thing will be transparent to both users and 
existing/future code.
Granted, I have no idea how PHP is coded behind the scenes and if 
something like this is even possible, it's simply an idea, and hopefully 
some of the more learned people on this list will be able to comment on 
the feasability of something like that.


Dave wrote:

clipped

how about this curve...  getting PHP to append a line to the apache log.

How about reading the documentation?

Deserved that for not being clear enough... see below.

My apologies if I missed the word access log or even assumed you meant
error log when you just said log.I shouldn't have.


RTFM never hurt anyone :)

You're right, you can't do that, without opening up security more than you
want to.

*ACTUALLY*...

There *probably* is an Apache function for access logs just like the error
logging one that PHP is using, and you could *PROBABLY* patch PHP with some
dead-easy copypaste to use it, and you could even submit that worthy patch
to the PHP Group.  I suspect it's not there only because nobody really saw a
need for it.


I've never had a use for it untill now, wanting to charge a customer for massive
uploads via file_upload forms...  transfer that is not recorded in the apache
logs and therefor not collected for billable bandwidth (while still preserving
IP addresses and avoiding a ipfw counting per IP).  Probably a requirement with
limited scope.

It's kinda icky that you'd almost have to use 4 (the next unused number) for
Apache access log with 0 being Apache error log and 1,2,3 being other
stuff between...  Maybe -1 for access log?  Ew.  That's not 'right'
either, but maybe it's 'less wrong' than 4.


icky, I agree

Damn things shouldn't have been magic numbers in the first place.  Should be
constants.  Hey, while you're in there, make up some decent constant names
and let's migrate to them and then deprecate the magic numbers and fix it
right :-)


:)

Another option might involve some sort of nasty named pipe stuff and
redirection and whatnot, and you *MIGHT* be able to have a file that you
error_log into, but it really just ends up going into the Apache log...
There may be some risk of corrupting your access log, however, if any
incredibly *HUGE* entry over-steps the atomicity threshold for file
appending in Linux...


sounds like a nest of potential problems

Not so sure it's a Good Idea anyway to have two programs trying to write to
the same file at once if it can be avoided.


thus the interim solution of having PHP write to a seperate log file, then doing
a merge/sort during rotation time.

Will look into it to see if something can be presented without creating more
problems than the solution is worth.

Cheers,

Dave





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




[PHP] When to destroy sessions that iterate

2002-07-24 Thread PHPCoder

Prolly a silly question, but I have a session process that never really 
ends as it is supposed to allow the user to carry on submitting etc.

So I don't know where and when to end the session, and if it is really 
nescessary to end a session?

Obviously a logout button will do the trick, but what about aborting 
users that don't bother to logout? I presume a session will have a 
timeout value? If so, how does this work? Surely there can't be a 
physical time allowed for a session to stay alive? What about if I want 
to have an intranet application that could ( and preferably should) be 
able to be open indefinately?

Ta




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




Re: [PHP] Help with msql_fetch_array()

2002-07-24 Thread PHPCoder

I can almost guarantee that it's not the second line that is failing, 
the problem here is that $result is not containing naything, and that is 
normally due to the fact that you are not connecting to the db, or the 
table tablename is not there.

I use the following format as my standard MySQL connect and query snippet:

$link = mysql_connect(localhost,$username,$password) or die ('Could 
not connect!'); // suppresses the default error message generated by 
this function and the or die() bit kills the script right then and 
there should it not be able to connect.
mysql_select_db(YOUR_DB_NAME,$link);
$sql = select * from your_table_name;
if ( $result = mysql_query($sql)) {  // checks to see if $result 
contains anything before it even tries to fetch an associative array 
from it.
 $row = mysql_fetch_assoc($result);
} else {
echo Empty result set!;

Note also that I use mysql_fetch_assoc and NOT mysql_fecth_array, as 9 
out of 10 times, you don't need the array element id's that is returned 
by mysql_fetch_array.

Matthew Bielecki wrote:

I have a couple of scripts that fail with the error of:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result 
resource in...

I'm new to both SQL and PHP and I'm wondering if I have some setting 
turned off or what.

Here's the piece of code that is failing (the second line fails):

$result = mysql_db_query($dbname, SELECT * FROM tablename ORDER BY id);
$row = mysql_fetch_array($result);


Thanks for your help in advance!!




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




Re: [PHP] Help with msql_fetch_array()

2002-07-24 Thread PHPCoder

Yes, what on earth was I thinking!
should be:
...
$result = mysql_query($sql);
if (mysql_num_rows($result)) {
 $row = mysql_fetch_assoc($result);
 } else {
 echo whatever;
 }
...


Kevin Stone wrote:

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

if ( $result = mysql_query($sql)) 

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

-Kevin

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


I can almost guarantee that it's not the second line that is failing,
the problem here is that $result is not containing naything, and that is
normally due to the fact that you are not connecting to the db, or the
table tablename is not there.

I use the following format as my standard MySQL connect and query

snippet:

$link = @mysql_connect(localhost,$username,$password) or die ('Could
not connect!'); //@ suppresses the default error message generated by
this function and the or die() bit kills the script right then and
there should it not be able to connect.
mysql_select_db(YOUR_DB_NAME,$link);
$sql = select * from your_table_name;
if ( $result = mysql_query($sql)) {  // checks to see if $result
contains anything before it even tries to fetch an associative array
from it.
 $row = mysql_fetch_assoc($result);
} else {
echo Empty result set!;

Note also that I use mysql_fetch_assoc and NOT mysql_fecth_array, as 9
out of 10 times, you don't need the array element id's that is returned
by mysql_fetch_array.

Matthew Bielecki wrote:

I have a couple of scripts that fail with the error of:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL

result

resource in...

I'm new to both SQL and PHP and I'm wondering if I have some setting
turned off or what.

Here's the piece of code that is failing (the second line fails):

$result = mysql_db_query($dbname, SELECT * FROM tablename ORDER BY id);
   $row = mysql_fetch_array($result);


Thanks for your help in advance!!



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






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




Re: [PHP] Re: MySQL - PHP combined log

2002-07-23 Thread PHPCoder

Thanks, but all these methods require modification of the scripts 
already on the server, and it won't ensure any new script being written 
by a user on my system to comply.
Are you all saying that there are no logs kept by default of errors 
generated on php/mysql pages at all unless specifically coded? Wouldn't 
it be possible then in future PHP releases to have a set_error_logging 
directive in the php.ini file that will automatically run a wrapper 
function on all mysql_query() functions to do this kind of thing?

How are people out there managing the scripts/script errors caused  by 
users on their systems? Or is it a case of handling the crisis when it 
happens?
You see, as administrator, I need to be able to quickly see who are 
coding in such a way as to leave security holes, or even worse, cause 
the server to crash due to poor coding. There are almost 1000 individual 
php files on my server, and it wouldn't be possible for me to scrutinize 
all of them to make sure they are OK.
Are there any admins out there that have policies about scripting 
practices on their systems; ie, checking a script from a user before it 
is allowed to be uploaded etc?

Thanks
 

Richard Lynch wrote:

Hi, tried this on mysql list, no luck:

I want to be able to view a single log that contains the following:

IP of user : page_name (PHP only): time/date: MySQL query ( 'select * 

from xxx' etc.) : error msg from mysql/php if any

So it's almost a hybrid between apache and mysql with some extra's

I'm sure you all should see the benifit of this in troubleshooting and 
specially keeping track of who does what when it comes to PHP coding on 
ones server, specially with crappy code that kills the server.

Is something like this possible, already there?

PS, Running RedHat 7.0 with PHP4 and mysql 3.23.x


http://php.net/error_log

if you can get everybody to use your own function to query the database.

Or, you could use http://php.net/set_error_handler and
http://php.net/trigger_error and catch all errors thrown by all PHP code.

Actually, to get the PHP page name and line number, set_error_handler is
probably your best bet.




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




[PHP] Sessions without cookies : forms

2002-07-22 Thread PHPCoder

Hi, thanks for all the replies on my two previous postings relating to 
sessions and cookies.
I have set my mind on using sessions but without cookies, so that 
entails passing the SID via relative URL's.
My problem comes in here, when I create a simple login page with a form 
that send username and password to the next page, I start_session(); and 
then in the form action, I append the url with ?=SID? , but that 
causes two parse errors.

Warning: Cannot send session cookie - headers already sent by (output 
started at /home/www/index.php:3) in /home/www/index.php on line 4
 
Warning: Cannot send session cache limiter - headers already sent 
(output started at /home/www/index.php:3) in /home/www/index.php on line 4
 
The code is like so:
html
head
?php
session_start();
?
   
/head
body
form name=form1 method=post action=admin_select_project.php??=SID?
  table border=0 cellspacing=0 cellpadding=0
tr bgcolor=#CFCFCF
  td colspan=2Admin Login
  /td
/tr
tr
  tdUsername:
  /td
  tdinput type=text name=username
  /td
/tr
tr
  tdPassword:
  /td
  tdinput type=text name=password
  /td
/tr
tr
  td
input type=submit name=Submit4 value=Submit
  /td
/tr
  /table
/form
/body
/html
What am I missing...

Thanks



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




[PHP] Sessions: watertight?

2002-07-18 Thread PHPCoder

Hi
I'm doing some reading on sessions and how it works etc, and have a 
concern (which is probably fed by my ignorance on the topic).
The couple of simple session examples I have found in the PHP/MySQL 
book by Luke Welling  Laura Thompson gives a simple 3 page session 
example where the session is started on the first page, a variable is 
registered as a session var and then has a link to the next page where 
the session_start() is called and the session_var is echoed to 
illustrate the workings of a session.
My understanding is that PHP will either use cookies to store the 
session ID on the client's pc, or send it via URL, so, assuming that 
cookies is a no-go, can I now assume that PHP will attach it's session 
ID to each and every URL located on my .php page?
The reason I'm asking is as follow:
I did the little excersise, and then deliberately rejected my browsers 
call to process the cookie, and then the script didn't return the 
variable as it did previously...
And now, assuming that I can assume that PHP will attach the SID to all 
URL's , how does it know to which URL's to attach, or am I supposed to 
manually attach them, leaving me with another question, If I have to 
manually code the SID into the URL, then the whole session coockies if 
possible approach doesn't seem to work???

Can someone explain it in more detail for me plz?
Thanks



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




Re: [PHP] Sessions: watertight?

2002-07-18 Thread PHPCoder

Thanks
OK, I have checked my phpinfo(); and the  *session.use_trans_sid* = 1 ; 
*session.use_cookies =* On, so I'm not sure if I need to turn the 
cookies bit off, but I would think it not to be necessary. ; So, I can't 
see why the URL's aren't changed on my pages...
Now, something to contemplate so long; say I DO get the URL bit right, 
what method does PHP use to determine which URL's to append? Would this 
method have a considerable overhead on performance? ( given that there 
could be alot of session usage on my domains). I'm rather interested in 
the workings of this URL detection, as it basically means that PHP 
runs forward through all my pages to see where the session stops and and 
it's difficult for me to see how PHP can tell which pages have to do 
with which sessions. Arguably one can have two session threads that 
has some overlapping files, and my mind boggles as to how php can track 
the session vars, secially if the one session thread were to use the 
same session variable names ( which is surely possible right?)
I guess my question is very academic, but I'm trying to understand the 
workings of  sessions..
But for now, my main concern is getting PHP to work it's magic with my 
URL's.

Thanks



[EMAIL PROTECTED] wrote:

Taken straigh from the manual:
(http://www.php.net/manual/en/ref.session.php)

[quote]
There are two methods to propagate a session id: 

- Cookies 

- URL parameter 

The session module supports both methods. Cookies are optimal, but since
they are not reliable (clients are not bound to accept them), we cannot rely
on them. The second method embeds the session id directly into URLs. 

PHP is capable of doing this transparently when compiled with
--enable-trans-sid. If you enable this option, relative URIs will be changed
to contain the session id automatically. Alternatively, you can use the
constant SID which is defined, if the client did not send the appropriate
cookie. SID is either of the form session_name=session_id or is an empty
string. 
[/quote]

Regards
Joakim Andersson


-Original Message-
From: PHPCoder [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 18, 2002 11:17 AM
To: php-general
Subject: [PHP] Sessions: watertight?


Hi
I'm doing some reading on sessions and how it works etc, and have a 
concern (which is probably fed by my ignorance on the topic).
The couple of simple session examples I have found in the PHP/MySQL 
book by Luke Welling  Laura Thompson gives a simple 3 page session 
example where the session is started on the first page, a variable is 
registered as a session var and then has a link to the next 
page where 
the session_start() is called and the session_var is echoed to 
illustrate the workings of a session.
My understanding is that PHP will either use cookies to store the 
session ID on the client's pc, or send it via URL, so, assuming that 
cookies is a no-go, can I now assume that PHP will attach 
it's session 
ID to each and every URL located on my .php page?
The reason I'm asking is as follow:
I did the little excersise, and then deliberately rejected my 
browsers 
call to process the cookie, and then the script didn't return the 
variable as it did previously...
And now, assuming that I can assume that PHP will attach the 
SID to all 
URL's , how does it know to which URL's to attach, or am I 
supposed to 
manually attach them, leaving me with another question, If I have to 
manually code the SID into the URL, then the whole session 
coockies if 
possible approach doesn't seem to work???

Can someone explain it in more detail for me plz?
Thanks



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





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




[PHP] Cookies - good or bad???

2002-07-18 Thread PHPCoder

I'm really battling with this whole session thing.
My first impressions are that cookies are OK, and really helps to make 
sessions workable and efficient, YET, from a developers point of view, I 
always play devils advocate, and I'm wondering about those stubbourne 
individuals out there who outright refuse cookies; rendering my 
application useless unless I code a plan B into my code; meaning I can 
just as well NOT use cookies from the start...
catch 22 dejavu...
What are the general feeling out there amongst developers about the use 
of cookies?
I'm concerned about the following scenario specifically:
I develop my great application using session controll - which uses 
cookies by default, or alternatively adds the sid to the relative URL's 
on the page, YET, from responses to my previous posting, I gather that 
the alternative url method is not 100% the same as the cookie method 
inthat it doesn't work with IFRAMES etc. Leaving me to think that there 
will potentially be people out there that will NOT be able to use the 
application, that could lead to messy discussions between developer and 
client...

Before I started to read up on sessions, I simply used my own form of 
session management by sending all relevant variables either via URL or 
via form fields to the subsequent pages. Obviously this method leaves a 
bunch of holes as well, but I KNOW that my application is always pure 
and simple HTML, doesn't have browser issues, doesn't have cookie 
issues, so 100% of the internet community can use it.

Does anyone out there have a view/practise when it comes to 
session/cookies? - basically I am still not convinced that using 
sessions/cookies is a good idea, but I would love to be educated as to 
why I should...




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




Re: [PHP] Inclusion error contd..

2002-07-16 Thread PHPCoder


Check execute permissions on the PHP file, try chmod 755.


Sachin Keshavan wrote:

Hello all,

Thanks for the suggestions. But my .php file does not have any include
statement any where in the page. Is there any thing which I have to check
out? The site contains 6 .php files, and it is only in this file the error
comes.

I have tested this in my local build (Apache server), and the same file
executes perfectly. The error comes in the production server, in which PHP
is configured by a third party (i.e server admin).

Thanks once again,
Sachin.





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




Re: [PHP] textarea new line

2002-07-05 Thread PHPCoder

Sorry, you DO need nl's, but it's \n not n\


PHPCoder wrote:

 When you echo, you are adding to HTML, so you need br for new lines 
 not \n. There is a function called nl2br that converts the nl into 
 br's for you, so do this;

 $string=-line1n\ -line2 n\-line3;

 $string = nl2br($string);

 echo brtextarea name='aria' cols='50' rows='2'$string/textarea;




 adi wrote:

 i want to add in textarea a string with new line tag in it. how to do 
 that?

 my try:
 $string=-line1n\ -line2 n\-line3;
 echo brtextarea name='aria' cols='50' rows='2'$string/textarea;

 but i see a single line instead of:
 -line1
 -line2
 -line3

 tx in advance for any help







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




Re: [PHP] textarea new line

2002-07-05 Thread PHPCoder

When you echo, you are adding to HTML, so you need br for new lines 
not \n. There is a function called nl2br that converts the nl into br's 
for you, so do this;

$string=-line1n\ -line2 n\-line3;

$string = nl2br($string);

echo brtextarea name='aria' cols='50' rows='2'$string/textarea;




adi wrote:

i want to add in textarea a string with new line tag in it. how to do that?

my try:
$string=-line1n\ -line2 n\-line3;
echo brtextarea name='aria' cols='50' rows='2'$string/textarea;

but i see a single line instead of:
-line1
-line2
-line3

tx in advance for any help




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




[PHP] Solution to register_globals=off existing code???

2002-07-03 Thread PHPCoder

Hi
Already posted a question asking what to do with existing code that uses 
register_globals=on and migrating to a new PHP with 
register_globals=off; solution seemed to be have to re-code;
I came up with this code, and am basically asking the more enlightened 
if this might be a solution, ie, plug this code in at the top of all 
form action pages written with the old style... It's crude, so be nice.


if (isset($HTTP_POST_VARS)) {
$type = $HTTP_POST_VARS;
} elseif  (isset($HTTP_GET_VARS)) {
$type = $HTTP_GET_VARS;
}
foreach ($type as $key = $val) {
$string  = \$$key = \$val\;;
eval($string);
 }


If this will help, can it be written into a function? Is there a more 
elegant way of doing the same?Will this actually work?

Ta
Petre





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




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

2002-07-03 Thread PHPCoder

DOH!
Now you tell me!!! :-[
Hah, thanks man, should have known that there is always a simple 
solution in PHP, just need to know where to look for it...



Kevin Stone wrote:

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

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


Hi
Already posted a question asking what to do with existing code that uses 
register_globals=on and migrating to a new PHP with 
register_globals=off; solution seemed to be have to re-code;
I came up with this code, and am basically asking the more enlightened 
if this might be a solution, ie, plug this code in at the top of all 
form action pages written with the old style... It's crude, so be nice.


if (isset($HTTP_POST_VARS)) {
$type = $HTTP_POST_VARS;
} elseif  (isset($HTTP_GET_VARS)) {
$type = $HTTP_GET_VARS;
}
foreach ($type as $key = $val) {
$string  = \$$key = \$val\;;
eval($string);
 }


If this will help, can it be written into a function? Is there a more 
elegant way of doing the same?Will this actually work?

Ta
Petre





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






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




[PHP] Register Globals = off

2002-06-30 Thread PHPCoder

Hi
Going through some literature, it seems like the use of registered 
globals can cause security issues. Now, the dilemma, all my previous PHP 
installations ( for the last year or so ) have come with register 
globals = on in the php.ini file by default, and users on my system has 
happily coded their websites using this function.
Now , with  all the new versions of PHP, the registered globals are 
turned off in the ini and will basically cause all those previous sites 
not to function. Which means that I'm between a rock and a hard place, 
turn the register globals back on and carry on with the security risks, 
or keep it off and have all those people re-code their sites...
Is there a more gentle solution out there? Am I just misunderstanding 
the issue?
Any light on the matter will be appreciated.

Thanks



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




[PHP] Adding GD libraries after compile

2002-06-28 Thread PHPCoder

Hi
I have a working PHP build on my webserver, but it seems it was compiled 
without support for gd or pdflib and a couple of others.
Since rebuilding PHP requires a rebuild of apache as well, I really 
don't want to go that route unless 100% essential.
So, is there a way I can add these libs now without recompiling?
If not, what is the safest and easiest way for me to get apache php and 
mysql running again without major upsets.
Ta



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




Re: [PHP] Re: Generating Barcodes and printing

2002-06-28 Thread PHPCoder

Thanks, this one seems to be the easiest. Shouldn't be too difficult for 
me to modify so the barcode gets displayed alone on a new page so the 
person can just hit the print button on his browser...


Anil Kumar K. wrote:

Also: http://www.mribti.com/barcode/


On Thu, 27 Jun 2002, Peter wrote:

Read the stuff you find on google first though - there was an article I read
about certain inks absorbing InfraRed light so barcodes printed in them will
not work!
The HP ink used in the Deskjet 693 and 660 seems to be ok for this job.


Phpcoder [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

Hi,
I would like to generate barcodes and have it print out the barcode
automatically from awebpage, is this possible? How?
Thanks







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




[PHP] Generating Barcodes and printing

2002-06-27 Thread PHPCoder

Hi,
I would like to generate barcodes and have it print out the barcode 
automatically from awebpage, is this possible? How?
Thanks


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




Re: [PHP] function echo ' '

2002-06-25 Thread PHPCoder

Yes, just use  instead of '.
Using ' causes the contents to be treated as literal strings, and the $ 
is therefore not treated as a $.
Just do:

echo a href=\$address\;



Martin Johansson wrote:

Is there a way to express php variables inside an echo ' '.

I want something like this to work:

echo 'a href=$address';

I know I can write it like this:
echo 'a href=';
echo $address;
echo '';

But Its to hard to read the code like this.
/Martin






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




[PHP] Tracking file downloads

2002-06-18 Thread PHPCoder

Hi
I would like to know any ideas on tackling the following:

I would like to have people give me their details via a form and then 
allow them to download files from the server, and I would also like to 
keep track/record of the files that are downloaded. The record doesn't 
need to be kept, just e-mailed to the admin as soon as it is done and 
the user exits the site.
I guess this would be the perfect example for using sessions? 
Unfortunately I am not too hot on sessions, so any advise/help will be 
appreciated.

Thanks



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




[PHP] Sessions : see also Tracking file downloads

2002-06-18 Thread PHPCoder

HI
While waiting for responses on my first question, I've done some reading 
on sessions, and came up with the following questions:
First, I have been coding with PHP for a while without knowing about 
sessions, and have completed a couple of rather large projects without 
using sessions as such, yet, much of what I have read on sessions, I 
have done manually already by creating my own unique id's and 
passing them on via url to the subsequent pages.
So, here is my question.
Is sessions basically just that, made easier , or are there 
fundamental differences/advantages. I know (now after reading a bit) 
about the use of cookies etc if availale when using sessions, and that 
you cannot overwrite a session variable by passing it via url, but are 
those the only differences? So, basically, do you really HAVE to use 
sessions, or is it like most other things in life; there are more than 
one way to skin a cat. Are there set rules or guidelines to when one 
would definately absolutely have to use sessions?

Thanks
Hope I make sense...
 



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




Re: [PHP] help me please! :)

2002-06-10 Thread PHPCoder

?php
$i = 1;
$liv_1 = one;
$liv_2 = two;
$liv_3 = three;
$liv_4 = four;
$liv_5 = five;
while ($i = 5 ) {
$do = echo \$liv_{$i};;
eval($do);
echo br;
 $i ++;
}
?

Simply echoing the \$liv_$i will not work, need to evaluate the string 
after parsed as in example above...


Kevin Porter wrote:

You need to escape the dollar sign with a backslash to prevent PHP trying to
interpolate the variable $liv (which presumably doesn't exist).

echo \$liv_$i;

HTH,

- Kev

-Original Message-
From: Veronica Ghezzi [SMTP:[EMAIL PROTECTED]]
Sent: 10 June 2002 09:24
To:   Php-General
Subject:  [PHP] help me please! :)

Hi,
   i must get the information saved in a several select list named
  liv_1 select name=liv_1
  liv_2   select name=liv_2
  liv_3   select name=liv_3
  
  liv_n   select name=liv_n

To get the value i work in this way...

  $n = 50;
  for ($i=1; $i=$n;i++){
  ...
  echo $liv_$i;   in asp i do:   response.write
(request(liv_ +
i))
  ...
  }
But i get only
  1
  2
  3
  ...
  50

What can i do to get $liv_1 ... $liv_2...  ???
Thank you a lot!

Veronica Ghezzi


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



**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
**




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




[PHP] SMARTCARDS - PHP + MySQL

2002-05-24 Thread PHPCoder

HI
I would like to hear from anyone who have possibly worked on 
implementing a smartcard solution to controll access to a website.
I am looking into possibilities for a proposal, and one of the 
requirements of the client is that the system data has to be accessible 
via the web, and that the access to the information has to be extremely 
secure.
The administrators of the site as well as the clients will need to be 
verified with ( ideally ) smartcards.
Obviously, you can deduct from this that the system will not 
neccessarily be implemented on the internet, but most probably WAN. It 
looks like the clients or users of the system will be physically 
required to be in front of a terminal connected to the system ( and it 
will have a smartcard reader)
I have never worked with smartcards before, and am not sure how one 
would ( if possible) integrate or pass the access signal through to 
the php/mysql pages.
Also, the user stations will most probably be Microsoft machines, but 
the servers will most definately be Linux, and if possible, I would like 
to have a smartcard verification solution on the servers as well ( this 
is not THAT, important, but seeing that the administrators might also 
want to work from Linux boxes, I would like to know if it can be done on 
a Linux platform).

So, in a nutshell, it's almost like a normal postoffice scenario. 
People will come to visit the establishment and produce their smartcard 
to verify their identity to the clerks who will then be able to 
transact via a webinterface with the servers.

Hope this is clear enough??
PS, I'm not trying to be cryptic, it's really all I know and most are 
deductions I made myself from reading the initial drafts.

Thanks for any help.



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




[PHP] Script executes for longer than 30s

2002-05-13 Thread PHPCoder

HI
I wrote a basic script that takes the input of a textfield and passes it 
onto the system() function and then echo's the result, somethinglike this:

?php
$result = system($command);
echo $result;
?

The $command is sent from the previous page via text field.

Whe I test this and do something like  ping 192.168.0.2, the page 
keeps on growing and growing, way past 30seconds. My php.ini file is 
definately set to 30s timeout. Is there something wrong or do I have a 
misunderstanding of the timeout workings?

Thanks
'


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




Re: [PHP] Script executes for longer than 30s

2002-05-13 Thread PHPCoder

Hi Chris
The script is not meant to run ping, I just used it as a test and then 
noticed that it does not time out as I would have expected. The problem 
is thus that if it is used on the command it is intended for and that 
command actually just keeps on going and going for whatever reason, I 
might end up with a problem where I expected PHP to take care of it for 
me


Chris Hewitt wrote:

 If I may respectfully suggest that you do not use the php scipt 
 timeout to limit the number of pings but ensure that the system 
 command will finish within the required time. The former seems a poor 
 technique to me.

 In your example, the ping command will never complete (unless php 
 closes it down). Why not limit the number of pings with ping -c 10 
 192.168.0.2?

 HTH
 Chris

 PHPCoder wrote:

 HI
 I wrote a basic script that takes the input of a textfield and passes 
 it onto the system() function and then echo's the result, 
 somethinglike this:

 ?php
 $result = system($command);
 echo $result;
 ?

 The $command is sent from the previous page via text field.

 Whe I test this and do something like  ping 192.168.0.2, the page 
 keeps on growing and growing, way past 30seconds. My php.ini file is 
 definately set to 30s timeout. Is there something wrong or do I have 
 a misunderstanding of the timeout workings?

 Thanks
 '







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




[PHP] Self Destruct code

2002-05-07 Thread PHPCoder

Hi
I have a funny request; I wrote a system for a client and am rather 
concerned that I am not going to receive payment for the work done. They 
want me to hand over the code before they are willing to pay, so 
basically I will be left at their mercy; if they don't pay, they will 
still have a working version of the system...
So, is there any way I can inconspicuously code in some boo-boo's that 
are time related etc. Something that will bomb the mysql tables or break 
some code if it is not unlocked within a month etc.
I'm not sure if people out tjere might have existing safeguard tools 
etc, so I'm open for suggestions.
PS, I know about Zend's encrypter, but since it will live on their 
server, I don't think it will help much since they will need the 
decrypter on there anyway right?

Thanks


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