I realize Ive got a security hole in my script here Input boxes insert data into a database which is later echoed
keywords here are : LoadModule php5_module modules/libphp5.so
I'm sort of new to PHP.
AddType application/x-httpd-php .php .phtml
gettype allocated 7 megs and failed
…. wtf!
phpinfo() is corract
!tell n0dding0ff about at
!tell n0dding0ff about lm
You really should be using AddHandler instead of AddType, FWIW
does this make sense to anyone?$remote_command = "net use t: \\\\lib2\\tools\rt:";
corract! (i've been waiting all week for your spelling error! )
O.O
Indeed!
how come?
wouldn't AddHandler make it through CGI?
On windows/iis, where do you put stuff to be in php's include path?
ask phpinfo()
Because while AddType and AddHandler do the same thing today, there's no assurance from the Apache group that they will continue to do so, and technically PHP should be registered as a handler
part for?
oh, note taken
BTW, i simple skimmed the docs and pasted the first line i saw for n0dding0ff … someone might want to update the docs
(http://www.php.net/manual/en/install.unix.apache2.php)
i followed the tutorial here, and make a IRC bot using PHP (CLI) can anyone help me add stuff to it? I'm new to php, and it was my first project.. now I want to add features and stuff to it. and i dont know php web hosting well enough yet.
http://www.combined-minds.net/tutorials/13/Creating_an_IRC_bot_in_PHP
mu9214 perhaps a simpler project might serve the purpose better?
well, i already made it now…..
AddType "Maps the given filename extensions onto the specified content type"; AddHandler "Maps the filename extensions to the specified handler". application/x-httpd-php is a handler in this context, not a type. The "type" should be "text/html" in most cases.
it works, but i want to addstuff to it.
anyone know why pg_last_error complains ('supplied argument is not a valid PostgreSQL link resource') when pg_connect fails?
Because pg_last_error requires a link to the server
anyone?
TML, that makes perfect sense … that means that AddType implied the php processing … which the apache group does not garantee to stick to … perfect sense
oskie, and the link wasn't created by pg_last_error
not according to the docs… but if it was so: then how do I get the error message if pg_connect fails?
mu9214 asking your question would help
I have several fputs commands. I really *really* need to be able to see what the "response is".
by response I mean what I would normally get if the commands were run on the command line
libpq generally doesn't return an error if connection fails
i followed the tutorial at http://www.combined-minds.net/tutorials/13/Creating_an_IRC_bot_in_PHP, and make a IRC bot using PHP (CLI) can anyone help me add stuff to it? I'm new to php, and it was my first
project.. now I want to add features and stuff to it. and i dont know php well enough yet.
And you must be misreading the docs, they pretty clearly state that "pg_last_error() returns the last error message for a given connection."
Without a connection, you can't get the last error message for a given connection
oh, that was the actual question
yes. i want to know how to add stuff..
what do you want to add?
hm true.. although the connection argument to pg_last_error is optional, but apparently then it will use the default connection
Right. And if it can't find one at all, there's no "default" for it default to.
anything.. a !google command - that gets some results from google.
ok grr, the error message is printed, so there should be a way to "catch" it… printed on screen though…
a !time command that gets the time
s/printed on screen though…//
is there a function to interpret strings with '\r\n' into their respective carriage returns?
hello
as in CR/NL
nl2br
I don't know of one
that won't work
And I use pgsql a LOT
look at the last code snippet
you are correct… you want carriage returns, not "br/"
preg_replace('/\\r/', '\r', $haystack);
"sent pong back to server" …
um wait
Can you guys help me out real quick?
if( $ex[0] == "PING" ) …
preg_replace('/\\r/', "\r", $haystack);
I found it. stripcslashes()
well there you go
I realize I've got a security hole in my script here. Input boxes insert data into a database, which is later echoed from the database using PHP. The input form is password protected, however, is there a way to make sure the user can't enter PHP code into the input box and have it executed on
the page?
yeh it's annoying
thanks though
yeah?
what about it?
actually … you've got a line of IRC connection input there
do a print_r( $ex )
the problem is not with the user entering PHP code, unless you're using eval() that should never be a possibility
it'll list every word …
they could however exec some javascript
you'll be able to better understand the IRC protocol
where do I add that?
eg "PRIVMSG" … where the usernames are … channels ..
after $ex = explode( ' ', $data );
and the way to deal with that is basically to use htmlentities() or to escape double quotes
PEAR_DB does it using some track_errors magic, but that's just fugly
look into the switch construct
defining functions
and you should be on your way
?? what do you mean the "switch construct"?
It's one place the MySQL client API is simply better than libpq
php.net/switch
swtch( $variable ){ case "something": … }
What you really should be doing, though, is looking at how to get started with PHP. Our bot can help you there.
php-bot: tell mu9214 about getting started
for some reason when I include('DB.php') for some of my pages it won't display them, even though I enabled E_ALL I don't see any errors… any clues?
check display_errors
thanks
You turned on display_errors?
I'm not 100% sure the problem is in libpq though…
is there a way in php webhosting to tell if the headers have been printed or not?
I have several fputs commands. I really *really* need to be able to see what the "response is".
by response I mean what I would normally get if the commands were run on the command line
is it possible to escape defines in a double quote somehow? "{DEFINE_NAME}" doesnt do anything
ah..thanks!!
I am
I tried to fix it once so that pg_last_error behaved more like mysql_error(), but the way the libpq stuff works, I couldn't make it work
That's not to say it can't be done, just that libpq makes it incredibly difficult, and libmysql makes it brain-dead simple
thanks
there were several calls to include the file from which include('DB.php') was called so I replaced it to include_once('DB.php')
PQconnect should always return a ptr to something (unless mem alloc fails), and then you can use PQerrorMessage to get the error msg if PQstatus(conn)!=CONNECTION_OK.. apparently PHP pg_connect returns FALSE instead
welcome to php?
PHP does that to unify its behaviour with all the other database hosting APIs somewhat. For example, mysql_connect() will return false, but the underlying data structure still exists in both cases.
The difference is that in libpq, you have to carry several different pointers to achieve the same result as you get from the base data structure in libmysql
hello again
ScottMac?
How can I get a list of things I get from sql host and put it into a variable just one?
is it possible to escape defines in a double quote somehow? "{DEFINE_NAME}" doesnt do anything
Would something not insert into the php mysql web hosting database if it contained a Slash?
But if you want to take a crack at fixing it, ext/pgsql/pgsql.c is your friend. You'll want to look at the PHP_PQ_ERROR macro as well as _php_pgsql_trim_result.
Because thats the only problem I can find
php.net/join
Thanks.
where would I start w/ research on how to scale a php/mysql app?
mysql_error() will tell you where your syntax error is
I know
I used MySQL error
I also do. But, the only thing I can conclude
Is that a "slash" is right where it breaks off
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'type`) VALUES('', '', '08.21.07', '72.177.4.215', 'gorefest.swf', 'application/x' at line 1
I think I found my error
The word "type
A missing comma
The word "type" is almost certainly a reserved word
I've used it before though
You should get out of that habit
Yup, the problem is fixed. But okay
howdo i get the mysql module working on a binary install of PHP on XP
?
GBenemy stop being a dork and read the manual
Basically, you'll need to create your own data structure for PHP_PQ_ERROR to stuff the error in, since there's not really one that libpq gives you, and have pg_last_error consume from there instead of having it shadow to php_pgsql_get_link_info and poke around itself.
php.net/mysql should have pretty good instructions on that
i don't get the manual
i went there it talked about writing lines and all this wierd crap that i don't understand
Then ask clarifying questions derived from the manual text so we can help you understand it.
uThen ask clarifying questions derived from the manual text so we can help you understand it./u
please. there *must* be a way to get teh output from a fputs command!
ok
*function lol
no you don't. you are asking the same questions in #php and #mysql and doing nothing for yourself.
What do you mean "get teh output from a fputs function" (sic)?
like if I ran a dir command I would get text back.
fputs() only returns one thing: the number of bytes written
I hav ea telnet session going from popen
and I want to be able to know what theresponse from the server hosting was
instead of just guessing
If you want to read something, you have to fread
ok, basically I have to uncomment a line in my php.ini file so the extension becomes available
the extension is php_mysql.dll
I can do that
like from a file? or from the cmd line?
the only problem is, I can't find where to download the php_mysql.dll file
from the file
;extension=php_mysql.dll
that one
If you're writing to a file pointer using fputs, and you want to read from that same pointer, you have to use fread
but i dnt know where to download php_mysql.dll
Would `bashcommand ` . $var work?
php_mysql.dll comes with PHP
It should already be in your PHP's extension_dir
ty! ty!
did you download the MSI Installer or the Zip Package?
or libmysql.dll
I don't have an extension directory
msi
that's why
the MSI is "missing some things" … i.e. it's missing just about everything
and ScottMac told me not to install any extensions
download the Zip Package instead
…. 0.o
he said to only do the core
ive got a question about getting a mysql query and result to be done once a minute.. without using the db for entering info about run time
That got only one thing. I want it to get each game from the database of that user then put it into a variable, you know?
because i originally did it with all the extensions but php qouldn't run
"don't install any extensions" sounds like kind of a poor idea, who would say a thing like that? extensions are there for use, if you need them then use them
cron
cron is out
No, I don't know
download the Zip Package and extract it to Cphp
server doesnt support
then follow the instructions in the README for installation
like
ok
I do
ok
anyone messed with sorting arrays?
and then if you want extensions, just enable the ones you're actually going to use
Put a PHP page that you can fetch and then run "wget thatpage" from cron on a machine you control
multidimensional arrays
SELECT fc_game, fc_user FROM friendcodes WHERE fc_user='$user', then I want to put each game the user has into one variable.
don't go and enable every extension available, that's a bad idea. just enable the ones you actually need
"uninstall" that MSI first though btw
i dont have cron access
ok
the thing is i don't know which ones i need
im on a shared system
i don't even know what any of them do
Get a machine. Install Linux on it. Put a php webhosting page that you can fetch and then run "wget thatpage" from cron on that new machine.
r there any other options?
other than cron
It can be a $50 Pentium 2 with an 8GB HDD and 16MB of RAM
if you don't know then don't enable any of them
Sure. But they're all the same principle.
TML it needs to be on the server im using
actually
when you know which ones you need enable them
TML all using cron?
No, there's nothing you can do on the server you're using
the .msi can install different extensions for me
i've just used it to intall the mysql extension
k
Well, there's Scheduled Tasks in Win32…that's not cron, but it's the same idea
i'll see if that works
!+func array_keys
There's also a Unix alternative to cron called "at"
no seriously man, don't use the MSI, use the Zip Package
But again, same basic principle
Why do we even have an MSI if it's so fundamentally broken? Have you filed bugs?
i have this solution.. but i dont like it.. everytime it is run it adds an entry into the db.. and then once its more than a minute from being last run it is then run
I would expect the MSI to be the same contents as the zip, with some additional smarts.
ok
Why not just do what I suggested
Heck, if you don't want to buy a machine, just get a shell from someone like freeshell.org
heh, i never use the msi either
TML because its messy
That's not messy. It's pure elegance.
i get an entire NEW COMPUTer to run one script? lol
no thnx
So get a shell account somewhere
if there was some kind of error msg (like wrong ip/passwd etc) from a popen command, would doing $errormsg = fread($telnet, 100); catch that error msg?
you would expect it to, but the MSI is missing basically everything
Is there a way to recursively print whatever in an an array? I mean, print $myarray just shows nothing..
thnx tho
Well, it'd be one thing to not use the MSI because you (think you) know what you're doing; it'd be another to go around telling people the MSI is worthless.
var_dump
ok files are extracting
I would argue that your solution is far more messy than assuming there will be someone loading the page every minute or so
Zip is the way to go, i was rather confused too because i would have expected the MSI to be identical to the Zip except including a convenient "installer" script to automagically integrate PHP with Apache or IIS or whatever you choose, but nope, the MSI is basically the Zip minus everything
except php.exe
thanks
So open a bug
Solifugus, print_r do the job too
the .msi configured my http setver for me
and i could choose which extensions to put ine tc
**in etc
why is it that when I refresh my page it resubmits the form and inputs data to my db? i thought it only happened if I clicked the submit button
ok, files have bee extracted
? eh i don't much care, i might do that
"choosing which extensions to put in" is as simple as editing php.ini
and can you stop it?
How do you remove the last four characters of a string?
var*
yah
thanks
i gtg now
i'll configure it later
php.net/substr
thanks everyone
1) copy php.ini-dist to php.ini 2) read the readme and add the proper lines to httpd.conf 3) be sure extension_dir is the full path to the dir 4) uncomment the extensions you want to use in php.ini
done
Okay, thanks
ok.. nusoap is giving me a boolean (false) when i call a web service..
?
cheers abstrakt
any ideas?
\o/
about what?
That php dot net link didn't really do what I wanted. It did, but theres more. This is a user entered string, so it can be anything.
I'm trying to remove the extention from a filename.
alexwait, it should, yes, if the error is in the stream
preg_replace()
i
Hi
anyone know of a quick way to take old HTML or XHTML Transitional files and convert them to XHTML Strict on the fly?
I use substr() fonction but I want cut the last word .. have you got a simply solution ?
thansk
anyone messed with sorting multi dimensional arrays before?
I want to do that exact same thing, except I want to remove the last four characters.
HTML Tidy claims to be able to do that
Hello, is there anything like __CLASS__ that would check the very lowest child's class name?
from where does your multi-dimensional array come from? how is it populated? is it populated from a database?
ok .. blah569 so now you must find the solution :p
substr($blah, 0, strrpos($blah, " "));
helooooooooo
abstrakt, cool looking into that now
yeah if you know it's going to be standard 3 char extensions then substr() will work fine
not a database population, i'll pastebin the bit of code that populates it, thanks
http://us2.php.net/array_multisort
If i have many lines to write in an file.. What is the best way to do it?
I know, but The string can be 6 characters to 100
checked that, but won't work for me, i don't think
And more, I was just using that as an example.
$line1 = fopen("file.txt","w+");$line2 = fopen("file.txt","w+");$line3 = fopen("file.txt","w+")?
oO
the extension can be 6 to 100 chars?
Not the extention
The file name
so?
you have a solution ?
You only need to fopen once
Then fwrite until you're done, then fclose
I have an array $regarray, with indexes 0, 1, 2, 3, each holds an array index like, "name", "cpuname", "mac", "ip"
So, I don't understand how this "substr" will work if I'm not sure of the strlen
hm
php.net/substr
Please read it
Okay
substr($blah, 0, -4);
substr($name, 0, strlen($blah) - 4);
Okay, thanks.
that will get all characters except the last 4
i don't know that -4 will work will it?
It will
yep
Thanks.
it assumes the strlen()-4
oh yes nm it will
If you'd bother to read the docs, it says pretty clearly that you can use a negative length
I have, SELECT fc_game, fc_user FROM friendcodes WHERE fc_user='$user', then I want to put all the games the user has added into a variable.How to put it into one variable?
i was reading the docs hadn't scrolled down to that part yet
The question doesn't make sense.
ugh
hmm
I use subst fonction but I don't want cut the last word .. it's possible ?
so anyone know how I can sort a multi dimensional array based on information held in a key?
Ignore me, I'm just irritated that blah569 got off without having to RTFM
substr
more to the point is that if blah569 had read the docs he wouldn't have been clueless
php.net/usort
yes i'm with you on that one
i checked the sorts but not sure if it will work, but I'll mess and maybe get lucky
too many spoon feeders here
You can define your own sorting criteria
ahh, that's the sort i was looking for, checked array_multi, asort, rsort arsort and ksort
ha that's why i didn't check it, didn't show up as a sort function in the see also section
php.net/array lists all the functions relating to arrays with a brief description of what they do
anyone here use nusoap?
I'd bet nusoap has its own support fora
please ?
I have a list of games in the database I want to get all the games a certain user has and then put it into just one variable like. Have it output something like Games for Monie: mkds mph acww sfc
Like that.
just a link…
What do you mean you "don't want to cut the last word"?
maybe.. but not an irc channel on freenode
True, but the lack of a freenode IRC channel does NOT make ##PHP their support channel.
kilgost, what are you doing again?
instead of reading from a the resouce id (a telnet session), fread is reading from a text file that is opened in another part of the script 0.0
You passed it the wrong pointer
for example .. (sry for my english I'm french) .. : bla bla mum father….. mother bathroom
i did?
Sorry
You passed it the wrong pointer
:P
i want .. blabla mum father … mother..
So you want to trim the entire last word off of a string?
and not blabla mum father … mother bath
but I didn't
kilgost, told you this already
substr($blah, 0, strrpos($blah, " "));
I want keep only 500 word without cut the last word
that gets a string from beginning to the last space
so am i in trouble for asking someone here uses the php class, nusoap?
hum ok SBNet_Work
substr($blah, 0, strrpos($blah, " ")); I need to add "500"
in effect it will get all words, but the last
I have a list of games in the database I want to get all the games a certain user has and then put it into just one variable like. Have it output something like Games for Monie: mkds mph acww sfc
"trouble"? Not really. I'm just trying to provide a gentle reminder that this is a support channel for writing PHP, not using third-party PHP apps.
kilgost, you want only the first 500 words?
yes …
substr($blah, 0,500 );
ok ok
so they could give you 1000 words and you want just the first 500
try this
in this case a 3rd party php lib.
but.. i can obtain .. mother..fat…
$blah = explode(" ", $blah);
Right. "third party" is the key phrase here.
I don"t want a cut in word…
hello, is there a way i can make php output what it generates to the browser faster and not stall when a exec / shell_exec command is run ? just like a perl cgi would do
for($i = 0; $i 500; $i++){
Ugh. No.
ok..
$blahnew .= " ".$blah[$i];
}
that's one way and a good place to start
Don't use a for loop please
Use array_slice
then go to a foreach
ok.. then being perfectly on topic, how does one consume a soap-based web service in php?
yeah array_slice, it's faster
php.net/soap
but why should they learn to use a premade function? you should learn to make your own so you can better understand a premade function
anyone here use SimpleTest?
implode(" ", array_slice(explode(" ", $string), 0, 500)
micky, use output buffering to send the contents of the buffer to the client immediately before the exec/system call. ob_start(). if you don't need to wait on the system call, and your host allows you to background it, do that
I don't think teaching people to write for loops helps them understand array_slice
wait i look array_slice .. in php.net
You want to run the shell script in the background?
ok, all it does is the same as the for loop, it just counts the first 500 places in the array and only keeps them
that's all array_slice basically is
but i'll leave it alone
everyone has their own way of doing things
You also don't want to do $blah .= " ".$blah
that's $blahnew .= " ".$blah!
Oh, you said "blahnew"
then you would trim it at the end
Buy yourself a foo and a bar, they're easier for old eyes like mine to distinguish
yes sir!
You still don't get what I mean?
I get that your database is returning multiple rows, each row appears to have a "user" and a "game". That's about as far as I can understand you.
You still here?
Ok. I want to put each game into one variable for that user.
So it says… Monie has: MKDS ACWW SFC MPH
yeh
Something like that.
I can't speak for any other version, but as of 5.2.3, the MSI and the ZIP have precisely the same contents.
well that's good, then things have been fixed
thanks
I even compared the hashes of a number of files, and they're the same
I didn't do all of them, but enough to satisfy myself.
Like…
while($row = mysql_fetch_array($query_result)) { $users[$row['username']] .= $row['game']; }
Something to that effect
Ok, thanks.
You can also probably ask your DB to do it for you, which is how I'd approach it
thanks for pointing me to usort, does just what I need. appreciate it greatly.
"SELECT user, stragg(games) FROM …."
hello, is there a way i can make php output what it generates to the browser faster and not stall when a exec / shell_exec command is run ? just like a perl cgi would do ?
You want to run the shell script in the background?
What does stragg do?
s/script/command/
TML not exactly i want gradual output
It aggregates columns
I meant to say that it aggregates rows into a single column
Ok.
micky, more than one of us have answered you already.
Is there a way to open a PNG image that has alpha transparency in it, and be able to keep that alphatransparency?
Wait…those are different questions
If you put the job in the background, you can't read from it…it becomes disconnected from you
You probably want php.net/flush
TML i have a script that executes around 5 or 6 shell commands but it does not output after the first one starts running and only does after the script finished
What is the command to show errors? (not the setting in php.ini–but the command in a script)
Solifugus php.net/error_reporting
Note that getting Apache, PHP, and the browser to all agree on flushing stuff is pretty hard to do a lot of the time. It's probably easier to give them a page that uses something like AJAX.
ok… will check that..
hmm.. what's this channel about.. obviously php.. but a certain version or… ?
micky, probably you want to check the output of the command while the command is still running, right? O think that the function proc_open() can do that.
TML that`s what i was thinking at first but i need the output of the command recorded in a database, then i started looking at demonising a cli app but realised i need to learn a little more to get one written and now i just got back to the old way " run each command after the other "
$query = "SELECT fc_user, stragg(fc_game) FROM friendcodes WHERE fc_user='{$user}'"; That gave me an error.
hmm
TML just the finished output since they only return something after they finish
why $_POST["choice"] is on if checked and not foo?
I'm not sure what makes you think you need to daemonize anything, but *shrug*
PHP3, PHP4, and PHP5 are fine. You can even ask questions about PHP6, but don't expect any answers.
oh.. well.. .. this is just the most simplest php i belive Lol
all im doing is converting text into .php
Hunh?
"converting text into .php" makes no sense
.txt
so i can use the include function to insert the text into a php page
O_o
well i'm writing an open source OpenVZ web interface to create new / restart / backup vps`s and the creation process requires about 6-7 commands .. everything is fine except that it stalls a little and i wanted to do a daemon that gets the commands from a db and runs them then updates the
database with the result
are there any pre-set functions to remove empty values from an array?
The .txt file is downloaded from the National Weather Service.. so the text is all organized.. but once i convert the .txt into a .php file and upload it to my site.. the text is eveywhere
everywhere*/
but if i view the same .php file on my PC
its fine
just like the .txt
You're not making sense
Changing the extension of a file from ".txt" to ".php" doesn't do anything
Unless the file actually *CONTAINS* PHP
some body can help me?
why $_POST["choice"] is on if checked and not foo?
Jalba, What you mean with "everywhere", no line breaks?
error_reporting(E_ALL); ini_set('display_errors', '1');
freebox check print_r($_POST); for all the variables you posted
Do you have more than once checkbox named "choice"?
on)
lol
no
Also, might I recommend you write cleaner HTML? For example, checkbox should be quoted.
i have an simple form
which browser are you seeing this behaviour from?
firefox
ok.. strangely, it put error_reporting(E_ALL); ini_set('display_errors', '1'); on the same line and suddenly they work.
Only reason im converting is so i can use the php include function to insert text into another page
If i knew another way.. i wouldnt mess with php
without using frames
include 'file.txt';
You don't need to "convert" anything
Jalba, you can use file_get_contents() to handle the TXT inside a variable
TML as long as his file.txt contains valid html code
yep
im making an squid.conf parser
\o/
freebox gimme a shout when you finish it
All my site is is html and css.. but the index.html i convert to index.php Just so i can use that insert command
Try http://hashphp.org/~joey/a.php and tell me what shows up
unfortunately.. the windows version of php doesn't appear to support php.net/soap
string(3) "foo" }
Actually, PHP doesn't care WHAT the file contains
I'm having a little trouble with xml parsing. I have a document that has an encoding of iso-8859-1 and I've set the target encoding to utf-8, but a right single quote mark, 0×92 in iso-8859-1 gets converted to u+0092 instead of the code u+2019, anyone know what I can do. I can't seem to find any
solution online
brb
It's something to do with your server environment or with your HTML. pastebin the HTML.
Jalba, to just show your text file within HTML use echo htmlentities(file_get_contents('/path/to/your/txt'));
ericmoritz: 0×92 in iso-8859-1 SHOULD get converted to u+0092 in UTF-8
LOL
but that's not a right single quote in utf-8 (or is it)
sry tlm, im editing an old file
:/
hahaha
thanks
hi
is there something like an "any" variable in php that just calls everything? like * under bash?
Xardas, I guess you want something like the $GLOBALS variable
ericmoritz: No, it's not a right quote in UTF-8, but it's not a right quote in ISO-8859-1 either
maybe ^^
http://drupal.org/node/154096 - i wanna do this
wiki/sometitle
and the titles are different
what are some of the programs that will crop an img on upload to a folder?
so i would need to call them all at once
GD, swimrr
http://drupal.org/node/154099 — here it's better explained
GD?
Yes, the GD library. php.net/image
with two args
I can't understand what your question is…
Are you trying to call a particular function on every single variable in the global scope of your script?
That could be a bad idea
anybody have any experience with using telnet and php?
(using the popen command maybe?)
which php accelerators can be used with fastcgi?
I know APC and ionCube *cannot*, however much that helps
where can I find the classes needed for using soap, the host has php 4.3.9, it hasn't got the soap extensions and I'm unable to install pecl or pear packages
PHP doesn't have a builtin SOAP library in 4.3.9. You might try nuSoap, but we don't support it here.
Ah, I see, the data is actually encoded as Windows-1252 instead of ISO-8859-1, man, what a pain
ericmoritz:
nuSoap dates from august 2005, seems quite old?
ok, I'm sure there is some function to convert that somewhere now that I know what to call the encoding
And PHP 4.3.9 doesn't?
PHP 4.3.9: Released: 22 Sep 2004
Thanks.. let me figure out how to do it exactly and hopefully it works
Honestly, I'd suggest finding yourself a new provider. It's one thing if they're running 4.4.y rather than 5.x.y.
I could even possibly understand if they were running 4.3.11
look at this: http://drupal.org/node/154099
lowest section
But 4.3.9? There's no excuse for that.
I run servers with 4.3.x still.
there's written how you can controle the main title of your site by such arguments
didn't know it was that old, I'll try to get the hosting company to switch to recent php5 version
(granted, I don't charge clients fees to host their applications lol)
now i'd like to adept the title of my wiki so that it's no longer the site name
with two arguments which represent the url
wiki
There's far too much code there for me to continue to be interested in your problem.
and the second must call anything
lol
thanks for help (0)
Did he ever ask a question?
yes, i did
hey
Not you, wykis
somebody have ideia howto solve this ? http://pastebin.ca/666017
well.. cu
i can force rename()?
chaoscon, idea ?
Is the blank line significant? It's not in /etc/resolv.conf
Warning: rename(squid.conf,squid.conf.old) [function.rename]: File exists in Cwamp\www\box\mostra.php
TML, I don't want put blank line
i need that rename force rename
thanks, eaccelerator apparently works, will give it a shot
TML, because if I execute this process again two blank lines will be inserted
It worked
but the text is still messy
freebox, check first if the file exists (file_exists), if exists remove it (unlink), then rename
TML, understand ?
http://www.wncw.net/advisories/
hm.. ok
how do I find out what the permissions of a specific file are?
anybody have any experience with using telnet and php?
(using the popen command maybe?)
php.net/stat
Sorry…Alanius, not alexwait
trim() the lines and manually add the \n where you want it
oh
Hello, how to determine system operating system ? I have 2 systems Linux and windows, thanks
Good call, I had forgotten about fileperms()
TML, hmmm!?
okay, thanks. One more question: why didn't any of this show up under google?
PHP_OS
You'd have to ask google, I guess
I guess
TML thanks
It does show up if you search on "PHP file permissions site:php.net"
I was starting to think it was either not possible, or else possible through some really difficult way
It's hit #6
okay, now I know that too. Thanks
php.net doesn't pay for Google placement or work particularly hard for it.
if you want to find a PHP function go direct to php.net, not through Google
Does anyone here have any experience blocking people from screen scraping prices from websites?
All you can do is prevent the casual attempts. Nothing will stop someone determined to do it.
Short of taking down your website, that is.
You could try asking them not to
http://www.wncw.net/advisories/testing.php
Anyone know why it comes out like that?
yes I have already asked them to stop
any ideas on this? I can connect to my ssh server on my windows machine on port 22. but when I use fsockopen with the same info it times out
but when I use the same code on but supply the ip on my linux box it connectes immediately
TML, still blank line :/
the people screen scrapping my site are doing it with very obvious algorithms
they are basically just going down the list of my products
quick question, how does php handle a checkbox from a form?
is it just going to be boolean
hello everyone.
I am currently very confused about escaping, exec, and escapeshellcmd
I want to verify user supplied usernames and password with the system command
/usr/local/libexec/pwauth $'username\n$passwd'
– as a bash command –
take_it_t, PHP doesn't know the type of input that the form sends to the server, but the checkbox has a "value" property, and if it is checked this value is sent otherwise no value is sent
now how do I get php to execute that command with a bash shell safely?
hey aaco.. i got the php code to work fine.. adding the .txt file.. but when the text is displayed.. for some reason its still unorganized
and the txt file is
so id simply do isset($_POST['checkbox'])
right
hi, how to connect to sock file using pdo?
tag and put the text there or use nl2br() function do convert \n to
take_it_t, yes
k, found
anyone?
ah i see what you're saying
I see that working.. only if the contents on the text file didnt change _
also another quick question, for a boolean field in mysqual what should i set the variable of which i am passing along to the database, should it simply be set as true or false, or as a true or false string?
any ideas on this? I can connect to my ssh server on my windows machine on port 22. but when I use fsockopen with the same info it times out
i have an array of say $array[5] = 'value', $array[7] = 'value2', is there a way to shift those to basic numeric indexing? i.e. $array[0], $array[1]?
or a pre-existing method in PHP rather…
if you sort it it will lose its keys
I am using openssh please tellme someone here has used it before ^_^
ascendvisual, http://www.php.net/array_values is a way to do it
oh yea, good one thanks
ascendvisual, no problem
ok. (here's hopign I'm not asking into the proverbial brick wall again): anybody have any experience with fsockopen and port 22/ssh connections?!
anyway to send identification strings?
who do I figure out where this error is? Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ']'
/usr/local/libexec/pwauth $'$username\n$passwd' ?
no line given?
line 33
swimrr, the parser found a string (like "xyz") when it was expecting a "]"
hmmmm
does the line necessarily correspond to the line in my code?
what do I need for this function? ssh2_connect? http://us3.php.net/manual/en/function.ssh2-exec.php
swimrr, yes, the string was found at this line
isn't php5.0 not supported?
Eh?
and isn't any code written in php5.0 compatible with php5.1+?
well… err… isn't php5.0 not at all recommended?
aleph0, see the system() function
aleph0, but you're using a shell construction probably, then use bash -c "command" instead
why is this print statement causing me problems? http://pastebin.ca/666067
['name'']
swimrr, change ['name''] to ['name']
ah crap
thanks guys - couldn't see that
np
Hey all
what does this channel think of the ioncube encoder?
I just installed IIS 6 and installed PHP and MySQL but I cant get php to work i created the info php labling it test.php and when i go to http://localhost/test.php it just comes up with CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.
any thoughts?
factor 1.05), but I want to calculate with the interest per day.. (1.05^(1/365)), unfortunately the '1' component ruins the precision and PHP's floats just return 1.. BC is not of any help because bcpow() only takes an integer exponent; GMP same.. what would you do?
aaco thanks. I've managed to reformulate the bash command to
{ echo "$username"; echo "$passwd"; } | /usr/local/libexec/pwauth
if you change 1 to 1.0?
tried all that!
that I can simply pass to exec with simple quotes
the question is, do I need some escapeshellcmd in there?
i'm trying to parse some utf characters.. and i'd like to store them normally… for example, the ' (single quotes) in http://www.uck.ca/test.html .. if you were to get that with file(), how would you conver the charset
Horribly, I've resorted to call MySQL to do a "select pow(1.05,1/365)" which works GREAT on MySQL 4.1, but returns a plainly wrong result on mysql 5.0
aleph0, well I think that $username and $passwd should be filtered through escapeshellarg
but I'm already even ashamed of myself for thinking of calling MySQL for it
cool thanks
help??
agentbob, how are you trying to parse them?
just want to store in db, but want to store a regular single quote/apostrophy instead of unicode char
lifeforms, what about the pow() PHP function?
so, you want to convert utf-8 characters into ascii equivalents
right
agentbob, you can try http://php.net/iconv
you might have to use mb_ereg_replace()
OMG!
pow() works where ^ fails
where can I find some basic tutorials for help with imagemagick and php?
lifeforms, lol, maybe ^just works with integers?
thanks, taking a look
I guess
thanks!
lifeforms, no problem
it's even accurate!
thanks 10^6
iconv works! thanks
agentbob, no problem!
Anyone got any thoughts about CGI Error on IIS 6?
where can i read about what the special comments /** */ means in php
Logic-Box, it is not exactly a PHP issue but take a look at http://support.microsoft.com/kb/145661
gwhite, you mean javadoc, or phpdoc style comments?
thanks aaco looking now
gwhite, means nothing but comments to PHP, but means documentation structure to php-doc
aaco thats what i mean
do you mean phpDoc?
gwhite, phpdoc.org, I think there is a php-doc on PEAR, I don't know if it's the same
thanks
anybody have a script(or link to page) that shows how many people viewing site on-line ? thanks
I have php code that works when I try it on the command line, but not when I include it in the web portal software I'm trying to modify.
uI have php code that works when I try it on the command line, but not when I include it in the web portal software I'm trying to modify./u
if im doing a function which i want to pass multiple variables can i go function(array($vars)){ foreach $vars for $var{ } } ??
sorry. just a typo
I'm off
what error number should I get with fsockopen (http://us2.php.net/manual/en/function.fsockopen.php) if the connection times out?
should i be worried about packet snooping?
in terms of sending information with GET etc
anyone know a chat channel or irc server for IIS?
oh my
is it more efficient to use stdClass or arrays to build a datastructure of strings and ints, etc
pretty sure arrays use less memory
array ftw
thanks dude
Hello
I need to match ^tutorials/([1-9]+)?(/([0-9]+))?(/([0-9]+))?(/([0-9]+))?(/([0-9]+))$
But thats not working
nvm
Anyone else considered hiring a contract killer to deal with those 'problem' clients?
how would i check for spaces in a variable?
strpos(' ',$var)
Thought about it, but then I realized that it'd just make my accounts receivable ledger a maintenance headache.
There are certainly potential downsides…
what will that return?
false or a number.
oh okay
If there's a space.
It won't match other types of space (tabs, newlines, etc)
any good tutorials on controllign remote servers with fsockopen?
or even using it in general
It just opens a socket.
It simply opens a socket you and the server can communicate. The type of communication depends all on you. You can communicate via binary data or just plain text, it's up to you.
Hi guys
hello sugaryse
Is there a way to write a small app which would tell me the hostname of a user
users computer
So a user would click a link which would get there hostname of there computer and save it to a file
hi
php would not be useful for that.. because it runs on the server side, sugaryse
What would I have to use? Javascript
can i apply func_get_args() to a variable. And than pass that variable through a foreach
Er, sure.
take_it_t, I beg your pardon?
haha, its been a while since i did any php
func_get_args() can't be used unless assigned to a variable in the first place.
func_get_args() is for methods, not variables
basically i have a function, with dynamic parameters
ah, that's how I should have read it. Sorry, I should get some sleep now. Cheers guys, see you later.
how can i get each of these parameters and than process each of the values
Anyone have any idea where I can buy hosting that's not shared
rather dedicated, virtual, etc.
at a decent price
I heard localhost got a free first server deal right now
No shit?
hurry up, it is only valid for +Infinity days
Hi, all. I've got a little question
ask
Well I want to get the id of the last row in a mysql table
max()
so I created a new query, whick selects all
and $lastid = mysql_result($result,$num,"id");
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die("Unable to select database");
$query = "SELECT * FROM posts";
$result = mysql_query($query);
$num = mysql_num_rows($result);
mysql_close();
$howmuchids = mysql_result($result,$num,"id");
Wow.
heh.
mysql_result() [function.mysql-result]: Unable to jump to row 7 on MySQL result index 3 in /var/www/Personal Site/blog.php on line 38
You wanted to get an individual field, so you queried the entire table.
That didn't strike you as inefficient?
ORDER BY ID LIMIT 0, 1')));
hehe
oooooo, touche
Hello!
You could simply use mysql_result() on that query, eternal_enigma, to avoid the mysql_fetch_assoc() and array_pop()
even better, good sugg
But why does my script work?
Hey guys.
I see that there is an easier way, but I'm curious
Can someone help me get started on converting a webdna based site to php?
I just need to figure out how the code translates, i guess?
Er… I mean - Why does not work
how do I get a variable from a script outside the function?
Pass it into the function, use a class scope variable, or a global. (Best to pass it in.)
Hello again everyone
good but "If you want them to ask questions, specify if they are to do so as they have them, or wait until the end of the interview."
change that tp
**to
Specify when there is time for them to ask questions, if they are to do so as they have them, or wait until the end of the interview."
why does the following not work
OR take out that part
if(strpos(' ', $var)==TRUE){ echo 'Spaces'; } else{ echo 'no spaces'; }
wait
wrong channel
Heh.
anybody?
"httpd.exe: Syntax error on line 491 of E:/Abstract Designs/Web Server/Apache/conf/httpd.conf: Cannot load E:/Abstract Designs/Web Server/php/php5apache2.dll into server: The specified module could not be found." I have checked, and doulbe checked that the path is correct, and it is
if (strpos($var, ' ') !== FALSE) { echo 'There are spaces.'; } else { echo 'There are no spaces.'; }
GBenemy, the path may be correct but did you make sure the file is in that directory?
and if so, is the case sensitive?
the file is in that directory, i'll check the case
paste me line 491
LoadModule php5_module "EAbstract Designs\Web Server\php\php5apache2.dll"
did you try taking the "" off?
LoadModule php5_module EAbstract Designs\Web Server\php\php5apache2.dll
?
maybe
I think I know the isse
it gave me this:
it is not the module itself
"httpd.exe: Syntax error on line 488 of E:/Abstract Designs/Web Server/Apache/conf/httpd.conf: LoadModule takes two arguments, a module name and the name of a shared object file to load it from"
is it unsafe to have an insecure login for an admin function of a site??
it is the php interperter
or does it not matter
i mean it's not like people are going to snoop the packets
ah
What makes you think nobody's going to snoop the packets?
AddModule mod_php5.c ?
did you do that?
Yea, you need the "s
well to snoop the packets they have to be between your computer and the server anyway
so it's unlikely
he needs this:
Yes, we call that a 'man in the middle' attack.
LoadFile "php5ts.dll"
ah!
yea
!
i remember now
yeh and it's unlikely they would work out where those middle points are anyway
*walks away*
so what do i do sorry?
take out the LoadModule php5_module EAbstract Designs\Web Server\php\php5apache2.dll and add in LoadFile "php5ts.dll"
?
i mean they wouldn't be able to gain access to the middle points or even have the motivation to try that
That's not a reason to choose an insecure approach.
add an loadfile directive for the php5ts.dll before the loadmodule for php5apache2_2.dll
yeh but even if theres a security breach they won't be able to do much
You really want to entrust the security of your site to that assumption?
hmm well eventually i will want a fully functional admin panel so yeh maybe it's best to use secure http
http://wiki.apache.org/httpd/PHPOnWindows
just wondering, what's the simplest way to take a string and insert a dot before the last two characters
is it possible to enable https on shared hosting?
or does it need something special :s
When working with regex, does the "?" mean it may have it or not? and if so should it go in-front or behind the thing you are trying match?
Saberu, not usualy
o ok
If your account includes that, perhaps.
you kinda need a dedicated ip address for ssl
o
are all variables in a session stored?
well i don't have that
or do you have to define them somehow?
and most shared hosts does not provide that, they give thousends of sites the same ip
shall i just risk insecure?
x-x
it's not like i'm sending bank details..
Do you deal with any sort of personal information?
not really, it's just an admin panel for a dating website
the shared hosting is the higher risk than the lack of SSL, to me at least
swimrr, all variables except for resources and class properties the class don't want saved is saved.
Dating websites tend to include personal information.
hey it worked
thank-you
well yeh information that is available on the site freely
so it's not private
thanks everyone!
wait
no not quite
uh oh, GBenemy broke it
:P
swimrr, this even applies to nested complex variables, you can even save recursive complex variables properly
broke it?
basically
anyone? is there a built in php function that could help me insert a character before the last two characters of a string??
i restarted apache, and everything went fine
i'd do that, if I knew what they were
lol
until i pointed my browser to http://localhost
all object pointers in one serilization call will work properly
then apache "has encountered an unexpected error and closed"
GR
GBenemy, ##apache
hydrozen, let me think
:P
err
#apache
nvm
it's working now
hydrozen, what about substr($var,0,-2).$insert.substr($var,-2);
Has anyone worked with WebDNA before?
sounds good… i can't think anymore been up too long
Is it possible to get .htaccess here? The people in #apache arn't helping.
help here*
blah569, you are doing it wrong
it is not .htaccess
What?
hmm
Well, Does anyone have any idea what the url should be with? ( RewriteRule view/(.*)/(.*)/$ /ul/viewfile.php?$1=$2) (http://www.mysite.com/view/1 doesn't work)
it is apache directory specific configuration files
I'm STILL getting this when i go to my phpMyAdmin "Cannot load mysql extension. Please check your PHP configuration."
the line is uncommented in my php.ini
but
hi
you should, if possible at all, use the main apache config file instead, since it is faster
Me or someone else?
GBenemy, I highly recomend the mysqli extension over the mysql extesion
I don't have mysqli installed
blah569, you for my secound last reply
what ever that is
GBenemy, it is a pack in php extension
that does everything that the mysql extension does, and more
things like prepared queries
whats the minimal Options-Directive to set so that I can use 'php_value' in htaccess-files?
ok
I did that one
but i still get "Cannot load mysql extension. Please check your PHP configuration."
GBenemy, remmember to tell phpmyadmin to use it too
What httpd are you using?
Apache
how?
config.inc.php?
and please, please dont forget to reload the config file for apache
When you stop apache and start it again, do you get any prompts such as "Cannot load DLL"?
GBenemy, yes, that file
why wouldnt this work array_keys($array[0])
no
I use restart
and a command box pops up
and then closes
what's the line?
Athfa1, because it likely is not an array
$array=array(array()); would make it work
GBenemy, if apache is a service, remmember to restart the service instead
hi…
yea nm it is an array inside an array but i am doing something wrong
use the windows service mmc plugin to do that
yu[
**yup
except the restart.exe does it
Athfa1, do a var_dump on the expression
because that's what i did when i changed my http.conf for the php thng
How do I sort the output of directoryitertor? As sort($dir) doesn't work?
GBenemy, wild guess, but is apache running at all?
freebird, save into an array your self and then sort
right now, yes
You'll have to read it all in order to sort it
I'm lazy…that involved me recoding existing work…no other way?
I still don't know how to get phpmyadmin to use mysqli
I mean it will involve me recoding…any other way?
You can't sort something until you know what all the values are
freebird, borow someone elses code to do it
I thought the directoryiterator was an array…obviously not?
No, it's an iterator
enlighten me
I'm not a programmer…what's an iterator
GBenemy, did you checkout the phpmyadmin autoconfig script?
yes
http://en.wikipedia.org/wiki/Iterator
hi. what's the regex to extract the strings between "!!" in: !!HI!! !!HELLO!! !!THERE!!
I couldn't find which button did that
GBenemy instead of wasting everyones time including your own on a very BASIC install procedure (if you cant figure it out after all this time it is probably not for you) why don't you grab a complete, newbie-friendly WAMP (windows-apache-mysql-php). you can check out http://www.wampserver.com/en/ , although there are plenty of other WAMP packages. google.
an itterator in c++ is easy, *(i++)
I had XAMPP
and i replaced it with Apache, mysql and php
because the xampp had all the olds versions of them
GBenemy, may I recomend power tools like "proccess monitor" and "proccess explorer"
they are great for tricky debuging of things that don't feel like working
so you iterate over an array..you don't iterate over an iterator
while it may be "basic" for some, it may be harder for others, that's like saying riding a bike is "basic" for some it may be, for others it may be quite difficult, you cannot judge another users experiences on difficulty based solely on your own
You iterate over anything that implements an iterator protocol
how do I change move_uploaded_file ($_FILES['thefile']['tmp_name'], "../users/{$_FILES['thefile']['name']}") so that 'name' is a variable?
Arrays happen do so, with the side benefit of always knowing what all the data is at any point
GBenemy you have been asking questions in here and #mysql all afternoon pertaining to using the mysqli extension with phpmyadmin. figure it out. read the manual. READ IT!
hi. what's the regex to extract the strings between "!!" in: !!HI!! !!HELLO!! !!THERE!!
But they are not iterators themselves…they're just a data structure that implement iteration
swimrr, may I strongly sugest that you start checking the script so that it doesn't allow directory transfersal attacks
!!(.*?)!!
i have said, in both channels several time, i don't get it
what are those?
GBenemy, use phpinfo() to see what you have got installed
I made a php frontend to my home media centre…I used the directoryiterator and will have to a bit of recoding to bring the html I was spitting out back into an array
and if you can not do the change your self, you shouldn't be playing with powerfull things like php
how can i tell if im running php as a 'cgi server' isnt that what it does by default anytime i use php to make dynamic web pages?
GBenemy, then perhaps you should quit. if you can do nothing for yourself, you should not automatically expect that everything will be done for you.
seems there isn't a shortcut then
What, exactly, do you fail to understand?
swimrr, let's say the user says the uploaded file is ../../../../../../../../etc/passwd
what do you think would happen?
Instead of DirectoryIterator, you might consider glob()
if I don't play with them, how do I ever know them?
read whitepaper
TML, nope.
Are you aware of some secret profundity of PHP whitepapers?
http://www.henke37.cjb.net/index.php?page=phpsafety
and it is no seceret
What do you mean "nope"?
TML, it's not that.
imo everyone in this channel should read this whitepaper
guess henke was born a php expert
hi guys, Iam trying to have my text field show available options while typing. any idea?
What about scandir? Would it give me an array to sort so I could keep my existing foreach?
Yes it is
$ php -r ' preg_match_all("/!!(.*?)!!/", "!!HI!! !!HELLO!! !!THERE!!", $m); var_dump($m[1]);'
no, I studied to become the expert, but I do have a natural affinity to programing
Works just fine
Alloosh, javascript, ask #javascript
hence…. henke37: and if you can not do the change your self, you shouldn't be playing with powerfull things like php
thanks
all the words, i understand but put them together in that way and i don't. so unless, trix, when you started, you instantly understood absolutely everything that you had to do, then i suggest you either help me, so that i "stop wasting your time" or just stop fucking patronising me and ignore
me, either way suits me fine
TML, I want to split it
That's not what you asked
What do you want to split it on?
an array
GBenemy, you choose the more difficult path and expect people to hold your hand. get over it. I will take your suggestion, though.
What do you want to split it *ON*
array of strings that is
TML, what do you mean?
TML, I want the strings inside !!
Then use the regex I gave you.
That's not splitting
!!HI!! !!HELLO!! !!THERE!! — i want HI HELLO and THERE inside array[0] array[1] array[2]
!!(.*?)!!
TML, i'm using java String.split
b0r3d, do a var_dump on $m
You're in the wrong channel for help with Java
This is ##PHP
you might find that it is complexer then you think
Although I'll point out that you seem to have a fundamental misunderstanding of what "splitting" is. To split something means to find a particular symbol that appears *between* the tokens. For example, CSV can be split on comma: "abcd","defg". What you have is something that appears *AROUND*
the tokens.
what is CSV
TML, so in my case i won't be able to split it according to a pattern
hey guys
b0r3d, you want to remove the excess chrs not split
I'm sure there's some incredibly convoluted way to make Java do what you want, but that's A) not the point; and B) not on-topic in ##PHP
maybe he wants to replace them
did you guys know that strings in java is never storaged twice?
The point is "Your proposed solution is not a natural fit for the problem"
you can stuff one hundred vars with the same thing
and is also a stupidly slow way to do things if you are doing string jugeling
I find string abuse in php reasonably fast
We try
that is because each php string contains the actual characters
anyone done any conversion from pdf to jpg, atm i got one going pdf-ppm-jpg and sometimes it fails
I wrote a amipro.sam to html converter at the weekend
"amipro.sam"?
old windows 3 word processor
I've got an error that I can't find is someone is willing to look and see what I am missing.
http://pastebin.com/m4cd227c6
You know, if you would clean up that document, and break it into self-contained sections, I'd like to see it posted on our site.
Where's line 134? That paste has significantly fewer than 134 lines.
well, while I myself are to lazy to do it, I don't mind licenseing it away
Last three lines of the actual code…..the comment
Logan_Andrews, minior bug at line 6, print_r does not work like you think.
the br is never outputed
it's doing well enough as a trouble shooting tool
sql injevtion vulnerability at line 12
it will be out of the final copy
*injection
hey guys, i'm not getting a response (looks like no activity at all) in the smarty channel. Anyone here up for a challenge?
specifically what's wrong with the sql?
let's just assume that all sql queries has at least one injection vuln and get done with it
Logan_Andrews, you know what sql injection is?
you are not cleaning the variables in the sql
also appologies all those line numbers are off since I only posted the applicable section
$view and $formatdata
err..formdata
Unfortunately, the parse error is not in the section you pasted.
no I don't
try reading my whitepaper
http://www.henke37.cjb.net/index.php?page=phpsafety