fetchRow()” how do i fix this?

#apache

Sorry about this; what kind of thing am i looking for The include for libmysql.so? There’s an additional /etc/php.d/mysql.ini The file itself just says “extension=mysql.so”

Kuja, just did a test run on my process thumbnails scripts, it gets through a ton of them but dies at one stage with memory alloation problem, the last memory usage reports 1884208 just before it crashes on this message “Allowed memory size of 8388608 bytes exhausted (tried to allocate 224 bytes)” kuja, so the script’s only using 1.9MB by the looks of it before it crashes.

i was moving some of my prepared statement queries to SPs. it seems to have created a problem where a mysqli_free_result doesn’t seem to work the same way since i now get the “Commands out of sync” error on the second prepare attempt. any ideas as to what i may be missing?

hi Wolfpaws, you adviced me to call the code from within a function, didn’t you? this code uses global variables… there isn’t a funktion that interpretes another script independantly, and returns the script’s output?

What’s wrong with my google calculator? http://rafb.net/p/y9TENa63.html

ob_start()

why don’t you tell people what is wrong with it

Monie you forgot { or not

ah. i found it. next_result(). it wasn’t that obvious to me

Any ideas how i’m supposed to include a directory that contains individual ini fileS? files*

oo

Anyone know of a good, free PHP5 tutorial?

And also, to restart PHP

(quite a random answer, but the question was kind of random too. with ob_start() you can get the output buffer from a script and use in other)

you can’t include a directory. You could I guess use scandir() and then loop the result, including each file seperatly

moraes, well, maybe I should ask better:

See, i think fedora 7 may do it automatically not sure, but..

AlexC_, u available?

Master_Plan, you mean service httpd reload?

hahaha, anyone seen this before? http://www.phpobjectgenerator.com/ the submit button is a sperm :P

the callen script should be executed INDEPENDANTLY of the caller script. ie, the called script as NO access to the ressources of the caller script.

i’m such a child… lol

lolz

does someone here uses maxmind?

just about to go and grab some food

http://devzone.zend.com/node/view/id/627

need fooood

AlexC_, c u in tango when u get back?

or here

Need to restart php

AlexC_, tango - its quieter

moraes, no idea for this? ok…

php-bot: tell Ringostarr about aolbonics

The mysql info is supposed to be in etc/php.d/mysql.ini

1. execute the independent script, 2. save output using output buffering 3. get the output to use in the other one

1. execute the independent script == how? THAT is my problem^^

php-bot, why no aolbonics - they are just faster when writing quickly

LoL AOLBonics shows gayness from the start

and yes - i know its a bot

nobody will help you if you use AOLBonics.

bah, if you continue you’ll be banned. end of story.

with include, or require etc, the script is some kind of inserted, not called independantly

In fact, I would yell at you.

I was thinking of a more advanced, in-deep tutorial of php5, explaining the OO futures, etc.

no aolbonics. it degrades your intellect, makes you look dumb, and it’s a rule.

http://br2.php.net/curl ?

i see people using the letter “k” for ok in here regularly - and adding the letter z never mind tho

stx still here?

yeah

you looking for php5 OOP guide?

hmm, ok, so what could cause this memory problem, anyone able to look at some code here and tell me why after about 35 file reads and 69 image generations in it faults on memory allocation? http://pastebin.com/m45f38e5d

yes

Try this.. http://devzone.zend.com/node/view/id/638

moreas, looks nice, but I have no permission to install such things

Could anyone please help me with this problem? All of my configuration files are default for fedora 7, i’ve not customised ANYTHING at all, but when i try to use mysql_connect or mysql_query the script on the webserver does not load ANYTHING

piXelshooter, ask for it, if not get a better host

Hi

does array_map preserve keys?

have you configured Apache properly and php to load mysql modules?

sorry. maybe: http://www.sitepoint.com/forums/showthread.php?t=78687

Is it good performance level if entire script executes in 0.02727 second? Or is it slow?

sonds like it doesn’t know those functions

I’ve got php to load mysql modules, but i’m unsure about the apache part — what should i configure to do that?

maybe it needs mysqli instead?

does phpinfo(); show all mysql modules are loaded correctly, have you restarted apache server since making any modifications to PHP.INI?

file_get_contents()

Do you want me to dump my phpinfo()?

php -l yourfile.php. probably the errors are going to a log somewhere and you don’t see it complaining

I’ve set it to log_errors = on Still nothing

yeah sure. What does mysql_connect produce a blank page or error?

moreas, really nice that you help me . I’ll try s.th with it…

I’ve had that before, and it was down to not installing MySQL

also check your apache error log

blank page

http://www.sitepoint.com/forums/showthread.php?t=78687#post1141967

Currently using mysql_connect() or die(”error”); (with obciously the credentials in mysql_connect)

thanks.

Nope, MySQL is installed

Thank you!

mysql-devel, MySQL 5 && mysql-server

i don’t think “or die” works if the function doesn’t exist

is there a native implamentation for threads in php? something which takes care of launching, killing and getting the restults?

Hmm

a blank page indicates that something is not configured correctly between apache/php/mysql

or a patch or something?

Well, i think it’s most likely the apache issue

just do php mysql_connect(); ? nothing inbetween the ()

Check your apache error log

try “display_errors = On” in your INI that may make it easier for you to get started

Errors are one on* Use of undefined constant mysql_connect - assumed ‘mysql_connect’ in /var/www/html/index.php on line 2

make sure you have enabled the mysql module in mysql.so if it comes shipped seperatly

Dynom,

apache is probably croaking

if it is’nt enabled php will just crash without any error

Inside mysql.so?

extension=mysql.so

Yes I used; yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel

was the line i needet to enable

moreas, eval(file_get_contents(”…”)); does not work. eval dies because of the in php at the beginning of the file eval is not independent. If I write eval(”die();”);, not only the evaluated script dies, but the whole script.

But, in Fedora they’re all defined in /etc/php.d/x.ini x = mysql, msql, etc

would it be better to load all the data from a table and when something needs editing to refrence what has been loaded to only update what has changed? or can I overwrite all the data when a update has been sent

hm okay

you apt-get php-mysql package?

No

http://www.somacon.com/p109.php - try this as well

i’m lost.

i used yum -___- I used; yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel

Do *NOT* use eval unless 1) you know EXACTLY what are you doing and 2) there is no other way. !+eval

If eval() is the answer, you’re almost certainly asking the wrong question. — Rasmus Lerdorf, BDFL of PHP

heh eval teh win

hmm

Wolfpaws! How to get a list of these channel commands?

Wolfpaws, another idea? btw, eval executes the script in the same thread…

eval is good when you don’t know the question, but your advanced user does

Why aren’t you just updating the neccesary information exactly when it’s required?

and you trust them

php is so sweet - it’s possible to do console programs, websites, ncurses and gtk… the only disadvantage is that it has no thread support. is’nt it planned to implent it?

because theres no easy way to do that

what is pcntl for?

because I use a form to display the data in the database the data in the database is just a bunch of ones and zereos for ‘on’ and ‘off’ (checked, unchecked) and I use the form submit button to send it for processing

Okay, well 0 want to get my problem sorted out first ;-D

hey fuck hell, have’nt seen that yet hydester! thanks

morning DARKGirl

Please tell me what the hell fedora thinks it’s doing putting all the things in php.d -_______-

the only way I can think of doing it is by loading all the data from the database into temporary variables g’morning, [fields]

whats your puzzle?

its not a puzzle, really. Its just a question as to which would be more efficient i suppose I can read the database to check to see the value before attempting to change it and only change it if the values differ

Wait a minute.. what exact kind of program needs to dump an entire database and display it? Wohoo, fedora does suck I just added the line in php.ini and it’s working -_-

its not dumping the entire database O_o it displays the data in a single table, based on user

if(function_exists(’mysql_connect’)) {print(”Yeah, its fscked”);} Works Well, thanks a lot anyways you sexy people ;-D

huh im confused lol I think I will just overwrite everything

Temporary tables work well for that kinda thing

thats the easiest way to implement this

6.. is there an easy way of receiving the month out of

vas php.net/strtotime and then php.net/date

thnx

Hurray, back to coding

a new what?

hurray. this should be fun. will try one day.

Well, they call it “CSM”; it’s where they manage all their orders and things like that When you phone them up, they ask for an order number, blah blah — it sucks, though

ah I see,

Their current one cost £100,000 and it’s coded in ASP and sucks ass

CRM is fun.

O_o

I’ve already coded in php for a few years, but i’ve only just switched to installing php5 on linux all these years First time for everything, i guess Well — i’ve installed it before, but was unsure how Fedora7 did it this time ’round :-)

setting up lamp couldn’t be any more easier on Linux ^^

I can install most other things I’ve switched about 50 computers from windows vista to SuSe enterprise here

support is better each day. like, updated packages and so. amazing.

Now i can finally use linux, and support it

hi all

hi ringo!

Hey there; i love your music

hey that whole strptime thing is really confusing me, how would I easily use that to get the month name out of a string

Why No Internal Browser tab on Zend Studio IDE? in Linux

date($format, strtotime($string))

Hmm

@CAA:85 5ABL?

hi sanek! yeah, we are here.

=0H?

I agree, english only sorry

OK, sorry

not sure why I told him that if he can’t speak english, what good is it for me to say english only ohhh, you can speak english

crazy

Hmm

Why No Internal Browser tab on Zend Studio IDE?

For some reason, php is spitting out an error for missing delimiter return (mysql_connect($conn[’host’],$conn[’user’],$conn[’pass’] && mysql_select_db($conn[’path’])) ? TRUE : FALSE; Sorry, unexpected

missing a )

AlexC_, u free?

Thanks Alex

mysql_connect( foo, bar, car && mysql_select …. ) Master_Plan you’re welcome, that I am

It’s working, now It’s using // mysql://user:pass@localhost/database :-D

cool AlexC_ where were we

##php

were not are lol last night i meant lol

Anyone tried fedora 7?

hi How do I do user management in php?

is this a trick question?

no

`adduser`

I have absolutely no idea and want to program a forum

then it’s best you start from the beginning, DukeDrake

well, youre propably on the same line as most of the forum programmers

Contribute to phpBB instead of wasting time on new forum stuff

how long have you been coding in php?

OR contribute towards DruBB, pleeease :-)

Ok, I pondered about using flatfile, SQL-based user management, os-based user management, apache basic-auth or digest-auth and such.

-_-

But somehow I get the feeling that the ‘right’ solution is not yet among these

os-based user management with fail, s/with/would

The last thing we need is a new forum software

they all work. it all depends on what you want to do

it would only work on a server that let random PHP scripts create a new user which …. last time I checked, the grand total is 0

AlexC, that was sarcasm

there needs to be an internet standard … maybe some W3C standard sarcasm tags uthere needs to be an internet standard … maybe some W3C standard sarcasm tags/u

hm… true o.o

at least that is my standard. but i am not standardized

so you’re a sort of Microsoft?

Absolutely not.

“it’s a standard …. just, my standard”

i am not that rich either

oh

oh dear, what the hell have you done

so … flatfile would actually work then….

Err, pressed wrong bouton :X

how did you do that?

thnx

what the hell was that lol

typed /notice AlexC_ text

you should really start from the beggining and do some basic database stuff,

i’m going to just throw this out there: sql all the way

hey how do I add something to the end fo an array, like dynamically, I just need to toss a string to the end of an array

attempting to do a form while storing all user data in a file will, somehow fail

as another value in the array

vas $foo = array( ‘foo’, ‘bar’ ); $foo[] = ‘car’;

not that i’m a big fan of this, but some people would argue for LDAP

thnx

the bosses love to ask for LDAP

i don’t know any reason not to use sql?

Or, just look at phpBB and say “wow, this has covered all the ground i’m going to cover; i think what i’ll do is something worthwhile and contribute towards this project — i’ll get props from the community, some thrill and also have helped a project out.” “Second thoughts, let’s get started coding a login interface” YAWN

i think i’ll make my own little library that uses the LDAP acronym, just so i can tell them i’m using LDAP. they won’t think of asking any details

when I do a exec(’ssh -i /usr/local/userdata/username/username usernamel@123.123.123.123 -f /home/username/script restart’) I get the following error: Could not create directory ‘/var/www/.ssh’. Host key verification failed. Never had this issue this way

Check your permissions

Master_Plan, but I don’t want and need an /var/www/.ssh

use sudo

you do need one,

if you really want to do stuff like that

:O

AlexC_, always ?

when you SSH it creates that directory and a ./ssh/known_hosts file yes, it’s required

hydester, I do this as a user, not as root

sudo -u user

sudo is using it as user

AlexC_, mhh, but that is not nice in your www folder if you ask me

just remember to deny access to it via .htaccess

AlexC_, true, never needed it before, but it asked for a password

yes, the users password

just spectating here, but, as i’ve never yet made a forum, you’re saying you’re going to store user data in an sql database?

AlexC_, or should I use the ssh function of PHP ?

anyone know any good spyware program?

yeah, it’s called wtf-are-you-on-about-ware

antu-spyware*

b00j check #windows

haha

cheers

I’m not familiar with them

b00j, I had a bash spyware that did the following echo “rootpassword” ;

forget check windows, just install Windows

AlexC_, me neither, so I use exec and bash

oh, did you mean spyware or anti-spyware?

Linux

AdAware and SpyBot are favorites

anti-spyare

and use firefox

now that makes more sense,

windows defender

but it’s not really a topic for ##php

and don’t surf the web as admin

don’t surf the web

It’s porn

hijackthis, rootkitrevealer, ccleaner, xpantispy

true. unplug the network cable and you’re as safe as you can be and have a good virus checker

avg

solve this all by just installing Linux

reimage the windows box daily

lol so are the user records going to be in sql or a text file

I say go for plain-text file with plain-text passwords,

text files scale real well

and allowing $_POST data straight into SQL queries so malicious users can have their fun

using quicksort?

then do random things like unlink( $_GET[’page’ ) ); so they can do even more destruction. Gotta let them have their fun

a ‘normal’ var’s value won’t be changed when the execution leaves its scope, right?

i thnk you should to ` $_GET[’page’] ` - why constrain the user? all about openness and flexibility

it means they can be accessed without having to create a new instance of the class this is true and once in a while have it show the users passwords ‘accidently’

honestly, download phpBB or phorum and play with those

or even an instance at all?

yes

look at the code, at the dtabase, etc.

I see. Thank you

and use them or use those to fork your own

Oh, man — what a quote

what quote?

single or double?

“My religion consists of a humble admiration of the illimitable superior spirit who reveals himself in the slight details we are able to perceive with our frail and feeble mind.” Albert Einstein Presumably during his “Annus Mirabillis”

Well, I have some ideas about the mind and people myself, but it’s not really appropriate for this channel

#philosophy

Is it possible to just define a variable without any specific data? i.e $var; Or does it have to be $var = “”;

$var = null or 0 or ” or whateverf

not 0 i dont think

NULL will do

Why not 0?

cause it has a value aka data unlike null

so? null is also data. 0×00 to be exact

well, if it’s not initialized to anything it’s still null, right?

yes, but if the ariable called isn’t iniialized, then you get error of level E_NOTICE

idk is there a deb package for phorum?

is this a correct channel to ask?

well, you were all talking about it a second ago

I was? IIRC, I was talking about variables in PHP

i didn’t bring it up or anything not you

hi folks can someone please help me ro-code a script AlexC_ was helping with last night …. apparently it was full of holes

then fix it?

i’m trying Wolfpaws thats what AlexC_ was doing - helping me fix it

honestly, download phpBB or phorum and play with those

Why don’t you ask the person who coded it in the first place?

and since phorum runs on php, i think that makes it at least mildly relevant

wolferine, coz i added to it from as it was given and i cant get hold of the urchin that gave it me Wolfpaws, even

this is #php right i’m not in the wrong channel or anything am i

i’d really appreciate some help, if no one is willing or able i might as well go quit learning php

did you learned PHP already or you just want us te do your job?

Hmm, when a query returns more than one row, and you fetch an array; in MySQL, what is the array layout?

, [1], etc ?

am just learning Wolfpaws

no, just 1 MySQL row - you have to do a loop

I have a feeling you never even started learning PHP.

Hmm

Wolfpaws, u do do u i know i shouldnt have use “u”

So, you have to do more than one query?

Is there something wrong with executing this using COM and ADODB.Connection: mid(digits, 1, 11) LIKE ‘*7*’

slap me php-bot

That is in a SQL query for an Acess database s/Acess/Access

that’s not what I said, you keep looping mysql_fetch_array or what ever until it returns false

Ah, i see

php-bot? I have a better idea.

Lemme post some code i was working on http://rafb.net/p/dfHisN31.html

if you’re suppose to be creating this order-tracking thing for Woolworths, I think it would be a great idea to actually learn about PHP and MySQL

Trying to recurse over each row, and append/prepend with tr/tr I’m just testing MySQL, i’ve already done it with PostgreSQL but i was unsure how the MySQL query was passed into the array It’s fine now, though.. i’ve run it The other stuff is verified with other routines, so it’s fine

sup

is there a way to prevent a form from loading a seperate page when it only contains php code?

DARKGirl javascript

When the user clicks on the ’submit changes’ button, the script IS called, but the page doesnt switch to it, instead, a popup appears telling the user that the changes have been updated in the database

javascript. slash ajax slash buzz-word-of-the-day

ajax?

asynchronous javascript & xml its the new web 2.0 kind of crap that does just what you explained, and more

hello, having a thing like for ($tabindex = 1; $tabindex = 3; $tabindex++) $output .= $indent . ‘ tabindex=”‘ . $tabindex . ‘”‘; that’ll create a tabindex numeration for menu items, how can i create it without know the number of items, please? = 1?

you can also just reload the page with the values retained and them pop up the alert not always necessary to be that fancy when people’s connections and computers are fast

you can get plenty of books/tutorials on the topics ajax and javascript that’ll help you do realtime changes to webpages without it appearing as if you’re really doing anything

what’s the smartest way to get the current directory?

getcwd? dirname( __FILE__ );

thanks

Is it good or bad performance level if entire script executes in 0.02727 second?

I’ll php.net it

that’s very vaque what does the script do? how does the script do it? on what hardware? what load? how many pigs are currently flying?

hang on - __FILE__ doesn’t return a path, does it?

yes,

http://rafb.net/paste/ - is $this-data a reference to method argument or to $data array (out of class)?

Danker wtf? that much, you should optimize more, that’s terrible

Why?

Danker nothing, just ignore that line

http://rafb.net/p/QgHmaU83.html

Danker if all your script does is echo “lol”; then yes, it’s pretty bad.

how can I make a form that submits via ajax request when the user presses enter instead of having to click the submit button? i dont want it to actually submit the page though, it has to just call a function to send the ajax request

Does anybody here have any experience with MagickWand?

how do I use a variable with a ” ” in the name like “my variable” ?

And whether it’s faster than doing an exec(”convert …. “) ?

aarcane, variables can’t contain spaces.

is there a way to echo out the SQL statement PDO executes?

andre_pl, they can, you just have to escape them, and I think you have to use variable variables somehow, but I’m not sure of the exact details.

aarcane, even if it is possible, i would say its a horrible decision to use them. just dont and why would you want to?

andre_pl, I just want to demonstrate to my teacher that it’s “possible”, not that it’s a good idea :P

bah

$foo = “test var”; ${$foo} = “bar”; echo ${$foo}; var_dump( get_defined_vars() );

let me add that to my list of useful code snippets /sarcasm

oh, sorry it was meant for aarcane

yeah I figured.. not trying to be rude or anything, I just think its about the dumbest thing I’ve seen.

hello, is there a php class which can display error messages on html pages?

What error messages?

principally any messages

AlexC_, still around ?

not sure, are you?

there is a message displaying facility in horde. i was looking for something similar

AlexC_, Dunno, before the beer and pills or after it ?

I’ll go for before

It’s called “echo”

Hi, what function is faster to get 1 line from web page. fsock() file() file_get_contents(). I need one line to get from page.

is there some more or less “standard” known regexps for validation of an username ?

AlexC_, yeah me… OK than I’m here

it depends on what you want as a valid username ok, glad we got that sorted out

no

no what?

that’s right.

AlexC_, I’m still figuring out how to ssh to the box using PHP exec() still a right problem… the user is only known on the remote hosts, that is why I use that key

so we can’t answer

AlexC_, yeah… that’swhere it’s all about

what was the code?

yes I know. I was just wondering if there was some frequent/known usage for acceptability of logins

AlexC_ , when I do a exec(’ssh -i /usr/local/userdata/username/username usernamel@123.123.123.123 -f /home/username/script restart’) I get the following error: Could not create directory ‘/var/www/.ssh’.

I’d say normally anything,

no, i probaply couldn’t explain my needs

I think I’m going to avoid nicknames such as “_____” for example

then it needs to make that .ssh directory, but doesn’t have permission

or even “_J_O_H_N_”, I guess I have to define my rules and create the appropriated regexp appropriate*

AlexC_, if that is the only way…

exactly, but what if someones username is normally _J_O_H_N_ ?

How are you supose that I could help you then? I have absolutely no idea what “message” in your case is.

hello guys… I’m having a little problem… got this code:

well, that’s why I was asking if there was some existing conventions about what’s usually appropriate and what isn’t

$xxx = array( array( 03, 06, 12 ), array( 08, 09, 10 ) ); print_r( $xxx ); and got the following output:

I said before, normally anything

i was hoping that there is a ready class for printing messages, already formatted and evtl. with a warning or error logo

10 ) )

ok so even “_____” would be acceptable

10 ) )

or “__….___._”

I’ve seen that kind of username before yeah

Soooo… What is the problem?

sorry… this one:

10 ) )

and?

miss the 8 and 9 :-S

ok AlexC_, but I think it’s not appropriate for a “normal” usage inside a given community where users has to interact with each other have*

wolfy@timberwolf:~$ php -r ‘var_dump((int)08);’ int(0)

it depends on the formaility you want. If it’s a formal site then it’s quite common to make users enter their first and last name then use that. wtf

What?

why does that equal int 0, yet this happens: $ php -r ‘var_dump( (int) 03 );’ int(3) why does 03 do it, but 08 not?

If you want to keep the numbers as they are use string.

08 and 09…

octal system.

seriously?

what’s the quickest way to get the first element in a multidimensional array (i dont know the key of the first element)

oh yeah, I see,

every number with leadnig zero is treated as octal number.

do you know how deep it is?

guys display_errors = on but it doesnt show me them just HTTP 500 Server error ?

 

Personal mysql5 web hosting solution

 

I am surprised you don’t know that…

Why is it that when i try to sort() an array it first give me all the uppercase words and the all the others, when i need it to not be case sensitive :X i tried natcasesort() but still doesn’t work

then something more serious is wrong

like what

apache problem

apache error log show me the php error

Look in your server’s error log

3 ) — i need the first element but i dont know what its called

what is the easiest way to convert a string in the form “g100471″ to the number 100471?

would $a[ key( $a ) ] work?

hehe, yeah I’m not really up to speed on octal, hex etc etc

figures wolfy@timberwolf:~$ php -r ‘var_dump((int)013);’ int(11) There.

Shu, how does natcasesort not work

array_shift($a)

boo

ah thanks wouldn’t that shorten the array?

yes

:-/ any way to do this without shortening the array?

reset($a); echo current($a);

reset( $a ); $a[ current( $a ) ] ? ok cool

np

No. Just current($a)

anybody ?

well the reason to do the reset is if the array is somehow not pointed to the first element just incase but current() will work better ya i just need to know the name of the element as well

Wait… What?

im saying that the array pointer could be pointed at the 3rd element, so current() will not return the first

shu it should work fine

and i also need to know the key name of the element

reset() then current() will return the first value and key() will return the first key

Thank you!! )

does anyone know how to get the first integer from a given string ie “g1001″ would return 1001

Example 11-2. Octal weirdness: If an invalid digit is passed to octal integer (i.e. 8 or 9), the rest of the number is ignored var_dump(01090); // 010 octal = 8 decimal

would regex be too much?

i was looking for something easier

all i can think of is strlen() loop and using is_numeric() on each character i just tried typecasting to int and “g1001″ just returned 0

hmm

you could use regex

8] AgentScorpion i was looking for something

yea regex would be easy, but heavy the loops seems like the most logical solution

i suppose I could use trim, and then cast it to a int

maybe create utility function in your library for that

what would be the best way to strip the number out of /comics/oots0484.html

Am I able to choose the temp directory that the configure script uses?

Artnez would regex be the bottle neck in your program? I doubt it

no, but elegance is beauty my friend otherwise i’d just eval() my templates :P

manual parsing isn’t particularly elegant

perhaps, this is why we’re still thinking

if(isset($_FILE[’file’])){ for testing to see if a file was uploaded with a form, the forms input being called “file”?

no you need to also check the error code with the $_FILE[’file’]

and also is_uploaded_file

if the error code is 4, no file was uploaded (user didnt choose anything)

in the form - nothing else

ahh thats where i was going wrong

enctype=”multipart/form-data” was set)

Artnez yeah that makes sense now

Guys I need some help, why wont require_once work when I try to include files?

because you can trick it into “uploading” /etc/passwd and moving it to a place where you can read it, so is_uploaded_file() is needed wrong path

what path needs to be specified?

.. the path to where the file is

try php.net

Dude I know that

then why ask?

How can I have the wrong path if I have even spelt out the entire path

go to the file you’re trying to include and type this into the very top

you spelt it wrong?

no it’s 100% correct

php realpath( __FILE__ ); ? php realpath( __FILE__ ); exit(); ? use the second one

ok cheers

that will give you the 100% for sure path, just copy paste that (although i suggest using a defined constant for the root path to your app syou dont have to do taht every time) eek, typos galore

Artnez so are the error codes for isset on the php manual? im looking but haven’t spotted them yet

i would first look at what ‘include_path’ is before doing a lot of work

not isset, $_FILES[’file’][’error’]

what should it be set to?

Artnez ahh i see now that makes more sense

^^

isset() simply returns true/false to see if a variable exists — it should be your first check but not your last

it depends

php.net/features.file-upload.errors

can i return ’self’ in class’ function ?

what is your require_once() call, what is your include path, and where is the require_once being called from?

just like its common in ruby or javascript ?

can anyone help me out with PDO? i have this code: http://pastebin.archlinux.org/13909 and i get these results (i dont think i should be): http://dev.imagemanagement.ws/pdo.php

cheers AlexC_ many thanks

if you’re using PHP5+, you can’t do in the constructor — but otherwise yes return $this;

you’re welcome

have you tried it?

nope

if you’re using PHP4 (from my recollection), you can return it in the constructor (but its not recommended)

just interested and php4 is dead imo

not sure what you want there bud

yes, yes it is

try it.. I don’t honestly know for sure. php4 has been dead for a long time, and will be officially dead 2007-01-01

try what i told you

how can i stop a foreach when some statement is true?

php.net/break bXi

what is your require_once statement?

I have a strong suspicion it has something to do with include_path in the ini file… but I dont know what this path should be

it was dead for me since i realized , it had no destructor in objects

is their a ‘isin’ type function in PHP, I need to check to see if a value is in an array

the require_once() statement is 100% correct I gurantee

the path can be anything you want it to be. it depends on your server.

php.net/arrays

do what i said first

http://php.net/isarray

then if that doesnt work you know something is up

that wont work

ah sweet, thanks

100% against what?

no, that wont work

I echoed real path and it matched my require_once() statement

my bad.. http://php.net/is_array

is_array will

nor will that,

my point is something is wrong otherwise you wouldn’t be having this problem

how so?

you want to see if a value is in_array()

I used the real path function and it matched what I am includinh

pardon me?

not of it is is_array()

is_array . Finds whether a variable is an array — this is what I want to do.

it’s all in the manual, read this: http://us3.php.net/manual/en/ini.core.php#ini.include-path then read this: http://us3.php.net/set_include_path

oh wait

that’s not what you said

that is is, not is in

you want to see if a value is _IN_ an array, hence in_array()

explain

ah ok, thanks

are all the pastebin sites down?

is_array() checks if a value is an aray

ok.. http://php.net/in_array is the link to that doc. I misread your question.

I highly highly doubt it ^^

thank you for catching my mistake.

welcome,

ya I am viewing that now, thanks

I do not mind being wrong, but in the future if you could be a little more descriptive right off rather than “that won’t work”, that would help me

^^ I was going to get there in the end, just wanted to say it incase he was going to leave straight away

is there a date/time picker written in php?

well, if you are concerned about him leaving too quickly, you should be quicker telling him the *proper* link to the docs straight away.. and for my own personal development, I need more than a “that won’t work” more quickly than it happened this time around

can i overload operators on php5 (like in java or c++)

I doubt it, and you should be careful about that anyways, since it can lead to serious confusion.

ok

I appreciate it

my target was to overload [] and =

oh by the gods *why* would you want to do that in php?

to make resault easier to use and folow

naw.. that won’t help

do while false mechanism is a lifesaver!

like in $a = new OB(”) damn like in $a = new OB(’aaa’) ; $b = new OB(); $b = $a;

you want to check if $a is an instance of OB?

that would be a nice feature for own objects .. makes code cleaner

hello everybody, i followed the instructions in the paypal sandbox guide to add money from a virtual bank account. It’s listed in “recent activities” with status : “pending”, and the test user balance is still 0.00. I can’t figure by myself how to complete the virtual transaction, any tip please ?

this channel does not normally support things like paypal.

nevermind, i figured

is it possible to echo something then sleep for 5 seconds

but I’ll give you a hint (and hope I don’t get kicked ) .. add some ability to track exactlly what you are sending to paypal, and what is coming back from them.. check the response code.

then repeat?

keep in mind that paypal is asyncronous.. you cannot assume that you will get a response immediately after you send a transaction to paypal.

i am working on the sandbox …

right.. I have too. look, we’re gonna get in trouble if we talk about this too much more.

$2,555.00 USD balance, i wish this was my real account hahaha

what context are you talking about when sleeping for 5 seconds?

i got a comic loader all coded up and my goal was to wait 5 seconds between every comic (so it doesnt hammer the server)

comic loader?

as in webcomic

wow webcomic

http://ctrlaltdel-online.com/comic.php example

i want to know what you mean by waiting 5 seconds

well i display link for comic1 comic 1 gets downloaded then sleep for 5 seconds display link for comic2 etc etc

when do you know that comic 1 is downloaded?

i dont know but thats not important i could generate the page in 1 second and let it try and get all comics

so when does the 5 second rule come into play?

it gives the browser time to load each comic while reading them i dont need all 500 comics on my screen at once

tnx for info

it sounds like you have things under controll, where is the problem?

well i had an issue with outputting the echo on screen but i had to use flush(); instead of ob_start(); ob_flush();

i’m trying to find a good way of setting up a shared server. multiple users come in and login via ftp. Trouble is i want the web server and ftp server to have permissions into each virtualhost document root.

i have a feeling you are not telling me exactly what you are wanting to do

i haven’t found a great way to do it yet. i’m thinking of using suexec but that has some disadvantages.

probably more research is needed

i told you exactly what i wanted to do but like i said i already got it

heh. :-) alright.

very unreleated to php but proftp has options to do something probably

hmmm that’s an option.

i guess the problem i have is you are describing something that the web just doesn’t do

have the ftp server change over to the user’s id

use the ~/public_html folders and use pure-ftpd or something i’d say

you set proftp to set the root of the login to the basedir based on a database config

its not that hard a simple for loop

AlexC_, found the solution

then explain to me and show me what you are trying to do

in that loop you echo($link); flush(); sleep(5);

cool stuff

those are all good, but that does that the issue where the apache user can’t write to the directory…. or the directory is readable by everyone else.

AlexC_, -o PasswordAuthentication=no -o StrictHostKeyChecking=no forgot it

with that i know you do not understand how browswers work

oh that’s ok then

http://apparoat.nl/oots.php exactly like i said make the user member of the apache group

AlexC_, I was wondering if I shall do it like this or send it to a bash that is located locally and does the rest

the ideal solution, has 1) the apache user and ftp user don’t clobber each other’s permission bits, 2) both www user and ftp user can write into the dir, and 3) other sites can’t read another site’s dir. so far, i can get 2 out of 3 for most solutions. but not all 3 yet.

what OS and do you have root access to this server?

making it a member of the apache group would solve 1 and 2 but not 3. yup. i own the server. full root. centos 4

then the ftp root should be chmod 770 chown $apacheuser:$ftpuser; chmod g+s and you apacheuser should be in the ftpusergroup

couldnt chmoding /home/ (or whatever folder the sites are in) to something restrictive help? users cant cd .. and cant ls from there like you can see on that page it does the 5 second waiting thing

zircu, hmmm. i don’t think that will work as you expect. the apache user runs as one uid so other sites can still access another site’s dir since its running under apache i could chmod a-r for /homer /home so no one could acutally do an ls in there

users had to guess other folders in that way

and see the other sites. but that’s securing by obfuscating… it is possible to guess….

the the restriction on where the root directory is on ftp restricts that kind of thing

that as well tell ftpd to jail the users

i was thinking about making each user’s home dir a md5 hash. ie.. /home/435jgklfdj984543543/whatever

you are running a vhost with untrusted people?

they’d need shell access to do anything else then

zircu, i can restrict the ftp user, yes, i’d chroot them to their home dir. but…. the apache user can still access anything.

the web access

they can do a php exec(”ls /home/foo”); ? and get what they need

REPORT

theres a php setting to block that i believe

yes but there are ways around it if you didn’t catch everything

well, the one i’m most concerned about is this one exec(”cat /home/victim/db_config.php”); ? yup. php_safe_dir i believe

yes that is why i have never done hosting

but that’s not recommended anymore by the php folks

the best way is that each host is seperated from each other aka jailing all vhosts

yeah. but each site would eat one ip.

http://truth.pastecode.com/39367

a vhost doesnt require a sepperate ip

bXi, if I jail it, it would.

i have like 20 vhosts on my homebox going all from the same vhost

hio people

right, you can run multiple vhosts on the same ip.

mysql_close($cn); ?

you say that if you jail your accounts they would need a seperate ip for each?

zircu, right, they would.

there are ways to rewrite i would guess and look at first

by using a registry pattern, the object will have a copy, right? one outside $registry, and one inside?

most virtual enviorn’s like jails, containers, virtual env’s, etc… they all need an ip.

untrue

i havn’t done this vhost untrusted setup for a long while

look at vservers for example

eh? there’s a way to jail without using an ip for each one?

vserver are advanced chroots for linux

back to your problem…

chmodding the users dir to 700 allows me to still ftp to the user

right, you run a virtualized enviornment in eachone.

but not enter other users folders

i’m note sure what it is.. except that some browswers dont output data to the user till a certain buffer is reached

but chmod 700 probably won’t allow the www user in there. i’m using openvz at the moment, a bit different from vservers but same idea.

you echo maby 30 chars.. i know that IE does not do anything till it gets to a certain byte level another option…

anyways, unless a ve has an ip assigned to it, it can’t talk to the network. and only one process per ve can bind to port 80.

nevermind it is too confusing to explain

zircu, try me. i’d probably get it. :-)

firefox does what i need i cant care about IE

i know but IE wont ok

i only have ie6 for when i need to build some template for a customer

setup an ftp that is on a different ip or port than standard IP and have that ftp proxy the changes to the proper server so you would have a ftp server running as the webuser blocked from any access but from the server it should be accept commands from

zircu, hmm. are you saying assign each user their own private ftp port?

no i ftp to upload.domain.com… that ftp server is setup as a proxy directly to the proper location with the proper permissions setup to talk to a proxy

anyone know good tutorials on creating a CMS?

oh

google?

no sites other than one crap one seems to come back

i dont know the details or it can be done but i think that is the only way given the permission issue

zircu, might have an idea. might work. i’ll have to play with it a bit.

in this setup you will have to have an explicite (sp) ftp setup as well, i think

you could always team up with a developing cms

alex^^: but wich one?

www.tangocms.co.uk its being developed atm just started i think

imo, CMS’s are the 2000’s you will not see that term used in 2010 bimo, CMS’s are the 2000’s you will not see that term used in 2010/b

hello

nice original name

yeah. i think so.

does anyone know how to grab post data from a page then pass it along after completing a paypal transaction?

thanks

is it working? can you explain in more detail? do you know how to get post data?

ok i am working on a site that users will be able to paypal for services, i want to create a confirmation page that will be able to update the users info in a way where there user wouldnt be able to user a get type url yes i know how to utilize get

hi there, somebody can help for consuming webservices using php? …

how do i reverse an array?

but i dont want the user to be able to manually update their payed status (via url)

paypal docs should explain how to do such a thing

i will explore it more but so far i havent found anything

paypal has a callback system where it should confirm the actual transaction

hi

hi there, somebody can help for consuming webservices using php? … who say yes?

what paypal system are you using?

ar3dam, consuming webservices, care to elaborate?

i say you have repeated your question again in like 2 minutes reword your question to make sense

i am only using regular paypal no special systems

CrazyTux[m]: didn’t you know.. it accesses the web

zircu, lol

ok, zircu, that if somebody can help me to consume webservices using php….

but what service? paypal has a few options on doing things

what are you trying to do specifically ar3dam? well i was planning to just generate paypal buttons

asdf3 to consume a webservices, i try use nusoap, but i cant consume :s ..

oi does someone see something rong in this ? var $query = “(SELECT b.name, b.picture, b.description from band b WHERE b.name LIKE ‘$one’%) JOIN (SELECT concat(p.first_name, p.last_name) p.picture, p.description from professionals WHERE p.last_name LIKE ‘$one’%)”; expecting: Identifier or ‘+’ or ‘-’ Identifier or ‘+’ or ‘-’

can anyone tell me why session_start() is not recognised? .. though php is working fine.. and I’m running apache22 on a FreeBSD box and I installed php5-session support .. what else should I do?

check you config.ini session.xyz

hello, where can I find a good tutorial about how to make the page have a different content, example www.website.come/index.php?body=policy and www.website.come/index.php?body=register or how its done to be like that?

I think you was pointing to httpd.conf

Does anyone know where i can find a simple php file browser? No extra stuff, just browsing. Not even safety stuff.

session_start is php so no, php config

k let me check thnx

and newguyss, thats $_GET[]..

I need help I am trying to add digg buttons to my website

new guy

I managed to do it for each individaul php page

pm

but I cant seem do do it through a while statement

show a unit test navets_

I know its $_GET[] and I want to know how to it, because the session will have forms, and the question is what to do with the forms to keep it in the same page

unit test? you mean the code?

I sent you a message,but this thing havent been working for me for a long time

rule #1 as a programmer… dont tell your parents, they will call you for any little thing

newguyss, you store it in the session

and friends, and colleagues ESPECIALLY colleagues

or in the database, or in a cookie, or in a txtfile, whatever yes, i mean the code

ok 1 sec

with an exemple of the problem

hi I’ve got this http://tinyurl.com/q6zv6 help me pls ok no help ? bye

is it possible to run jmaki on apache?

woot, that was the easiest help

jmaki http://59.95.0.20:8080/google/index.jsp

newguyss theres two ways to do this

here is the code http://pastebin.com/d9a073e4 http://navetz.com/blog.php

PHP if ($_GET[’page’] == “register”) { include “register.php”; } of you can echo your content directly

listening

-of + also

it posts 5 digg buttons for the 5 blogs I have, but it only shows the one blog

would anyone consider it spamming if i typed a roomname for newguyss to join so i could show more examples to them?

yes

its not spamming I suppose, would you like to talk on yahoo or msn?

i don’t understand you code lol you want to add a dig button to each blog you have ?

i wouldn’t if it was a supported freenode channel hey Wolfpaws, long time no see

yes

hi, zircu

I run a while loop to that outputs the content in my database and each time I output a blog, I want to have a digg button under it

Hello folks

I need a small bit of PHP help

ask

I have posts in wp. When I get them in a loop I need to get excerpts only. Do we have something builtin in php that I can get excerpts from from a whole post to show?

the damn question

pastebin what you need to show. simple

Im trying to make an edit button for my forum, but I don’t know how to make it only display the edit button to the user I want the edit button to show up for only that user’s posts, so he doesn’t see an edit button on everyone’s post

check if the post author id is the same as current logged in user?

i dont know how to make it check that that’s what I’m trying to ask if ($user[forumaccess]==’2′ || $user[forumaccess]==’3′ || $user[userID]==’$user’) { echo ‘a href=”‘ . $root . ‘/index/forum/edit that’s what Ive got

if ( $post_author_id == $current_user_id ) show_button();

forumaccess 2 and 3 are mods and admins

bad practice to not quote your array keys

Any ideas?

array keys? i think I’m relatively new to PHP, and this forum was given to me a long while back by a friend

can’t exactly help you out then. your problem is relative to your code. start reading it like a book untill you know it inside out

$user[forumaccess] … forumaccess is the array key. do [’forumaccess’]

everyone has opinions, no one reads the god damn manual

Do we have anything in string functions to get excerpts of a full text/article?

flowOver, I have. I feel like I’m close but not quite there

a magical English language parser? no

no, not a parser

word wrapping no good?

Well, if you want random excerpts, there’s a number of ways. But it depends on your criteria.

A function that will select the first few sentences or the first paragraph out of a whole article for showing. I need to show excerpts and then when the more link is clicked I need to show the full article on the same page. The idea is to keep the layout intact

place the mark on the nth period and yank everything between 0 and the mark?

I think!

quote your keys

We need a new class in php for excerpts/strings/blogs :p

“we” don’t

true plenty of string functions

flowOver, oops copy&paste failure

oh looky “behaviour driven development”

what the hell is that?

i wonder if there is ever going to be a “common sense driven development”

DamnLNX, that part is fine. Im questioning about

lol i was just iterating the point so it wasn’t forgotten. i caught on that it was a copypasta error

if ($user[forumaccess]==’2′ || $user[forumaccess]==’3′ || $user[userID]==’$user’) { echo ‘a href=”‘ . $root . ‘/index/forum/edit

http://chrisdpratt.com/2007/09/03/an-introduction-to-behavior-driven-development/

the end part where it says $user[userID]==’$user’ hang on ill be back

meanwhile as bloggers write about generated code and rapid development crap that will slam your server with any kind of influx of traffic, real developers carry on coding sites proper

is a good idea transcode to utf8 with utf8_enconde/decode the data before send it to the INSERT mysql command?

every time I stumble upon a new “framework” website that has screencasts and digg buttons, I die inside a little bit

Eh that doesn’t describe anything that’s already being done. Next thing they’re going to discover UML! 10 diggs!

you mean that hasn’t already been done

Yeah, that’s what I meant.

UML is like cat shit. Better when buried.

uML is nice to show to managers

growl

so is a chainsaw growl!

yeah UML i’ve used to get the go ahead before it makes pretty graphs

“Imma cut ye up suit boy”

I’m not the type that converts uml to code though

it’s the other way around that really scares me

code to uml? heh

I really dont WANT to see what these people were doing all the time in terms of architecture mmmm

does this make sense? str_replace (’ ‘, ”, $info[1]);

what is google gears good for exactly, other than saving traffic

people can take gmail style apps offline

oh. really helps when you have 50gb document pool. kek.

anyone happen to know if PDO-lastInsertId() works on PDO_OCI ?

i suppose it wouldn’t there. i would implement a way to mark documents as one you would like to have offline in that case i read somewhere rumours of a new gmaps. you can take city maps offline with you using gears obviously not the world though

yeah, I really feel like sifting through a hundred thousand documents with my insert key.

gears is very niche. probably not for you.

proba bly not.

are you allowed to have javascript loop inside a php while statement?

javascript is just text echo’d so yes its only a script when seen by the browser

well i am having an issue with this then because the script works outside the while statement on other pages but not in it

How is it possible to distribute a script like an application for windows to be used without running a webserver?

“the script doesn’t work” love that one

You can output javascript code like echo ’script type=”text/javascript”alert(’see?’);/script’;

keep in mind that inside ‘ ‘ $vars will not be parsed

yeah, sorry.

can someone please tell me how to make this work if the file name has a space in it? http://pastebin.ca/680495

alert(”see?”); or alert(\’see?\’); then

and you want to escape those extra ‘ , yeah like that

or put the js code in an external file and echo script src=”some_path”.. etc

my first point wasn’t about that fout but good on yeah still

meow

you have not read the stuff on php.net/exec

why do you say that?

foutrelis It’s possible and not even hard, but it requires whole php with it so your “hello world” turns to few MB :P

I should code this app in another language, but I know and love PHP, so..

1

is it strange to have the same kind of queries multiple times in your code on different places ? Or is this just normal because you need to with other WHERE’s and so on ? alsways doubt

the time has come for me to brainwash you

foutrelis have you tried xcache already? if it suits you

strange? Not stranger than having your arms cut off.

I haven’t. I’ll look it up.

MikeSeth, mhh ?

Please go ahead.

well that’s what should be done to people who scatter SQL across their code trac.agavi.org!

MikeSeth, but sometimes you can’ t do better I guess because you need different data from the same table with othere WHERE statements

Well in terms of efficiency, you should only request the fields you need and not just select * for all your queries.

you should still concentrate your database-related code in one place get on it. You wont regret it.

The only framework I understood was CodeIgniter. So.. I’m quite noob. Do you believe I’ll understand Agavi?

unless you’re lazy

why MikeSeth just makes it harder to read

lazy is my middle name :$ I’ll give it a shot sometime.

Hmm, I feel uncomfortable with putting stuff in html tables, even though it’s clearly tabular data. Considering the constant crusade against using tables

what makes it harder to read?

jumped from file to file instead of the flow code flow

http://rafb.net/p/RJiUVn74.txt

what do you think is the more important aspect of software, how fast it runs or how much other people hate you for writing it?

That depends a lot on the requirements, actually.

Really? So tell me, what do you consider acceptable conditions for writting crap code?

Not crap code, just code where code flow is more important than speed.

i call it dirrty code but easy to folow

I can probably think of a php example, but very obvious is inline assembly code in c. If efficiency dictates it, it’s allowed, but one would do better to avoid it if it’s a part that changes a lot.

now you’re contradicting yourself. ah. never mind.

is there a function to remove all spaces form a string?

Pff have you even tried a search? :P

php.net/str_replace

what about one to check if a string contains something?

o.O

or php.net/preg_replace

thanks

for multiple spaces

but I only want to return true if it has a space, not replace them

This is what you said before

hmmmm sorry

Regarding your second question: php.net/strstr or php.net/preg_match

what is the difference between preg_replace and str_replace?

Personal jdk web space.