Kalium got this right -- paths in the wordpress interface are relative, causing the administration interface to not work properly when accessed in this manner. Your approach is concerning in a few ways, so I'd like to make a few quick recommendations. Firstly, I would try to find a way to remove the $username and $password variables from being hard-coded.
Think about how easy this is to break -- if the password is updated via the administration interface, for instance, the hard-coded value in your code will no longer be correct, and your "auto-login" will now fail. Furthermore, if someone somehow comprises the site and gains access to handshake. Php -- well, now they've got the username and password for your blog.It looks like your wordpress installation rests on the same server as the handshake script you've written, given the path to /blog is relative (in your sample code).
Accordingly, I'd suggest trying to mimic the session they validate against in your parent applications login. I've done this several times in the past -- just can't recall the specifics.So, for instance, your login script would not only set your login credentials, but also set the session keys required for wordpress authentication. This process will involve digging through a lot of wordpress's code, but thats the beauty of open source!
Instead of using CURL and hard-coding values, try to simply integrate wordpress's authentication mechanism into your application's login mechanism. I'd start by looking at the source for wp-login. Php and going from there.
If all else fails and you're determined to not try to mesh your session auth mechanism with that of wordpress, then you could immediately fix your problem (without fixing the more concerning aspects of your approach) with these changes to your code: First, add the following curl_opt: curl_setopt(CURL_COOKIEFILE, ''); // Enables session support Then, add this after closing the curl handler: curl_close($ch); // Instead of echoing the result, redirect to the administration interface, now that the valid, authenticated session has been established header('location: blog/wordpress/wp-admin/'); die(); So, in this less than ideal solution you'd use CURL to authenticate the user, and then rather then attempt to hijack the administration interface into that current page, redirect them to the regular administration interface. Hope this helps! Let me know if you need more help / the solution isn't clear.
Check the HTML source. It sounds like WP's links may be relative. Instead of making this process even more complicated than it already is, however, I suggest you perform the login, hand the user whatever cookies are required, and redirect them.
Otherwise you're coding a proxy, piece by piece.
Good thought, but that assumes the login script and the wordpress install are on the same domain -- otherwise there's no way to set the cookie. – Eli Apr 8 '09 at 17:54 If you have sufficient access, set up a subdomain of the wordpress domain and use that to set cookies as needed. It's something of a hack, but still better than creating a proxy in a piecemeal fashion.
– Kalium Apr 8 '09 at 19:43.
If your script doesn't perform all the functions you need in a single execution, you may need to parse out the cookie values, store them in a file, and then resend on the next execution. Check out the CURLOPT_COOKIEFILE option.
How about using Zend Framework's Cookies class to manage them for you. I have used this in the past for crawling secure sections of a web site using Curl.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.