|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 22 Mar 2005 10:56:28 -0000 Issue 3352
php-general-digest-help
lists.php.net
Date: Tue Mar 22 2005 - 04:56:28 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 22 Mar 2005 10:56:28 -0000 Issue 3352
Topics (messages 211217 through 211279):
refreshing an included php file
211217 by: AndreaD
211218 by: Chris W. Parker
211222 by: Richard Lynch
211223 by: Jason Barnett
211246 by: AndreaD
[semi OT]: Planning projects
211219 by: Chris W. Parker
211220 by: Richard Lynch
211224 by: Jason Barnett
211229 by: Chris W. Parker
211234 by: Miles Thompson
211240 by: Robert Cummings
Download system
211221 by: JoShQuNe \(TR\)
211226 by: Richard Lynch
211231 by: JoShQuNe \(TR\)
211238 by: Chris Bruce
Building modular applications (long)
211225 by: Chris W. Parker
Re: ODBC Errors and Undefined functions
211227 by: Jason Barnett
211243 by: Jason Barnett
211259 by: Philip Olson
Re: fwrite and sort
211228 by: Richard Lynch
Re: looking for address finder..uk
211230 by: Richard Lynch
Re: carriage returns using error_log?
211232 by: Richard Lynch
Re: Regex
211233 by: Richard Lynch
Re: http authentication with safe mode enabled?!
211235 by: Richard Lynch
Re: Authorization header is missing from apache_request_headers() array
211236 by: Richard Lynch
211269 by: LacaK
Re: fopen
211237 by: Richard Lynch
211261 by: John Taylor-Johnston
211265 by: John Taylor-Johnston
Re: Chapter 38. Handling file uploads
211239 by: Richard Lynch
Re: Files upload - Encrypt into a variable - Do not injectinto db (PHP/Apache/MySQL)
211241 by: Richard Lynch
211251 by: Marek Kilimajer
Re: XML & HTTP
211242 by: Richard Lynch
Re: sessioncookies?
211244 by: Richard Lynch
Re: preg_replace with rawurlencoded?
211245 by: Richard Lynch
Re: getting text with strange encodng
211247 by: Richard Lynch
Re: Reading all headers sent
211248 by: Richard Lynch
Re: Custom errors handling class problem
211249 by: Richard Lynch
Re: can you help me ??
211250 by: Richard Lynch
211255 by: Marek Kilimajer
Re: something stupid... split().
211252 by: Richard Lynch
Re: opt-in mail list best practice
211253 by: Richard Lynch
Re: SimpleXML and xpath woes
211254 by: Richard Lynch
Re: obscure error message - PHP Notice: (null)(): Permission denied (errflg=2) in Unknown on line 0
211256 by: Richard Lynch
Re: PHP source code formatter for OS X
211257 by: Richard Lynch
Full-text searches sucks?
211258 by: Ryan A
211260 by: Larry E. Ullman
211263 by: Ryan A
211264 by: Larry E. Ullman
Apache user can't use exec(), passthru(), etc.
211262 by: Jim Poserina
access violation
211266 by: Rob Agar
Re: Different approach?
211267 by: John Taylor-Johnston
211268 by: Josh Whiting
Re: obscure error message - PHP Notice: (null)():
211270 by: M. Sokolewicz
Drop down list - persistant value
211271 by: Jacques
211272 by: Burhan Khalid
re-setting all cookies
211273 by: AndreaD
211274 by: Ken
211279 by: Burhan Khalid
remove space
211275 by: William Stokes
211277 by: Kim Madsen
211278 by: Chris Ramsay
Re: php.ini file
211276 by: Kim Madsen
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
I have a file, index.php and this has an included file, lets call it
calculate.php. When I insert values in text boxes and hit submit the values
are written as cookies. The question is how can I refresh calculate.php so
it shows the new value.
AD
attached mail follows:
AndreaD <mailto:andrea.davidson
silene.co.uk>
on Monday, March 21, 2005 2:27 PM said:
> I have a file, index.php and this has an included file, lets call it
> calculate.php. When I insert values in text boxes and hit submit the
> values are written as cookies. The question is how can I refresh
> calculate.php so it shows the new value.
By submitting the form probably...?
You haven't provided any code, or actual problems. If you wrote the code
correctly within calculate.php you wouldn't be asking this question.
Upon refresh/reload of index.php, calculate.php should be updating your
cookie.
Chris.
attached mail follows:
On Mon, March 21, 2005 2:27 pm, AndreaD said:
> I have a file, index.php and this has an included file, lets call it
> calculate.php. When I insert values in text boxes and hit submit the
> values
> are written as cookies. The question is how can I refresh calculate.php so
> it shows the new value.
When you set a cookie, it is sent *TO* the browser, to be sent *back* in
the *NEXT* HTTP request.
The browser itself does not have access to the cookies, so you can't, say,
use javaScript to do calculations with them.
The Cookies you just *sent* at the top of your script have not been sent
*back* yet -- But since you have the values at the top of the script, you
can use those same values in some variables to provide whatever
calculations you want.
Hope that helps you sort things out...
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
AndreaD wrote:
> I have a file, index.php and this has an included file, lets call it
> calculate.php. When I insert values in text boxes and hit submit the values
> are written as cookies. The question is how can I refresh calculate.php so
> it shows the new value.
>
> AD
You'll need calculate.php to setcookie(). Then on the *next* index.php
invocation $_COOKIE['yourcookie'] should get updated with the value you
wrote to the cookie.
The only way to "refresh" calculate.php is to finish output to the
browser and then refresh index.php. Although perhaps using a session is
better than using a cookie in this case?
I guess I don't grok your problem because the way you described it seems
trivial.
<?php
function calculate($var) { return "The value of var is $var"; }
/** From the browser / cookie / whatever */
$input = 11;
$output = calculate($input);
setcookie('yourcookie', $output);
/** And now you do whatever you want with output */
var_dump($output);
?>
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
attached mail follows:
Richard had got it spot on!!!!!
Have solved it by using iframes.
AD
"AndreaD" <andrea.davidson
silene.co.uk> wrote in message
news:20050321222731.78408.qmail
lists.php.net...
>I have a file, index.php and this has an included file, lets call it
>calculate.php. When I insert values in text boxes and hit submit the values
>are written as cookies. The question is how can I refresh calculate.php so
>it shows the new value.
>
> AD
attached mail follows:
Hello,
This is the only "programming" list I participate in so that is why I'm
asking my question here. I hope no one objects greatly!
So my question has to do with planning a project (not necessarily a
website in general, but a programming project specifically). I've got
Visio 2003 and a pad of paper with a pencil. I'm pretty much willing to
try out different methods although I prefer a visual approach.
I've googled on this subject quite a bit in the past but haven't really
found anything that satisfies me. That is, I've found some short
documents on flow charting, but nothing directly related to programming
(and what symbols to use, or how detailed to get). I've also tried just
writing out some pseudo-code but that always tends to get a little messy
when I try it.
If I start writing code outright I find myself rethinking a lot stuff
once I'm already pretty entrenched in what I've got. Of course this
turns into being a major pain going back and revamping stuff.
Anyway, I'd like to hear some feedback from the audience as far as what
works/doesn't work for you as well as some keyword recommendations that
I can feed Google with.
Thanks,
Chris.
attached mail follows:
On Mon, March 21, 2005 2:55 pm, Chris W. Parker said:
> a pad of paper with a pencil.
+1
:-)
Seriously, any time I try to plan something out for any kind of
programming, I find that a nice big desk surface, and a pencil and paper
are the best tools.
After I've got things worked out on paper, with all the scratch-outs,
circles and arrows, and am happy with the basic design, I then type up
something in plain text as my "final" draft.
Not claiming I don't end up revising the hell out of it in development,
mind you, but it seems to work, and I catch all the stuff I have enough
smarts to anticipate.
The stuff I can't anticipate, well, there you are, eh?
I've tried Visio and all that stuff, and find myself wasting *WAY* more
time lining up the damn boxes than actually thinking about what I want to
*do*.
YMMV
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
<disclaimer>I am not very good at diagramming these things!</disclaimer>
After programming in PHP for a while I ran across this (helpful)
website. Although I don't really do this like I should, perhaps this
link will explain things well and /or inspire you to do things "The
Right Way"?
http://www.jjg.net/ia/visvocab/
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
attached mail follows:
Richard Lynch <mailto:ceo
l-i-e.com>
on Monday, March 21, 2005 3:44 PM said:
> On Mon, March 21, 2005 2:55 pm, Chris W. Parker said:
>> a pad of paper with a pencil.
>
> +1
> Seriously, any time I try to plan something out for any kind of
> programming, I find that a nice big desk surface, and a pencil and
> paper are the best tools.
[snip]
All true.
And having read Jason's email I think I'll try to put that graphical
process into practice. Doesn't have to be in Visio considering...
> I've tried Visio and all that stuff, and find myself wasting *WAY*
> more time lining up the damn boxes than actually thinking about what
> I want to *do*.
Agreed.
Thanks,
Chris.
attached mail follows:
I'm with Richard - lots of scrap paper, couple of nice sharp HB pencils ...
let it ferment a bit,
then pseudocode in a plain text editor.
As for the graphics - well, I have an old template used in Introductory
Basic for the Control Data Corporation <whatever>. Haven't used it since
about 1970, but then keypunch machines have been scarce.
Cheers - Miles
At 08:02 PM 3/21/2005, Chris W. Parker wrote:
>Richard Lynch <mailto:ceo
l-i-e.com>
> on Monday, March 21, 2005 3:44 PM said:
>
> > On Mon, March 21, 2005 2:55 pm, Chris W. Parker said:
> >> a pad of paper with a pencil.
> >
> > +1
>
> > Seriously, any time I try to plan something out for any kind of
> > programming, I find that a nice big desk surface, and a pencil and
> > paper are the best tools.
>
>[snip]
>
>All true.
>
>And having read Jason's email I think I'll try to put that graphical
>process into practice. Doesn't have to be in Visio considering...
>
> > I've tried Visio and all that stuff, and find myself wasting *WAY*
> > more time lining up the damn boxes than actually thinking about what
> > I want to *do*.
>
>Agreed.
>
>
>
>Thanks,
>Chris.
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
On Mon, 2005-03-21 at 18:43, Richard Lynch wrote:
> On Mon, March 21, 2005 2:55 pm, Chris W. Parker said:
> > a pad of paper with a pencil.
>
> +1
+1
For the most part if you're working on this alone, then the pencil,
paper approach is probably the best. It doesn't matter how carefully you
plan your architecture you WILL want to change it and then not only will
you have to change your code, but that big fancy time-sucking, visio
diagram.
On the other hand if you are working with a bunch of people (and this is
especially true if they are remote from one another) then you really
MUST have some kind of clear and concise plan in place or you'll be
stepping all over each other.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
attached mail follows:
Hi, i want to add my site a more specific download system. The redirecting is now done by directly
giving the path of the file to variable. I want to do it over an id number.
(now: dl.php?rel=/files/somefile.zip, i want: dl.php?id=64b3j283) The file path and id is read
from mysql table. System is now; it matches from table and lets visitor to download but putting
this kind of path is something useless. Download script is just used for counting the hit but for
example i want to rename the file while giving to visitor instead of letting user to learn where
it is stored and its real name, The_Justice_by_Someone_MyDomain_com.zip looks like what i want to
have. I tried this system with header("Location: ......"); but it just opened a new page and
nothing happened else. For example if visitor uses FlashGet i want him to see just an address
which doesnt involve the real path and name. If any body can help me, please.. Thanx a lot..
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
attached mail follows:
On Mon, March 21, 2005 3:45 pm, JoShQuNe \(TR\) said:
> Hi, i want to add my site a more specific download system. The redirecting
> is now done by directly
> giving the path of the file to variable. I want to do it over an id
> number.
> (now: dl.php?rel=/files/somefile.zip, i want: dl.php?id=64b3j283) The file
> path and id is read
> from mysql table. System is now; it matches from table and lets visitor to
> download but putting
> this kind of path is something useless. Download script is just used for
> counting the hit but for
> example i want to rename the file while giving to visitor instead of
> letting user to learn where
> it is stored and its real name, The_Justice_by_Someone_MyDomain_com.zip
> looks like what i want to
> have. I tried this system with header("Location: ......"); but it just
> opened a new page and
> nothing happened else. For example if visitor uses FlashGet i want him to
> see just an address
> which doesnt involve the real path and name. If any body can help me,
> please.. Thanx a lot..
Some snippets of ideas that should be useful to you:
Build a table that relates secret tokens to filenames:
create table downloads (
token char(32) unique not null primary key,
filename varchar(255),
whattime time_stamp
);
Generate a secret token:
$token = md5(uniqid(rand(), true));
Put the file they asked for and the token in the table:
$query = "insert into downloads (token, filename) values ('$token',
'$download')";
You're on your own for the rest.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
--- Richard Lynch <ceo
l-i-e.com> wrote:
> On Mon, March 21, 2005 3:45 pm, JoShQuNe \(TR\) said:
> > Hi, i want to add my site a more specific download system. The redirecting
> > is now done by directly
> > giving the path of the file to variable. I want to do it over an id
> > number.
> > (now: dl.php?rel=/files/somefile.zip, i want: dl.php?id=64b3j283) The file
> > path and id is read
> > from mysql table. System is now; it matches from table and lets visitor to
> > download but putting
> > this kind of path is something useless. Download script is just used for
> > counting the hit but for
> > example i want to rename the file while giving to visitor instead of
> > letting user to learn where
> > it is stored and its real name, The_Justice_by_Someone_MyDomain_com.zip
> > looks like what i want to
> > have. I tried this system with header("Location: ......"); but it just
> > opened a new page and
> > nothing happened else. For example if visitor uses FlashGet i want him to
> > see just an address
> > which doesnt involve the real path and name. If any body can help me,
> > please.. Thanx a lot..
>
> Some snippets of ideas that should be useful to you:
>
> Build a table that relates secret tokens to filenames:
>
> create table downloads (
> token char(32) unique not null primary key,
> filename varchar(255),
> whattime time_stamp
> );
>
>
>
> Generate a secret token:
> $token = md5(uniqid(rand(), true));
>
> Put the file they asked for and the token in the table:
> $query = "insert into downloads (token, filename) values ('$token',
> '$download')";
>
> You're on your own for the rest.
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
>
>
Thanx for answer but i ve already done this part of job. I have got generated tokens for files but
at the time of download i can not use the token instead of file name and path. I want to redirect
to file while showing a senseless token but i can not imagine how to do it..
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
attached mail follows:
How about setting up symbolic links on the server in a tmp directory.
You could use the values from your database table to create the sym
links. Have the sym link be the token name and then have it linked to
the real file name. You could then have a cron job running to clear the
sym links at set intervals. I do this for a Royalty Free stock site and
it works great.
Chris
On Mar 21, 2005, at 7:08 PM, JoShQuNe ((TR)) wrote:
> --- Richard Lynch <ceo
l-i-e.com> wrote:
>> On Mon, March 21, 2005 3:45 pm, JoShQuNe \(TR\) said:
>>> Hi, i want to add my site a more specific download system. The
>>> redirecting
>>> is now done by directly
>>> giving the path of the file to variable. I want to do it over an id
>>> number.
>>> (now: dl.php?rel=/files/somefile.zip, i want: dl.php?id=64b3j283)
>>> The file
>>> path and id is read
>>> from mysql table. System is now; it matches from table and lets
>>> visitor to
>>> download but putting
>>> this kind of path is something useless. Download script is just used
>>> for
>>> counting the hit but for
>>> example i want to rename the file while giving to visitor instead of
>>> letting user to learn where
>>> it is stored and its real name,
>>> The_Justice_by_Someone_MyDomain_com.zip
>>> looks like what i want to
>>> have. I tried this system with header("Location: ......"); but it
>>> just
>>> opened a new page and
>>> nothing happened else. For example if visitor uses FlashGet i want
>>> him to
>>> see just an address
>>> which doesnt involve the real path and name. If any body can help me,
>>> please.. Thanx a lot..
>>
--
Chris Bruce
chris
idextrus.com
Idextrus E-Business Architects
http://www.idextrus.com
3282 Wilmar Cres.
Mississauga, ON
L5L4B2
CA
905.828.9189 South Office
705.361.0331 North Office
Skype: callto://chrisrjbruce
****************************************************************
This e-mail and its contents are privileged, confidential and
subject to copyright. If you are not the intended recipient,
please delete this e-mail immediately. Any unauthorized use
or disclosure of the information herein is prohibited.
attached mail follows:
MIME-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Date: Mon, 21 Mar 2005 15:56:11 -0800
Message-ID: <97FD54B5E57A1842AA1A4B232E476117824B
ati-ex-02.ati.local>
From: "Chris W. Parker" <cparker
swatgear.com>
To: <php-general
lists.php.net>
Subject: Building modular applications (long)
Hello,
So I was thinking about building some modularity into future projects
and wanted to bounce some ideas off my fellow list members.
My definition of "modular application" is: A modular application is one
that can have it's major functions added/removed with the click of a
button, or the creating/deleting of a file without breaking the
application on any level. The user should be able to add/remove a
module* from the filesystem and have the application update itself
automatically without any (or very little) interaction with the user of
the application.
For example, here is what I've come up with at this point for how a
modular application could be built.
First of all there would need to be some kind of script that
controls/integrats/manages the individual modules. I imagine this task
to be performed within an include file that is included at the top of
every file in the application (let's call it adjuster.php). This include
file would determine how to build the main menu based on certain factors
within the applications directory tree. Said another way, this file
would take an inventory of the available modules and build a menu based
on what it found. In this way a module could be added/removed without
any interaction** from the user and the menu would update automatically.
This in and of itself is not difficult. What I think the difficult part
of it will be is finding the appropriate way to construct modules. At
this point I'm imaging a directory called modules/ where each directory
within the modules/ directory is a module itself. It would contain all
the classes and functions associated with that module as well as a
definition file for that module (could be a simple .txt file).
Adjuster.php would read the modules/ directory and recursively discover
each module and then build the main menu accordingly.
Having said all that I think what I'm looking for is some feedback from
experienced person(s) on the list with building modular applications. I
can see this being really helpful for something like a shopping cart,
CRM, or CMS app.
Thanks,
Chris.
* In the short time I've been thinking about what a "module" is I've
determined it to be one of a few things (or a combination thereof). A
module could be (a) a single file, (b) a set of files, or (c) a
directory containing one or more files and/or directories.
** Not having any interaction with the user does not have to be a
requirement, but it would sure be helpful when upgrading the
application. For example: Customer comes to your website, buys a new
module (or downloads for free, however you choose to license the
software), and simply adds it to the module repository. Yadda yadda
yadda, a new, full functional menu option is available.
p.s. Are there any lists out there that deal with programming in
general?
attached mail follows:
Jay Blanchard wrote:
> [snip]
> Okie dokie. I have an odbc data and I can use odbc_result_all() to
> return data in an HTML table format. If I switch to odbc_fetch_array()
> or odbc_fetch_object() I get a call to an undefined function even though
> TFM says that these are available in 4.3.7 running phpinfo() shows that
> ODBC is enabled properly. I have googled for it, with no meaningful
> return except that at one time there may have been a bug.
>
> Signed
>
> *Scratching My Head in Texas*
> [/snip]
>
> I should have asked a question [*slaps own wrist*], huh? Has anyone
> encountered this before and is there a solution?
I haven't encountered this problem before. However, most of the time
when I run into a problem like this it's because there is a missing
library that is required *in addition to* the library for the extension.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
attached mail follows:
Oh and Jay... since no one else has found the answer it would be nice if
you could post your solution here when / if you find it.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
attached mail follows:
> Oh and Jay... since no one else has found the answer it would be nice if
> you could post your solution here when / if you find it.
Accoding to the source, these two functions require
something to exist:
#ifdef PHP_ODBC_HAVE_FETCH_HASH
PHP_FUNCTION(odbc_fetch_array);
PHP_FUNCTION(odbc_fetch_object);
#endif
Elsewhere in the source is this:
#if defined(HAVE_DBMAKER) || defined(PHP_WIN32) ||
defined(HAVE_IBMDB2) || defined(HAVE_UNIXODBC)
# define PHP_ODBC_HAVE_FETCH_HASH 1
#endif
So you need to meet one of the above requirements to have
those two functions available.
According to the changelog, many of these checks were added
in early 2003 (4.3.2) not that this has to do with you but
when documented these should be taken into account. I'll add
this documentation later this week :)
Regards,
Philip
attached mail follows:
http://php.net/asort
On Mon, March 21, 2005 12:29 pm, Sebastian said:
> i have a form with checkboxes which after POST it writes to a file.
> i would like to allow the user to sort the selected checkbox filename in
> the
> order they want it written to file.
>
> so i was thinking creating an input text box where they can enter a
> number,
> then have it written to file in that order.. question is how?
> the script starts like such:
>
> foreach($_POST['map'] AS $file)
> {
> if(file_exists('/maps/'.trim($file)))
> {
> $found .= $file;
> }
> }
>
> if (file_exists($mapcycle) && $found)
> {
> $fp = fopen($mapcycle, 'w');
> fwrite($fp, $found);
> fclose($fp);
> }
>
> any help is appreciated.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Mon, March 21, 2005 6:50 am, Jason Barnett said:
> AndreaD wrote:
>> I'm looking for an address finder where a user types in a postcode and
>> house
>> number and then the user is given an option of to houses to choose
>> from.
>>
>> Anything like this available for a small charge?
>>
>>
>> Ross
>
> Try talking to Richard Lynch... he *might* be able to help you out. Or
> at least he was talking about this same problem on the list a while back.
It's a work in progress, but so far the progress is so minimal that the
phrase "I got nothin" would be closest to what he needs.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
> Heh... no, I was already using double quotes. I also tried using actual
> carriage returns in the string, that didn't work either.
>
> Is error_log simply incapable of obeying carriage returns within the
> error string?
It works for me, but if it's not working for you...
function my_error_log($text){
$lines = explode("\n");
while (list(, $line) = each($lines)) error_log($line);
}
[shrug]
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Sun, March 20, 2005 3:18 pm, Colin Ross said:
> I'm trying to compress down a php-powered javascript file.
> In the file i have php run a bunch of loops and foreaches to build
> huge nested arrays for use in the javascript.
Have you considered using PHP to write JavaScript that will build the
arrays?...
If the arrays are at all predictable from a smaller set of data, this can
cut your bandwidth.
One starts to wonder if you're not maybe just going down the wrong path
entirely...
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
> I have no idea what to do to deal with this. There is only one .htaccess
> file, which is in the top-level directory of my account with my ISP. And
> I've even put
You can always add more .htaccess files in more directories, or edit the
one that's there.
> AuthType None
>
> in there, but it doesn't change anything.
> The fact that the uid of the script is appended to the realm specified
> shouldn't require any changes in the code, or should it?
No. It would only invalidate any "saved" logins or passwords from the old
realm being managed by the browser.
Different realm == different login/credentials needed.
> I really don't have any more ideas of what to do. What is probably
> important is that apparently my ISP upgraded his version of PHP to
> 4.3.10 which is now CGI instead of a module.
That's your ISP being silly, not PHP 4.3.10 "changing"
That said, HTTP Authentication WILL NOT WORK with CGI.
It is disabled in PHP source because, because your password would be
transmitted insecurely from Apache to PHP, and the PHP Team is not willing
to do that for obvious reasons.
Get your host to go back to PHP as Module, or switch to a form login.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Fri, March 18, 2005 6:24 am, LacaK said:
> When I try to use "HTTP Digest Authorization" using code like :
>
> Header( "HTTP/1.0 401 Unauthorized");
> Header( "WWW-Authenticate: Digest realm=\"www.myrealm.com\",
> opaque=\"opaque\", nonce=\"nonce\", stale=\"false\", qop=\"auth\"");
>
> browser returns in HTTP request Authorization header like this one :
> Digest username="lacak", realm="www.myrealm.com", qop="auth",
> algorithm="MD5", uri="/devel/phpinfo.php",
> nonce="5e8ac9b033001458fc5380d8a88325a2", nc=00000004,
> cnonce="c9495e4af19fa6b08eb045f32e6ced79",
> response="fbd8f86b45334202b2cac380f29d9706"
>
> When PHP runs as apache module with safe_mode=off
>
> I can read this header using apache_request_headers() function
>
> But when safe_mode=On,
> then apache_request_headers() returns no Authorization (this is documented
> behavior)
>
> Is this bug or exists other way how access Authorization header ?
> Can anyone help ?
> How to report this to php developers, to fix this problem ?
I could be *WAAAAAY* wrong, but I thought nobody ever bothered with Digest
Auth because, errrr.
It's not better/safer than HTTP Auth?
You might as well go with SSL if you go to that much trouble?
Not enough browsers support it?
Okay, so clearly I don't remember why I thought this.
Google for "PHP HTTP Digest Authentication" and see what turns up...
But don't be surprised if the answer is "Not supported"
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
Richard Lynch wrote:
> I could be *WAAAAAY* wrong, but I thought nobody ever bothered with Digest
> Auth because, errrr.
>
> It's not better/safer than HTTP Auth?
"HTTP Basic Authorization" send login:password in clear text (only
base64 encoded) so it can be 'eavesdropped'
in
"HTTP Digest Authorization" password is hashed md5(...) co can not be
direct readed.
Digest is more secure than Basic and was developed as replacement of Basic
>
> You might as well go with SSL if you go to that much trouble?
>
Yes SSL is solution, but when ISP does not support it ... ?
> Not enough browsers support it?
>
I have tested it with IE5.x, FireFox 1, Opera 7 and all works OK
> Okay, so clearly I don't remember why I thought this.
>
> Google for "PHP HTTP Digest Authentication" and see what turns up...
>
> But don't be surprised if the answer is "Not supported"
>
attached mail follows:
On Sat, March 19, 2005 6:48 am, John Taylor-Johnston said:
> chmod($defaultfile, 666);
http://php.net/chmod
has examples that tell you exactly why this is wrong...
666 is decimal.
The 666 you want is Octal.
They ain't the same number.
> What does the at_sign mean at the start of this line?
>
>
$results = fopen($datafilename, "w+");
means you are IGNORING any errors this generates.
It's usually a really bad idea unless you have some more code for error
checking.
> if (!$results) { die ("Our results file could not be opened for writing.
> Your score was not recorded. Please contact the person responsible and
> try again later."); }
> flock($results, 2); #lock file for writing
> fwrite($results, $filestr); #write $filestr to $results
> flock($results, 3); #unlock file
> fclose($results); #close file
This is an incorrect way to try to flock a file for writing.
You should:
1) Open the file for READING.
2) flock that file handle, so only YOU have access to that file.
3) Re-open the file for WRITING, now that you have control.
4) Write your data
5) Release the lock.
Your application, as it stands now, has a race condition between the open
for writing and the flock, which sooner or later, WILL bite you in the
ass.
Probably.
Maybe.
If $filestr is small enough, the Linux OS has locking built-in. Windows
may or may not (and I don't care enough about Windows to remember, much
less look it up). FreeBSD and other OSes may or may not also have locking
at OS layer. I wouldn't rely on it, though, since it's trivial to do the
5 steps above.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
Thanks for that!
John
Richard Lynch wrote:
> On Sat, March 19, 2005 6:48 am, John Taylor-Johnston said:
> > chmod($defaultfile, 666);
>
> http://php.net/chmod
>
> has examples that tell you exactly why this is wrong...
>
> 666 is decimal.
>
> The 666 you want is Octal.
>
> They ain't the same number.
>
> > What does the at_sign mean at the start of this line?
> >
> >
$results = fopen($datafilename, "w+");
>
>
means you are IGNORING any errors this generates.
>
> It's usually a really bad idea unless you have some more code for error
> checking.
>
> > if (!$results) { die ("Our results file could not be opened for writing.
> > Your score was not recorded. Please contact the person responsible and
> > try again later."); }
> > flock($results, 2); #lock file for writing
> > fwrite($results, $filestr); #write $filestr to $results
> > flock($results, 3); #unlock file
> > fclose($results); #close file
>
> This is an incorrect way to try to flock a file for writing.
>
> You should:
> 1) Open the file for READING.
> 2) flock that file handle, so only YOU have access to that file.
> 3) Re-open the file for WRITING, now that you have control.
> 4) Write your data
> 5) Release the lock.
>
> Your application, as it stands now, has a race condition between the open
> for writing and the flock, which sooner or later, WILL bite you in the
> ass.
>
> Probably.
>
> Maybe.
>
> If $filestr is small enough, the Linux OS has locking built-in. Windows
> may or may not (and I don't care enough about Windows to remember, much
> less look it up). FreeBSD and other OSes may or may not also have locking
> at OS layer. I wouldn't rely on it, though, since it's trivial to do the
> 5 steps above.
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
attached mail follows:
Richard, thanks.
> > chmod($defaultfile, 666);
> http://php.net/chmod
> has examples that tell you exactly why this is wrong...
> The 666 you want is Octal.
chmod($defaultfile, 0666);
Check. Thanks. Didn't pay enough attention to that.
> > What does the at_sign mean at the start of this line?
> >
$results = fopen($datafilename, "w+");
>
means you are IGNORING any errors this generates.
Hmm. Thanks. Decent to know.
> > flock($results, 2); #lock file for writing
> > fwrite($results, $filestr); #write $filestr to $results
> > flock($results, 3); #unlock file
> > fclose($results); #close file
> This is an incorrect way to try to flock a file for writing.
>
> You should:
> 1) Open the file for READING.
> 2) flock that file handle, so only YOU have access to that file.
> 3) Re-open the file for WRITING, now that you have control.
> 4) Write your data
> 5) Release the lock.
Could you show me a correct method, or example please? I admit I'm a little too newbie with flock. I have not used it since my Perl days, and even then ...
> http://l-i-e.com/artists.htm
Didn't know that!
Thanks,
John
attached mail follows:
On Fri, March 18, 2005 1:43 pm, Timothy A. Whitley, P.E. said:
> Warning: move_uploaded_file(/images/tim.jpg): failed to open stream: No
> such file or directory in
> /usr/hsphere/local/home/ice-admi/iceagents.com/CxDatabase/fileuploadh.ph
> p on line 20
Dollars to doughnuts there is *NO* /images directory on your machine.
There might be a /www/iceagents.com/public_html/images directory, or there
might be a /home/whitley/public_html/images directory or something like
that, but almost for sure there ain't no /images directory on your
machine.
If there *IS* such a directory, PHP needs write access to it.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Fri, March 18, 2005 12:00 pm, Steven Altsman said:
> Got packet bigger than 'max_allowed_packet'
>
> ... Gotta love mysql_error();
>
> If I find out what causes this, I'll bring it over to this list too..
> since
> it's been pretty quiet, I guess I've gotten folks stumped.
If that's a MySQL error, you're gonna be WAY better off asking on the
MySQL mailing lists...
At a guess, you're either trying to send a query that's WAAAAY too long,
or get back waaay too much data, or your database server and internet
server aren't doing TCP/IP packets nicely, or...
It could mean a whole lot of things, actually.
Google for the error message, and 'max_allowed_packet' and see what turns up.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
Steven Altsman wrote:
> Got packet bigger than 'max_allowed_packet'
>
> ... Gotta love mysql_error();
>
> If I find out what causes this, I'll bring it over to this list too.. since
> it's been pretty quiet, I guess I've gotten folks stumped.
>
I think you can put the encrypted file to the database in chunks. Split
the file up and append it to the column in a loop.
attached mail follows:
On Fri, March 18, 2005 11:14 am, Jerry Swanson said:
> I create XML file, how to pass the XML file to another server through
> HTTP?
Let's try it this way:
What's the other server?
Did you read their FAQ and their documentation?
Here are functions that, depending on what you read on the other server,
may be helpful:
http://php.net/file (GET)
http://php.net/fsockopen (POST)
http://php.net/curl (SSL)
The (WORD) indicates which function you would use, at a minimum, if you
find that word in the other server's documentation.
Note that in each case, you *could* use the next function down in my list,
if you wanted to do it the hard way. :-)
YMMV. NAIAA.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Fri, March 18, 2005 8:30 am, William Stokes said:
> OK. so can I set 2 or more session cookies for the same user? Like this:
> setcookie("sess_id","$sess_id",0,"/");
> setcookie("cookie2","$another_variable",0,"/");
>
> If so is there a limit?
The browser is not required to keep more than N cookies.
I think N is 30.
It *also* is not required to keep more than X kilobytes in all the cookies
from your server combined.
X is some reasonable number.
It doesn't matter because...
> Or is it a bad idea for some other reason?
It's a Bad Idea because it's just more crap going back and forth over HTTP
(slow) and more annoying to those of us who surf with some discretion over
Cookies. If your site sends too many Cookies for me to decide if they are
"okay" or not, buh-bye.
Use session_start() which sends *ONE* cookie, and then you can store
whatever you want in $_SESSION to tie it all to "me"
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Fri, March 18, 2005 8:18 am, BlackDex said:
> I have a litle problem with replaceing a string in some HTML code.
>
> the html code is:
> ---
> <img width="240" height="180"
> src="01%20-%20Raptor%20AMD%20Sempron_image001.jpg">
> ---
>
> I want to change the "01%20-%20Raptor%20AMD%20Sempron_image001.jpg"
> becouse
> the location of the file will be changed after the upload.
>
> the location for instains will be
> "/images/uploaded/01%20-%20Raptor%20AMD%20Sempron_image001.jpg"
$html = str_replace('src="', src="/images/uploaded/', $html);
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Fri, March 18, 2005 5:40 am, Diana Castillo said:
> no, its not html entity, it doesnt have a semicolon, its exactly as I
But some versions of Microsoft IE will display ® without the semi-colon
as an HTML-entity, in complete violation of HTML specifications. Yes,
really.
So some idiot may have though this was a Good Idea, and, after all, it
works in their browser, so it MUST be right!
Good Luck!
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
Search php.net for "RAW HTTP"
Maybe.
On Fri, March 18, 2005 3:28 am, martin said:
> Thanks for the answer,
> what I'm trying to achieve is a php proxy that receives any GET/POST
> request with correspoding headers and brings back the results to the
> caller.
>
> Let's say I do a google search request with curl:
> // I would like all this to be sent by another page --- (header + xml)
> $data ="soapreq.xml";
> $handle = fopen ($data, "r");
> $send = fread ($handle, filesize($data) );
> fclose($handle);
> $header[] ="MessageType:CALL";
> $header[] ="Content-Type:text/xml";
> // -------------------------------------- I don't know if what I want
> can be achieved this way, but maybe this explains better the idea.
>
> $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL,
> "http://api.google.com/search/beta2");
> curl_setopt($ch, CURLOPT_POST, 1);
> curl_setopt($ch, CURLOPT_POSTFIELDS, $send);
> curl_setopt ($ch, CURLOPT_HTTPHEADER, $header);
>
> $data = curl_exec($ch);
>
>
>
>
> Best regards,
> MARTIN
>
> Jesper Goos wrote:
>
>> The $SERVER variable is an array, so try this:
>>
>> <?
>> echo "<pre>";
>> print_r($_SERVER);
>> echo "</pre>";
>> ?>
>>
>> regards Jesper
>>
>> martin wrote:
>>
>>>
>>> Hi,
>>> I wanted to know if there is some way to expose the full headers sent
>>> to a php page.
>>> I found in google that for windows there is $_SERVER['ALL_HTTP'] to
>>> read all the headers sent but I'm using php on linux/apache.
>>>
>>> There is any way to get in a variable the full headers sent to a page ?
>>>
>>>
>>> Best regards,
>>> MARTIN
>>>
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Fri, March 18, 2005 12:46 am, Mihai Frisan said:
> I use a custom errors handling class, which set one of its methods as
> the php errors handler.
> All works well when I use this class in a file with only procedural code
> (all errors are caught by the custom errors handling class), but if I
> instantiate another class in this file, and in this class I have a
> error, this error is not caught by the custom errors handling class that
> I defined, instead is caught by the implicit php error handler.
> My question is what can I do to make my custom error handling class
> catch all the errors, even if they are in another class that I have
> instantiated?
Some errors are simply too heinous for PHP set_error_handler to catch.
See user notes on php.net/set_error_handler for discussion.
I think that's where it is... Maybe in bugs.php.net
At any rate, if you are hitting one of these errors, it has nothing to do
with your class, and everything to do with what set_error_handler simply
cannot cope with.
If your PHP source code simply cannot be parsed, those errors will not get
caught by set_error_handler.
That could be what's in your class file.
You'd have to tell us the error message and maybe even show us the lines
near the PHP error message.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Wed, March 16, 2005 1:57 am, Wahyu SP said:
> dear webmaster i would like to ask few questions :
> 1. can php determine the mime type of file without
> uploading a file ??
No.
It's none of your damn business what's on my hard drive. :-)
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
Richard Lynch wrote:
> On Wed, March 16, 2005 1:57 am, Wahyu SP said:
>
>>dear webmaster i would like to ask few questions :
>>1. can php determine the mime type of file without
>>uploading a file ??
>
>
> No.
>
> It's none of your damn business what's on my hard drive. :-)
>
Using javascript, you can read the "value" property of your file input.
You can get the extension from this value, this should be sufficient enough.
attached mail follows:
On Thu, March 17, 2005 3:16 am, Chris Knipe said:
> Lo all,
>
> echo ConvertTime($AcctSessionTime/90); # Returns: 03:17:46.7666666667
>
> I am trying to drop the .whatever.. Thus,
>
> list($Duration, $none) = split('.', ConvertTime($AcctSessionTime/90), 2);
>
>
> However, $Duration is empty, and $none has the whole string from
> ConvertTime.... As I said, something silly ;)
split does regular expressions.
Where '.' means "any character"
So you *could* do '\\.' instead of '.'
But http://php.net/explode is the better answer here.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Thu, March 17, 2005 2:37 am, Scott Haneda said:
> on 3/16/05 12:46 PM, Todd Trent at todd
hogfishdesign.com wrote:
>
>> - This could be hosted on shared hosting server.
>> - Opt-in list could be less than 100 or in the 1000¹s.
>> - May need a way to track sending success.
>
> Check this out:
> <http://phpmailer.sourceforge.net/>
>
> I use it to create HTML emails, send them to 1000's of people. I think I
> did a test to 30K or so, it handled it fine using mail locally.
>
> As for tracking, what we do is embed a image bug in the html and track
> when
> that loads, it is getting less reliable in todays anti spam world, but in
> my
> case these are paying subscribers so they generally want to get these
> emails.
>
> To track your users, at least the bounces we set the bounce address
> (return-path) to mysql_user_id
domain.com and POP check domain.com every
> few
> seconds. We then scan for the bounce address and mark that user as
> bouncing
> x times, if they go over y we cancel the account.
So I could forge a bunch of bounces from somebody else's email account and
guess/use their ID in your table, and get them kicked off your service?
Cool!
[that was light sarcasm]
You might maybe wanna use some kind of one-time token such as that
described on http://php.net/uniqid instead...
PS Yes, some semi-legitimate spammers will drop you from their lists if
you bounce email. The total scum spammmers won't -- Their return address
isn't even their own, much less something they check. I *WISH* all email
clients had a "Bounce" button to return emails as if they had bounced...
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Wed, March 16, 2005 9:39 am, Simon Turvey said:
> (Apologies for the larger than normal wrapping - there are some long
> lines)
>
> I'm playing with SimpleXML for reading REST responses from Amazon Web
> Services.
> Having successfuly read the response to my request I'd like to perform an
> xpath query
> on the result. I've pared down the original response to a static XML file
> for testing
> purposes containing the following:
WILD GUESS:
The static XML you have saved is out-dated from their session/whatever?...
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Wed, March 16, 2005 2:32 pm, Zinovi Boyadjiev said:
> I am getting this strange error while developing imap mail to mysql
> inporting script :
>
> PHP Notice: (null)(): Permission denied (errflg=2) in Unknown on line 0
This looks like a custom error message and/or something coming about as a
result of using http://php.net/eval
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
On Wed, March 16, 2005 8:11 pm, DuSTiN KRySaK said:
> Does anyone know of a PHP source code formatter to clean up sloppy code
> that runs on OS X?
http://php.net/highlight_string may or may not do some cleanup. Probably
not enough.
I think there's a PHP pretty-printer at http://phpclasses.org
You should Google for "PHP pretty print" and you will find solutions.
--
Like Music?
http://l-i-e.com/artists.htm
attached mail follows:
Hey all,
I just put in a search function for a site using mySql full text, i am
running it on my local server for now.
I am running it on two fields: ad_sub and ad_text
The results i getting are really quite bad, this is how i am testing it out:
1. I wrote an insert statement and looped it 700 times, so i have 700 test
records in the db which are identical
2. I found two words which are in the ad_text of the insert statement and
wrote a search statement like so:
SELECT *,
MATCH(ad_sub, ad_text) AGAINST('want to') AS score
FROM blk_ads
WHERE MATCH(ad_sub, ad_text) AGAINST('want to')
ORDER BY score DESC LIMIT 0,40;
2a. I have checked many times and this text " want to use a full....." is
present in the ad_text field
but mysql gives me no results.
Reading up on "full-text " I came accross this useful piece of info:
you should add at least 3 rows to the table before you try to match
anything, and what you're searching for should only be contained in one of
the three rows. This is because of the 50% threshold. If you insert only one
row, then now matter what you search for, it is in 50% or more of the rows
in the table, and therefore disregarded
which means because I i getting a match for well over 50% of the
records...its disregarding it.
Now i am in two minds if i should use this or go back to the same old dirty
way...of exploding the search and using LIKE '%%' for each word
Comments/suggestions?
Thanks,
Ryan
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.4 - Release Date: 3/18/2005
attached mail follows:
> which means because I i getting a match for well over 50% of the
> records...its disregarding it.
Yes, this is exactly the problem.
> Now i am in two minds if i should use this or go back to the same old
> dirty
> way...of exploding the search and using LIKE '%%' for each word
FULLTEXT searches are great; it's your testing of them that is poor.
What validity is there is "searching" through X number of identical
records? This isn't a real test at all. Also, FULLTEXT searches are
improved as the number of __different__ records increase.
If you want to see some results, regardless of the 50% threshold, use
the IN BOOLEAN MODE feature. Keep in mind, though, that in your case
any search will return either 0 or 700 results.
Larry
attached mail follows:
Hey!
Thanks for replying.
> FULLTEXT searches are great;
> it's your testing of them that is poor.
Kind of true, but I would have still been happy if it had found some records
rather than 0 results.
>Also, FULLTEXT searches are
>
> improved as the number of __different__ records increase.
Yep, I understood that from reading the docs.
> If you want to see some results, regardless of the 50% threshold, use
> the IN BOOLEAN MODE feature. Keep in mind, though, that in your case
> any search will return either 0 or 700 results.
I dont want to do that as its only mysql 4.1+ compatable, I presently DO
have a 4.1 setup....but if we shift hosts...i dont want it to "break" my
code.
Thanks,
Ryan
On 3/21/2005 8:03:39 PM, larryullman
dmcinsights.com wrote:
> > which means because I i getting a match for well over 50% of the
>
> > records...its disregarding it.
>
>
>
> Yes, this is exactly the problem.
>
>
>
> > Now i am in two minds if i should use this or go back to the same old
>
> > dirty
>
> > way...of exploding the search and using LIKE '%%' for each word
>
>
>
> FULLTEXT searches are great;
> it's your testing of them that is poor.
> What validity is there is "searching" through X number of identical
> records? This isn't
> a real test at all. Also, FULLTEXT searches are
>
> improved as the number of __different__ records increase.
>
>
>
> If you want to see some results, regardless of the 50% threshold, use
>
> the IN BOOLEAN MODE feature. Keep in mind, though, that in your case
>
> any search will return either 0 or 700 results.
>
>
>
> Larry
>
>
>
> --
>
> PHP General Mailing List (http://www.php.net/)
>
> To unsubscribe, visit: http://www.php.net/unsub.php
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005
attached mail follows:
> Thanks for replying.
You're quite welcome.
>> If you want to see some results, regardless of the 50% threshold, use
>> the IN BOOLEAN MODE feature. Keep in mind, though, that in your case
>> any search will return either 0 or 700 results.
>
> I dont want to do that as its only mysql 4.1+ compatable,
IN BOOLEAN MODE was added in version 4.0.1 not 4.1, for what it's worth.
Larry
attached mail follows:
If I run this PHP script:
<?php
echo '<pre>';
echo exec('whoami');
echo '</pre>';
?>
from the web, the output is
<pre></pre>and from the command line running as the apache user(webuser),
the output is.
Content-type: text/html
X-Powered-By: PHP/4.3.9
<pre></pre>But if I run from the command line as root, the output is:
Content-type: text/html
X-Powered-By: PHP/4.3.9
<pre>root</pre>and from the command line as a user in the root group, the
output is:
Content-type: text/html
X-Powered-By: PHP/4.3.9
<pre>jimpoz</pre>Safe mode is turned off. As webuser (or any non-root-group
user), no shell commands work. Not echo, not ls, not whoami, not touch. And
no shell functions work: no exec(), no passthru(), no shell_exec(), no
backticks. Every command I'm trying to run is world-readable and
world-executable.
If I turn safe mode on, it gives me a "safe mode is on" warning only about
lines that call shell_exec(), and not for exec() or any of the others. Other
than that, it doesn't hang or give any kind of error or anything when it
comes to a shell function call; apparently it just ignores them.
Anyone know what's wrong? I've been staring at this thing for three days and
have come up empty.
Thanks,
Jim
attached mail follows:
hi all
All of a sudden, my local install of Apache has started throwing access
violation errors. It's happening pretty frequently, particularly when
hitting the refresh button on a page generated from POST data, causing a
re-POST, but isn't 100% reproducible.
Anyone else had a problem like this? I couldn't find anything in the
php or apache bug databases that sounded like the same problem.
If anyone has debug mapfiles for the php dlls, or even better, win32
debug builds of 4.3.10, would it be possible to send them to me. I don't
have access to MSVC here, so I can't build them myself :(
Any suggestions welcome!
Windows XP pro SP2
Apache/1.3.33 (Win32)
PHP/4.3.10
stack trace:
7C910C27 C:\WINDOWS\system32\ntdll.dll
7C910D5C C:\WINDOWS\system32\ntdll.dll
77C2C2DE C:\WINDOWS\system32\msvcrt.dll
77C39AE9 C:\WINDOWS\system32\msvcrt.dll
77C35F5D C:\WINDOWS\system32\msvcrt.dll
77C35FEC C:\WINDOWS\system32\msvcrt.dll
10047D4E c:\php4\php4ts.dll
or sometimes:
77C46137 C:\WINDOWS\system32\msvcrt.dll
100CA6AE c:\php4\php4ts.dll
60002E50 c:\php4\php4apache.dll
6000186F c:\php4\php4apache.dll
dll base addresses:
0x60000000 php4apache.dll
0x10000000 php4ts.dll
Rob Agar
Web Site Consultant
Wild Lime Media - rob
wildlime.com
Studio 1, 70 McLeod Street, Cairns 4870
Tel: 07 4081 6677 | Fax: 07 4081 6679
Web and Software Development Services - www.wildlime.com
Search Engine Optimisation Services - search.wildlime.com
Professional Website Hosting Services -www.hostonlime.com.au
Winner 2004 Telstra North QLD Media Awards - Best Website - Online
Content & Information
attached mail follows:
Jochem,
> what is the context of the code you posted? ... in a function? class? part of an app?
> whats its purpose?
A singular, tutorial example I put together to show a basic way to connect and write if the table exists, if not create table.
> why do you need to check/create the table dynamically?
Newbie protection.
> why do you think the way its done now is 'bad'?
I'm not that skilled. Just checking with real coders. I'm more of a well-meaning academic who wants to share an idea with other teachers and show them an easy, applicable example of sending score results to a mysql server. It's part of a bigger tutorial:
http://compcanlit.usherbrooke.ca/eslcafe/hotpotatoes/hot-potatoes_104.htm
I'm still working on it.
> >>John Taylor-Johnston wrote:
> >>I've read:
> >>>http://dev.mysql.com/doc/mysql/en/create-table.html
> >>Would anyone code/approach this differently?
> >>#################################################
> >>$server = "localhost";
> >>$user = "myname";
> >>$pass = "mypass";
> >>$db = "mydb";
> >>$table = "demo_assignment1";
> >>#################################################
> >>$myconnection = mysql_connect($server,$user,$pass);
> >>#################################################
> >>$sql = "CREATE TABLE IF NOT EXISTS `demo_assignment1` (
> >>`StudentNumber` varchar(8) NOT NULL default '',
> >>`Exercise1` varchar(100) NOT NULL default '',
> >>`Exercise2` varchar(100) NOT NULL default '',
> >>`TimeStamp` timestamp(14) NOT NULL,
> >>PRIMARY KEY (`TimeStamp`)
> >>) TYPE=MyISAM COMMENT='place something here';";
> >>mysql_select_db($db,$myconnection);
> >>mysql_query($sql) or die(print mysql_error());
> >>#################################################
> >>$sql = "INSERT INTO $table
> >>(StudentNumber,Exercise1,Exercise2) values
> >>('$StudentNumber','$Exercise1','$Exercise2')";
> >>mysql_select_db($db,$myconnection);
> >>mysql_query($sql) or die(print mysql_error());
> >>mysql_close($myconnection);
--
John Taylor-Johnston
-----------------------------------------------------------------------------
°v° Bibliography of Comparative Studies in Canadian, Québec and Foreign Literatures
/(_)\ Université de Sherbrooke
^ ^
attached mail follows:
On Thu, Mar 17, 2005 at 11:01:44AM -0500, John Taylor-Johnston wrote:
> Hi,
>
> I've read:
>
> > http://dev.mysql.com/doc/mysql/en/create-table.html
>
> Would anyone code/approach this differently?
[...]
> $sql = "INSERT INTO $table
> (StudentNumber,Exercise1,Exercise2) values
> ('$StudentNumber','$Exercise1','$Exercise2')";
>
> mysql_select_db($db,$myconnection);
> mysql_query($sql) or die(print mysql_error());
>
your example looks pretty solid, but the code above does not escape the
$StudentNumber, $Exercise1, and $Exercise2 variables. If any of these
variables contain data that when placed into the SQL string interferes
with the SQL itself, you'll have unexpected failures and also a security
hole if untrusted users can populate those variables. The solution is
to wrap any strings or untrusted input like that in a call to
mysql_escape_string(), like so:
$sql = "INSERT INTO $table
(StudentNumber,Exercise1,Exercise2) values ('".
mysql_escape_string($StudentNumber)."','".
mysql_escape_string($Exercise1)."','".
mysql_escape_string($Exercise2)."')";
-jw
attached mail follows:
Richard Lynch wrote:
> On Wed, March 16, 2005 2:32 pm, Zinovi Boyadjiev said:
>
>>I am getting this strange error while developing imap mail to mysql
>>inporting script :
>>
>>PHP Notice: (null)(): Permission denied (errflg=2) in Unknown on line 0
>
>
> This looks like a custom error message and/or something coming about as a
> result of using http://php.net/eval
>
>
actually, last time I saw something like this was when I prepended a
(php) file via the auto_append_file setting, and that file /included/ or
opened another file that it didn't have access to. :)
attached mail follows:
I am using PHP. I have a registration page where the user has to select his
country form a drop down list. If the username that the user selected for
himself exists in the database I am sending him back to the registration
form with all the fields completed with the values he previously entered.
This is easy to do for a textfield but how do I indicate on the drop down
list which country he originally selected?
Please help.
Jacques
attached mail follows:
Jacques wrote:
> I am using PHP. I have a registration page where the user has to select his
> country form a drop down list. If the username that the user selected for
> himself exists in the database I am sending him back to the registration
> form with all the fields completed with the values he previously entered.
> This is easy to do for a textfield but how do I indicate on the drop down
> list which country he originally selected?
Set the attribute selected on the country, ie :
<option value="12" selected="selected">United States</option>
This is really a HTML question, not PHP related.
attached mail follows:
I want a button that resets all my cookies. Can I reset them all with a
foreach command?
AD
attached mail follows:
/*From the php manual
$arr = array(1, 2, 3, 4);
foreach ($arr as &$value) {
$value = $value * 2;
}
*/
$_COOKIE is a variable... but you need the key for setcookie(). so you can do:
foreach($_COOKIE as $key => $value){
setcookie("$key","", time()-3600);
}
i know there is the $value bit that we never use, but this is the
simplest form I can think of. can anyone else think of something
better?
HTH :D
On Tue, 22 Mar 2005 08:39:45 -0000, AndreaD
<andrea.davidson
silene.co.uk> wrote:
> I want a button that resets all my cookies. Can I reset them all with a
> foreach command?
>
> AD
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Ken wrote:
> /*From the php manual
> $arr = array(1, 2, 3, 4);
> foreach ($arr as &$value) {
> $value = $value * 2;
> }
> */
>
> $_COOKIE is a variable... but you need the key for setcookie(). so you can do:
>
> foreach($_COOKIE as $key => $value){
> setcookie("$key","", time()-3600);
> }
>
> i know there is the $value bit that we never use, but this is the
> simplest form I can think of. can anyone else think of something
> better?
foreach(array_keys($_COOKIE) as $key) { setcookie($key,"",....
attached mail follows:
Hello,
How can I remove a space character from variable value.
for example:
change
$name = "John Doe";
to
$name = "JohnDoe";
The blank space needs to be removed from the string. How?
Thanks a lot!
_will
attached mail follows:
> -----Original Message-----
> From: William Stokes [mailto:kalles
operamail.com]
> Sent: Tuesday, March 22, 2005 10:49 AM
> How can I remove a space character from variable value.
>
> for example:
> change
> $name = "John Doe";
> to
> $name = "JohnDoe";
>
> The blank space needs to be removed from the string. How?
Did You search? http://dk.php.net/manual-lookup.php?pattern=replace
Str_replace, ereg_replace, preg_replace is just a few friends, that will
help You. Php.net is Your best friend ;-)
--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/systemdeveloper
attached mail follows:
[snip]
> How can I remove a space character from variable value.
[/snip]
Take a look at preg_replace, for example...
RTFM
http://www.php.net/preg_replace ;)
chris
attached mail follows:
> -----Original Message-----
> From: Burhan Khalid [mailto:phplist
meidomus.com]
> Sent: Monday, March 21, 2005 2:05 PM
> > Hopefully not! Files in /tmp are deleted in most *NIX variants, this is
> > a _bad_ idea and the name of the folder pretty much tell You so...
> >
> > Default path is /usr/local/lib
>
> No, I don't think this is correct. The default path for temporary files
> is /tmp -- I just tested it on a clean install of PHP.
Ehhh... php.ini, a temp file?
> The whole point of temporary upload files is that they are deleted by
> the system, so you don't have stale files lying around. Which is why
> there is the move_uploaded_file function.
>
> This, of course, is assuming I didn't mis-interpret the question.
Quote: "> i'm experimenting with php on mandrake 10 and i'm not sure about a few things. first, where should the php.ini file go?"
I think You did indeed.
And I´ll correct my self for the info:
"If You compile PHP there´s a parameter to use:
--with-config-file-path=/usr/local/php.ini"
Skip the php.ini from the _path_ (doh!)
--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/systemdeveloper
- application/pgp-signature attachment: OpenPGP digital signature
- application/pgp-signature attachment: OpenPGP digital signature
- application/pgp-signature attachment: OpenPGP digital signature
- application/pgp-signature attachment: OpenPGP digital signature
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]