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 si
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 = $v\n";
}
prints:
0 = [VET]
1 = [PA]
2 = [TC]
> -Original Message-
> From: Michael Roark [mailto:[
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
>
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
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
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]
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:
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 docum
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 pa
$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]
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:
First
Second
Third
when the form submits, $form['category'] is not
an array of selected values, but rather a sing
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" O
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] F
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 sup
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
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, and
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
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
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,
thing
default:
> $retval = "other";
> break;
> }
>
> return $retval;
> }
>
> > -Original Message-
> > From: ..s.c.o.t.t.. [gts] [mailto:[EMAIL PROTECTED]]
> > Sent: 19 April 2001 21:31
> &
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(
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 PRO
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: [EMA
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 compilati
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:
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:5
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 to
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 informatio
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 (
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
roo
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] Cry
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 fin
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 wo
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
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 a
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 conn
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 Message
since PHP is executed before any otuput is shown to the browser,
all you have to do is keep a server between your code and
the other person.
unless i am horribly mistaken, you can turn off options to
allow people to view PHP source code via their browser.
> -Original Message-
> From: R
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
> Subj
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
the same way that you passed information over to the second page.
> -Original Message-
> From: Don [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 15, 2001 4:09 PM
> To: php list
> Subject: [PHP] passing variables from one form to another
>
>
> Hi,
>
> I have a PHP script (script_
you could just tar/gzip up the entire tree,
open a regular FTP session and FTP it all over
in one shot.
trying to write the whole thing in PHP is a waste
of time if the sole purpose is to move files as
easily and quickly as possible.
> -Original Message-
> From: Andreas D. Landmark [ma
try @fopen(...)
prepending a '@' to the mysql funcs will suppress error
messages by those functions... maybe it'll work for fopen also.
never tried it, though.
> -Original Message-
> From: Kenneth R Zink II [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 15, 2001 4:58 PM
> To: PHP
>
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);
>
>
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 variab
this will work...
(if you wnat to check against any other possible domains,
just add it into the "|" separated list...
(com|edu|cc|uk|org|tv), and so on.
(the following regexp should be all on one line)
preg_match("/([a-zA-Z0-9]+)\@([a-zA-Z0-9]+)\.(com|edu|net|org|tv)/", $email);
- Origin
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] ." \n ";
print $thing[1] ." \n ";
print $thing[2] ." \n ";
output will be:
/pages/error.php
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
49 matches
Mail list logo