php-general Digest 19 Jul 2003 17:00:06 -0000 Issue 2185
Topics (messages 155869 through 155899):
Re: Securing File Uploads Was: Is it possible to test an uploaded file to check the
type?
155869 by: Jason Wong
155872 by: Gerard Samuel
155873 by: Curt Zirzow
Re: Still problem with files
155870 by: Jason Wong
155898 by: Beauford.2005
Enough is Enough.......
155871 by: Beauford.2005
155874 by: Curt Zirzow
155897 by: Beauford.2005
Re: classes v. functions
155875 by: Sam Baum
155877 by: Jean-Christian IMbeault
155881 by: Tom Rogers
155882 by: Ryan A
155887 by: Curt Zirzow
155893 by: Andu
155899 by: Sam Baum
caching question
155876 by: Jean-Christian IMbeault
155878 by: Jean-Christian IMbeault
155890 by: Curt Zirzow
Re: Failed to Receive in E:\...\mailscript.php on line 25
155879 by: Philip J. Newman
HOW TO -- ARRAY UPDATE MYSQL
155880 by: Suresh Babu.A [Support]
155892 by: Curt Zirzow
affiliate program
155883 by: Ryan A
dbx module - limit
155884 by: Sebastian Erlhofer
what is the problem?
155885 by: pehepe php
155886 by: Chris Knipe
155888 by: John Manko
155891 by: David Nicholson
Re: running a php script in /cgi from /web
155889 by: Dale Walters
Help with UPDATE command...
155894 by: Tony Tzankoff
155895 by: John Manko
155896 by: Jon Haworth
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
On Saturday 19 July 2003 04:49, Gerard Samuel wrote:
> Sorry for bring this back to life, but Im looking for some more opinions.
> A friend and I are somewhat dead locked, as to whether with available
> tools via php, that its possible to *reliably* secure file uploads.
> File uploads currently encompass, images, mp3, real audio files,
> with plans for ogg vorbis, flash, and what ever audio/visual/document
> file formats, I can make php read its metadata.
> These files will be used in a gallery type environment, to be displayed,
> downloaded, or streamed.
> The end product will be used by people who most likely will have their
> sites hosted, thus no real control over the server, and can be run on
> *nix/Windows environments.
In a response to your previous posts on this matter, I suggested that you
search freshmeat/sourceforge for a PHP-based media file metadata extractor
(yes one does exist). I'm putting forward the same suggestion again.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
The story you are about to hear is true. Only the names have been
changed to protect the innocent.
*/
--- End Message ---
--- Begin Message ---
Jason Wong wrote:
In a response to your previous posts on this matter, I suggested that you
search freshmeat/sourceforge for a PHP-based media file metadata extractor
(yes one does exist). I'm putting forward the same suggestion again.
Ok, Ill look, but not sure what good it will do me, as Im already
reading a file's metadata (using my own code).
Im basing my assumption, on that binary data may share so called "magic"
bytes.
Like an mpeg header (11111111111) may/or may not appear in other file
formats. (Purely an assumption as of this moment)
But thanks for reminding me on the other code...
--- End Message ---
--- Begin Message ---
Gerard Samuel <[EMAIL PROTECTED]> wrote:
> Jason Wong wrote:
>
> >In a response to your previous posts on this matter, I suggested that you
> >search freshmeat/sourceforge for a PHP-based media file metadata extractor
> >(yes one does exist). I'm putting forward the same suggestion again.
> >
> >
> Ok, Ill look, but not sure what good it will do me, as Im already
> reading a file's metadata (using my own code).
> Im basing my assumption, on that binary data may share so called "magic"
> bytes.
> Like an mpeg header (11111111111) may/or may not appear in other file
> formats. (Purely an assumption as of this moment)
> But thanks for reminding me on the other code...
I hope your not using that 11111111111, that isn't correct for an mpeg
file.
I would also point out that even if the magic was unique and you could
tell that the file was the type it is suppose to be, the person can
still put invalid data inside there. Like wrap a jpeg header and eof
marker in there but have an executible within it.
Some file formats have crc's built in, like mp3. You could also run a
crc check on the files if its available. I believe avi's do to, but i'm
sure since this isn't reliable it isn't going to be a reasonable
solution.
Another thing to do to garuantee the file would be to decode the format
and then reencode it ie(mpeg, mp3, jpeg, gif, etc). then again this seems
like overkill and plus with lossy formats like mp3 and jpeg you'll lose
quality.
I'm not sure if this is a big issue for you, I just thought I'd point
that out.
any way, thats just a few comments i had on that
Curt.
--
--- End Message ---
--- Begin Message ---
On Saturday 19 July 2003 04:58, Beauford.2005 wrote:
> Yep, but am I doing it right I don't know. This is the line that will be
> written to the database (there will be 130 of them).
>
> $p = "<Option Value=\"131\">Player Name";
>
> So where do I put the \r\n. I have tried just \n at the end, but same
> thing.
>
> $p = "<Option Value=\"131\">Player Name\n";
It beats me why you're not storing the info in a DB rather than a file.
Anyway here's some psuedo-code:
$file = file('file);
foreach ($file as $line => $data) {
$file[$line] = trim($data);
if (!strcmp($what_you_are_looking_for, $file[$line])) {
// found, do your replacement stuff
}
}
implode('choose a suitable EOL character(s)', $file);
write_out_file();
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
GOOD-NIGHT, everybody ... Now I have to go administer FIRST-AID to my
pet LEISURE SUIT!!
*/
--- End Message ---
--- Begin Message ---
These files were already done from last year, so I figured I would just
carry on with them. Last year they did not have to be manipulated - so
it wasn't a big deal. I have since changed the whole thing and am now
using a database (took me a whole 45 minutes), which I was using anyway
to hold all my other info. I'd still be curious though as to why the
other way did not work.
-----Original Message-----
From: Jason Wong [mailto:[EMAIL PROTECTED]
Sent: July 19, 2003 1:34 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Still problem with files
On Saturday 19 July 2003 04:58, Beauford.2005 wrote:
> Yep, but am I doing it right I don't know. This is the line that will
> be written to the database (there will be 130 of them).
>
> $p = "<Option Value=\"131\">Player Name";
>
> So where do I put the \r\n. I have tried just \n at the end, but same
> thing.
>
> $p = "<Option Value=\"131\">Player Name\n";
It beats me why you're not storing the info in a DB rather than a file.
Anyway here's some psuedo-code:
$file = file('file);
foreach ($file as $line => $data) {
$file[$line] = trim($data);
if (!strcmp($what_you_are_looking_for, $file[$line])) {
// found, do your replacement stuff
}
}
implode('choose a suitable EOL character(s)', $file); write_out_file();
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
GOOD-NIGHT, everybody ... Now I have to go administer FIRST-AID to my
pet LEISURE SUIT!! */
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi,
I apologize for all the emails on this, but I'm truly at a loss here and
really need some input as to what I need to do to get this working.
I have a FORM with two drop down menus and have the entries saved in two
separate .inc files i.e:
<Option Value="3">Alfredsson
<Option Value="39">Arnott
<Option Value="150">Aucoin
<Option Value="143">Audette
Etc...
<Option Value="67">Bates
<Option Value="36">Battaglia
<Option Value="152">Berard
<Option Value="6">Bertuzzi
Etc....
The user enters the webpage and chooses a player from list one and list
two. This gets submitted to my PHP script which reads in these files and
manipulates them accordingly and re-saves them. At the end of the PHP
script I include the input file again - include("injury-input.php") -
which should now have the updated drop down menus.
This seems to work the first time you open up a browser and go to the
input page (although I can't really even be sure of that now). If you
try to do it again using a different set of players, it doesn't work. I
usually end up with two empty files. So it appears it is opening the
file the second time ok, but is not writing to it.
I have no idea what to do with this.
Here is the script:
function writeplayer($from_row, $to_row) {
include("trade-errors.inc");
$filename = "players.inc";
$fd = fopen ($filename, "r");
$content = "";
while (!feof ($fd)) {
$content = fgets($fd);
if (preg_match ("/".$to_row['player']."/", $content)) { }
else { $list[] = $content; }
}
fclose ($fd);
$num = count($list);
$list[$num] = "\r\n<Option
Value=\"".$from_row['idp']."\">".$from_row['player'];
$num = count($list);
$list = preg_replace('/(<.*?>)(.*)/', '$2$1', $list);
sort ($list);
$list = preg_replace('/(.*?)(<.*>)/', '$2$1', $list);
if (is_writable($filename)) {
if (!$fp = fopen($filename, 'w')) {
$injury_errors = $playeropens;
include("injury-input.php");
exit;
}
for($i=0; $i < $num; $i++) {
if (!fwrite($fp, $list[$i])) {
$injury_errors = $playerwrite;
include("injury-input.php");
exit;
}
}
fclose($fp);
}
else {
$injury_errors = $notwritable;
include("injury-input.php");
exit;
}
unset($list); unset($content); unset($num); unset($filename);
unset($fd); unset($fp);
writereserve($from_row, $to_row);
$injury_errors = $updated;
return($injury_errors);
}
function writereserve($from_row, $to_row) {
include("trade-errors.inc");
$filename = "players-reserve.inc";
$fd = fopen ($filename, "r");
$content = "";
while (!feof ($fd)) {
$content = fgets($fd);
if (preg_match ("/".$from_row['player']."/", $content)) { }
else { $list[] = $content; }
}
fclose ($fd);
$num = count($list);
if (is_writable($filename)) {
if (!$fp = fopen($filename, 'w')) {
$injury_errors = $playeropens;
include("injury-input.php");
exit;
}
for($i=0; $i < $num; $i++) {
if (!fwrite($fp, $list[$i])) {
$injury_errors = $playerwrite;
include("injury-input.php");
exit;
}
}
fclose($fp);
}
else {
$injury_errors = $notwritable;
include("injury-input.php");
exit;
}
$injury_errors = $updated;
unset($list); unset($content); unset($num); unset($filename);
unset($fd); unset($fp);
return($injury_errors);
}
--- End Message ---
--- Begin Message ---
Beauford.2005 <[EMAIL PROTECTED]> wrote:
> Hi,
Hello
> [...]
>
> $list = preg_replace('/(<.*?>)(.*)/', '$2$1', $list);
> sort ($list);
> $list = preg_replace('/(.*?)(<.*>)/', '$2$1', $list);
what is list after the first preg and after the second one, that regex
doesn't look safe to me.
Do you have access to a database? This task would be a whole lot easier
to do, plus a whole lot more safer.
Curt
--
--- End Message ---
--- Begin Message ---
Done. You must have read my mind. I just finished putting the whole
thing in MySQL - since I am using it anyway to hold all my other data it
was easy to do. Took me about 45 minutes to do this as opposed to a week
with the other, and it still didn't work. I'd still be curious to why
the other is didn't work though. I know my logic is correct, but maybe
what I was trying to do just wasn't feasible.
Thanks for the input.
-----Original Message-----
From: Curt Zirzow [mailto:[EMAIL PROTECTED]
Sent: July 19, 2003 2:33 AM
To: PHP
Subject: Re: [PHP] Enough is Enough.......
Beauford.2005 <[EMAIL PROTECTED]> wrote:
> Hi,
Hello
> [...]
>
> $list = preg_replace('/(<.*?>)(.*)/', '$2$1', $list);
> sort ($list);
> $list = preg_replace('/(.*?)(<.*>)/', '$2$1', $list);
what is list after the first preg and after the second one, that regex
doesn't look safe to me.
Do you have access to a database? This task would be a whole lot easier
to do, plus a whole lot more safer.
Curt
--
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi,
am Friday 18 July 2003 23:08 schrieb Andu:
> This may show my ignorance or my refusal to take for granted something I
> don't fully understand but I have a hard time figuring out the advantage
> of using classes as opposed to just functions. I am certainly new to php
> and at first sight classes seemed to cut a lot of corners but so do
> functions (with which I have more experience). The more I read about
> classes the deeper the confusion. Anyone can enlighten me?
Im programming for a few years now in PHP. After trying to use classes i
dont see their point either. In most cases if i need a class-like structure
i do something like this:
function thing_new() {
return ++$GLOBALS['thing_resource'];
}
function thing_put($stuff, $res=NULL) {
if (is_null($res)) $res = $GLOBALS['thing_resource'];
$GLOBALS['thing_stuff'][$res] = $stuff;
}
function thing_get($stuff, $res=NULL) {
if (is_null($res)) $res = $GLOBALS['thing_resource'];
return $GLOBALS['thing_stuff'][$res];
}
Because there is no constraint to be more OO like in Java it doesnt makes
sense. And this way you are more flexible.
bg
Sam
--- End Message ---
--- Begin Message ---
I am sure someone will call this heresy, but if you really want OO don't
(Bdo it in PHP. If you are new to OO and start with PHP you will do
(Byourself a grat disfavour. OO programming in PHP is still not ready. If
(Byou try and program in OO in PHP you have to learn all of it's
(Bshortcomings and many "tricks" to get around them. And I promise that
(Bmore than once you will scratch your head and wonder why your object
(Bseems to have lost it's state or some variable never seems to get set
(Bproperly.
(B
(BJean-Christian Imbeault
--- End Message ---
--- Begin Message ---
Hi,
Saturday, July 19, 2003, 7:08:55 AM, you wrote:
A> This may show my ignorance or my refusal to take for granted something I
A> don't fully understand but I have a hard time figuring out the advantage of
A> using classes as opposed to just functions. I am certainly new to php and
A> at first sight classes seemed to cut a lot of corners but so do functions
A> (with which I have more experience). The more I read about classes the
A> deeper the confusion. Anyone can enlighten me?
A> Regards, Andu Novac
Classes are good in that they group functions and variables into a re
usable block. Trying to do everything by just loading functions will
eventually lead to naming and include hell once you start doing
complex things.
PHP might not be an oo language but it sure helps me keep things
togeher. I tend to make classes that do a function like
authentication, I just need to include authClass.inc and fire it up
and all my auth work is done. i know I can create other functions as
they won't clash with the ones in the auth class.
Another great thing with classes is you don't have to make common
variables global all the time.
If you haven't used any other type of OOP then you won't have any
problems trying to make PHP look like java, you can just grab the
benifits with whats available :-)
--
regards,
Tom
--- End Message ---
--- Begin Message ---
Hi,
I myself never really create classes to use in my projects, if I ever use
classes its only because they come from someone else (eg phpclasses.org), I
find using the non OO approach much easier to understand.
Just my 2 cents.
Cheers,
-Ryan
----- Original Message -----
From: "Sam Baum" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 19, 2003 11:59 AM
Subject: [PHP] Re: classes v. functions
> Hi,
>
> am Friday 18 July 2003 23:08 schrieb Andu:
>
> > This may show my ignorance or my refusal to take for granted something I
> > don't fully understand but I have a hard time figuring out the advantage
> > of using classes as opposed to just functions. I am certainly new to php
> > and at first sight classes seemed to cut a lot of corners but so do
> > functions (with which I have more experience). The more I read about
> > classes the deeper the confusion. Anyone can enlighten me?
>
> Im programming for a few years now in PHP. After trying to use classes i
> dont see their point either. In most cases if i need a class-like
structure
> i do something like this:
>
> function thing_new() {
> return ++$GLOBALS['thing_resource'];
> }
>
> function thing_put($stuff, $res=NULL) {
> if (is_null($res)) $res = $GLOBALS['thing_resource'];
> $GLOBALS['thing_stuff'][$res] = $stuff;
> }
>
> function thing_get($stuff, $res=NULL) {
> if (is_null($res)) $res = $GLOBALS['thing_resource'];
> return $GLOBALS['thing_stuff'][$res];
> }
>
> Because there is no constraint to be more OO like in Java it doesnt makes
> sense. And this way you are more flexible.
>
>
> bg
>
> Sam
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Sam Baum <[EMAIL PROTECTED]> wrote:
> Hi,
>
> am Friday 18 July 2003 23:08 schrieb Andu:
>
> > This may show my ignorance or my refusal to take for granted something I
> > don't fully understand but I have a hard time figuring out the advantage
> > of using classes as opposed to just functions. I am certainly new to php
> > and at first sight classes seemed to cut a lot of corners but so do
> > functions (with which I have more experience). The more I read about
> > classes the deeper the confusion. Anyone can enlighten me?
>
> Im programming for a few years now in PHP. After trying to use classes i
> dont see their point either. In most cases if i need a class-like structure
> i do something like this:
>
> function thing_new() {
> return ++$GLOBALS['thing_resource'];
> }
The biggest thing classes do is resolve name space issues, even with
this method you have namespace issues with your function name and your
variables. This rather effects a lot of people who create libraries to
share with.
A big downfall with classes, however is there speed. Benchmarking a
function call vs. a class->method call, results in a significant
difference and even more if your using a lot of classes.
In general, I only use small and nicely bundled classes that don't have
to do a lot of work, ie authentication, session.
>
> Because there is no constraint to be more OO like in Java it doesnt makes
> sense. And this way you are more flexible.
And besides php wasn't designed/developed to be an OO language.
Curt.
--- End Message ---
--- Begin Message ---
Thanks to all for your input.
Regards, Andu Novac
--- End Message ---
--- Begin Message ---
Hi there,
am Saturday 19 July 2003 16:30 schrieb Curt Zirzow:
> Sam Baum <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> am Friday 18 July 2003 23:08 schrieb Andu:
>>
>> > This may show my ignorance or my refusal to take for granted something
>> > I don't fully understand but I have a hard time figuring out the
>> > advantage of using classes as opposed to just functions. I am certainly
>> > new to php and at first sight classes seemed to cut a lot of corners
>> > but so do functions (with which I have more experience). The more I
>> > read about classes the deeper the confusion. Anyone can enlighten me?
>>
>> Im programming for a few years now in PHP. After trying to use classes i
>> dont see their point either. In most cases if i need a class-like
>> structure i do something like this:
>>
>> function thing_new() {
>> return ++$GLOBALS['thing_resource'];
>> }
>
> The biggest thing classes do is resolve name space issues, even with
> this method you have namespace issues with your function name and your
> variables.
Sure i have to add and take care of the namespaces myself, but thats it and
the amount mental work compared to designing a class is imho lesser in my
way. And most times only 1 object of a class gets instanciated, which is to
much overhead in an application. And then u dont even need my construct.
And if you dont create an object and call the function in an static way
(via ::), then the whole benefit of the associated data is gone anyway and
the only thing you have is the namespace. So i dont give the Parser the
challenge of preparing a class representation and keep it simple. And at
last: no more copied objects.
> A big downfall with classes, however is there speed. Benchmarking a
> function call vs. a class->method call, results in a significant
> difference and even more if your using a lot of classes.
Ok i just assumed that, but good to know for sure.
Sam
--- End Message ---
--- Begin Message ---
I am using Apache 1.3.27 and PHP 4.3.3.RC1 and someone has told me that
my web page cannot be cached but I cannot figure out why. My friend
tells me my pages all keep sending this in their headers:
Cache-Control: post-check=0, must-revalidate, no-store, no-cache,
pre-check=0
But I can't figure out why the headers are set like this. I am not
setting any headers so I am wondering if it is a setting in my web
server, php.ini file or some other php scripts I have running in the
background.
Also print_r($HTTP_SERVER_VARS) gives one server variable to be:
[HTTP_CACHE_CONTROL] => max-age=0
What does this variable mean and where was it set?
Any and all help appreciated!
Jean-Christian Imbeault
--- End Message ---
--- Begin Message ---
Found somewhat of an answer here http://www.mnot.net/cache_docs/:
(B
(B"By default, objects processed by PHP are not assigned validators, and
(Bare therefore uncacheable"
(B
(BJean-Christian Imbeault
--- End Message ---
--- Begin Message ---
Jean-Christian IMbeault <[EMAIL PROTECTED]> wrote:
> I am using Apache 1.3.27 and PHP 4.3.3.RC1 and someone has told me that
> my web page cannot be cached but I cannot figure out why. My friend
> tells me my pages all keep sending this in their headers:
>
> Cache-Control: post-check=0, must-revalidate, no-store, no-cache,
> pre-check=0
>
> But I can't figure out why the headers are set like this. I am not
> setting any headers so I am wondering if it is a setting in my web
> server, php.ini file or some other php scripts I have running in the
> background.
In most cases you dont want your php output to get cached, and so php
will do this automaticly. You can stop that from happening by sending
the same header with public as the paramater:
Cache-Control: public
You also might want to set a few others:
/* if you are sending a file send the last modified time */
'Last-Modified: ' . gmdate("D, d M Y H:i:s", $unix_ts . ' GMT')
/* for old ie bug and older proxy caches */
'Pragma: no-cache');
/* if this applies */
'Expires: '. gmdate("D, d M Y H:i:s", time()-(1200). ' GMT')
Curt.
--
--- End Message ---
--- Begin Message ---
thanks
----- Original Message -----
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, July 06, 2003 7:06 PM
Subject: Re: [PHP] Re: Failed to Receive in E:\...\mailscript.php on line 25
> On Sunday 06 July 2003 14:59, Håkon Strandenes wrote:
> > This is not my server, so I cannot change the settings in php.ini. This
> > is my ISP's server, and I think they run SMPT om the same server. And
> > yes, this is a Windows 2000 server.
>
> A quick and easy way to check whether mail() would work is to use the
> error_log() function.
>
> > How do I set the SMTP server I shall use in the script? I have no access
> > to the php.ini...
>
> I believe you can set that at run-time using ini_set().
>
> > I will contact my ISP at moonday and tell them about my problem.
>
> Good idea!
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> Theory is gray, but the golden tree of life is green.
> -- Goethe
> */
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
HI ALL,
I want to update a mulitple row from a HTML Table to MYSQL Database.
L1 V1 T1
L2 V2 V2
L3 V3 V3
Any help in this regard is much appreciated.
Suresh
--- End Message ---
--- Begin Message ---
Suresh Babu.A [Support] <[EMAIL PROTECTED]> wrote:
>
> HI ALL,
>
> I want to update a mulitple row from a HTML Table to MYSQL Database.
>
> L1 V1 T1
> L2 V2 V2
> L3 V3 V3
Can you expand on this a little more, it's a bit vague.
--- End Message ---
--- Begin Message ---
Hi,
Can anyone recomend a good affiliate program please?
I have found a couple at hotscripts/scriptSearch and google but I dont know
which one is really good (and free :-D ) depending on your
experience...which one would you recomend?
The program is for sites selling software and memberships (non porn)
Thanks in advance.
-Ryan
--- End Message ---
--- Begin Message ---
Hello,
fist, I want to introduce myself. I am 24 years old, studying media
science in Germany (Trier) and working with PHP for 5 years now.
My question is about the dbx module in PHP.
Is there any possibility to use it with mysql-command: LIMIT?
There are similar commands vor postgres etc. but I didn't find anything
for that in dbx_query either.
Greetings,
-sebastian
--- End Message ---
--- Begin Message ---
form.php is this:
<form method="post" action="takeform.php">
<input type="text" value="sentence">
</form>
............
takeform.php is this:
<?
echo $sentence;
?>
................
these codes are running at my hosting
but it couldn't run on my computer. I tried on pws, apache, php 4.0.4, php
4.2.2 and php5 but it didn't work.
why i couldn't run it?
please help me!
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
--- End Message ---
--- Begin Message ---
> form.php is this:
>
> <form method="post" action="takeform.php">
> <input type="text" value="sentence">
> </form>
<input type="text" name="sentence" value="sentence">
Learn to code html ;)
> takeform.php is this:
>
> <?
> echo $sentence;
> ?>
echo $_POST['sentence'];
> these codes are running at my hosting
> but it couldn't run on my computer. I tried on pws, apache, php 4.0.4, php
> 4.2.2 and php5 but it didn't work.
>
> why i couldn't run it?
It's more than likely register_globals that is off.
--
me
--- End Message ---
--- Begin Message ---
just a few more tips.
the following ensures that an form input field by the name of 'sentence'
is actually sent via method=post, otherwhile you can escape it.
this is good for low level script integrity
if( isset($_POST['sentence']) ) echo $_POST['sentence'];
you might want to also look into the following functions.
rawurldecode()
htmlspecialchars()
addslashes()
stripslashes()
chop()
Chris Knipe wrote:
form.php is this:
<form method="post" action="takeform.php">
<input type="text" value="sentence">
</form>
<input type="text" name="sentence" value="sentence">
Learn to code html ;)
takeform.php is this:
<?
echo $sentence;
?>
echo $_POST['sentence'];
these codes are running at my hosting
but it couldn't run on my computer. I tried on pws, apache, php 4.0.4, php
4.2.2 and php5 but it didn't work.
why i couldn't run it?
It's more than likely register_globals that is off.
--
me
--- End Message ---
--- Begin Message ---
Hello,
This is a reply to an e-mail that you wrote on Sat, 19 Jul 2003 at
15:25, lines prefixed by '>' were originally written by you.
Two things...
> <form method="post" action="takeform.php">
> <input type="text" value="sentence">
> </form>
Your input does not have a name attribute.
> .............
> takeform.php is this:
> echo $sentence;
> .................
This line of code will onyl work if the name of your input tag is
sentence and register globals is switched on.
David.
--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/
Professional Web Development by David Nicholson
http://www.djnicholson.com/
QuizSender.com - How well do your friends actually know you?
http://www.quizsender.com/
(developed entirely in PHP)
--- End Message ---
--- Begin Message ---
Tom Rogers wrote:
Hi,
Saturday, July 19, 2003, 10:31:04 AM, you wrote:
DW> Folks,
DW> I've searched through the archives of the general mailing list and
DW> cannot find the answer to my question. My web hosting service requires
DW> ALL scripts run from /cgi. I've tried putting <?php ?> and <SCRIPT
language=php SCRIPT>> in my HTML files (located in /web/???) to run php
DW> commands but they aren't working. The web hosting "tech support" can
DW> only tell me that all php scripts must be located in /cgi; NO php code
DW> allowed in /web directory. So, how can I load an html file from /web,
DW> but within that file run a php script from /cgi?
DW> Thanks, and I'm sorry if this IS available in the archives.
DW> Dale
Time to find another 'serious' hosting company :-)
you may need to put this in the cgi file (if you are on a unix server)
#!/usr/bin/php
<?
include('/path_to_web/page.html');
.
.
?>
change /usr/bin to whatever directory the cgi version of php is in if
you can find out where they have hidden it.
Thanks for the response Tom. Unfortunately, that won't work either. A
little background.... I'm using Dreamweaver and their template feature.
for the site. I want to read some info out of a text file and format it
into the web page. (the hosting company doesn't support any db
either... I wish I COULD change companies, but...) So, if I use your
idea, when the html file is included in my php script in /cgi, the
images in the html file will be relative, not absolute (../images/***).
The only solution I can think of is to call the php script, have it
extract the info I need and deposit it (with html-formatting) into a
file, then have the html file include that file. Course, this will blow
up if more than one person accesses the site at the same time.
Anybody with any other thoughts?
Thanks
Dale
--- End Message ---
--- Begin Message ---
Here is the code I am trying to implement...
update table set col1=value where condition=true and condition=true order by
col2 desc, col3 desc limit 1;
The UPDATE command does not seem to support the ORDER BY part despite it
being listed in the instructions on the mysql.com website. Is there any
workaround to this that anybody knows of?
Thanks in advance for your help. :o)
--
Tony Tzankoff
http://www.tzankoff.com
=========================
--- End Message ---
--- Begin Message ---
what error message are you getting?
mysql_error() and mysql_errno()
Tony Tzankoff wrote:
Here is the code I am trying to implement...
update table set col1=value where condition=true and condition=true order by
col2 desc, col3 desc limit 1;
The UPDATE command does not seem to support the ORDER BY part despite it
being listed in the instructions on the mysql.com website. Is there any
workaround to this that anybody knows of?
Thanks in advance for your help. :o)
--- End Message ---
--- Begin Message ---
Hi Tony,
> The UPDATE command does not seem to support
> the ORDER BY part despite it being listed in the
> instructions on the mysql.com website.
This is only supported in versions 4 and above - if you're using 3.23 you
can get away with LIMIT in your update queries, but not ORDER BY.
Cheers
Jon
--- End Message ---