i have 3 php files onephp twophp threephp onephp form posts a variable _POST[name] to twophp which processes _POST[name]
sorry!!! I meant if (a and b) in all cases!
not a or b
did you get preg_replace working?
no
greetings. i wonder how php handles large POST data when running as fcgi instance. the server doesn't actualy start a new instance when all the running ones are busy with the uploading.
i got preg_match working but not preg_replace
I'd test the one that will be false more often than not last, would mean you're falling through to the 2nd check less often
Ahhh, thanks for testing!
I played around with Ajax for the first time today. It was very fun.
can anyone check if is the correct country code that appears here? http://www.orangesense.com/lab/ipforward/demo.php Thanks
logik-bomb - works for Australia
thanks
logik-bomb - no problem - I'm just discussing with my brain cells why they are on strike
if i read php_pcre.c correctly - it matches only digits for back references
Hi! is_array() tells me that $_POST['foo'] is an array, but when I try to do a foreach($_POST['foo'] as $foo) I get: 'warning: Invalid argument supplied for foreach()'. Any ideas?
knutin - does your code assign $foo as an array that you are passing back in $_POST - $_POST is an array
logik-bomb: works for Canada too.
thanks very much!
you could also do: print_r($_POST['foo']); to see what foo is being set to.
I've tried that, and it *is* an array
no
knutin - what if you set $new_foo = $_POST['foo'] and test if $new_foo is an array. I'm thinking its just picking up that $_POST is an array - that will tell you anyways
good idea.
XH )
no, that's wrong
XH ) 1
I have no idea what that 1 is doing there
there's nothing in my form besides what should be there
count($foo) returns nothing
what kind of nothing
if you had an array in an array - ie $_POST is an array and $foo is an array - testing $_POST is an array might always return if it exists.
is_array($_POST['foo']) wouldn't test if foo was an array?
knutin, you'd have to pull out each of the $_POST items and test those
ahh
how are you putting this foo back into the form again?
I'm not
how is it getting there in the first place?
I have some input type="checkbox" name="foo[]" /
foo is then an array and those elements exist if those checkboxes are ticked
it's generally easier if you use name="foo[value]" so you can check them as $_POST[foo][value] being true or not
meaning - any of those checkboxes
my php code is doing a system call which calls a shell script. my arguments need to have quotes around them however I think php is tripping them and hence my shell script doesn't run in php since the args are corrupted. Does php hosting strip quote by
default for security?
I don't care if one or ten boxes are checked, I need to iterate through them and do stuff
I'a
php has no sensible way of executing external things, they're all string arguments passed to the shlell
I'm doing the *exactly* same thing with other fields, that's why I'm getting so grey-haired
knutin - $my_checkboxes = $_POST['foo'] and test em
use name="foo[value]", then you can use array_keys to find out the names, and just test directly if they were checked
use escapeshellargs() or (something)
meow
hello, f00li5h.
that was put much more elegantly than my explanation
I had this problem, think I just cast whatever came back from the form as an array
it's luck that i even remember how post forms work, i have classes to do all that for me
(array) $_POST['foo']
ew.
ok. I see. thanks
watch the array be full of 'on's
hi guys. has anyone here used mysql slow query log?
Maybe the question is more appropriate for #mysql.
escapeshellarg is in the php.net docs but my php script claims Call to undefined function escapshellarg() do I have to include anything extra?
hi
do someone knows a good php code criptographer?
maybe php-cli? But I'm sure it shouldn't depend on that.
what?
SamuraiDio, Zend SafeGuard?
Umm… Reread your statement; Checked spelling lately?
that's terrible, thank you
heh. I hate those typoes
I'm 45 and I need to get reading glasses
I'm 30 and I just can't type properly
!+func array
o.o
What?
It looks up PHP4 function?
array isn't a function.
o.0
what? Array has always been and always will be a language construct
meow
http://us2.php.net/manual/en/language.types.array.php
:/
in all fairness, it does look stupidly like a function
but it's not.
ofcourse it's not
"foo" o.O ?
was just a magical comma
but ok, the manual is quite confusing about array, it even have php.net/function.array
I imagine 'language construct' something like 'a function, with which you can do funky things'
why can't I omitt the brackets on Array then?
Note: array() is a language construct used to represent literal arrays, and not a regular function.
langauge constructs != no brackets
language construct
Array() defines an array just like creating a variable
Because not all language constructs isn't specific about that. array() and isset() are 2 that come to my mind.
like "new" is used to make a new object
exit/die with values too
true
s/isn't/are/?
except isset() is a function
new doesn't need any parens, although it's an operator
enygma, nope
enygma, the manual only makes the distinction in the manual entry for those "functions"
manual! luxury! in my day, used to have to read source code with bare hands!
it's not possible that isset is a function. Using an undefined variable anywhere else would throw E_NOTICE.
is empty a function then?
nope
no
ah! so that is it's whole reason for existance, empty($foo) = @! $foo
o.O
well, it exists only to silence the notice, and negate the value
no, not really
f00li5h, but, you can't use expression, you would with !
could*
you what, sorry?
compare and contrast
sulencing the notice isn't same as checking if the variable is defined.
f00li5h, you can use !trim($a) while you can't use empty(trim($a)); so they're not the same, negation offers more possibilities
quoth hp.net/function.empty q{ empty() is the opposite of (boolean) var, except that no warning is generated when the variable is not set. }
so in exchange for silencing the notice, i loose scope for using the construct
how do i fix this error? Fatal error: Call to undefined function: array()
o.O
are you using array_map or something?
lul
’cause array isn't a function
and so it can't be a callback
show line in wicha you have this error
aside of that, array() can't be used as callback.
is it possible to fake the $GLOBALS['REMOTE_ADDR'] for local testing?
well, at compile time, it gets translated to something liiking like "check if $a is empty", while a normal function looks like "call func with arg index"
logik-bomb: Anything that comes from the client side can be faked.
this is the line the error is on
VALUES ("' . $_POST['country'] . '", "' . $gender($_POST['gender']) . '", "' . $birthday . '", "' . $ethnicity($_POST['ethnicity']) . '", "' . $_POST['tellCity'] . '","' . $_POST['tellProvince'] . '",
Wolfpaws thanks
whats wrong with calling an array element like this? $gender($_POST['gender'])
One of those variables is array rather than proper function name.
oh wait
i need square brackets
escape your cursed data
i just remembered lol
can you say sql host injection
where can i find a channel for people who do graphic design/logos ? im looking for freelancers
yeh i will escape it when i add the validation
just testing if it works for now
!+jobs
no job posting / asking for jobs on ##php (see /msg php-bot g7). You might want to check out: ##php.jobs http://www.geekfinder.com, http://www.monster.com, http://www.rentacoder.com or http://www.getacoder.com, or php.net/links, "Developers and Job Opportunities".
I'd recommend going to any one of the numerous freelancer sites.
Wolfpaws - I wanna add my site to that
!+sql injection
It's a really bad idea to put variables directly into SQL queries. Always escape them using a function like mysql_escape_string() first, and make sure the data matches the format you're expecting. For more information, see http://www.php.net/manual/security.database.sql-injection.php | Examples can be seen here: http://www.unixwiz.net/techtips/sql-injection.html
Such as the ones listed by php-bot
knock yourself out. You know how to change that?
tell me how about work as php programmer in uk ?
that little number is for you
nope :/
pm?
yeh i know how to escape them
i just didn't add that yet..
So I've been trying to trouble shoot my site's terrible performance on a shared hosting environment. I got my web host to turn on the mysql slow query log for a week and send it to me. One query (for example) that gets run faily regularily on my site,
takes 10 seconds sometimes, other times 22 seconds, other times 210 seconds. Does this PROVE that it's not an indexing/code performance, but rather the hosting environment? Due to the
benchmark your code.
proof is rarely conclusive
hi all
It's the first thing I add.
That way I don't forget.
No excuses.
anyonw know how I can print the content of an array?
will benchmarking my code explain the hugely varying query times on mysql?
o.o ok
echo $array give me Array but I want see the content, any idea?
It can.
Loop through the array?
print_r($array);
indro:
or loop through the array
ack
it'll tell you where to look more than anything
okay, thanks!
Mace[work]: how?
If your executing similar queries constantly consider enabling the mysql cache by giving it a maximum value
that's the magic of it - tias
mysql cache is enabled in all versions of mysql, it's just given a MAX size of 0mb
hmmm really… is it changeable without root access?
im thinking of just moving hosts. page requests time out regularily, at best respond in 10-20 seconds. when they 'reboot' the server, everything's lightning fast, then over days it slows down to a halt again.
they claim the shared hosting environments pretty 'full' on that server
it could well be your scripts, try them on a dedicated server
I have this in my index.php | http://pastebin.ca/658245 | Is there anyway to redirect the user to the index.php without enter in an infinite cycle? Thanks
aka your computer
will do
I just did my first security related php hosting bug report on bugs.php.net !
but i dont really see how the scripts/code could explain the varying times. if my code or queries was REALLY shit, the response time would be consistantly really shit, no?
[dev]Viper: I'm resisting comments.
220 secondss, for the same query
well if they're caching the difference in times could be explained by the query either being in the cache or not.. you just never *know*
yeah true Mace[work]
you can't resist. come to teh dark side !
[dev]Viper: Did you report all of PHP?
not exactly
hi i want datagrid control with edit capability.
Uh… What?
lol
he wants to change arrays
That's my guess
you could look into dojo's turbogrid.
What this address?
be better.
does anyone understands how the regular expressions and mod_rewrite work?
people on #apache do
Hey all, am I being dense? Is it possible to have ZendOptimiser AND APC installed at the same time? after installing optimiser Aapache segfaults on every hit, I've tried uninstalling and reinstalling apc through "pecl (un)install apc", but no joy
f00li5h thanks
sure thing
thats the hacker uncertainty principle logik-bomb
thank you.
what, optimiser and apc?
http://bugs.php.net/bug.php?id=42310
what about it?
sorry, thought you were suggesting they were mutually exclusive
[dev]Viper: What about it and how it concerns me?
JediMaster, i can imagine they would conflict quite badly
I posted it, I was wondering what do you think, I am pretty sure this can be developed
i think theres some php.ini settings to disable APC
might be worth a try
hey folks
well I can just comment out the apc.so line, but I need APC, and I need ZendOptimiser =/
hey
is imap support included in the build of mod_php by default?
JediMaster, i thought the Zend product and APC did the same thing
possibly, but I have some code that actually uses APC functions to cache data
maybe you'll need to specify alternate PHP configurations for different hosts then
[dev]Viper: I still don't know, what exactly do you want. From what I gather, that behaviour isn't wrong notr unexpected.
you can add php.ini directives in .htaccess files
s/notr/nor
why I don't have imap support with my php installation?
Some of them, at least
this is the problem, I need both APC and ZO on the same virtual host =(
yeah, wondering now if extensions really falls into that lot
you might be fooked then, JediMaster. for want of a better word
heh, I can drop the apc functions if I have to
you can't enable extensions via htaccess. You can use dl() in PHP scripts, but dl has to be enabled and accessable.
that makes sense.
here
rza, huzzah
rza, the Windows build worked fine. No errors what so ever on my end. I tested an old copy and a new copy. Didn't notice much of a slow down at all.
did you get errors with the old copy?
yeah
I got crashes
i tested several image formats so it looks fixed BUT its still a hack
a if you're windows and its a thread safe copy hack
do you want to create the RC release?
or shall i make it?
you can do it, I'm still fighting stuff
I'm using phpMyAdmin, and i have a little problem. What is wrong here? http://rafb.net/p/0g9pQT74.html
what SQL error are you getting?
Check the link. It's phpMyAdmin, so that is the error i get.
sorry didnt see the error at the bottom
I just fileed in the phpMyAdmin create table form. What have i done wrong? /I'm a total noob when it comes to sql.)
unrelated, but did you want to generate the 'id' yourself? cos otherwise you should add AUTO_INCREMENT
any swedes around here
Yes, i want to name the id fields myself.
Japp!
is there a function that gives me http://www.example.com/cleanurl/ when I have http://www.example.com/notsoclean/../cleanurl/ ?
anyone?
how can i get the mime type of a file?
claesson92, hur säga man "click to play" på svensk?
"Klicka för att spela"
tackson
:-)
is there a function that gives me http://www.example.com/cleanurl/ when I have http://www.example.com/notsoclean/../cleanurl/ ?
you should specify how long this double is.. for exmpale (5,2) and then you cannot use text as key like that
Where you from?
wow, lots of people dwelling in here for no apparent reason, it seems
not very nice to repeat yourself. whoever knows and want to help will do. How do you expect this function to know what nice url is for you?
resolve ugly paths with '../' in it
like realpath can on paths
So you mean i should put the double's length to 999.99 or something like that?
doesnt browser strip it already?
well use realpath…how you got to this ../ anyhow. must be hard. maybe apache rewrite or something
yes, but that doesn't give me a clean url in my variable
realpath doesn't work on URLs, only on Paths
claesson92, sweden currently
3 this will allow to 999 and digits after comma. 2 will allow to 99 for a total of 999.99 not 100% sure but makes most sense
and urls in most of the part are exactly paths. should be more specific.
well, i just tested quicly with firefox and firefox seems to be stripping the .. before the request
… I need the clean URL in a Variable, not in the browser
still, realpath doesn't work.. I want to know if there's a function who resolves paths in URLs, c'est tout
Really sorry to ask more. But you mean like (4.2)
ello ello
I got it! Ithink..
yereth what do you need to do
will pathinfo() do what you need?
who is producing these ../ stuff ?! I get your problem will be best web hosting solve by some weird apache rewrite rule.. as you refuse to think urls have something to do with php and realpath
more like (4,2)
… I need a clean variable, I can pass through to JS so it can compare URLs later, in post-processing… I'm sure that doesn't help
asking me why the path is like it is doesn't help, thank you
no prob
yereth give an example of the path you need to "clean"
One more error to solve. #1170 - BLOB/TEXT column 'id' used in key specification without a key length
I came in with an example.. I'll re-enter
mk
kkelly
I want http://www.example.com/cleanurl/ when I have http://www.example.com/notsoclean/../cleanurl/ ?
yep solve it
?
what denotes the "notsoclean" part?
…. a path?
a path
might be of interest http://www.mydigitallife.info/2007/07/09/mysql-error-1170-42000-blobtext-column-used-in-key-specification-without-a-key-length/
it's just a path.. like any path.. a physical path actually..
Thanks.
yep. thats what I think too.
that could actually mean something to that site
I know for sure
Next time i'm in the city i should get a mysql book from the library.
ok, yereth
do this
enjoy reading
since example.com could be doing some rewriting of the url, or some other funkyness
Hello
guys.. it's my own website.. I know exactly what's going on
all I want is a function that resolves '../' parts
does it exist? or not?
why are there such parts at all !? I don't get it. directly on url no. there is no such function. build one and let us know
try this
well one sec
I'm honoured you want to place yourself into my head, that's all lovely, but it's not what I need
So, i can't have a text/blob as a key?
I'm getting the soapfault exception "unable to parse url in…" for this URL: https://internal.example.com:80/internal/?q=sync/modules&wsdl … is there something wrong with that?
thanks
er..
thanks.. that's all I want to know actually
no idea First time I see this error..just googled it for you I personally don't see any point at all to have key text/blob as key
This error is driving me mad
Why can't soap be a bit more detailed with the error messages. The URL looks just fine to me!
Now it worked. I can't really tell why i used longtext to store the name of an item in a webshop. Varchar is smarter + it works.
parse_url() is only thing theoretically that could help somehow.
yereth try this
$url = $_SERVER['REQUEST_URI'];
$path = pathinfo($url,PATHINFO_DIRNAME);
$pathParts = explode($path);
oops
$url = $_SERVER['REQUEST_URI'];
$path = pathinfo($url,PATHINFO_DIRNAME);
$pathParts = explode('/'$path);
maybe you need to encode the url, because of the slashes after your '?'
yereth, I'll give it a shot
that will give you an array like this.. url = "/some/stupid/path
the array will look like this array('some','stupid','path')
bom dia a todos
you can do whatever you want to it
good morning
buenos dias
Not until you add the missing , though
yeah and I can run through it, resolving the '..' parts by removing it's brother
cheers
yereth did that help
I installed php5-mysql but it still says that it doesnt know the mysql_connect function..
well, I'm working on it.. but it was actually kind of what I was planning if there's was no function available
install the lib files correctly
yereth you can try parse_url but that will only parse a query string (?foo=bar&poop=crap )
I know
kk
ok i'm out
c ya
bye then
hi
can anyone help ?
how can i assign ShelfLife directly if there is only one element in the list? foreach($ShelfLifeList-getObjectList() as $ShelfLife)
jax, i don't follow. the 1 item from the list is in $ShelfLife
is there a simple way to get the first element from an associative array?
not exactly, sparrw
heh
PHP doesn't guarentee any logical order when using non-numeric keys
so $array[keys($array)[0]] ?
guarantee, even
the keys are numeric
they are just very large numbers
do you care about the key?
maybe
how are the keys significant? do you want the lowest number?
yes
and they are sorted
sort( $array );
ok, then you could use array_values() to get the values, and take the the first index.
or array_keys, if you want the key.
hey friends
Shrike|work if $ShelfLifeList-getObjectList() only contains one element, i just want to assign it to $ShelfLife
instead of doing the foreach
you can't do that in a one-liner, unless you implement something from the SPL. array notation is not compatible with object notation.
$list = $ShelfLifeList-getObjectList(); $ShelfLife = $list[0];
Hello
how is everyone
hello
on this wonderful august day
I have a question
relating to an error I get with php
syntax error, unexpected T_VARIABLE in /home/chrisdi/public_html/admin.php on line 20
Can someone elaborate what that means, a little?
missing semicolon?
I couldnt see a missing semicolon anywhere
let me try posting the entire code
php
if(isset($_POST['FetchData'])) {
$mysql_connection = mysql_connect('localhost','chrisdi','11235813218771150603571') or die(mysql_error());
$mysql_database = mysql_select_db('chrisdi_userinformation') or die(mysql_error());
$query = 'SELECT * FROM billinginformation ORDER BY UserID DESC';
$data = mysql_query($query);
$array = mysql_fetch_array($query);
print_r $array;
mysql_close($mysql_connection);
}
…
pastebin would be better Chrisv
I don't think its a missing semicolon
Yeah, good point
print_r isn't language construct
Chrisv nice password hahaha
lol
I wanted to know if there is a proven way to make select and update queries with php host to mysql database
in other words, you're missing parens around print_r
I actually know that password by heart
hmm
Chrisv hahaha
that is a rewrite of this page's example http://us.php.net/manual/en/ref.mysql.php
brb
speaking of, using a loing and password, aint kosher, right? You want the database to be setup as anon access, right?
"You want the database hosting to be setup as anon access, right?"- well, it is going to recieve data from a form where users submit information
davis, you run your databases with anonymous logins?
Oh lord.
Oh. Lord.
i guess that is a mistake
so, is it common to use the login and passowrd in the .php file on a server?
well yeah, pretty much.
i was thinking it would be a security breach.
more so than letting anyone at all access your database?
is there something like predefined queries or anything like that…think I heard sth like that for java, but I'm not sure
do you only use a login which has mysql read access?
login in every case guy
yes, that is dumb. thanks for the tip.
i use sql hosting server, but yes the user has restricted permissions.
What are you trying to do?\
mysql without login, just in test servers
ok.
do you login to the webpage via apache or via php?
in a login system?
What's wrong with mysql stuff without logins?
you'll store informations in a mysql without password?
i think not ;}
Ummm… What? As in mysql username without password?
can someone point me to ao guide on installing and configuring php4 and php5 on the same serve4r
Wolfpaws forget about guy
hehe
just install php as CGI. php.net/install or google will help
I'm bad at forgetting. So what's the deal?
anyone :}
algum brasileiro perdido por aqui?
Wolfpaws, the deal was anonymous logins on a database.
if you're running a demo application that manages the database, I don't see what's the problem.
I have another question, if you dont mind
if it doesn't include pasting code in the channel, no.
code is written , not spoken
hah
what?
http://pastebin.com/m8f59303
that is the php to my submit page
never insert post data like that into a query
Im a php newbie so you might have to explain
php.net/mysql_real_escape_string
!+sql injection
It's a really bad idea to put variables directly into SQL queries. Always escape them using a function like mysql_escape_string() first, and make sure the data matches the format you're expecting. For more information, see http://www.php.net/manual/security.database.sql-injection.php | Examples can be seen here: http://www.unixwiz.net/techtips/sql-injection.html
^— that
who want's roasted pork-chops
ok thanks
i say that
hehe
Where does that question part kicks in?
does anyone know how I can turn variables not existing into exceptions?
i know how to turn them into notices
Well, you can do isset magic. But handling undefined vars via exception system directly is no-no.
why a no-no?
because you can't do that.
Where does that question part kicks in?-I fell asleep
hah
the question
its the question that drives us wolfpaws
(sorry for matrix quote)
you can catch notices with set_error_handler() and throw an exception
anyway
if you really wnated to
my question is gone because I just realized I have to overhaul my entire data submission form
not sure if this is a php or a mysql question so i'll start here and go there if i need to:
I do, massively
i have the following query written
is there a specific class of Notice for undefined?
if I want my database and our nations people to be protected
as well as canadians for the sake of this form
no. It just says that index or variable is undefined.
SELECT * FROM Assignemnts WHERE Class = 'php echo $_GET['ClassName'] ?
'
i keep getting syntax errors when i call the page
I didnt realize how vulnerable php was to attack
That is wrong in so many ways…
ok — whats wrong with it?
PHP has nothing to do with that.
cool nick btw
PHP has nothing to do with that."- nothing to do with what?
oh
yes
there.
sorry mysql
Hi! How can i get the name of the folder the running script is in? Something that returns "myfolder" from: /path/to/myfolder/mysript.php
so i cannot insert values from my URL into the query?
A failproof way to make a form to submit data would be to make the form save the data to a file on the server instead of a database
so I'm going to have to parse the warning string to discern between warnings about undefined variables and other warnings?
No. Everything is vulnerable. And it's up to the programmer to assure it's at highest level of security.
wolfpaws are you saying simple php input forms are vulnerable to some kind of attack?
In security, you get exactly what you pay for.
There is no such thing as infinite, absolute security.
normally you get less than what you pay for
you can easily do $query = "insert into blah (somefield) values ('".mysql_real_escape_query($_GET['blah'])."')";
PHP is open to abuse as soon as you take user strings as input
numers / booleans are easy enough to clean
s/numers/numbers/
and if its made in china you get roughly half of what you paid for
The other half comes as lead paint. Use it.
i dont understand at all — but thank you for your time - - i appreciate it - -i'll go find the answer someplace
I always treat everything as it should be treated: Unsecure. You should to. User input should never, EVER be trusted.
If you're so concerned about security, use Haskell.
Go read the manuals about predefined variables and mysql functions
code that isnt being executed is causing my page to not load… i would expect that to be a symptom of a parsing error, but im getting nothing in my error log… help?
ok
well wolfpaws, I am making a test site- not a nuclear launch platform so your children are safe…for now….
Maybe it's not that page that gets executed? If it is, raise error_reporting
but thank you for your help
Whatever you're making, the input shouldn't be trusted.
commenting out this block of code, in a function that isnt being executed (because nothing calls it), causes the page to load
I am wondering wolfpaws
I am trying to put a hyperlink on the footer of my page to show the highlighted source code of the current page. but I can't figure it out. I've looked at show_source and $_SERVER[php self]; and things but am no wiser can anyone help me?
what is the best way to encrypt the data being sent to the server
or to protect it from being looked at in transit
Then as said, just raise your error_reporting level and enable display errors
!tell sparrw about error reporting
from client–server–client
use SSL
SSL?
yes, SSL
*google.com
Secure Socket Layer.
hello everybody, i have a style question, how would you arrange this line to not exceed 80 caracters please ? $this-aTemplate['id_description'] = $this-aExisting['descriptions_index'][$this-aTemplate['description']];
is this natively supported or does the server need to have a special module installed for ssl
wordwrap() is_null
Since when is that important?
since sometimes i don't have X
also it's something that i have read in cathedral and the bazar
SSL is usually needed for thins like e-commerce and such. Rarely in other cases.
What is X?
i meant, an X server
you probably eared of x.org or xfree86 have you ?
ha, sorry I read your question wrongly is_null ^^
hello
excuse me
cutting at the equal sign is probably best, but then, indent the second line or not ?
is_null, how is no having X a problem with lines exeeding 80 chars ?
I have just enabled a custom php.ini
which resides on /cgi-bin/
reading a source code with a screen displaying less than 80 chars is a pain.
as required by dreamhost
use an editor that supports them
but now everything points to the /cgi-bin/ :/(
So what? What happends if line is more than 80 chars long? It just get wrapped by your editor. What's the big deal?
it won't be wrapped in all editors, then, it's still a pain for me
*blink*
if you're worried about that, then use FB
I have a select-query that returnes a table with 20+ attributes that I wish to return to the client in XML, is there any faster and better way to accomplish this than writing everything by hand?
Hello,
how do i call an object method using call_user_func()?
like var_dump the $result as XML
array( $object, $method );
heya, I'm looking to find the mime type for ODT documents so I can check if they're being uploaded, does any one have any idea what the correct mime type is (for use with $_FILE['file']['type'] == )
There is explanation in the user comments.
ml2k, call_user_func( array(&$object, "methodName"), … )
thanks
is there somebody, who knows to help me, inserting a captcha-script into a php-guest-book-script?
(ODT as in OpenOffice.org text documents)
sometimes i want to work on small terminals in the back of my boss
Wolfpaws / HarryR: thanks
Ask for the support in the site where you found the script.
what do you advise me?
That I just did - no answer from there
I am trying to put a hyperlink on the footer of my page to show the highlighted source code of the current page. but I can't figure it out. I've looked at show_source and $_SERVER[php self]; but I can't seem to get it to work.
If you're seriously worried about that, I wonder what would be the least worry. Code functionality?
thanks troll
…
code functionality is always the last thing on my mind!
Tinned_Tuna:
"Who cares if it works or not. It's important that it looks good" XD
it would be nice if I could type without typos, wouldn't it?
I forget, what is the @ symbol called in php when used with functions like @fread, etc
!+@
[@] The PHP error control operator that suppresses errors (@foo()), see: http://php.net/operators.errorcontrol - Don't use it. Think I'm wrong? Ask me about "GO".
at least, i am polite. You are trolls.
Thanks Woflpaws
me? troll? I always thought myself more of an ogre, or maybe a goblin on better days…
How could I do a switch system like to enable & disable commands.
Chill, please.
any idea on the mime types that the browser supplies for open document text's (.odt?)
Haha, i wish you could work on my code with a 80 chars width terminal, then you could feel bad about having trolled instead of given me a fair intelligent opinion
You might have a problem; since some browsers and/or OS's that don't have OOo installed, may treat it as application/octect-stream
herro everyone
I don't have any problems with it.
does php version 4 have anything equivalent to version 5's DirectoryIterator?
don't they treat it like a zip file if it's not installed? I was planning to allow those, too
because you are a better coder than ESR, which is not my case
Hi everyone, I have some difficulties with creating image with php. I create it as in Example 981, but i get warning, witch says next "Warning: Cannot modify header information - headers already sent by (output started at CAppServ\www\cygne\index.php:14) in
CAppServ\www\cygne\com\sveciu_knyga.php on line 148" how can I deal with it? Thank you very much
No. PHP4 doesn't have SPL
hm damn
i did fine the glob function in 4, i suppose thats the nearest thing?
find*
Grr, somehow i have been logged into freenode for days now at some other location. It wont let me change my nick to my original =(
I never bothered to be better than anyone else. I just can read the code. Even wrapped.
I am not sure what DirectoryIterator does; But if you're looking for something that'll read the content of the directory and stuff it into array, then yes, glob() is fine.
ghost it
thanks for your opinion about the thema of my question. I am still interrested in another point of view if anyone is experienced with better readable code.
drop it.
what good documentation would you guys suggest about OO with php ?
is there somebody, who knows to help me, inserting a captcha-script into a php-guest-book-script?
php.net/oop and php.net/oop5
thanks Wolfpaws
don't repeat, and I've told you what you should do.
btw what is the difference between oo5 and oop5 ?
oop and oop5 I mean
when you have to cut a line with two variables and an equal sign, what is the most logic way to cut it, tyia
PHP4 and PHP5's OOP are different
ok oop is the old one I get it
thank you
And I answered. But maybe there joined another person inbetween - for that I repeat my question time - a -time
no
no-one will help you do that
Are you the only one expert in this forum?=
##php doesn't support 3rd party scripts. and since you're asking the question, I'm going to doubt, that you wrote the CPATCHA script.
this isn't a forum; and if you're really too lazy to write a cpatcha script, look at someone else's code, like if there's a cpatcha script in phpBB or another open source project.
there are numbverless captcha scripts out there.
it's correct, that I didn't write the captcha-skript - but it runs on my html-contact-form - but how to use it throughout of another php, this is my problem
And I still can't type
I'm not sure where I would find a cpatcha script, however. Please also note that if you take code from a GPL project, your code must be GPL'd
welcome to the typo club
new keyboard needed
Welcome? I'm it's president XD
:-)
the captcha itself is very well @ function. the call of it from the other php (guestbook) is my problem
That changes nothing. "do it for me" isn't the way of this channel.
##php is an English only channel
ah, timing
Mace[work]: That was pretty much "WTF" :3
i couldn't understand it
Mace[work]: I stopped trying to do that looooooong time ago
Who hoo, im myself now =
=P
yey!
I have no idea who you are, but yey!
does preg_match() not support group names for backreferences?
AFAIK, no.
and there's no way to re-assign backreference numbers right?
like change a certain group's index in the matched array so that in "/(a)(b)/" I could make 'a' backreference 2 and 'b' backreference 1
how can I determine the file type? (other methods than file extension and/or mime)
for back references yes, for replacement strings not
there is no other way.
Wolfpaws, but that's no way to be sure… right? Mime can be forged…
$pattern = '~(?Pcountry[a-zA-Z]+)-(?Pcode\d{5})~';
I am having a problem with file downloader. It works in mozilla, opera and else, but it does not in ie. Ie shows a dialog unable to download download.php?file_id=5. The code is http://paste-it.net/3145
mime can be forged, but they're marginally harder then file extensions :p
this is a pattern with named groups
anyways
see you laters
so then would it be possible to extract those groups after using preg_match()?
Why is the name of the channel ##php and not #php?
mysql_free_result($foo) = unset variable $foo ?
mime depends on magic bits, yes. You can append basically anything after those bits. But if you're trying to detemine the file type of uploaded file, the you should use fileinfo PECL extension
!tell cruddpuppet about move
!tell me about move
oh, thanks
Um. No.
thank you Wolfpaws
same here
anyone halfway familiar with mediawiki code? i need some help tweaking up the redirect to enable external redirects
Isn't that in the settings?
is there a way to get print_r() directed into another output than echo?
(IE i just want it to be output to a file)
fwrite?
php.net/print_r
mcknin, make it return the result instead and then write that to a file
Maybe #mediawiki would be a better choice?
print_r($var, true);
that will return
the variable
fwrite($handle, print_r($var, true))
no, $foo = print_r( $bar, true ); will put the output into $foo
but he said he wanted to write it to a file
yeah, I said that in response to what just said before that
someone can introduce me a flv player that can embed php scripts.
wha?
print_r( $var, true ); wont return a var, you have to assign it to a var
all flv players can embed php scripts
oh
my bad
flash player is client-side. PHP isn't.
do you want a dynamic flv file?
tried that first - no bites.
Well, ##php isn't really about 3rd party applications. It's more about self-writen PHP scripts
i'm american so my setup is for american english or whatever, but i need to print/store in a db/parse some french words that have accent marks: école do i have to do anything special for this in php?
Go with UTF-8
what functions would i use for that
and how can i tellw hat im currently using
isn't UTF-8 default?
rza, I have an updated package.xml ready
will commit shortly
header('charset=utf-8');
can someone show me a guide that you can have both php4 and php5 running at the same time using fastcgi
I'm having hell finding one
all the one's I find are not compatible
I am having a problem with file downloader. It works in mozilla, opera and else, but it does not in ie. Ie shows a dialog unable to download download.php?file_id=5. The code is http://paste-it.net/3146
Apache/1.3.37 (Unix)
Red Hat Linux release 7.2 (Enigma)
well… a self-written php script written by me, is a third-party application from your point of view.
#apache then
#apache for a php install ?
Actually; Strings don't care what is their content… graywhite: If you want to do funky things with multi-byte characters, then read php.net/mb_string
but more seriously, i just needed someone with more php experience to take a look at it to help me figure out what to do, so i thought #php would be somewhat relevant…
php.net/install
you have to setup apache to deal with the files differently, so like you'd make all .php5 files use php5, and all .php files use php4, or the other way around, all .php use PHP4, all .php4 use php4
pastebin the code.
how do I get all client sent headers in php?
eh?
all HTTP headers sent by the client/browser
raw
oh; If I understand you correctly, use apache_get_headers(or something)
the problem i'm having is figuring out how a number of different files interact. so i am not even sure which files to paste. you could get the mediawiki source archive from their file releases, though. There's this redirect.php file in there, which is nice and short, but it appears that changing
it doesn't affect the redirects…
Does same PHP Session works in all the subdomains?
let me see
change php_imagick.h also
to reflect the release
2.0.0-rc1
rza, just committed now
not yet tagged
apache_request_header(), txs
if the SID is transfered to subdomains; Sure, why not?
that, yeah
How to transfer the session id?
last one, can I redirect dump_vars() to STDERR (error_log) ?
SID implys session id ?
STDERR?
You'd need proc_open
I meant log_error()
hi guys, how can I check which is the version of installed php?
phpinfo()
ah ok
there is a shell command?
Or error_log?
php -v
error_log() right
what AtariPunk
said
[root@webdev local]# php -v
PHP 4.4.6 (cli) (built: Mar 26 2007 20:51:23)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with Zend Extension Manager v1.0.11, Copyright (c) 2003-2006, by Zend Technologies with Zend Optimizer v3.2.0, Copyright (c) 1998-2006, by Zend Technologies
Hum… Use print_r
rza, I've tagged CVS and built the package now
Wolfpaws:How to transfer SID?
thxs
still rusty on php
Either with a properly forged cookie or post/get
yes But how to set the SID in the next PHP file
if I call a function which uses "echo" to emit some text, is there any way of modifying the result of the echo with regexp before it gets printed WITHOUT modifying the function?
php.net/session will tell you that
hey can enyone help me.
just ask
thanks
I am reading that But it says that directly the Session id will be set but my multi domain is not listed
cool, make a release
setup my site . and loged on did the config startup page thing with the sql info. then once i did that all i get now is this message . . . message_die() was called multiple times. This isn't supposed to happen. Was message_die() used in page_tail.php?
(unless you did already)
im writing some replication xml config files
Read it: http://us2.php.net/manual/en/function.session-set-cookie-params.php
i did already
Hey guys — if I'm creating a domain registration system and I want users to be able to search for a domain name, and give them results in .com .net,etc…and then be able to add those to a cart and continue to search, what would you use to store what they have?
I'm fighting with double pointers
i have sqlite3_stmt **
and its getting mangled somewhere
Is there a header to make try to force browser cache and use all cached images?
Anyone?
Google for header cache-control
thanks
enyone know why im geting this message when i try to go to my message boards. message_die() was called multiple times. This isn't supposed to happen. Was message_die() used in page_tail.php?
yes
that means you used it multiple times
maybe you used it in different files?
used what multiple times?
like, you used include() and didn't realize that you used message_die() in each file
!+enter
Don't use the enter key as punctuation. Think in complete thoughts, then type.
i dunno i just put phpbb on my site and did the setup page then i get that message
did you use a mod?
thanks guuys cya
neh i just d/l phpbb2 from the php site
#phpbb, please
oh right
wrong channels then lol
if I call a function which uses "echo" to emit some text, is there any way of modifying the result of the echo with regexp before it gets printed WITHOUT modifying the function?
no
that to me?
yes
it's not a string which means regex won't help you
You could use output buffering, but that is downright stupid
Is it a function included with php?
no
it is a function used in wordpress
http://pastebin.ca/658492 … How can I insert some variables passed from my PHP script into certain fields in this MySQL statement ( the `Username` and `Location` field has a values in $username and $location
then copy the source of the function
and rename it
and modify it so it returns the string you want
and not a boolean
or whatever else it is
or I could use output buffering I guess
can you please stop abuse enter?
sorry
which will make it more mantainable
s/abuse/abusing
if you can, avoid OB.
I can't see any other way of doing this sadly
anything I should be aware of if I use it?
ye there is. Modify the function
rza, I got a new lense ordered
rza, its a 70 - 300 IS
anyone know why I can't join #python ?
Will this work? http://pastebin.ca/658499
problem with that is, if the source function is modified, e.g. for security reasons, then I need to check the diff on every new release
You're not registered
I have to register to get in?
yes you do
the problem lies in this: The table I am selecting from doesnt have the Username or Location fields
make one then?
no you're mixing values and select
same as the one in my wishlist
the syntax is INSERT INTO table (fields) SELECT fields FROM table2
How do I sort $filename in order of time created? (If I've got filemtime($filename); )
rza, I've got a friend getting me it from the US
rza, its $1050 out there
and the Fields element of a SELECT can contain strings
I have a 50 1.8 and a 18-85
yeah, no wonder no one has bought that from my wishlist
err 17-85
im getting a CD thou
cool
SELECT field1, 'string1' fROm table
helped some romanian guy for a night
his boss bought me a cd
what if I forgot my password? is there any way I can send it to my email?
hi
Stull those into array and just run sort() trough it
*gasp*
I… Hate… Inking
Inking?
yes, inking
anyone know any good articles on PHP5 Role Based Systems…I'm trying to write one, but I'd like to follow some sort of tested standard / pattern.
Role based system? as in ACL?
Wolfpaws, ya, a simple ACL…
Donno… Always wrote my own. I've just followed my sanity
has anyone run into an issue where making a call to mysql_result() has affected the pointer of the result? because it appears to be doing that to me …. i call mysql_result() to pull out one main piece of data, then loop through the rest at a later point … but it skips the first
row…..
Wolfpaws, would that would in a foreach { } ?
Wolfpaws, thats the plan right now, but sometimes I question my sanity
i have 3 php files. (one.php, two.php, three.php), one.php form posts a variable ($_POST['name']) to two.php which processes $_POST['name'] then require()'s in another three.php which contains a form that posts to itself (in essense back to two.php) only once it does that $_POST['name'] seems
to be unset. Do i have to use sessions to preserve it?
@eliter maybe you can check Zend Framework's ACL
I always question my sanity. And the answer is usually negative
quick oftopic question. whats the command to auto link my index page to my forums.
mikaelfs, thanks for the tip…..ACL brought up a lot more results than Role Based System….I knew it was called something else…..
uh… What?
Wolfpaws, hah
eliter:
Wolfpaws, yes?
Well, I'm an artist, so my sanity is questionable by default
sanity
we dont need no freakin sanity
this is a programmers chat
man I have to pretend my 8 year old niece is here
how uncomfortable
lol
it would probably be less uncomfortable if I didnt have an 8 year old nieve
niece
kids are fun. You need to have a whole lot of energy for them, tho ^_^
ukids are fun. You need to have a whole lot of energy for them, tho ^_^/u
how can I strip a single occurrence of a string off the end of another string?
rtrim?
cool, thought trim just did characters
it does
use substr and strlen
if you know it's there, of course.
you don't need strlen. only substr
he probably meant strpos
you need strlen if you don't know the size of the string to strip out
I know the size of the thing I want removed but not the size of the string I want it removed from
mikearthur, do you know if it's always there ? If so, you can simply use substr
yeh, it always is
ah, right you are. i saw rtrim and thought you were looking to remove the last character
in which case, i'd probably use substr_replace and strpos (as Wolfpaws suggested)
err, strrpos rather
(extra 'r')
I don't see how substr_replace is of any help
if he needs to strip the last occurance of something, strrpos will get it's starting position from the end, and substr_replace() will replace within the context of the last match
ah yeah, in case he want's to remove the last occurence that is not always at the very end of the string, got you.
exactly
sup all
ive got a "weird" problem
this place is only about php
not any bodily functions or whatever it is you are facing not related to php
im trying to generate an pdf from an html, and im using $data = ob_get_contents(); and then storing it with file_put_contents in an html file
but whenever i do it turns all latin and funky characters into other rubbish
ÃO
???
check the content encoding of the page
I don't think you can directly turn pdf into html and back
Hello,
i have a problem about an Array which i got from a WordPress Plugin.
http://nopaste.info/f442d3a9c5.html
im using htmldoc to do so, that why i need the page in an html file
i don't see a problem
php.net/foreach
!tell DuxMortiS about g11
g11 ?
there is a message from php-bot
read it
ive checked the charset
no luck
i could try utf-8 i suppose
oh … ok sry … i have to read the manual and the link by alexc_ .. Thanks
could it be something else
?
ello
anyone know anything about ssi?
!tell p_orange about g1
and if the acronym refers to what i think it refers to then SSI is a topic for #apache not ##php
ok… thats what i thought, someone suggested this chan.
my php file gives me:
syntax error, unexpected $end in /home/fragal5/public_html/a/upload.php on line 64
if($ok) { header("Location: http://".$_SERVER["HTTP_HOST"]."/?id=".$id); }
check the line 63
and line 65
and line 28
(I just have a feeling)
63 is $db-cleanup();
Anyone here use Zend Development Environment?
i'm sure he does, though i haven't seen him in a while
it has been said however that anyone there prefers Eclipse
who?
anyone
uhh
I'll try out Eclipse, thanks abstrakt
err, that was not my intention, but if you wish, so be it
you're going to want PDT
Thanks
pacific daylite time?
daylight *
Oh ok. Thanks man.
http://downloads.zend.com/pdt/server-debugger/
what's the simpliest way to convert a string from utf8 to iso8859-1?
How do I make http://www.wilcob.com/Wilco/Pastecode/5014/showpaste.aspx work so when I choose a style in my dropdownbox and submit it runs the swich opereator acording to the coice
choise
does anyone know why HTMLTidy would be outputting chr(194) in place of instead of chr(160) or a space?
i have bla.php form posting to itself and the first form post sets $_POST['foo'] then processes it then does another form post to itself to create $_POST['bar'], only when it creates $_POST['bar'], $_POST['foo'] no longer exists. why is this?
graywhite, maybe $_GET is what you need…
don't quote me though
i was startin to wonder that myself. someoen else said that i could pass foo as a hidden form field
because there's no $_POST['foo'] in the second form ?
it's either that or use a session
as you said try adding it as a hidden field and passing to it the value from the first form
yeah ill try that
Is there any way to use a link instead of a submit button in a form?
lol I want images, not Microsoft Widget Buttons/
tag to have 'NAME' attribute, right?
DARKGirl - I believe only form elements … use id instead.
vonBose you can if you use some javascript
i am
i am using document.image[imgName]
#web #html
(^_-)
^^ g'day
hellooooz
is this channel logged?
yes
I need to get something I asked for yesterday, but then didn't paste because I'm an idio
where is it logged?
I'm not entirely sure, I just know I've come across it before
http://irclog.org/freenode/php.html maybe :]
hmmm no 2007?
just found that link ^^
yeah, not recent though
actually, does anyone know why simplexml_load_string() would convert a numeric entity of to chr(194) . chr(160) instead of just the non-breaking space character by itself?
We should set up a bot
there is one, foutrelis
php-bot?
yers
Oh, if it does logging too then ok.
I've no idea what that little bot does to be honest lol
hi, is there a page somewhere that lists the current state of php6 and the differences to php5 ?
Hi. I'm looking for a way to do multiple network lookups at once. Is there a way to do this in PHP4?
uHi. I'm looking for a way to do multiple network lookups at once. Is there a way to do this in PHP4?/u
http://irc-archive.com/read/FreeNode/php/2007-08-14/1
need. help.
http://www.pastebin.ca/658593
this doesnt do… anything
not even the echo works
at least youre not hissing at it
I'm looking for a way to extract the dimensions of an image without loading the entire file. Does anybody know how to do this?
error_reporting( E_ALL ); ini_set( 'display_errors', 'on' );
imagesize() DaSourcerer
getimagesize() even
Are you sure, that this will also work with fragments of images?
no not at all, ha - hold on
Say, the first 256b?
Aha
:]
anyone halfway familiar with mediawiki code? i need some help tweaking up the redirect to enable external redirects
I have no idea what you mean
Okay, I've got some remote images and I want clean HTML. So I need the dimension of those images.
But loading the entire images and processing them with getimagesize() is way to slow
So I thought I might just load the first 256b or so and extract the data from the image headers
I know how to do this with fsockopen etc. But I do not know how to parse those headers efficiently
which headers were you interested in? just image type? or exif data?
hello what is the latest pear version that is supported by php4?
I just need width and height
what is the problem with efficiency?
oh. that's going to depend on image type
do you really have a problem with efficiency or do you just not know how to do it
Currently I've got two lookups: getheaders and getimagesize. That's taking up too much time.
I did try, but I can't seem to find my original question - how do you pass a variable in php to a script?
I promise this is the last time I ask this
how do you know it's taking up too much time
Hello
Debugging
are you actually experiencing a slow down in your page load performance?
hello freebox
i tried caching the results. But it's of little help.
jpeg is pretty easy though.
whats the best way to avoid reposting form data on refresh
a slow down as compared to just loading images "normally" ?
True. But I've got little control over the type of those images.
Yes.
SubOne, redirect after a post so its back to a get
someother.php') but it still allows a repost even though its a differnt page
how do I pass a variable to a php script through a link?
hydoskee, echo $_GET['name'] and then foo.php?name=abcd
part of the problem is image formats don't always have a formal header's declaration.
It's not a problem if there are only one to three small images. But huge files are a problem.
how i can have absolutely sure if an linux daemon is running or not?
in the case of jpeg, you need to know the start of frame offset
*sigh*
That's even worse than I expected…
you can learn how to admin your linux box? you can ask the channel for your distro?
Either look for its process name in the process list, or look at its pid file and check if that process ID is running (e.g. with kill)
i am using header('location: someotherfile.php') but i can still hit refresh in firefox and it will reinsert records
well, it means in some cases the number of bytes you read is not going to be consistant, even with the same format
I assumed you meant programmatically from within PHP
do you have die() after the header?
i'm certaian it's doable for at least some of them though
and you should use full url with the location header
thats what the RFC says
yes in php
exit;
is no easy way to php?
I assume you mean a specific daemon, well, most create a .pid file, typically in /var/run. You can check if that PID is running
that depends heavily on what daemon youre checking
most monitoring tools have different kind of checks for different daemons
For example, if you look at /var/run/crond.pid, it contains the process ID of the crond process (daemon)
hm
good
i will test
thx
You can then use kill(0,pid) to check if it's running
awesome, thanks McFly
well, if the daemon crashes it doesnt necessarily clean the pid file
That's why you do kill(pid,0)
what about if the pids have cycled and its in use by another process?
That's too bad
It is possible however
but unlikely, as pids are not usually reused very often, except between reboots, when the OS typically cleans /var/run
Hm, I'll see to another caching solution.
pids are reused when the counter loops over
I suppose you could check that that PID is actually running the right program,
implementation dependant thou
or maybe he could implement different checks
for example for apache he would connect to the apache port
and see if he gets a response
and so on
Yes, but not all daemons run on a port you can check in that way
hence the "for example"
Most system monitoring tools I'm aware of work by jsut checking the process list
which ones those are?
how would they monitor remote systems then?
i use nagios and zenoss personally
Of course they typically optionally check a network port as well, which is handy for things like Apache
Big Brother / Hobbit
runs a local daemon which monitors the system locally then sends status updates to a central monitoring server
we use it at work to monitor 500+ servers
I need some opnions
What is the best way to make an front end for an .conf?
A big fat textarea element with no validation?
yep
is hard to do?
like an squid.conf
whats the best way to avoid reposting form data on refresh
Is there php tutorials on form creations for having inline php code when the submit button is pressed without calling an external php script.
anyone here looking for in-house work in Chicago? completely serious offer btw.
are you brazilian?
no
SubOne, use a separate script for your form processor and redirect after processed
hm
is that the only way to use a seperate file for form processing?
what I mean is that the action usually refers to an external php script. Is it possible to have that code inline with the parent code?
well, you could use the same file, but you'd still have to redirect after processing