of course that's possible... it's not default, but it's very possible
i think it's an apache module called suEXEC
that will run the script with the script owner's name.group,
not apache.apache
-Original Message-
From: [EMAIL PROTECTED]
Subject: [PHP] PHP/Apache security question
VirtualHost with their respective user and
group... But does that really 'secure' everyone's code from other equally
privileged users? :-?
--
Aaron Bennett
[EMAIL PROTECTED]
-Original Message-
From: ..s.c.o.t.t.. [mailto:[EMAIL PROTECTED]]
Sent: Saturday, July 07, 2001 4:33 PM
put Location before the URL:
header(Location: http://server.com/file.php;);
or
header(Location: ./file.php);
-Original Message-
From: Brad Wright [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 05, 2001 18:54
To: PHP General List
Subject: Re: [PHP] Re: changing to a different file
and session variables??
From: ..s.c.o.t.t.. [EMAIL PROTECTED]
Date: Thu, 5 Jul 2001 22:32:22 -0700
To: Php-General [EMAIL PROTECTED]
Subject: RE: [PHP] Re: changing to a different file in browser
put Location before the URL:
header(Location: http://server.com/file.php;);
or
header
or you could roll your own
function db_quote($data) {
$data = preg_replace(/'/, '', $data);
return $data;
}
-Original Message-
From: ReDucTor [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 05, 2001 19:54
To: Chris Anderson
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Submiting
does the directory exist?
does php or apache have the right to create new files
in /var/www/logs/?
if the file exists, are the permissions set correctly on it?
keep in mind that the user that owns apache usually
has very limited powers
-Original Message-
From: [EMAIL PROTECTED]
perhaps you'll have better luck finding comments
and suggestions on a VB or MySQL list
-Original Message-
From: Veerappan Rajendrakumar [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 03, 2001 19:30
To: [EMAIL PROTECTED]
Subject: [PHP] Help Meee!!
Hi,
I
there are two answers to this:
1) it cannot be done. as long as that image is on the person's
computer screen, it is physically impossible to prevent that
person from saving the image and using it.
(a simple tap of the print screen will take a screenshot
on windows machines, as someone else
you could also do it this way:
$ofile = file.txt;// original file
$nfile = new.file.txt;// new file
$string = original; // what needs to be replaced
$replace = replacement; // what to replace it with
$data = file($ofile); // original file's data
off the top of my head, you could try using a
lookup table to define the extra options...
ford_spec table:
id desc
--- ---
1 air conditioning
2 whatever
ford_cars table:
car extra1 extra2
-- --- -
'contour' 1
why dont you just use an email program that works correctly?
-Original Message-
From: Jon Yaggie [mailto:[EMAIL PROTECTED]]
Subject: [PHP] test
It wasnt a test my email program gets out of hand occassionally. trust me
i am trying very hard to control. i am sorry if it really
as a test, try removing the shebang line from your
script and running the PHP binary from the shell:
/usr/local/bin/php myscript.php
i've used the CGI version for months now with apache
for my website, and frequently use PHP from the shell
to test out ideas and code snippets and i've never
im not sure that i understand the question, but the way
i've got my apache/PHP configured, i dont ever see
the actual path to the PHP binary.
what type of problem are you having ??
PS: i never use shebang lines in my PHP scripts;
i have apache configured to handle *.php files
as PHP code.
look at the manual def's for both:
mysql_connect
and
mysql_db_query
if you have multiple database connections active,
remember to *always* use the linkid of the database
you want to talk to
-Original Message-
From: David Robley [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 23,
blaze board is what i use:
http://www.bbhacks.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
And even though it's much less elegant than the
solution by Sean below, you could also use 'eval'
$toast = array(wheat, rye, pumpernickel);
$numbreads = count($toast);
for ($index = 0; $index $numbreads; $index++) {
eval(\$column$index = '$toast[$index]';
echo
or if you're hellbent on using one form, you could
set a cookie db_insert_formname=1; so that if
the page refreshes, you can check the value of the
cookie to make sure you dont re-insert the data
-Original Message-
From: Sandeep Hundal [mailto:[EMAIL PROTECTED]]
Sent: Thursday,
print preg_replace('/(.*?)(\w{2})(.*)/', '\\2', $blah);
works for:
$blah = *9 scott 777zxsdf;
and
$blah = scott;
-Original Message-
From: Jerry Lake [mailto:[EMAIL PROTECTED]]
Subject: [PHP] ereg issues
I'm feeling a bit stupid today
how do I truncate a string to the
first two
use match_all to get an array of matches.
$s = [VET]We r NOT [PA]-Crew [TC];
preg_match_all('/\[.*?\]/', $s, $matches);
while (list($k,$v) = each($matches[0])) {
print $k = $vBR\n;
}
prints:
0 = [VET]
1 = [PA]
2 = [TC]
-Original Message-
From: Michael Roark
that's an extremely biased poll... considering that
it's a *scripting* website. it's only logical that
a majority of people going there would choose a scripting
language (and since PHP is so newbie friendly, it also
makes sense that it has such broad appeal to the
newbie web-programmers at the
if you're renaming to .PHP, i assume that you'll
be using PHP. use PHP to solve your problem:
This was taken directly from the PHP.net site:
if ($dir = @opendir(/tmp)) {
while($file = readdir($dir)) {
echo $file\n;
}
closedir($dir);
}
as others have said before, read the
as someone else suggested... a regexp is probably the
thing you want.
since i have no idea what the format of a MIB is,
i cannot give you any example.
but to find dotted num's, use something akin to this:
preg_match_all('/(\d+)(?=\.?)/', $MIB, $matches);
-Original Message-
From:
i apologize in advance if the answer to my question is
glaringly obvious.
i've got a multiple select on a form and want to
find out *all* selected values.
the form looks like so:
SELECT NAME=form[category] MULTIPLE
OPTION VALUE=0First
OPTION VALUE=1Second
OPTION VALUE=2Third
/SELECT
when the
$bob = Roy;
$s = 'Hey there $bob';
$s = 'print '. $s .';';
eval ($s);
prints: Hey there Roy;
perhaps that's what you're looking for?
-Original Message-
From: John Vanderbeck [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 07, 2001 4:21 PM
To: King, Justin; [EMAIL PROTECTED]
Subject:
this also works, since you mentioned that you're trying to
get away from evalling an echo statement.
$bob = Roy;
$s = 'Hey there $bob';
$s = '$somevar = '. $s .';';
eval ($s);
print $somevar;
prints: Hey there Roy;
personally, i think that using regexps to implement
an entire symbol parsing
my advice would be to disconnect the box from
the internet until you understand how to properly
secure it.
please read the documentation and manuals
before your box gets raped and pillaged
-Original Message-
From: Maxim Maletsky [mailto:[EMAIL PROTECTED]]
Subject: RE: [PHP]
the learning curve is smaller than most people think...
if you are willing to learn, and refuse to be
intimidated by the reputation that has been built
up around linux, i doubt you'll have any
problems installing and running/using it
in a lot of ways, i think linux is probably a more
natural OS
well, one idea is to serialize the array and put
into a HIDDEN text field to be submitted with
the FORM.
or, with no form, try this:
doc.php?myarray=. htmlentities(serialize($array));
-Original Message-
From: Clif [mailto:[EMAIL PROTECTED]]
Subject: [PHP] Passing arrays from page to
i tried to do it myself and nearly fell off
my chair becuase PHP makes you jump through
hoops to do such a simple thing
print preg_replace('/%([a-zA-Z]*)%/e', \$mioArray['$1'], $testo);
i never could understand why other languages
made regular expressions so convoluted.
why not just
PHP was started as a suite of perl programs... it is heavily
influenced by perl. if you understand PHP and are comfortable
with it, you should not have any problems learning Perl.
there are some very important differences between the two
languages that you need to keep your eyes open for,
i program in both PHP/Perl, and the concepts are
extremely similar...
granted, there are some similarities to C++,
but by far, the largest contributor to PHP's
language design has been Perl.
-Original Message-
From: Steve Lawson [mailto:[EMAIL PROTECTED]]
Subject: Re: [PHP] PERL
ahhh... sorry.
i thought the history of PHP was a bunch of perl scripts
that were used to keep track of website statistics or
somethign guess i was wrong.
but since you replied, can i ask what influenced you most
when developing PHP?
personally, i see perl influence everywhere in PHP,
but
it depends.
is it a char restriction that MySQL is placing on you?
e.g. a TINYTEXT field type can only contain 255 chars,
whereas a TEXT type can contain 16MB (or something like that)
if it's a PHP restriction, you'll have to wade thru
PHP scripts to find the function that checks the
length,
you could try swapping out some letters with
look-alike alphanum characters to make the password
a bit more secure
a=@
s=$
d=
thus, "password" = "p@$$wor"
-Original Message-
From: Jon Snell [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 19, 2001 11:47 AM
To: [EMAIL
i say the first style.
unneeded variables and other thingies just
obscure things and make it harder to maintain.
-Original Message-
From: Boget, Chris [mailto:[EMAIL PROTECTED]]
Subject: [PHP] Which is better coding style...
Which is better?
function blah() {
switch( $bob )
$retval = "this";
break;
case 2:
$retval = "that";
break;
default:
$retval = "other";
break;
}
return $retval;
}
-Original Message-
this works:
$r_start = 0;
$r_end = 65535;
$a = array('12', '198', 'b');
while ( list($k,$v) = each($a) ) {
if ( ($v $r_start) ($v $r_end) ) {
print "[$v] OKBR\n";
}
else {
print "[$v] NOPEBR\n";
}
}
-Original
you can get the amount of elements in an array using count()
and use that # as an index value for 1+ the last value
(the last value that's NOT IN the array)
$a = array('12', '198', 'b');
print count($a);
this'll give you "3", which, as you can see,
the last valid subscript of $a is $a[2];
this is what i use to scale down an arbitrary .GIF or .JPG
image to 150x150...
$image_name is the name of the original file that you want
to create a thumbnail of...
function save_thumb($image_name,$image_type) {
global $Svar;
$new_w = 150;
$new_h = 150;
$image_path
do any of you know of any nice web-interfaces to CVS
done in PHP?
since i write code at home and at work, i wanted to maintain
a single repository for files/code that i frequently use...
thanks for any suggestions.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail:
i did it for linux.
basically, what i did was to get GD and the other
libraries, 'configure' and 'make' them all
then, go into the PHP directory and tell PHP's
configure script where GD and such reside:
ex: ./configure --with-gd-dir=../gd-1.8.4/ --with-jpeg-dir=../jpeg-6b/
somthing similar
did you compile apache yourself?
try compiling apache yourself and then compiling
PHP as a stanalone-CGI (as opposed to server module)
and see if that helps any of your prob's.
-Original Message-
From: Louis Grenzebach [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 29, 2001 11:53
well, besides the fact that your code is interpreted
and the only data that makes it to the browser is
what you decide to output (or error message, but they
can be turned off/silenced)
i dont see how a surfer could get your PHP source code
via the webserver.
-Original Message-
From:
has anyone had trouble compiling PHP and GD on a linux/redhat
machine?? (what baffles me the most is that it compiled
flawlessly on another, almost identical, machine)
could anyone offer suggestions or hints, or perhaps
suggest a good website/discussion/archive that
might address GD-PHP
what i did was implement my own session class
so that i can have a single session variable ($s)
and have it handle all my session needs via
an OO interface ($s-CleanUp(), $s-Update(), ...)
consequently, all of my session data is in a
simple assoc. array that's a variable of the
session class
send the proper HTTP headers and then output
the contents of the file here's what i
used when i had to prompt the user for a
download box for arbitrary binary files
(.gif, .zip, .png, .pdf)
you might be able to not tell the browser
the size of the data, but it's best to
offer that
the way i do it for sites that need minimal to medium
is to generate a session id whenever a user comes to
the site. this session id is stored in mysql table
and as a cookie on the user's computer. when the
user logs in correctly, the username is stored in
the database with the session ID (not
quite possibly you did not compile PHP with mcrypt
library support.
for linux distrib's, mcrypt is not default, you have
to specify ./configure --with-mcrypt to get mcrypt
functionality (i dont know whether it's included
by default with the win binary, but i doubt it)
do the phpinfo() thing and
modulus also works for finding even nums:
if ($i % 2) {
// not even
}
-Original Message-
From: darion mapp [mailto:[EMAIL PROTECTED]]
Subject: Re: [PHP] Printing MySQL into HTML Tables
now it seems like you know what is to be done and you are not willing to
do the work.
do .php files work anywhere else?
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf
Of Maroufski
Sent: Thursday, March 22, 2001 5:41 PM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP/CGI Help
Hi all,
This is a tough one, wasn't able to find a
you dont... as far as i know,
crypt only works on = 8 chars
it will truncate anything over 8.
perhaps try using md5 or mcrypt...
-Original Message-
From: Randy Johnson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 22, 2001 4:33 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Crypt
check php.net and read the 'README' and
'INSTALL' files that come in the .tar.gz file
for more detailed information.
very basically, you want to get the sources,
untar/zip them, run configure, then build the
thing and test it (you can do all of this
as an unprivileged user). then install as
phpmyadmin
http://www.phpwizard.net/projects/phpMyAdmin/
-Original Message-
From: Jack Sasportas [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 21, 2001 16:17
To: php
Subject: [PHP] Pre-Written Script ?
Has anyone found a good prewritten (gpl) script that helps you to
this is a PHP list.
your problem is with java, not PHP
-Original Message-
From: Celestino Roberto Alejandro [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 15, 2001 3:34 PM
To: Lista PHPGral
Subject: [PHP] Error working
Hello..i'm veri tired, and i am going to require your
try using include_once() and require_once()
in place of include() and require()
also, make sure you havent defined any functions
that match PHP internal funcs.
-Original Message-
From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 15, 2001 3:29 PM
To: php
Subject:
of course. if it supports sockets then i dont see why it wouldnt
work with a back-n-forth exchange of information over those sockets.
php.net/sockets
look how much smaller that URL is than all the text you typed
out in the message :) always check the online manual first.
-Original
of course it's possible... :)
-Original Message-
From: Brandon Orther [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 15, 2001 5:33 PM
To: PHP User Group
Subject: [PHP] Has anyone got MSSQL2000 to connect and work properlly?
Hello,
I am trying to get PHP4 to connect to
or
do .. while (0==0);
-Original Message-
From: Jim Winstead [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 07, 2001 2:23 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] do..while(0) not staying true
trick question, right? 0 is false. you want do { ... } while(1);
jim
--
one is post-increment, and one is pre-increment:
POST-increment ($i++)
$i = 1;
print $i++;
print "\n"
print $i;
prints :
1
2
becuase $i is printed out and *then* it is incremented, so
the next print statement prints out the incremented value,
not the print $i++; statement
PRE-increment (++$i)
i use a regexp to slash-out single quotes for
inclusion into an SQL query:
// quote a value to make it appropriate for inclusion in an SQL string
function db_quote($value) {
return ereg_replace("'","\\'",$value);
}
-Original Message-
From: Mitchell Hagerty [mailto:[EMAIL
0 also works for AUTO_INCREMENT fields...
-Original Message-
From: Philip Olson [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 23, 2001 18:41
To: Clayton Dukes
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Help INSERTing to MySQL
If I knew I could get answers that easy here,
you dont need to have a list of field names if you insert
the exact amount of fields that exist in the table...
if you have fields Name and Email, you can do:
INSERT INTO mytable VALUES ('myname','[EMAIL PROTECTED]')
without a problem. however, if you have fields
Name, Email and Password the
well, you could load lynx, then type "G" (go) and
type in "www.php.net" on the address bar, then
navigate your way to the download page from there.
(it's only one page deep into the site)
that's how i did it at work on our linux machine.
-Original Message-
From: Simons [mailto:[EMAIL
mysql executes the queries in the order it recieves
them, (so if your program's logic executes a select
before an update, you'll never see results from the
update in your select... at least not normally :)
Are you able to access the MySQL monitor program?
if so, verify that the data really does
for system("perl test.pl", $retval);
and exec("perl test.pl", $ary, $retval);
the value of $retval is the value that the perl
script "test.pl" returns, (not a perl status code).
as someone else suggested, go and look for
exit(126) statements (or just exit(), if exit
returns the value of a
i am not positive about this, but you could try making
the amp process a background process by adding a
" " to the end of the command line
(at least if you're using *nix)
-Original Message-
From: Ashley M. Kirchner [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 19, 2001 00:40
from the "unset" documentation on php.net
// destroy a single variable
unset ($foo);
// destroy a single element of an array
unset ($bar['quux']);
// destroy more than one variable
unset ($foo1, $foo2, $foo3);
-Original Message-
From: andreas (@work) [mailto:[EMAIL PROTECTED]]
i had a very similar problem when i first setup PHP/Apache
on my linux box... i forgot to add a line to my httpd.conf
and got all sorts of "Cant find this" "Cant find that" type
of errors
my mistake was that i did not set ScriptAlias and Action
correctly, and thus apache was having all sorts
-Original Message-
From: Zenith [mailto:[EMAIL PROTECTED]]
Subject: [PHP] question about multidimension array
Consider the following code:
$ary1 = array ("one","two");
$ary2 = array ("three","four");
$2d_Dimension[] = $ary1;
$2d_Dimension[] = $ary2;
// is $2d_Dimension a
i dont know too much about ASP, as i've never had to use it,
but i thought ASP as more of an enviornment (or meta-language)
rather than an actual programming language (becuase VBscript
is the default language for ASP pages, i always assumed that
other languages could be utilized in place of
include() will only load the file if the include() statement is encountered
during the execution of your script
if (1==0) {
include("file");
}
the file will never be include()'d, since the if/then will always fail.
require() will always put the contents of the
al Message-
From: Christian Reiniger [mailto:[EMAIL PROTECTED]]
Subject: Re: [PHP] system()
On Monday 19 February 2001 21:00, ..s.c.o.t.t.. wrote:
i am not positive about this, but you could try making
the amp process a background process by adding a
" " to the end of the comm
there was an awesome article on phpbuilder about buffering output,
controlling when things got to the browser... so that you could
set cookies/headers anywhere in your script (or, as he talks about,
gzip content on the fly beofre outputting it to the browser)
well, i agree about writing some of my own libraries it helps me
get to know the language and the features that i am using better.
Libraries are a "Good Thing", it's just that i've seen loads of people
ask questions (on other lists mostly, since im new here) about things
that they'd know
ahhh... yes... :)
the linux version is much stricter when it comes
to table definitions...
i had the same problem trying to declare an INDEX
for my table too for linux, any key that
you use as an INDEX on a table must be declared
NOT NULL (whereas the win32 port doesnt seem
to care very
PROTECTED]]
Sent: Saturday, February 17, 2001 03:12
To: ..s.c.o.t.t..; Php-General
Subject: RE: [PHP] Can I select only the newest record?
I wonder, if LAST_INSERT_ID will work in here...
I know it works when on the same file was an insertion.. but will it return
you the last ever inserted
well, if the only characters that you want to allow are
alphanum/space/underscore, you could use a
perl regexp to match against anything *other* than
those things...(a positive match would indicate that the
string being matched had invalid characters in it)
use this:
preg_match('/[^\w\s]/',
any good .conf files?
...mine reads like a stephen king novel :)
it's easy... if you go to php.net and read thru their
installation documentation, there are about 4-5 lines
total that you need to add to your httpd.conf
(at least when you install php as a stanalone cgi)
to get apache to
it's not very elegant, but i havent come across any PHP
core function that will do what you asked, so here's a little
loop that will return the total length of a multidimensional
array
$total = 0;
for ($i=0; $i count($myarray); $i++) {
$total += count( $myarray[$i] );
}
print $total;
hmmm... what i would do is set a cookie named
"cookies_enabled" in the very beginning of your site,
and check for the presense of that variable in places
that you need cookie functionality...
logically, if $cookies_enabled isnt set, it means that the
cookie doesnt exist (and thus cookie support
or, a bit more concisely, you could use a regexp...
to allow only jpg/gif/png file formats, setup the
regexp to match on those three formats, and
yell at people who submit anything other than
those three
$imgName = "one.jpg";
if (! preg_match('/\.(jpg|gif|png)$/', $imgName) ) {
print
well, CSS support in netscape 4 is abyssmal to begin with,
and it's a 5 year old browser, so i would venture to guess
that's why you cant get anything to look the way it should...
i never thought i'd see the day when MSIE was more
standards compliant and more stable than netscape...
(well, at
there's a much easier way to get rid of whitespace
and linebreaks at the end of a variable than using a
looped ereg_replace (as i previously suggested)
1) use trim()
2) use preg_replace('/\s*$/', '', $input)
both will cremate spaces and linebreaks
--
PHP General Mailing List
did you check the value *before* writing it to a file?
before trying to solve any problem, you have to know
where to look perhaps the problem lies with the file
instead of the regexp.
the following code worked great for me:
?php
$html='a
well, there are two solutions,
1) for variables with only whitespace to be trimmed
2) variables with whitespace and \n to be trimmed
1) solution:
the way i'd do it too is regexp... very similar to your solution
(you're on the right track, but just needed to take that final step)
$var = "This
you could possibly store the name/password as cookies, so
that they're available to the PHP script without the user having
to type them in more than once per session (or even longer
if you set the expire date properly)
i know that cookies are horribly insecure, but for purposes
of a very simple
it's such a complex question and answer that i really think
you need to ponder some more fundamental design concepts
before you ask for advice on actually coding the thing...
such as what type of database layout fits the type of
information you will be storing/searching/retrieving,
how you want
I agree...
The red book "Professional PHP Programming"
(WROX "Programmer to Programmer" series)
is an exellent PHP book
but, if you're looking for novice level stuff, WROX
also published a companion called "Beginning PHP4".
i was fluent in perl when i picked up the professional
one, and had no
i'd use split, to split the value up into an array:
if this is your url
$url = "/pages/error.php?/pages/login.php?user=scott";
and use this code:
$thing = split('\?', $url);
print $thing[0] ." BR\n ";
print $thing[1] ." BR\n ";
print $thing[2] ." BR\n ";
output will be:
i've been using the header("...") approach myself, but
was curious to see if there's a builtin PHP function that
will accomplish the same thing
im a kind-of new PHP programmer, and havent really
been exposed to too much of the language yet,
but i found it quite odd that such a function seems
IL PROTECTED]]
Sent: Friday, February 16, 2001 16:57
To: ..s.c.o.t.t.. [gts]
Cc: php-general
Subject: Re: [PHP] Finding the? in $REQUEST_URI?page=blah
Is the PHP split command the same as that in Perl?
ex.
($var_1, $var_2) = split(/:/,$string, 2);
will some
there are two ways that come to mind of doing this if you're
using some kind of auto-incrementing field (not necessarily
AUTO_INCREMENT, but any field that increases [or decreases]
with time)
this will select the entire row, but limit the query to only
return 1 result (and depending on how your
92 matches
Mail list logo