Jump to content


Member Since 31 Dec 1969
Offline Last Active Yesterday, 09:06 PM

Posts I've Made

In Topic: preg_match

26 October 2014 - 11:02 AM

I see a number of issues with your regex, for example, one problem I see is that your patterns aren't accounting for newlines and whitespace between html tags.  But rather than try to make your regex work, you instead use a DOM parser for this.  

In Topic: How to load a PHP class into a PHP functions

25 October 2014 - 09:11 AM

function test($one, $two, $three, Database $database)
   $database->query(...); /// doesn't work inside this function
$database->query(...); /// works outside the function



So, some debugging 101 here.. you got an error that was essentially the result the variable not being within the scope of the function. So you updated your function declaration and now you are getting another error, which basically means you aren't passing to test what it expects.  To me, this sounds like you likely essentially have the same issue before, except backing up the chain a notch.  


So, where/how are you calling test()?  Did you update where you are calling it to have it actually pass a Database type object when you call it?  If so, are you calling test() within some other function, and $database isn't exposed to it, in the same way it wasn't exposed here?


Follow the trail, make sure $database is actually exposed, same as you already did here. 

In Topic: Complex regular expression

07 October 2014 - 10:25 PM

Good lord you never give up do you.  It must be tiring being you. 

In Topic: Complex regular expression

03 October 2014 - 06:18 PM

I gave a random example to make a point that you don't know what the context is.  Instead, you deliberately try to sidestep the point in a vain attempt to try and tear me down.  You really do have issues man.  As far as everybody in this community is concerned, you are the unwanted troll, and you know it

In Topic: carry cookies into an iframe

03 October 2014 - 11:51 AM

Also the URL that the iFrame is on is different to the content of the page inside the iFrame.


Different...what?  Domain?  I assume that's what you meant, because if the parent/child pages were on the same domain, they could share the cookies no problem (assuming you are setting the cookies to root domain name with no subdomain or path).  So, if you meant that they are on diff domains, then the iframed page cannot read the cookies from the parent page, as this is considered cross-site scripting.


To get around this, you can do the following: 


On the parent page:

- read the cookies on parent page

- append cookies as url params to the iframe url

- generate the iframe with the url w/ the params. 


Then on the iframed page:

- read url params from the url

- store them in cookies (or do whatever w/ them).  Note that the iframe page will store them in its own cookies scoped for that domain, which would be separate cookies from the parent page's domain.

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime