Domain Search | www.


Related Pages:

1 Displaying news from all categories with settings only 1 important setting disable comments of one category
Hi how could i make script i have list of rules and those rules have id and some other variable for example something
Need some opinions here I am starting to realize that i am spending way to much time developing little things







me to ... me to, =D

AlexC_, yeah the features for the price are amazing. but they're unrelaible... oh well, pick your poison, choose your battles

hehe, yeah - t'is why I'm moving to my own VPS server hosting soon

Myrth, whining about people being rude is just as annoying as people being "rude", this is IRC, get used to it

So, I have a problem.

have you been to the doctors about it?

Yup.
I need a php doctor.
http://pastebin.ca/614799

ok, bend over please

Ewww, disgusting.

AlexC_, check out layeredtech and mediatemple for your VPS

no one knows? :

lol i'm not affected by it, just sharing observations with someone else
blol i'm not affected by it, just sharing observations with someone else /b

I'm getting two odd errors, and I'm wondering why.
The errors are in the description of the pastebin topic.

could have told me this before I brought it from vpslink :P
scandir() [function.scandir]: (errno 0): Success in uploadphoto.php on line 22" wtf?
success?

lol, yeah i saw that too

urgh, Layerdtech sites does not work in FF, the menus that is

AlexC_, ? wfm

the drop-down menu appears below the main content,
so I can't actually navigate

That's what I was wondering...

AlexC_, um, wtf version of FF are you running? it works fine for me.

2.0.0.4

Any ideas?

AlexC_, weird, i'm on the same. it works fine.

can I borrow your Firefox?

KomodoKoffee, nope sorry. a little birdie told me that readdir is faster

Does it spit out the same result?

KomodoKoffee, http://php.net/readdir

Figured.

AlexC_, well try Opera then... or *gasp* IE
AlexC_, their site sure better work in IE
AlexC_, or restart firefox too... yesterday FF was using 350M of RAM on me

I'd rather it didn't. Gonna try epiphany now,

AlexC_, ahhhh...*nix* FF... that's why

But do you see any obvious errors in my code?

AlexC_, in that case I'm not surprised at all...

really? FF is normally good for me on Linux

AlexC_, well apparently it isn't :P

Its decent on linux

KomodoKoffee, aside from your weird indentation and lots of line breaks... no

There are problems though

this is why i don't use *nix as a desktop system anymore

because of Firefox? lol

AlexC_, no man, too many little bugs like that, all over, not just Firefox. i couldn't name them right now off the top of my head, but they exist, anyone who's used *nix as a desktop long enough knows this

hum, I've been using Ubuntu for over a year with no trouble at all - what did you try and when?

"you should just go fix those problems and make your software better" ... well i'd love to but i need to eat

http://pastie.textmate.org/78122

AlexC_, dude, i used *nix for like 5 years on my desktop over many distros... and i've used Ubuntu, Ubuntu is not free from it's faults either... it's not really the distro, it's more the GUI apps (e.g. *desktop* apps) that are buggy as all hell

it never prints -1

Hello, Some already have problems with mod_rewrite and sessions?

AlexC_, anyway, if you really wanna continue this discussion in #phpc i'm there
srand, nope, only you

I want to store an image host in a buffer without creating a temporary file...how do I do that?

nah we'll get back to helping now =D

OneFix_Work, define "buffer"

Hello, Some already have problems with mod_rewrite and sessions? - I have a session in http://localhost/minisite/dev/adm/user/add but in the url http://localhost/minisite/dev/site/list php can't read the sessions :/
:/
i think is a problem about path's but i can't find a solution

make sure you do session_start() in every file you want

i'm sure, have a session_start() in every file.
but php and apache understand how http://localhost/minisite/dev/adm/user/add and http://localhost/minisite/dev/site/list are diferent websites
then diferent sessions
do you understand?

aye, that I do

Is there any builtin function for text to png ?

use GD

AlexC_, GD?

GD

php.net/GD

Wolfy[drawing], tnx

right, I be off - cya

I echo a $_POST value, and the options (it comes from a radio) are "field" and "pipeline". However, it echoes simply "on".
How is this possible?
On another note, is there a lib to resize an image on the fly?

http://php.net/gd

And btw can you provide pasteBin example about your first problem? Could help you

aa^way: it's stupid to use HTML, the image loads at full size anyway

so is there any solution for my problem?

it's a waste of bandwidth
and most browsers do crap resizing as well

aa^way: Just a sec.

damn whats time for your guys?
AlexC_ quited about 30 mins back
going soon sleep ;9

aa^way: http://pastebin.ca/614861

Greetings

Have a look at http://php.net/gd

Hello, Some already have problems with mod_rewrite and sessions? - I have a session in http://localhost/minisite/dev/adm/user/add but in the url http://localhost/minisite/dev/site/list php can't read the sessions :/
php and apache understand how http://localhost/minisite/dev/adm/user/add and http://localhost/minisite/dev/site/list are diferent websites

has anybody here made apps for facebook? I want to create a app but it's a bit out of my reach. anybody here up for a freelance job?

srand you shure you start sessions with session_start()?

hey

aa^way: of course

I have a quick question. I have an array of file names thanks to scandir(), and an array of acceptable file extensions that I created $ext = array("jpg", "png", "gif");

where is the php.ini on a secure linux web hosting system
?

let's me see the path

how can I check the first array for valid extensions from the second. I tried using in_array() but it wants the whole thing
basically I want to check to see if filename.png is a valid filename and filename.txt is excluded

That calls for a custom array_filter or just two nested for loops

icf7, thanks. I'll do the two nested for loops

hey guys

srand it definiatly sounds really weird, you 1) arent setting session up at al 2) you need to use session_start in both files. 3) idk ceeya duds, sleeping time
and i havent had any probs with modrewrite+sessions, this shouldnt affect at all

Is it possible in someway to use PDO::FETCH_PROPS_LATE with PDOStatement-fetchObject? It works well with setFetchMode/fetch and fetchAll

Any reason why date("Y"); wouldn't return anything?

http://pastie.textmate.org/78122 - why does that not print -1?

why are you using OR instead of ||?

although i'd be quite surprised, but is exchange_id some sort of a keyword in php ?

though that's a little beside the point, there's not enough information in that little snippet to say why it wouldn't
because the system it's running on doesn't know the time?
no

i have a method to which i pass an array, and assign values to object attributes/properties ...
$arr[ 'exchange_id' ] fails evey single time
it IS passed to the method
the obj. just doesn't assign the value to itself

what's the difference between || and OR in this case?

[domon]: I don't if there is one, but it's inconsistant style and it bothers me. I never use "or" so I don't even know if it is valid

Is that possible? hmph.

I don't know, I can't think of another reason why not tho

|| and OR have different priorities

Neither can I, which is what's so weird
hmm

when using them both one takes precedence over the other (it's executed first)

well is it a *nix system?

Yes

[domon]: really? I didn't know that

you have root?

debian
No

debian ftw
ANYway
do you have a shell?
or a way to exec?

Nope, other than PHP, I suppose. I could contact the admin and have him look into it. I just think it's kind of weird

[domon]: yeah, you're right...

hm
make a really simple test case script

http://pastebin.ca/index.php
i really dont get it

php echo date('Y'); ?
just to check

oh, wait a minute.

hello all, anyone , can you refer me to a free script that verifies a database strucrue , i.e call the describe database host into an array and then check if it was properly created?

Hm, whoops I just had date("Y"); echo(date("Y")); works Boy, I'm a tad rusty

lol

Thanks

liggeh! :3

define "properly created" ?

google.com

http://us2.php.net/manual/en/function.msql-affected-rows.php

ensure that all the tables and fields are correctly created , by comparing it with a text create command

http://pastie.textmate.org/78150 - what's wrong with my code?

i am googling

whoops...missed an error
http://pastie.textmate.org/78151

is the opposite of "xor", "xor", or "not xor"?

NVM....:|

for example, $a ^= $b, how do I get my old $a back?

I don't know why you reuse something that you'll still use at later time..

it's called encryption ^^

My question isn't answered.

so third parties can't read what's leaked

Wait. You want a decryption algorythm?

($a ^ $b) ^ $b == $a

no, I want to write it

uh... Wha?

thanks!

$a ^= $b ^= $a ^= $b; // swaps $a and $b

hey, if i delete an element from an array, is there a function that'll compact the array so theres no blank spots?

wtf does ^= do? o.O

xor

array_values()
xor and assign

oes

[domon]: php.net/operators

sweet, thanks

I need some help with a regex. I'm currently using: preg_match("/^([a-zA-Z0-9_\.\-+])+@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/", $str);
It returns true if $str is an email address format. But what I want it to do is return true if an webmail hosting address format is found anywhere within $str

get rid of the anchors then (^ and $)

does anyone here use komodo IDE remote debugging?

should be \z not $ to validate anyway
and your domain suffix is too short, should be {2,6}

[fields]: no, it does not. (by the law that nearly all email regexes are wrong). What about ä@êè.fr Isnt this valid?

how in gods name did museum ever get approved...

who actually cares about a domains like ä@êè.fr

icf7 is technically right. if you actually look at the RFC for it, it allows a very wide range of characters you wouldn't expect
but don't expect all mail clients/servers to honor it

the one owning it, or worse "ä ß@êè.mobile" which fails validation although being correct

$object-method('blah'); // how can i tell php to supress warning just on this line? -- @? or something like that....

well, why not just check [^@]+@[^@]+\.[^@]+ then? Works fine, and the MTA may report errors anyway

i really don't care about those edge cases - in the unlikely event i ever need to, i'll still probably stick to xn-- notation

because that isn't valid either.
in fact, it's a lot less valid than what he's doing

the best way to do this is find a library/regex that's already done...

That matches all valid addresses, and some invalid ones. Where's the point in finding out if an address is correct?

according to your regex, you email address can contain spaces

or CRLF

Anyone have any idea why the following code is not grabbing all the divs in the context?? http://pastebin.com/m1f9c52f9 - The url is being returned just fine...

no, it won't match LF

are you telling me to rewrite it to: preg_match("(^([a-zA-Z0-9_\.\-+])+@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,6})+\z)", $str);

[^@] certainly will

ah, i suppose thats true

or does anyone have a solid email address format regex?

[fields]: you got the 2,6 right but you've misunderstood what i said about anchors
^ and $ (now \z) are the anchors, you've removed the delimiters (/) instead

I know, I've always had a difficult time understand regex

Is that a problem? afair, spaces are allowed in email addresses. Everything else will be fixed in the bridge to the MTA

no they're not.

I still don't understand specifically what I need to do, can you paste the correction?

a domain can most certainly not contain a space.

http://www.space.com
a href="http://www.space.com"http://www.space.com/a

email addresses cannot contian a space, multiple email addresses are commonly seperated by spaces

right

you done any screen scraping crap before?

but that's not a property of an email address. that's a property of a CC/BCC header
josh[n00b]: yes. as a rule, don't bother.

screen scraping?

ah i wish i had a choice. I am trying to write a lil peice of code that reads comments from top review sites for clients

have fun with that

lol, ohhh yeah
Should I just use regular expressions per site?
Or is there a better way
DOMDocument doesn't seem to like javascript :-p

I've done a lot of that

it's not going to matter how you do it. the first time they change things, your code is going to explode

http://tools.ietf.org/html/rfc2822#section-3.4.1

[fields]: really?
I know. I already prepped the boss man about that :-p
I told him, every time they change a) functionality. b) design. The hours double.

not so much that, but when they change a or b you
'll have to redo your work

Yeah..
How do you grab the stuff you need, just reg ex
??

I have some string functions I've written that I use

i'm familiar with it. if you want your email addresses to break, add spaces.

[fields]: just parse the hell out of the html then?

yeah

commong php functions you use that I can bookmark?

anybody here worked with facebook api interested in a freelance job?

!+jobs

no job posting / asking for jobs on ##php (see /msg php-bot g7). You might want to check out: ##php.jobs http://www.geekfinder.com, http://www.monster.com, http://www.rentacoder.com or http://www.getacoder.com, or php.net/links, "Developers and Job Opportunities".

hello..i have xyz.com/page1.php and 2nd page is abc.com/page2.php and page2.php is iframed in page1.php..so id there any way if someone wants to access page2.php they have to go through page1.php

doh will do

is there a way to hook into mod_php, like django does with mod_python ?

mod_php doesn't communicate with Apache the same way mod_python does (Which is similar to how mod_perl does it)

hrm

no, by design of the HTTP protocol and browser security. frames are deprecated, and although iframes are better, loading from two different domains wont enhance speed

So why this error? http://pastebin.ca/614963

frames are by no means deprecated.

The error is in the description.
I'm guessing there's a blatant error somewhere.
I just can't find it...

Sure, they break a number of things, i.e. small devices, printing etc.

because a browser can not interpret them does not mean they are deprecated

so, can anyone correct my email address format regex for me? I want it to return an email address found within a string. preg_match("(^([a-zA-Z0-9_\.\-+])+@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,6})+$)", $str);

in fact, they exist in the xhtml-frameset doctype

i give you that point. I was oversimplifying, but there's a reason you already need a special doctype to use them

Basically, it's a form-processing script. It takes input from a form (the gallery and the filename), uploads the file, names it the correct way, and then uses gd to create a thumbnail, which is renamed.

that reason is not deprecation

Then what do you suppose is the reason?
Anyone, some help?
Yay!

this breaks in a funny way if I name my image pngjpg.bmp

Right.
It would.
But you see, the thing is, this is admin-only accesss.
Therefore, it doesn't matter, because the client won't do that.

well, just use elseif in line 14, and replace /png/ with /\.png$/ , and this is gone

you do realize that you're including an error, but the line numbers don't actually match. it's reporting an error on line 76, but there aren't even 76 lines in your code post.

And the same for jpgs, too.
No, I know.
It gets an error at the end of the code.

and you don't use a regex for that at all.
http://php.net/pathinfo

better yet, use pathinfo
^^ or even /better/, mime types

uh, no

Nah.

never use mimetypes, especially if they're user supplied.

I think I'll use pathinfo
Thanks, caffinated

I did not say user supplied mime types.
And on !=Windows, file extensions are not required
but pathinfo will do here

but they are for webservers, unless you specificly overide it.
on a file upload, the mime is user supplied.

That makes the code beautifully simple.

yes, so you'll have to call mime_content_type

Anyway, back to my problemo...

you do understand how that works, right?

It fails on, basically, line 63 (the end.)

Basically yes. It checks for the first few bytes. If there is any problem I have not realized, I'd be gladfull for a good pointer

it's going to scan for a byte pattern, usually 2 - 4 bytes in the file to determine it's "type". it's not very foolproof, and is very easy to fake.

Any ideas, or blatant errors you see?
Other than the regex checks for extension.

faking the extension is even easier

yes, but the thing is the webserver doesn't serve a file based on it's contents.
it serves it based on it's extension

how do you know that? I don't even know which webserver he uses

how do you?

Therefore, if the server tried to display an exe disguised as an image, it would display as a nonexistent image?

You might want to check for illegal names, containing / or \

Is it possible in someway to use PDO::FETCH_PROPS_LATE with PDOStatement-fetchObject? It works well with setFetchMode/fetch and fetchAll

Do those characters need escapes?

at what point did popular webservers start serving via mime as extracted from a couple of "magic bytes" in a file?

oh, no I get your point. When serving the file directly and not using the solution I'm used to (just storing the md5sum and serving that thumbnail with the corrent mime type, name etc.), you have to check the extension
Yes, if you use $_FILES["..."]["name"]. This is can be set to any value by the user

so I would use an ereg("/",$filename) or ereg("\",$filename) ?

i see no point to actually performing any sort of complex analysis on a file if there is no potential gain. there is no gain to doing any sort of scan on image contents.

oh, I see, in your case the thumb nail's name is automatically generated, so there's no problem.
you may want to exit() after calling header(), though
Sure there is, finding out the file type in every scenario, not just a few.

Anywho...

you can't accurately determine that without validating the entire file format.

validating a file *format*?

did i say something confusing?

yes, I hope the creators of a format validate it

Why would I need to exit()?

if you want to verify a file type with 100% certainty, then you have to examine the structure of the binary file
anything else is guessing.

If you meant file, correct indication is the magic header. Works all the time. If the header is wrong, imagecreatefrom will abort anyhow

the magic header does not give you any indication that the file is, without any uncertainty, what it says it is.

Otherwise you proceed on writing the image, and some tricky guys could supply the filename "f.php"
no, but it is more accurate than the extension

it's no more accurate than extension

You mean in the regex-checks?

How comes? If I supply a png file as file.jpg, imagecreatefrompng will abort as soon as it doesn't find the header

Still the same error.

Line 36 in your example

I need some help.

not the header() calls at the bottom, sorry

Oh, okay. I tried it there, and the page exploded on me...

as it will abort if it gets something that is not an image which is renamed as a file with an image extension
given that, what's the point of scanning the file?

Supporting a totally valid upload with filename "niceimage" and a valid png image as content

but it's not certain. all you know is that 2 - 4 bytes haappen to meet your criteria.

yes, so I'll try to read it

which is just doing the same thing
so, in essence, you're only duplicating those efforts needlessly.

error, as in your solution

yes, this is duplication, but allows non-DOS based file conventions

for the 1% of mac users out there? they rely on extensions too. rename a .dmg file some time, and see what happens.

Guys, help me out. I keep getting "unexpected $end" errors.

I think the market share of !Windows is more about 5%, assuming Mac~=2%
Could you pastebin your changed code?

Yeah.
http://pastebin.ca/615014

linux is going to do it as well for file launching in most applications.
and OS X physically warns you "just like windows" that you're modifying the extension if you try

You're still using regexps instead of pathinfo

You mean inside the createthumb() function?
Oh.

yes, and line 57 just looks strange, you may want to use strpos instead of regexps

strpos returns the position of $needle?

Most *n?x desktop environments use the mime type if it is a local file.
yes, you just have to check it against false (use !== or =

http://pastebin.ca/615020 Better?

no, still missing pathinfo in createthumb
Is this the whole file or did you simplify?

That's the whole file.

popular desktops, and most software when retrieving a file list will not.

does any one has any experience with NearlyFreeSpeech ??

Just tested, KDE checks the mime type.

Hi

that might explain why it's so dog slow sometimes. "popular" doesn't really include KDE.

How can I convert to this php please Set KeyDLL = CreateObject("ShieldKey.KeyFunctions") and this unlockCode = KeyDLL.returnkey(TRIM(Request.Form("txtRegCode")), TRIM(Request.Form("txtUserName")))?

http://pastebin.ca/615049 Any better?

I do not want the code on the internet.
Its registration key data and its sensitve information.

In this case, you may want to check two things: 1. is $_FILES["uploadfile"] set? 2. if you are redirecting to 'Location: ?page_name=photo_conf , it should display something

hello
anyone know a class for making xls files ?

phil1000, that does not look at all like PHP.

-v

not from xls and not from mysql tables

I am trying to convert it to php.

Which language is that?

Well you're going to have to tell us quite a bit about what it does.

Its asp.

We can't guess. Tell us.

You type in the users registration key number and name then it calls the dll to make the key.

and you came to ##php for asp help because...?

Then you need to implement whatever's in the DLL in PHP
That's where the logic actually lives
To my knowledge, PHP can't just call DLLs

I am trying to figure out how to write the code to make it work with php.

it can in some cases.

An extension or a dl()?

you may be able to use the COM extension for that

exactly

hmm

But all you're doing is hashing some string, right? And unhashing it?

is there a way for me to use php to show a webpage within another page easily?

kerick, there are a variety of ways for PHP to perform an HTTP request and pull the contents of another website.
Or you can just use an iframe

yeah, thats what I had setup. I was just thinking there might be a better way to do it

Well there's nothing particularly wrong with that... it puts the task of loading the other page on the client, not on your own server.

I do not like asp that is why I am converting it to php.

But if server load is not a concern, you can use file_get_contents(), fopen(), fsockopen(), shell_exec('wget ...'), etc.
curl too

etc..) and then scan the page for relative URLs and fix them. if it contains any javascript, you may have to repair that too. it's probably more work than it's worth.

so ... does anyone know of a good class that can be used to make some xls files ?

alright, I'll just leave it then. Thanks guys

Thanks and I will have to research on it.

glontu, it's easy to generate a CSV which will work in Excel.

oh midnight again. damn.

If you want all the fancy Excel stuff, then I don't know of a class, no.

night people, cya

Bye HAM

so i need a class that will output a CSV then ?

Not even that, just fgetcsv() / fputcsv()

i just need a basic file with 3-4 cells with some info in it
oh ... cool ... i'll look those up
thanks

hey folks, how do I know which php.ini my server is using?

Calling phpinfo() will tell you that

is it somewhere in phpinfo?

Right on the top

oh

May attention to the "Additional .ini files parsed" section too
Pay*

hah

i'm going to die

thanks

i have to write the technical side of a proposal
that is costly enough that i'm sure there will be better IT people proposing
uthat is costly enough that i'm sure there will be better IT people proposing/u

technical writing is an art

If you want more advanced formatting than you can get with csv, there is a PEAR class you can use: http://pear.php.net/package/Spreadsheet_Excel_Writer

by $dc:creator:$description' - I need to loop around and expand all $variables with $item['variablename']

is there a library to do this?
no, that's crap

http://php.net/pcre

$value) { str_replace('$'.$varname, $value, $template); } ?

y, except I don't know the vars in advance
maybe s/\$\w/\$item\['($1)'\]/ ?
is there an interactive mode for php?

uh... where in the config you change the request method?

-a
got it
???? this language is not intuitive

A charge I've never heard levelled against PHP before.

but nevertheless, could be true
ignoring that tho...
what's the problem?

I'm not sure how it could be any more intuitive, really.

lol
variable typing

Eh

just one example

That's not a matter of intuition

why not?
if it's not intuitive then php is not entirely an intuitive language is it
it might just be "mostly intuitive"

Never mind

i think the response is "you're not that intuitive"
childish...but accurate

my response to that is "y'mum"

how do i tell if an E_NOTICE occurred?

use a custom error handler
well, if you want to turn reporting of notices on, then

NVM

!php

does php have a function to tell you the length of an array?

count

sweet, thanks

Hello there, I'm developing a system for a commerce. I'd like to add a way for people to pay the service with credict cards, it's a kind of pre payed delivery.. Anyone knows how to do It? The problem is that I'm from Brazil and I don't know if there's a 'global way'..

I need to parse some XML files... what are some known libraries to do this?

simplexml_load_file()

Pollita, I love PHP thanks.

hey all, whats the function that will cut whitespace out of results from a mysql_query();
s/ //;?
or rather "s/\s+//;"
wow, really talkative room today...

trim?

that is what i am looking for i believe
does it need regex? or just trim($var);?

http://php.net/trim
a href="http://php.net/trim"http://php.net/trim/a

$row['user'] = trim($row]'user']); desn't trim the whitespace off it

Hmm, I'm trying to use a temporary name for a function to save some typing... $short="$this-veryLongFunctionName"; $short("bla"); // (this obviously isn't the way) ... equiv python syntax is short=self.veryLongFunctionName; short("bla")
$short="veryLongFunctionName"; $this-$short("bla"); is a start, but I'd like to see if I can save myself typing $this too? :-)

not sure kim_register
but, you're using "s
that'll evaluate it to a string I belive
try using 's instead
$short='$this-veryLongFunctionName'; $short("bla");

Phil4, I tried that too, but then it tries to actually look for a function called '$this-veryLongFunctionName', which isn't actually a valid function name afaict (it's going to be hard to define an actual function with that name;-)"
but good thought!

:/
ok

apparently PHP wasn't ever designed from the ground up as a sane programming language, it's growing up fast, but maybe this is an example of something that still needs looking at

why wont my trim actually trim?

similar story about php not supporting named parameters ^^;;

what do you want to do j2daosh?
remove blank space from the beginning and end or throughout the whole string?

just count yourself luck you didn't come to PHP first! :-)

i want to trim the " " off the front of the output from one of my mysql_query();

*lucky

tjust the beginning

then trim should work fine

ltrim()

it should, but its not

or ltrim if you definately don't want to trim from the end too

oh i dont care about the end, its the the space in front thats screwing up my ucfirst() that i need to get rid of

that will. if it doesn't, you either don't have what you think you do, or you're doing something wrong.

$username = trim($row['username']);
thats the line i'm using, but its not clipping it off

insin, why's that? I wouldn't have known better and be blissful in my ignorance! ;-)

echo ltrim(" foobar"); // outputs 'foobar'
so if you're not getting the expected result, you need to have a good look at what you're doling.
*doing

throw in a few echo's to see if its actually that part which is getting the extra space

".ucfirst($username).""; , it has to be the trim...

it will remove leading spaces. that short test confirms that ltrim() is not broken.

I guess I really am unlucky...

so, we can say that if ltrim() is not broken, and your assignments are correct, that the problem must be in the string you're trying to manipulate.

hmm... var_dump($username); gives me nothing...

because php doesn't treat functions as objects )

j2daosh, ah! maybe it's null?
j2daosh, or ":" ?

Looks like you want python..

errr or ""

no, it would tell me it was null... it gives me NOTHING... not even a space where an extra line *should* be

Where functions are objects, and parameters can be named.

mattmcc, Ummmm "why can't php be python?" ... makes me sound rather foolish when you put it that way

ergo, a problem with your input.

suitably

Perhaps, but I think it all the time when I'm working at my PHP day job.

mattmcc, I guess we're both in the same boat
mattmcc, perhaps we could take a page from the wikipedia book, and {{sofixit}} ? ;-)

Eh, I just cope and take my paycheck, then do python on the side.

um
be a freelancer

mattmcc, well, PHP is open source too... if you also know C or C++ (dunno which, have to look) , I guess we can fix it

you can make same cash and do whatever you want.

get your department head hooked on another language. that's how you do it.

So I've heard...
I do that. Like I said, on the side.

do it full time
simple

doesn't work if you're creating say a plugin to existing open source code... written in php
the CTO of the org I'm working for did go like "Why don't we rewrite this crap in python then ... oh shoot, mediawiki is php, and we want to keep using that.... big shame"

no, but a lot of things are writeable as services, which is how we began the move awaay.

caffinated, tempting, tempting

find language agnostic communication methods that work well, and you can start to push off.

Mmm, RPC.
I've seen a couple python mediawiki syntax parsers floating around.

whats faster

42.

superman

sweet
how about

or the millenium falcon. even though calculating a jump to hyperspace ain't like dustin' crops.

MySQL query, select products 200 product Prices,IDs,Titles from a database, looping through & echoing them to the page

Does anybody need a good webhost?

or... Deserializing an Array containing 200 Product prices,ids,titles from file & echoing to page

I offer unlimited SQL databases, Email addresses, and FTP acces

don't advertize here please.

ay!
how now caff/matt :]

Unserializing is pretty labor-intensive.

is it?

mattmcc, that's not the entire mediawiki though... but tempting
mattmcc, I'm working on the wikidata plugin ... ;-)

Are you asking for purposes of caching?

yeah caching

Because there are better ways to cache data than serializing to a file.

i wanna be a poke** cache master
i wanna cachem all

Memcached, for example.

bare in mind im on shared hosting man
and running mysql 4.0
so i'm limited.

Ah. Yeah, shared hosts and scaling don't mix.

yeah
so what i do

For your case, I'd probably just set up a quick test to time both approaches.

not that such timing will be accurtate, since you can't tell what kind of load the database is already under.

really
well what do you generally think would be faster
queryin for 200 rows, or deserializing

hmm, serializing an object to file... something I still should look up to help with unit testing... :-)

if i were to hazard a guess, i'd say that under no load the database is probably faster.

If the columns you wanted were indexed, it could probably do it without even hitting the table.

sup boys

ok. what's wrong with this:
$var = '$item["$title"] by $item["$dc:creator:"]$item["$description"]';
$expr = '$a = '.$var."; return $a";
print eval($expr);

nah they're not all indexed

that's easy to fix.

syntax error, unexpected $end"

The only gotcha is the class definition needs to be present before you unserialize it, else you get a PHP_Incomplete_Class instance.

yeah i know

This tends to trip up people who are serializing objects to the session, and use session_auto_start.

but i mean its an 8000 row db lol

that's it? that's tiny.

6.6MEGS

mattmcc, sounds like you know what you're talking about :-)

yeehawwwww

i don't even see it ass 'getting large' until i have half a million rows or more
i don't even see it ass 'getting large' until i have half a million rows or more

Once upon a time, it made for an interesting design decision.

lol

Involving, ironically, caching DB queries.

ok ill tell you something else which is also making me consdier it
it seems my host has max DB connection limit set @ 10

"eval() returns NULL unless return is called in the evaluated code, in which case the value passed to return is returned."

which seems to mean theres a max of 10 people browsing the site before it fails

it's sounding more like shared hosting is not for you.

lol yeah
but till then
im considering maybe going on a cachem all experience

mattmcc, interesting, did you know that mysql has a caching facility?

Most DB servers do.

mattmcc, if so, why was that insufficient?
mattmcc, *nodnod* indeed.

$var = "$item['title']";
$expr = '$a = '.$var;
print eval($expr);
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

These were queries against Oracle, actually, and they were... elaborate.

mattmcc, for some reason mysqls default settings are rather inefficient ^^;;

Server Load 3.04 (2 cpus)

We weren't actually caching the queries, what we did was run a query for just PKs, using a given search criteria, once. Stored that list.

mattmcc, I know the problem, oh yeah

Then to display search results, we'd grab a block of 10-20 PKs from our stored list, and grab the full data for them.

because $var is not a constant in reality

Much, much faster than running the full query for each page of results, or even caching the full results.

$var is not a constant in any reality. it's a variable :P

mattmcc, why faster than caching the full results?
mattmcc, I'd expect the latter to be as fast as you can go... or were the results prohibitively large?
mattmcc, I'd expect the latter to be as fast as you can go... or were the results prohibitively large?

The number of results and amount of data in each result, combined with the odds of the user actually ever wanting to see more than the first couple pages..

mattmcc, I guess so then

be warned - i eat people for sticking images in blobs

caffinated, where would you like them to stick images then?

filesystem
you don't do that .. right?

It's fun, though, telling people that it can be faster to do 20-something queries per page (Based on PK) than to do one big query per page.

"what's a filesystem?"

Certainly not. Although that particular project did store PHP sessions in blobs.

MattKelly, Oh I'm sure it is
oh I'm sure it is (sorry MattKelly )

if anyone has to ask that, they need a new hobby.

caffinated, more like some sane companies have eliminated filesystems altogether?

i'd hardly call storing images in a database sane.

caffinated, well, a filesystem is just a poor man's database to begin with
so that must be even less sane then ^^;;

which is specificly optimized, and agressively cached for a single purpose. the storage of arbitrary data.

caffinated, so you claim that it's impossible to make a proper database engine be capable of same?

no, it's been done. and every attempt i've seen so far is considerably slower.

caffinated, even AS/400?

are you suggesting that every person out there buy specialized servers for things?

there was an OSS implementation out there someplace...
caffinated, no, just that the AS/400 operating system doesn't actually use filing systems upfront

to be fair, i'm not familiar with it, so it
may be faster than what i have seen.

ok. Why is this not okay:
$expr = 'return $item[\'title\']';
print $expr;
print eval($expr);

however, the people who commonly come in here do not run specialized systems.

caffinated, at this point I'd best ask what *have* you seen? :-)

syntax error, unexpected $end "

caffinated, since then I can compare and all that

so, in the generic pc-and-unix/linux you're going to be hard pressed to beat a filesystem for a direct lookup.

MartinCleaver, on which line?

ok. seems no semicolon.

MartinCleaver, if you forget the semicolon, your colon will feel like there is a semi in it ;-)
caffinated, I am somewhat dissapointed that Hans Reiser went off the deep end...
caffinated, else Things Might Have Been Different.

i'm sure ReiserFS will live on

There are those who'd say he hasn't actually travelled that far from his past state..

it's not like it just vanished becase he decided to murder some people.
uit's not like it just vanished becase he decided to murder some people./u

ouwie
perhaps I should just get back to coding
mattmcc, I did actually managed to do duck typing in php with a bit of introspection the other day... I should really just write a has_attr function, can't be hard :-)

Well, there is get_class_vars/get_object_vars.

mattmcc, lemme look up, 1 sec

and property_exists() in 5.1+

hmm... where can I find a pastebin...
http://pastebin.com/d3e6100c9
arpad, it exists now? \o/

yep
you could also do $c = new ReflectionClass('Foo'); if ($c-hasProperty('bar')) since 5.0

oh, I have 5.2.2 ......
hmmmmm!

im trying to build a recipe book application, each recipe has a set of ingredients which are stored in another table, a row for each ingredient, (many to one relationship) does any one have any ideas or suggestions on how to manage the input side of things im struggling a bit regarding how to manage accepting any number of ingredients, (each with three variables qty, unit, and type, unit and type each reference to another table)

hallo
Is it just me, or is PHP messy as fuck?

it is

It's driving me crazy.

arpad, way to confuse people
drewby, agree with arpad , both! ;-)

Some guy hired to me to make a site that allows users to e-mail live-published webcam video, I'm soooooooooooo glad it's almost over.
To be honest, the actionscript was even more painful than the php.

drewby, php 5 is almost sane
drewby, you can actually do proper oop and everything
drewby, next time, use python instead though

PHP is the first language, I learned, I liked it a lot at that time.

(unless we have a php 6 by then)

But then I learned Java.

drewby, php5 is probably saner than java by now

Bah!
No wayyyyyy.

drewby, it's not hard to make something saner than java in the 21st century...

Java seems pretty clean to me.

drewby, specially if your language is open source, and you can "borrow" from your neighbours ;-)
drewby, wait till you meet ruby or python :-)

I've met ruby.

or even perl for that matter

Ruby is sooooo pretty.

drewby, ain't it just

I like PHP more than perl, less than Java.

drewby, and python sort of spoiled me for java forever

i like php more than everything

TehSausage, do you know anything else? ;-)

heh, not very well

drewby, well, decent PHP5 code looks much like java..... painfully so for me ;-)

I like PHP, but it's way too lose. PHP is just too whore-like for me.
loose*

drewby, as I had just been discussing with mattmcc

c# and perl are my favourites - at pretty much opposite ends of the spectrum

drewby, so apply some self discipline

C# = vomit in a box, then eating it

arpad, c# is just yet another c-syntax language ;-)

I try as much as possible.

drewby, good show.
drewby, either that or learn python ;-)

naturally, but a very well designed one

Euphoria is a pretty good language

drewby, though python does require a bit more self discipline ;-)

Learning Java taught me how effective clean-programming is.

arpad, fair enough. actually javascript is strongly underrated in that field too

you can program php cleanly, if you write a bunch of mess behind afew classes :P
uyou can program php cleanly, if you write a bunch of mess behind afew classes :P/u

javascript is fun, but cross-browser javascript is a nightmare

arpad, that's probably what kills javascript, yeah

PHP isn't really about writing pretty, it's more just about hiding the mess.

that's the fun part :P

arpad, if people could agree on one standard, I might just start worshipping it
arpad, especially with its ability to manipulate dom trees trivially
arpad, javascript in SVG..... yum! :-)

So what IDE do you guys use for PHP?

!+editors

Editor discussion usually degrades rapidly due to personal preference. It is not a valid topic for ##php. Please try http://freshmeat.net/browse/63/ or http://www.php-editors.com/ and find your own preference.

well, a refactoring editor for php might be nice

whats the name of the function that lets you get all of the information about the current http request?

MarkL, might I pre-empt the entire discussion by mentioning ed, the one true editor?

I was just curious to know their personal preference, but I'll respect your complaint and just look at the links.

Not my complaint really, just a channel 'thing' Editor discussions usually degrade rapidly into flame war.

http_request()?

$_SERVER gives you pretty much everything, if you're using mod_php there's also apache_request_headers()

Alright, now, as a personal preference I'm going to say that I've yet to find anything more functional the eclipse and java, I've yet to meet anything as functional while using PHP.

drewby, Okay, so when I was sort of teaching people the ropes of java on irc (sounds odd, but it's an interesting way to teach)... I always told them to keep a half a mile distance from Eclipse

why's that

drewby, on the gripping hand, I don't object to it as much once you actually Know What You Are Doing
drewby, because if you're learning to code for the first time, eclipse does too much handholding, and you don't learn enough about the use of compiled languages
drewby, so some folks would end up only knowing eclipse, and not actually be able to code java in any other dev environment

well I did some of my projects just using a text-editor, really all eclipse did was make things go a bit faster.

hi, is there a shorter way for writing "$test = array();" ?

drewby, my very personal preference (don't shoot, don't shoot) is to use an editor I can call up quickly on a command line, which typically ends me up with pico/nano (but quite a while ago I switched to vim)
the only downside is that vim does no refactoring, afaik

but with vim you don't have to leave the fingers from "f" and "j"

v1v44n4k14, not afaik
v1v44n4k14, a (wo)man who knows what I'm talkin' about! griiiiiiin

golfing?

hm ?

arpad, I think so ;-)

why do you want to make it shorter?

v1v44n4k14, never heard of perl golf? (try to write code as short as possible)

i just wanted to know, because js also offers a way

instead of getting the least number of swings, you try to get the least number of characters ;-)

no, but sounds nice, i just know such contests from old asm-magazines for shortes bytecode

par for perl golf is insanely low ... and the resulting code looks like line noise (so what else is new?)
v1v44n4k14, Hokay, so you're an actual hacker-type-person I hear. What did you start coding on? Amiga? C64? perhaps Atari or BBC?

there's no $a = []; like js, but $a = null; saves a few bytes

Alright, so if I wanted to move a ton of variables into a config file, and use them throughout another PHP file, then should I just require_one() the config file and declare them global in any function I want to use them, or is there a better way to go about that?

put them in an array
like $CFG

i want to delete first 2 elements from array !

then you can global $CFG, but I find a better way is also to make a couple of functions
get_config and set_config
so you only global $CFG in those places

no... i just had a non real working amiga 500, i started programming on dos with 80x86

$a = array_slice($a, 2);

to fast for me

v1v44n4k14, you missed all the cool stuff! :-)

thanks

i know =(
i was born when the internet was "invented" in 1983... so i missed a lot cool stuff =(
ui was born when the internet was "invented" in 1983... so i missed a lot cool stuff =(/u

showing off too.... not that showing ogg would be bad

showing ogg ?

v1v44n4k14, one could show Ogg Theora. (ogg is a container format, Ogg Theora is for movies)

oh.. the ogg for mp3 ?
my english is not that good mate

ogg vorbis is most comparable to mp3

ahh - there are different off formats
ogg...

ogg theora is more like mp4 (or avi)

should I be able to evaluate this:

i've not found the time yet to get into contact with all this video stuff

$a = "$item['title'] is $item['link']"; return $a;

v1v44n4k14, does that mean you don't know bittorrent either?

hehe

v1v44n4k14, by now I thought the whole world got their video through bt, though I guess that can't be true... since many folks still have a television
uv1v44n4k14, by now I thought the whole world got their video through bt, though I guess that can't be true... since many folks still have a television/u
I just download the shows I want to watch O:-)

syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

i know how to get to what i need and also look movies... but just really rarely

(shhhh)
v1v44n4k14, fair enough

you know searchlores.org ?

no the quotes are wrong, see http://php.net/types.string

the reversing and seeking rulers

thanks arpad

someone here know uni-verse ?

i want a timer so a user can only access a page every 30 seconds... how can I do that?

does var_export not work with $GLOBALS?

hello guys
i have problem, in system CentOs (gnu/linux), trying work socket_creat(), diplay error message:
socket_create() Unable to create socket [1]: Operation not permitted in /home2/tecnobyt/public_html/ping.php on line 31
somebody fix it?
?
socket_create()
somebody fixed it?

you need to be root to make raw sockets
judging by the filename "ping" you tried to make one

Thanks
you are best!

hmm
having a problem with folder permissions when using mkdir
when I create them I am unable to delete them on my shared hosting server

php user != ftp user

right...but it is completely random
sometimes I am able to delete them...
sometimes I am not

is there a xml class where i can make selections like XPath or CSS ? (for example $xml-get("/*/debug[@mode='debug']");

v1v44n4k14, simplexml

and this works like this ?

similar

where to get it ?

part of php5
you can load the extension if it isn't arleady there.

cause i'm on writing a small php4 class for this

oh php4

jop =(

lol php4 and xml

works fine
and i want to learn a bit more about parsing

php5 works better, because it's already there....

my webspace does support both
but i don't know how to swithc
i also don't really know much about php5

php4

ALOT

how can i establish a dual piping reading and writing alternately?

what you mean ?

i want a timer so a user can only access a page every 30 seconds... how can I do that?

i use proc_open and fread, fwrite
with a session variable

would it be much effort to learn the differences ? so i can use it for the actual projects

if the user's browser supports sessions

gi000, that's a good suggestion but easy to get around

so what set the current tome in the session or something?

just delete the session cookie!

What browser doesnt support dessions these days?

exactly

v1v44n4k14, very little effort

you can disable it

v1v44n4k14, php5 is very useful. But perhaps you're learning how to parse? :-)

especially if your familiar with java... for some reason that helps

True, but you should disable access to that area if sessions arent available

cythrawll, some reason being that the php folks copied in all the brokenness of java? ;-)
why oh why would they do that?

but anyway, deleting the session cookie will cost some time too

there's so many prettier languages out there

The browser support of sessions is not the issue, the manual disabling it would be

kim_register, most likely because Zend see's Java as it's main competition on the enterprise front?

can someone tell me what command to use to print an array?

Print_r($array)

and Java programmers whine ALOT when they switch to PHP

yet they get the bigger paycheck

i'll learn this also if i'm doing php5

someone knows about read and write pipes?

thanks

Fushuing, yeah which is why i do alot of java in my day to day

:|

i've buyed "the dragon book" a few days ago and i'm sooooo happy to have it after a long time of spending money

I only do php for freelance... so much faster

i have learned java a bit, it's the same with all languages more or less

play with sessions

but how to declare a file as php5 ? maybee with file.php5 ?

with .php

you can save the ip and the browser identification too, but that's not as good as using sessions i think

would i get an error if i try to run php4 classes with php5 ?

v1v44n4k14, depends on your server setup

what's the normal way ? #!/usr/bin/php-5 ?

and v1v44n4k14 I think it depends, I think you'd get alot of warnings and notices but I don't think you'll error out most of the time.

are you a perl programmer/

so does anyone know why mkdir is creating folders with the wrong ownership?

v1v44n4k14, depends, the normal way is to either support 4 or 5 not both, so you just use whatever you have setup for the server.

i havn't seen a single difference between PHP4 and PHP5, except that PHP5 has more functions :x

(normally mod_php mapped to .php extension)
Fushuing, object handeling is different, exceptions
OOo is almost completely different

foreach($strings as $string) { fwrite($pipes[READ]); while(!feof($pipes[READ])) {$res = fgets($pipes[READ]); } } doesnt work well for me

and don't forget SPL!

cythrawll, if you want to compete with something, you make your system better, not a carbon copy ;-)
ah well

it hangs when there is no more output from the process being called

kim_register, I agree, but I'm not Zend either
I have alot of beef with Zend :p

so does anyone know why mkdir is creating folders with the wrong ownership?

especially after working on the ZF
Machness, what is the owner?

well I mean I am creating the folders with 755 mode right...
but then when I try to delete them or change their permissions through file manager in cpanel it wont let me
bbut then when I try to delete them or change their permissions through file manager in cpanel it wont let me/b

you should use 0755

Machness, probably because the files are owned by the apache user, because their the one's executing the php script

well sometimes I am able to delete them

you know a tutorial that teaches the differences php4- php5 ?

other times I am not

3] gi000 Machness: you should use

so i'll make the step to php5

mkdir("$directory")

v1v44n4k14, sure it's in php.net documentation

wouldn't that by default create 777?

no

Machness, no
I hope to hell no

mkdir("$directory",0755) so do that instead?

could someone job my memory, what function do I call to convert a string to a float?

(float)$string

cythrawll
thanks

"The mode is 0777 by default," rofl, maybe he was right

i looked it up

0777 by default? wtf?

i just dont understand why some are being able to be deleted and some aren't

should be 0000 by default
:/
Machness, cpanel, stop being so confuzzled

huh?

anyone experimented with proc_open() when he/she was young?

it's like using windows and wondering wtf is happening to your filesystem as it gets chewed alive by it's own mishmash of a kernel

0000 by default means no-one can touch it?

How can i remove a value from an array?
I have an array with a directory listing and i dont want it to include certain files

unset it =\
better off filtering them in the loop though, then you can just use continue;

no expert in piping here :|
good night everyone

Guess unset() is only useful for associative arrays

theres array_search() that can find you the key

Damn it.
I have yet to come up with a nice way to secure php in a shared environment This is tricky :/
Looks like the only real way is to use a chroot :/

i feel your pain

Hi for all!

what did you come up with

okay, I am able to delete the folders as long as I dont use my upload script to upload a picture into them
do you think my script could be changing the ownership?

well does it? _

I havent came up with anything great yet. My users are still using mod_php with just a open_basedir restriction
I resist using cgi to "secure" things
And i dont want to slow things down

Are there some free substitute for Zend Guard and Zend Optimizer?

if i store a bunch of variables into an array like $array[$index] = array(....) but $index is not always in numerical order, how can i sort it so it is in numerical order. i tried sort() but then $array wasnt liked in my foreach loop

does register_globals let you overwrite superglobals?

I thought no.

good, so i can reverse it with some php code XD

there was a bug where $GLOBALS could be overwritten
if you need to do it at runtime, use PHP_Compat

screw external libraries

yeah, reinventing the wheel is great

it is
i even have my own File class

can someone tell me what this is?: public $var2 = EOD
hello world

php

EOD;

a heredoc
http://sausage.no-ip.org:88/dev/dw/heredoc

CPanel is PHP, right?

it's the same as a double quoted string, but spans multiple lines and you dont have to escape double quotes

and is far less efficient without an optimiser

useful for a big chunk of html with some variables scattered around

do you have any good findings at all?

Someone knows a substitute for Zend Guard and Zend Optimizer?

only some of it

sardano, zend guard, kinda pointless, zend optimizer, phpaccelerator or apc

Thanks cythrawll!

how to get the php version that is actually running inside my script ?

i think it's php_version()

isn't there a constant for this like _FILE_ ?

phpversion, that is

hey

php.net/php_version
meow

APC encode or cripty PHP code?

does anyone under stand using array_search and the === operator?

sardano, scuse me?
stevemc1, where's the confusion?

I tried comparing a array_search() using === to false and true
it was neither

stevemc1, and what does array_search() return?

that's totally possible, 'moose' !== true && 'moose' !== false

cythrawll: Is APC encode or encripty PHP code, like is done by Zend Guard?

s/ stevemc1 /cythrawll/xg

sardano, no because it's completely pointless to begin with

it returns an int where in the array it exist or a boolean

encrypting source/p-code is kinda pointless, php can run it, so it can be de-compiled easily enough

Excuse me I don't undertood.

can array_search ever evaluate to true if used with ===? I don't think so

stevemc1, I don't think so
it should evalueate to false however if the needle isn't found

I'm looking for a tutorial on saving an array to a database. Does anyone know of any?

I think that's where I tripped up. am I right to think I can still === false?

sardano, encrypting php code is pointless because the op_codes are always exposed

: "[array_search] Searches haystack for needle and returns the key if it is found in the array, FALSE otherwise."

alright thnanks

encrypting code just raises the bar a little bit, it doesn't prevent code stealing
it's better to rely on licensing :P

it's listed in the manual
exactly, get the lawyers to fix it

f00li5h, unfortunatly
I am alergic to lawyers

as it happens, trying to distribute crypted code is just coding arround a human problem, which is always a bad thing

can someone tell me how to save multidimensional arrays to a database

you'd want to do it by looping over the structure, and inserting into different tables
then reconstruct the array by selecting back from those tables

sodani, serialize it and store it in a varchar :p
then select it back and unserialize it

ick, and ick.
what kind of data is it?

do you guys know of any tutorials on it?

if it's a 2D array, it maps perfectly to a table

it's rss feed data

LAWL
rss is pretty 2D iirc

that depends on what's in the array
Array(Array( new Foo() ) ) # i'm still 2D

the Foo adds a dimension, sorry ^^;;
objects count as n extra dimensions, where n is at least one

pff, it's a 2 dimensional array

as far as stuffing things in databases goes, anyway
unless you serialize foo

you don't serialise it, you ORM it

f00li5h, you realize that many langauges implement objects as being associative arrays, right?

not this one.
which langauge does that then?

how would you ORM your object... to a 2nd table perhaps?
f00li5h, think perl with bless() ? :-)

yes, perhaps to many tables

you could even bless a non-associative array, perhaps (it's been a while)

s/associative array/hash/ && understand()
you can bless any reference


Related Topic:

1 Displaying news from all categories with settings only 1 important setting disable comments of one category
Hi how could i make script i have list of rules and those rules have id and some other variable for example something
Need some opinions here I am starting to realize that i am spending way to much time developing little things