Secondly, where is a good place to read on the standards and formats used
by these different schemes. In the fsockopen() func, I made some writes
to 'GET / ' and 'HTTP 1.1' etc... After reading the script, I understand
what these imply, but not the importance, also, what other commmands are
Here's another question, possibly easier. Possibly even bone-headed.
What kind of checking/filtering/changing do I need to do on a
user-submitted string before I can feel comfortable using it to name a
new directory in the web root on Linux/Apache? Anybody have a quick
Regular Expression they
I have PHP installed on Apache and Unix with several vhosts so each vhost
has its own user account on Unix. Now when accessing a webpage, Apache
runs with user httpd.. but I want it to run as the user of the vhost
account.. How can I do that?
http://httpd.apache.org/docs/suexec.html
Is Googlebot (or any other bot) able to follow links that are php?
As others have already pointed out to you, what better place to find
information about google than google?
That, or your server logs - googlebot is great about identifying itself.
RTFM's aside, a little understanding of how HTTP
open(/tmp/sess_ce957a6f5c094441fbf7197aa683dec1, O_RDWR) failed: No space
left on device (28) in Unknown on line 0
can anyone explain what can i do with this? this always happen, btw, on
some of my php pages i always have sessions.
Sounds like you're out of room on whatever drive /tmp is mapped
Let the db server handle query/cache consistency ... why put yet another
server in the way that will have to be triggered by the underlying db to
clear ITS cache?
Very true, but tests I've done in the past with PostgreSQL and
MySQL-driven PHP sites show that adding a simple static file cache (for
There's 1 really important thing missing in PHP as I see it, and it's
the ability to keep variables in memory for as long as the programmer
choose. If this was possible there could be some truly great
optimizations done. Some things are very slow to create but very fast
to work with. I wrote
When I use the function bellow, and there is no occournce of the control
word, strpos shoul return false, but instead i returns 1, which is not
the intention. Does anybody here have an idea about what I am doing
wring???
You're adding the one:
$position = strpos($this-fileContent, \\.$word,
But I guess you can't write the tag and just do a PARAM NAME=movie
VALUE=show.php?id=xy etc. and have the show.php output the header...
Sure you can, as long as show.php outputs a valid flash file and the
correct content-type. As far as the browser is concerned, it's the same as
any other flash
Why create thumnails? You can resize the images on
the fly when needed.
It's generally good practice to trade CPU for disk space, where possible.
-
michal migurski- contact info and pgp key:
sf/ca
i hope someone can help me out... i have to replace
a href=order.php?order_id=12345
with
a href=order_12345.html
any ideas? thank you!
PCRE style:
'/a href=order.php\?order_id=(\d+)/'
replaced by 'a href=order_$1.html'.
-
I've read the manual several times on sorting multi-dimensional arrays,
but I can't seem to wrap my mind around what I need to do to accomplish
my goal.
//this is what I'm doing: (stepping through a result set, and putting it
into a multi-dimensional array.
while ($row =
mhm, I think there was a missunderstanding ;)
I want to know, how long the input-string could be (so that the encoded
strings, that you get, are unique)
In theory, you are limited by the fact that the MD5 message digest is 128
bits long, so collisions are /possible/, but not /probable/. In
does anyone know of a program/script that tracks incoming links from site
that youve traded links with. but not a simple php script that requires
the other site to link to www.mysite.com/links_in/12/ but some software
that analyses apache access logs for the referer field. this would mean
the
I want to get the POSTED data as it is without letting php to parse it.
You may be thinking of $HTTP_RAW_POST_DATA. You should set the
always_populate_raw_post_data config option someplace if you want to use
it reliably, though. See configuration directives in the manual.
I am looking for a comparison of features supported by PHP vs those
supported by Perl.
My gut tells me PHP is more robust, but we are trying to implement something
in a company that has long had a standard allowing Perl as a sanctioned
language, but current management does not want to fight for
Anyone know what is the php function for finding the length of the array?
I haven't found the answer at http://us3.php.net/manual/en/ref.array.php .
You are aware that all the available array functions are listed about
halfway down that page, right?
I have a folder full of html pages that I need to extract the content
from. They all have !-- content start -- and !--content end --
comment tags surrounding the content. I need an easy way (not one at a
time) to extract that content and place it in a new template.
Any ideas are appreciated. Im
i have a file name with the path ex food/italy/pizza/margherita.php. how
can i obtain the name of the file in this case margherita.php i know
there is a function, but i don't remember it.
basename(__FILE__) may work.
-
michal
Problem with looping over a CSV file (3 results for each line)?
Here is the script...
?php
$row = 1;
$file = fa.csv;
$id = fopen($file,r);
while($data = fgetcsv($id,100,,)) {
$num = count($data);
$row++;
for($c = 0; $c $num; $c++) {
echo host $data[0] {br /\nhardware
This was posted to Slashdot not too long ago, and seems applicable to
php-general given the frequent mentions of register_globals and usage of
the get and post arrays. It's a detailed explanation of many common ways
that software which is overly trusting of its input can be exploited, and
Here's a better example to what I meant from the last posting when I said
something about color=red#RowNum3.
--snip--
As in example #3, PHP seem to be able to distingush the difference when
there is a pound symbol, or # in it and know that '#RowNum3' is not part
of the post string to the variable,
$session_time = $current_time - $_SESSION('timestamp');
echo session time = $session_time seconds.br;
The output to the browser (Safari) is as follows:
inside check IF
Time = 1072308706.
Fatal error: Call to undefined function: array() in
How can I unlink files in a directory that are, for example older than 1
hour?
`find /path/to/dir -cmin +60 -type f -print0 | xargs -0 rm -f`;
-
michal migurski- contact info and pgp key:
sf/ca
Tortoise is a popular CVS client for windows -- CVS commands are added
to the contextual menu in [[whatever windows calls its Finder]]. All of
your files are edited locally, using the editor of your choice.
Does that mean you have to have Apache/PHP installed on your workstation?
No, it
I will be interfacing with a CVS server not hosted on a Windows machine
(it will be a bsd/*nix variant) and frankly I've never used it. What
client do all you Windows people use? Also, how does it wotk in
conjuction with your favorite editor? (Mine is HTML-Kit.) Is it necessary
to run some
I have an array in php like this:
$arr[0][0] = Something;
$arr[0][1] = Hello;
$arr[0][2] = Hi;
It is possible to post this array to another site in a form? Or how can i do
this?
It would help to serialize the array into a string, then pass it as a
regular value in a GET or POST request.
How does one go about using a JavaScript variable with PHP code. I have
a function in JavaScript that takes a single input parameter (ID). I
want to use this ID variable as the value on the where clause of a
database query.
Example: select * from somedatabase where field=ID
Can this be done,
[Snippit used]
$ipaddy = $_SERVER['REMOTE_ADDR'];
$host = $_SERVER['HTTP_HOST']; // as of now it is getting the name of
the server (i.e. localhost, 168.2.2.1)
jas
HTTP_HOST returns the name (or ip) of the machine on which php is
running. REMOTE_ADDR will return the ip of the client
Ah-hah! Jason hides under an email address that does not exist so one
cannot reply directly to him, only via the list. Does that not describe
the person well?
Insofar as he is cautious about spam, sure.
-
michal migurski-
Is there any particular advantage to having the default PHP install
exclude a lot of useful modules such as mcrypt, cli, sockets, etc?
Honestly, this has kind of been discussed this week in the encoder
thread. Where do you draw the line on what's useful or not and who does
the deciding on that?
This function I don't get at all, I hear all the time, if you want to
practice smart coding then turn register globals off, and be sure you keep
query data out of your script that is not set or defined with something
expected. So why would there be a function that returns true or false, $var
is
% Doing a quick search on google for SSH commands and SSH help returned
% quite a lot
% of crap that really didnt help me learn.
Good enough. What do you want to do?
Basically stop/restart apache when i make changes to the httpd.conf file.
But then thinking of it I realize that if I stop apache
There is evolution and then there is etiquette. Top-posting is not on
par with proving a theory (flat-earth v spherical-earth) or evolution
of systems. In as much as it is proper etiquette to trim and
bottom-post it is rude to be diametric, just as it is rude to fart on
purpose at a state
Forgive me for the simplistic question, I'm not much of a Unix, Apache,
or PHP wiz. I'm running Mac OS X 10.2 on a 12 PB. I've installed PHP
4.3.0 from Marc Lynric's site (http://www.entropy.ch). However, I cannot
actually find the installation files on my laptop.
My web server works. It serves
Could someone tell me how to pass a session cookie to different sub
domains, without passing it in url.
It's in the manaul...
http://www.php.net/manual/en/function.setcookie.php
To make the cookie available on all subdomains of example.com
then you'd set it to
I am looking for suggestions on a tool to load stress a php
application. We want to make sure that the application/web server will be
able to handle the amount of users we expect. I have found a few but they
seem to be very expensive. Can anyone suggestion an affordable and user
friendly stress
I have a line which strips the suffix (gif, GIF, TIFF, jpg, JPEG, etcetc
or I would just use basename() :-) from a string but it seems needlessly
drawn out:
$file = preg_split('/\./',$dirfiles[0]) ; $file = $file[0] ;
I would like to just assign the 0th element of the preg_split() output to
my
Whow, is that way of a loop really faster? I mean .. It looks as if the
accept same thing happens
- $upperlimit is set
- $i counter is set
- for every loop $i is set one higher
- Also for every loop the expression ($i$upperlimit) is evaluated.
Not sure, but I just did
Can someone show me a simple, clean way to apply one function (eg
stripslashes()) to every element in an array (eg $_POST)?
I've been doing it with a foreach() loop, but there has to be a better
way. I've also seen http://www.php.net/array_walk, but couldn't
determine how/if it suited my needs.
I'm looking for a function that does almost the same as array_unique()
But it must also delete the other duplicate entry.
snip
Untested pseudo-PHP follows -
$encountered_elements = array();
foreach($original_array as $key = $val)
if(in_array($val,
I'm looking for a function that does almost the same as array_unique()
But it must also delete the other duplicate entry.
snip
Untested pseudo-PHP follows -
$encountered_elements = array();
foreach($original_array as $key = $val)
if(in_array($val,
array(
'a' = 'one',
'b' = 'one',
'c' = 'zero',
'd' = 'two'
);
through this and am having a hind time with then logic... Could you
explain how the output would be array('c' = 'zero', 'd' = 'two')??
I was being pretty sloppy with the code (should've posted pseudocode to
begin with, my bad) but
I don't pretend to fully understand PHP references, or the strange and
mysterious ways that they work in regards to PHP objects, but I can tell
you how to acheive the results you desire. Someone else will have to
explain it. :)
snip
If someone sees that I'm leading Gareth astray here, feel free
Is there any pre-written code available on the net to generate thumbnail
images for a picture. I mean I send the path of the image and my PHP
Script should be able to generate a gif file of size 100x71 or something
like that.
If your server has Imagemagick installed (it seems pretty common), try:
It's said that you shouldn't use tables for layout, but does people
accutually listen to that? And what instead?
This is veering off-topic, but:
http://css-discuss.incutio.com/?page=CssLayouts
-
michal migurski- contact info and
My query output is about 20 to 30 records only. Instead of making the
visitors scroll the whole page, can I make a scrolling table with the
page such that the visitor scroll the results output table only?
This isn't strictly a PHP question, but you may want to look into the HTML
iframe element,
Lastly, where in the world did you get pedant? word for the day or
something? :-D Thats a real unusual word for normal everyday use, unless
you were trying to act pedant?? :-
The correct adverbial form is pedantically
;)
-
I do wonder what the rule for those born on Feb 29'th. Do they
celebrate they're birthday before or after it on non leap years?
Neither. They celebrate it on Feb 29th. So while we age every
year, they only age once every four. Make sense?
So their life expectancy is only ~19 years?
Have somebody any idea how I could do something like that?
snip javascript and PHP
You're somewhat out of luck, as the chain of events in your typical HTTP
transaction looks something like this...
[time]-
client request received from browser
If you are using PHP as an Apachemodule you also have the option of using
a url like
http://example.com/index.php/test/test.html
Apache will see that test.html is not available and will travel down the
directory path til it gets to the index.php (which should exist BTW) and
call that script.
This
Heh yes umm i know this. But how i could i catch this before is spits out
to an ugly error page so i can send to a custom error page.
Why would anyone but you ever see a parse error? It's the sort of thing
you fix before setting up custom error handling. :)
If you're using MySQL, you can use mysql_real_escape_string(). If
you're using another database, hopefully there is a similar function.
Doesn't MySQL automatically protect against attacks like SQL injection?
Or maybe it's that it automatically applies addslashes()? I can't
remember exactly.
Could some one tell me where can I find the documentation for the
Hedear() function?
The manual does not provide it but just some examples.
Check the HTTP spec for a definitive listing:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14
I got this project, I'm writing it in PHP of course. What I would
like to do is create a simple an efficient way to work on it from a
couple different locations/workstations. I'm throwing around the idea of
a CVS repository, but am not sure if this is the best way. Does anyone
have
If you've used it before, I can write more about how it can be used in
specific circumstances. I never start a project without starting a
repository someplace, and a combination of CVS and Make have really
helped me out with a lot of projects.
hmm.. i'm interested in seeing your approach with
: I have the following configuration.
:
: Redhat 8.0
: Apache/2.0.40 (stock redhat install)
: PHP 4.2.2 (stock redhat install)
:
: What I get when I try and run this is an Object Not Found.
If I was Apache, I would try to serve the file:
/index.php/var1/val1/var2/val2/index.php
or
Did a little more googling and found the answer.
In Apache 2.0, by default is does not allow this type of URL.
But I found a few article on it that explained that if I modified this
in httpd.conf modify, or add, this line.
AcceptPathInfo On
Don't know what it does, but it fixes the problem.
Thanks Justin, actually I was also thinking of the same, but just wanted
to confirm that it is really not a good idea.
Was also wondering if there is any third party solution ?.
A third-party solution to a bad idea?
-
michal
Dear All,
Does anybody have any solutions, which makes possible to produce static
pages of all dynamic cms once a day and can be easily integrated into
already made site?
Why do you need to do this? Is it because of hosting restrictions,
performance concerns, or portability/mirroring (which is a
As I wrote already this issue is mainly because of search engines
incompatibility with dynamic content sites (to be more exact - with urls
containing get parameters, in my case ex. index.shtml?lang=enmenu_id=23)
Which of your described solution would you suggest for my situation ?
Turck MMCache
I'm trying to have the output of the ps -ef command in Linux to my
browser. Can anyone help how to properly have the output in proper
format. I've used the passthru() function but the output is scrambled.
What do you mean by 'scrambled'? The following works for me:
echo 'pre', `ps -ef`,
my output is something like this:
UID PID PPID C STIME TTY TIME CMD root 1 0 0 Sep19 ? 00:00:04 init [3] root
2 1 0 Sep19 ? 00:00:00 [kflushd] root 3 1 0 Sep19 ? 00:00:09 [kupdate] root
snip
any idea?
Yeah, see David Otton's response, or look at the HTML source of your
output.
Warning: printf(): too few arguments in
/home/sites/site8/web/index_test.php on line 34
I cannot for the life of me figure out what the problem is. I've looked
thru archives, examples, and pages of a book all about printf, and this
just doesn't add up to me.. Anyone see the problem?
To print a
Does anyone know of a way to authenticate a person on one site and have
that authentication carried through to multiple sites?
Basically I'd like to have someone login on www.domain1.com and then have
their login be valid on www.domain2.com and www.domain3.com ... the
domain name is different so
Open sess_4f5d...0367 in any text editor and you will see your variable
there.
I can't. I'm unable to open or download or change the permissions. Is it
an array?
A serialized array, yes.
-
michal migurski- contact info and
The only part i am having trouble with is making the remote script
automatically look into the local computer's hard drive and grab the .txt
file.
snip
The problem with the code above is the path to the file does not show up
in the input type='file', and the user would still need to click on the
I was wondering, if anyone can help me with running system commands from
within php. Actually I have a script which deletes users from my database
(which is of course MySQL), now I want to delete those users from system
level also, as they are authenticated users of my OS also.
Now, the problem
I've created a class called university, it has a constructor which can
accept an id. If the id is sent during construction the constructor will
connect to a MySQL db to set all of the objects member variables to the
MySQl counterparts.
I'd like to include some error notification so if I send it
This all probably takes care about the problem with session id's in the
query string, which is known as referrer to the next website our visitor
visits. What I'm worrying and wondering about now are other users of the
server my site's at. They can most likely go into the /tmp folder and
just read
I need to print the following:
onClick=MM_openBrWindow('http://www.gilardi.com/pdf/gwyt1poc.pdf','','')
and I am not sure how to escape the ' characters.
with a slash.
http://www.google.com/search?q=php+single+quote+escape+site%3Aphp.net
$some_object = create_object('some_object');
This is really funny i've been doing php for a good while now but what is
the reason to use the symbol on the function ?
returns by reference.
-
michal migurski- contact info and
This is really funny i've been doing php for a good while now but what
is the reason to use the symbol on the function ?
returns by reference.
ok i get it but why would i need it in my example ?
I think it was a hypothetical thing on Brad's part ... one of the annoying
things about object
Ok, the reason I was getting this error seems to be related to Safari on
OS X. When I copy code segments in Safari and paste them in BBEdit they
generally looked ok, although there were extra spaces inserted in some
places. I then turned on show invisible characters and it made it even
more clear
Cuz the the way the PHP parser is written makes it impossible to discover
the error before it gets to the end of the file, and realizes that there
are no more braces to go around.
It definitely sucks... almost as badly as a stray backtick. Try finding
that little bugger at 1600x1280...
This is
I am building a recursive Menu object. Inside each menu item there is an
array which should allow me to add submenu items and so on. I am having
trouble, though, with getting the submenus to stay. They are
disappearing as I go along.
Without really going through your code (sorry) I would
Better to do this in an .htaccess file, so you don't incur PHP
processing overhead on the entire server (if there are others using
it).
Apache suggests not using .htaccess files at all because they require a
recursive traversing of directories looking for .htaccess files, because
some
It would be nice to have a php-function like
declare_superglobal($_MYFRAMEWORK);
And then use $_MYFRAMEWORK like $_GET.
You have a few options: if you are looking to set variables that are
static and atomic, you can use environmental variables in an .htaccess
file (getenv() to access them) or
For example, on a file called info.html, i want to have some PHP
code that actually gets executed.
In your httpd.conf add the line
AddType application/x-httpd-php html
Better to do this in an .htaccess file, so you don't incur PHP processing
overhead on the entire server (if there are
Thanks, but is this also possible for directories not on my server? Or
can i just use these functions?
Missed that bit, sorry. If the directory is not on your server, then you
need to go through FTP.
or SSH, or HTTP, or one of the other innumerable ways to get information
from one machine to
The PHP site seems to be down right now ... so here's the question: Is
it possible for PHP to tell me the current path of a page? For example:
www.whatever.com/this/page.php - I'd like PHP to return /this/page.php
... is that possible and if so, how so?
PHP site looks up to me, though I have
echo trtdYour score is: /tdtd; $score=split($P1OC1Q1,ΒΆ); echo
$score[0]./td/tr\n;
Do I have to go through all that to get score[0] ?
I think reset(split()) should work for getting the first element.
-
michal migurski- contact
What is the best way to pass the arguments so it is easy to maintain in
future if function behaviour changes by adding/removing one or more
arguments?
Currently i am passing arguments in array. But i think it is not the
clean way to do it and another approach i am using is functionName(arg1,
But some web pages when I cut and paste the URLs don't work. Like when
I search for something on Ebay. Could this be because of cookies?
That's a good guess! Yet further proof that cookies suck, except the
ones made with flour, shortening and sugar, of course.
Huh? seems like further proof
They are codes for date formatting.
Specifically:
%s represents seconds with leading zeros.
%d represents day of the month with leading zeros
They can also be codes for the printf family of functions:
%s represents string
%d represents number
See http://php.net/sprintf
I am not able to locate the file you are referring to. Please do
help me I am very much frustrated.
.htaccess files are described here:
http://httpd.apache.org/docs/configuring.html#htaccess
-
michal migurski- contact info
Here's a trick script. We know that some months have the last day
which is 30 while other is 31. As for February, it can be either 28 or
29. So, what's the trick in using the php to find out what is the last
day of the month if you want to checked it against the server's clock to
find out
I have created a little image manager. Mainly for personal usage but I
have a few friends that would like it as well. Anyway, the problem that
I've run into is that I can only select one file at a time using the form
attribute input type=file that I want to upload. Does anyone know of
a way to
I've never used GD or ImageMagick before.. can you guide me to any
tutorial, script, reference.. something upon the same that can help me
out?
Can you -please- do some of your own legwork once in a while?
http://www.google.com/search?q=imagemagick+tutorial
I want to get the current domain name in to a PHP variable.
print_r() the contents of $_SERVER to see all the information given to you
by the webserver -- the host name will be in there.
-
michal migurski- contact info and pgp
I have a large project underway which is (hopefully!) nearing completion,
running on the latest stable release, 4.3.2. However, strange things
have started happening...
My main page sometimes causes Apache to seg fault at some point during
the execution (e.g. [Sun Aug 10 18:05:55 2003] [notice]
There are two ways round your problem...
1. Set your cookie right at the top of the script, so as your first line
have something like: if(isset($_POST['vote'])){ setcookie(); }
2. Use output buffering, this will make PHP buffer all of your content
and not send it till you tell it to (or
At the risk of starting a flame/religious/holy war I find the One True
Brace style to have some inconsistency if it is as above. The 'function'
does not open the curly brace at the EOL, but the 'if' does.
Yeah, that's pretty much the definition of the OTBS. :)
I'm not sure why I find it so
I have written as part of my CMS, an image upload system, now when the
images are placed in the destination folder, they are owned by httpd.root
and I need to get them to be owned by siteuser.sitegroup.
I have tried to chmod and chgrp it to siteuser.sitegroup but it gives
permission denied
Is there a style guide for coding practices used when creating code to be
shared with the community?
PEAR has some, http://pear.php.net/manual/en/standards.php
I gave them a cursory glance, and they seem to be pretty solid -- in line
with standards that I used for the past year or so after
I am doing this for a client, and he doesn't have the ZZIPlib installed,
and would like to avoid it if possible. Any other ideas?
It has been mentioned before: use exec, or the backtick operator, and the
command-line tools: unzip, bunzip, gunzip, etc.
I need to write a script that will scan/read a given directory's contents
and delete files older than a certain date. Ideally, this will be a
script that runs via cron once a week and deletes all files it finds in
the directory older than 2 weeks from the current date. I do currently
have scripts
$HTTP_RAW_POST_DATA is an array...
with echo you'll only get array..
No, it's a string - just the raw bytes that were posted.
Is register globals ON or OFF? Either way, maybe try
$_SERVER['HTTP_RAW_POST_DATA']...
Also, ensure that always_populate_raw_post_data is on, too - see:
These errors are usually caused by an extra or missing brace or
quote/apostrophe/backtick. The best way to find where this is happening
is to use another error.
Alternatively, use a text editor that's syntax-aware. In bbedit for the
mac, finishing a closure or double-clicking on one (parens,
Thanks for the replies guys but the main reason I'm doing this is
because most times I don't have access to the servers, or not enough
preveleges to install myadmin or any other tools. I wish we had our own
server but I'm trying for a solution where you can't upload any tools and
cannot access
1 - 100 of 137 matches
Mail list logo