Very tricky php question I have an object with several public methods that return this so I can chain these object

, actually

its possible to do that only if its the first character?

so instead of php –with-xsl i've done: echo shell_exec("xsltproc " . implode(" ", $params) . " '$xslfile' '$xmlfile'");
i feel so dirty

remove only the first character.
if the first char is #.

preg_replace('^#','',$string);

substr() str_replace() or maybe even trim()

er, /^#/

ltrim() even

looks good, thanks.

that's a bit overboard :P

How so? It has to be anchored to the beginning
ah ltrim can use different chars, nice.

indeed

can i force a form to be sent?

?

can i force a form to be sent?

could hold the user hostage and form him to submit the form

You can always talk it into.

we heard you the first time

Repeating as in forcing us to read the q.

he likes forcing users to do things ^^

kinky

think for instance when you send a post with curl… is it possible to do exactly the same thing, but against the same ip-number?

preg_replace() [function.preg-replace]: No ending delimiter '^' found

php.net/ltrim
no I don't either, not sure what you are after mm2000

You can use cURL again if that's what you mean.

I think.. he wants curl to post forms on his users' behalf?
i.e. using their ip
thus forcing them to post something. naughty

yes. psilo
Nope.

why would you want to do that? O_o

Because…

ahhh 'Because', all makes sense now

k, thanks.
works.

but does it really matter why i want to do that?

well when you want to force a user to post using their IP address … seems a little weird

Whether or not it matters is up to individual(s) you are asking for help.. and possibly some channel policy
it smells fishy, if it's not then you have nothing to worry about

i have created a openid-consumer and server that uses diffie-hellman as encryption for safe login. The classes uses curl to send data back and forward. It works just fine. Now i want to be able to use both a consumer and a server on
the same site… and therefore i have to simulate all posts that i uses curl to do before. Is that reason enough?
hello?

hi, i have a problem with dynamic links. is there a module i need for that?

hey!

what is a dynamic link?

do you get my problem now?

index.php?page=module


i dont know what to say

rza, my sentiments exactly

rza, want me to paste some code?

well, not really but i assume you will do it anyway

rza, nah

if you do, please use http://phpfi.com

I don't really get your problem, but I will tell you this

are you using $_GET['page'] variable ?

you can fake the ip locally, but doing it across the net won't work
as any decent network will have egress filters on their routers and won't let the spoofed IP through

rza, no i use switch ($page) {

Very tricky php question. I have an object with several public methods that return $this. so I can chain these: $object = new Foo(); $object-a()-b()-c()-a(); Now. Is there *any* way that I can check in these methods a, b, c whether they are called /directly/ from a /variable/ (so, like the
first a() call) or are called on a return value, so already in the chain (like b, c and the second a call)?

thats called register globals and its bad for you
use $_GET['page']

rza, ah THANKS

ok, i cannot really just with php hosting force to post a form to a script?

rza, finally someonw who give me a answer i understand, i know i have register globals off

yeah but you can't fake the IP address mm2000

who says you can't fake an IP address on a request?

Hmm.. my only guess would be maybe try to make a distinction between returning $this and &$this.. although if my C++ background tells me anything, $this is already just a reference.

masquerade, me
I say you can't fake a REMOTE_ADDR

yeah, all this is php5 here. objects are always returned and copied by reference…

mm

there is no such thing as $object-a()-b() — this is not valid syntax.

imagemagick doesnt compile here

what version of VS are you using?

umm.. yes it is. I'm using it all the time here

ScottMac, I respectfully disagree

the free one and that is the reason
havent got VS6 license (except at work)

what version of php?

masquerade, show me how you fake a TCP / IP session please

5

correct me

then i dont need to fake ip.

which exact version

PHP 5.1.6 (built: May 22 2007 21:06:18)

how do i send it then, just with the command?

how can i print an array at once?

print_r / var_dump

ill add VS 6.0 to my wishlist

I dunno, I don't use PHP/curl for this sort of thing.

not like that..

next one who opens a windows bug can buy that to me

or, implode('br /', $array)

rza, I could send you a copy maybe ;x

ScottMac, are you familiar with TCP packet headers?

get_headers dont work either…

do you have extra licenses?

[0] = 'blabla'; [1] = 'test'; would print blablatest

or an "onsite license"

ok, thx

I have a student license :P
they dont sell VS6 afaik

i could put my company buy me the VS6
i bloody hate compiling on windows

ScottMac, http://www.securityfocus.com/infocus/1674 has a good article on the basics of various ways to spoof an IP address

hello. i'm having some problems posting a text field from a form to a mssql 'text' column. it gets truncated after about 4k bytes. any ideas what the issue might be?

hi ^^

hey

ho you to
'

FlimFlamMan, ask in a channel about your database or an SQL channel in general

"Any sort of spoofing beyond simple floods is relatively advanced and used in very specific instances such as evasion and connection hijacking."
quote from that article

this stuff is of such limited use due to egress filtering
it's really not that easy.. that I know of.

unless youre man-in-the-middle position, spoofing is really useless
you can fake your source address (which is filtered about everywhere anyways) but you wont receive the packats back

nobody said its easy or that its going to get you far, the point is that it is not impossible

you would need for example arp cache poisoning or similar

masquerade, yep you've linked me to a 4 year old document that says it not really possible these days.

but then we are talking about attacking from closer to the actual server

since sequence numbers are randomly generated

Well, nothing is impossible, as they say

and my subnet on the machine is actually what it should be

is there anything like realpath() which gives an absolute path but does not resolve symlinks?

rza, does your company have an MSDN subscription?

i have no idea
i dont do any windows stuff
or very little
i know we have VS licenses somewhere
but i dont know for which version

rza, you can get a Technet license or an MSDN license that let you get access to all MS software

Hm.. Trying to return $this by reference in a class method seems to raise a fatal error..

hah

ive adjusted the file size uploadin limits as well as the memory limits, but im still gettin errors saying the connection to the server was reset while the page was loading

Yeah I have no idea man.. that's tricky.
man/woman

ScottMac, for someone with a sufficient amount of time and resources, performing man-in-the-middle attacks against a high priority target will be well worth the time, as well as other attacks that would require you getting closer to the target. Because its difficult doesn't mean it should be
trusted, and that is the reason you won't see any of the largest websites in the world relying upon things like an IP address as any sort of

unique identifier for you.

man's right

feindgild, did you try dirname?

yeah, then I'll do a e() method that one will have to call at the end of chains..

masquerade, whats your point in all this btw?

ScottMac, just saying that telling someone an IP address will never be spoofed is disinformation.

you mean like dirname(realpath($file)) . '/' . basename($file) ?

depends what you are using the IP address for

like dirname($file) . '/' .basename($file)

how did a session key get set to "db5aaeb7fe7b0aed5427d33dd4a04e07, AdUser" ?

from the URI?

may I ask why you need this anyway? $foo-a()-b() should be considered equivalent to $foo-a(); $foo-b(); // I think

hey im using DOMDocument-loadXML() to load an xml file… and it bitches that it's not utf-8…. no encoding is defined in the XML… just wondering, does it assume utf-8 by default?

can that be done?

wait, how did you get a file w/o a dirname ?

what a crock
or i suppose a lame search engine could mess around
right.

hardcorelamer, see pathinfo

psilo, eh, that is only true if you return $this from $foo-a()

yes of course.. otherwise $foo-a()-b() makes no sense
I am just curious how being able to distinguish whether $foo is calling b, or $foo-a() is calling b, is useful

rza, thanks again, now it works like a charm..

yeah it is. It's kinda complicated.. My class implements Iterator, and so when used in foreach I can control workflow. So I let it iterate over a _selection property. With these chained methods now I put different elements into selection. E.g. foreach($object-parent()-siblings()-children()).
Think jQuery in php. Now, I need to reset the selection afterwards, because otherwise the next time I use these methods in e.g. foreach, there

would still be a _selection from the last time, which would obviously cause havoc. For foreach(), I can reset the selection when there is no more valid element, so at the end of the foreach - that works. But now I want to use these selector functions also outside of foreach, e.g. have a function
set() that sets a property on all selected elements. That would mean, though, that I have to reset the selection at the end of the chain somehow.

ah and there is my answer

http://devzone.zend.com/article/1362-Fluent-Interfaces-in-PHP — talks about returning $this
i think it's horribly bad and will confuse most other devs who look at the code, they will probably think it's a bug and try to change it

sorry for being a bit verbose :P

hardcorelamer, I thiink that is only the case if other devs have never worked in any language but PHP and didn't start out with PHP5 and frameworrks

actually, I think I just found the solution. I do it the same way jquery does it. A normal function q($object) { $object-resetSelection(); return $object } and then for the chain just q($object)-children-set() etc.
actually, if you're interested, the code is at http://cvs.drupal.org/viewvc.py/drupal/contributions/sandbox/frando/fapi4/ . It's concept code for Drupal 7.

masquerade, i've never seen any pattern or framework, either in java, python, or PHP which regularly returns $this by reference from a normal method
never heard it even talked about until today

whoa, nice, yes I will check it out

i would consider it a bug and re-write it
they're giving a name to a "pattern", and it's not a pattern, it's just a syntax change ..

Well, good luck
8am == quittin time for me

$foo-a(); $foo-b(); becomes $foo-a()-b();
that's not a pattern… it's a crazy hacked up shorthand

hardcorelamer, its regularly done in other languages, its just more silent because other languages have different notions of types

what if a() needs to return an error…. Opps, calling -b() on an error won't work

sure it will
when you throw an exception

where is it done in other languages? i seriously would like to see an example
omg… is everyone seriously using php5 in here?

yeah

"".join(seq).capitalize();

no one makes products for other people to use at all? it's all internal corporate one-offs?

function a () { throw new Exception("Go away") }
there you go

haha

in that case -b() never happens
i missed a semi colon but you get the idea

masquerade, that's totally different… join(seq) returns a new string…
not $this
that's normal method chaining

I don't know python, but isn't a string an object?
So it's the same thing

hardcorelamer, We make products for people
we tell them PHP 5 is the minimum requirement
actually we tell them PHP 5.2
we have a list of hosts that have it
or we can offer to host it for them for a fee

does php have lists and maps like in java ?

php has an array

and thats all ?
=(

well you can do lists

is your product open source, scottmac?
i would like to see a real PHP app that needs PHP5, most of them work under PHP4 if you just s/public|private/var/

hardcorelamer, nope its not

well, i would say any larger application can take advantage of php5 features

http://habariproject.org/en/

like interfaces and abstract classes for example

proper exceptions

hardcorelamer, its called making a stand. No hosts are going to upgrade unless appllications require it.

reflection

proper date support

header('Content-Type: image/jpeg'); No errors just nothing. How can I create the image if there is other content on the page ?

none of this messing around with timezones / utc

IMAGICK SUPPORT!
one of the main reasons to upgrade to php5

lol ^^

make image.php and use img src="image.php" /

Ah I thought I did it before just couldn't remember that work around, thanks rza

php4 support ends at the end of the year anyway doesn't it?

yes

mancos, yep

exactly, no reason not to use 5

double negative

hi, silly question, but i assume i can get help about php here ?

yes

is there somewhere i can post some code ?

phpfi.com

pastebin.ca

cheers

http://www.rafb.net/paste/

actually we support the Pink Horse Parade, not the code PHP

damn
:oP

So that's why I kept getting odd links sent to me while in here o.O

ok
here we go
http://rafb.net/p/8VqJkA83.html
i'm trying to add alt image tags
but not sure how to do it
any help appreciated
the pp calls the image from the css file
*php

If a class extends another class, will the parent class' constructor be called when the sub-class is created?

tag

this is what i thought

rza that doesn't seem to work.

:o(

eml, a copy of the function will be called, don't use "static" function variables and expect them to work with sub-classes

Ok, thanks

i'm gonna have to take all the images out of the css and put them in the php aren't i ?

/usr/bin/php /path/to/testGet.php this=4 but the _GET array stays empty.. any suggestions ?

lost_and_unfound, don't use $_GET, use argc and argv

Hi

i am running php as a CGI and not as CLI

no the constructor wont be called,
you will have to do parent

*
To prove that you're not a bot, enter this code
Anti-Spam Image

Comments are closed.


Blog Tags:

Similar posts: