Script to insert data on different domain - php

I am thinking about writing a script that will perform a sort of checkout procedure automatically similar to a program like Ebay snipe.
I will know what the page exactly looks like. All I really want to do is load the page from a different domain than the one that is running my script into an iframe, have jquery insert the data into the appropriate fields and then use javascript so click the submit button.
I have been reading about security issues with accessing information across different domains. On the domain I am trying to submit to I would like to call a few jquery functions such as .find() to get the id of the submit buttons so I can programatically click on them.
This might sound malicious or something which its not there is something going on sale that will sell out quick and I will not be around to click refresh one hundred times to try and buy it. I figured it would be a cool project to make a script that buys it for me.
Anyway my first question is, is this possible? Secondly, what would be the best way to solve this problem? I was going to use PHP/Javascript/Jquery. Will this even work/be allowed. Also if anyone has any other information that might help me out that would be great. Thanks.

Not going to happen... The only way I think you can accomplish this, for yourself, is by inserting your code with FireBug (or the like) on a per-use basis, or perhaps in a GreaseMonkey configuration... but it's not something that you could publish so that others would get the same functionality just by going to your page.

In Firefox, you can create a bookmark that runs JavaScript (instead of navigating to another page). So, now you can inject any javascript into your own page.
With this info, you can load jQuery from another domain along with any other scripts and automate whatever you like.
This only works for you, the person with the special bookmark, but you can hand the bookmark to others for their use.

Related

Getting a discussion forum /query support on my website

I want to have a forum like thing on my website.I dont want any complicated thing, just the user must be able to post questions and the administrator(that is me) can answer them..(It would be nice if it has tree like structure but even without that it is fine) ..All the users can read the questions on the forum anytime(obvious) ..I dont want to put phpbb3 or any such readymade tool..I just want to be it simple (something like this scroll to the bottom) ..How to get this thing done..If possible in php please tell that..Otherwise tell other options..Please help me out..
You could probably do something like this in WordPress. (Your local webserver would need to be running MySQL as well as PHP to achieve this.) At the simplest level you could set up a page and allow user comments on it.
A really simple way is just to have a basic form with text-input, textarea, and submit button. Then have the person input their name, question, and submit it. Make sure you validate the form with js and/or php. Then update a password protected page that only you can access with the name and question. Then using whatever cms you have for this page (or just static html if you have the patience) you can just update the front page with the new question and answer above the form.
The best way, though, is going to be some kind of "readymade" system that you tweak...

Save URL of AJAX loaded page, so it can be loaded after a refresh

We have an application writted in PHP. Its main view is for example: /pages/index.
Now when the user clicks on certain links, it pulls in other Views via ajax. ie. a call may look like /pages/publish, so the PHP outputs the relevant html for the publish section back to the index view.
The problem we have is we'd like to be able to give the user the option of refreshing and seeing the same view as before. So, my initial thought is this, when we use .load() in jQuery, to take the URL its going to load and store it somewhere to be read by the PHP if the user refreshes. Is the best way to do or can someone think of a better way to do this whole thing?
Check out jQuery.address which should solve your problems! It allows AJAX loading of new pages, and will update the address bar accordingly. If a user saves this URL and reloads it, the script on the page can then load the correct page.
Alternatively, if you're HTML5-only, then you can try history.pushState() which will modify the URL without using the hash symbol, but support isn't 100% yet. (I don't think... it certainly behaves oddly on iPad from my experience.)

Help - use PHP-broswer, or proxy or get_page_contents or include page, or something else?

I am trying to develop a web application for which I need to capture a specific user-driven event (such as mouse dblclick) occurring on a different-website page loaded through my website.
What I want to do is :
User visits my website - hosted by me.
There, user types in any website URL (e.g.: http://www.example.com)
That URL page gets loaded as is.
When user double-clicks mouse over any link or image from that page, a popup/side-panel is displayed with content related to that particular image or link.
I can do this with a combination of PHP get_page_contents or include-page, and javascript dblclick.
However, when user clicks on any link or submits a form, the control goes to that other website, where I cannot show the side-panel.
I might be able to handle the links by proxifying them when user clicks on any of them. How do I handle forms submission and other stuff ?
I can use a full-featured proxy, but that will be too heavy just for the purpose of capturing the event.
My question is that is there a way to write some kind of light PHP script that sits on my website - that loads other websites contents as is, but lets me capture the mouse-dblclick event to show related-content in the side panel .
I have already searched the internet, but could not find anything.
Any help is really appreciated. Thanks.
This sounds way too complicated to ever get reliably working IMO. Proxifying complex requests on 3rd-party pages? Maybe even with some additional AJAX that you'd have to proxify too? I may be wrong, but I think you'll go crazy and get swamped with complaints about sites not working.
I don't know what your web application is supposed to do but I would strongly consider building a Firefox extension (that has much more rights to access and do things on 3rd party sites) or similar.

problem with ajax( page refresh)

hi im using ajax to extract all the pages into the main page but am not being able to control the refresh , if somebody refreshes the page returns back to the main page can anybody give me any solutions , i would really appreciate the help...
you could add anchor (#something) to your URL and change it to something you can decode to some particular page state on every ajax event.
then in body.onload check the anchor and decode it to some state.
back button (at least in firefox) will be working alright too. if you want back button to work in ie6, you should add some iframe magic.
check various javascript libraries designed to support back button or history in ajax environment - this is probably what you really need. for example, jQuery history plugin
You can rewrite the current url so it gives pointers to where the user was - see Facebook for examples of this.
I always store the 'current' state in PHP session.
So, user can refresh at any time and page will still be the same.
if somebody refreshes the page returns back to the main page can anybody give me any solutions
This is a feature, not a bug in the browser. You need to change the URL for different pages. Nothing is worse then websites that use any kind of magic either on the client side or the server side which causes a bunch of completely different pages to use the same URL. Why? How the heck am I gonna link to a specific page? What if I like something and want to copy & paste the URL into an IM window?
In other words, consider the use cases. What constitutes a "page"? For example, if you have a website for stock quotes--should each stock have a unique URL? Yes. Should you have a unique URL for every variation you can make to the graph (i.e. logarithmic vs linear, etc)? Depends--if you dont, at least provide a "share this" like google maps does so you can have some kind of URL that you can share.
That all said, I agree with the suggestion to mess with the #anchor and parse it out. Probably the most elegant solution.

Opening Javascript based popup ads on the same page

I own an image hosting site and would like to generate one popup per visitor per day. The easiest way for me to do this was to write a php script that called subdomains, like ads1.sitename.com
ads2.sitename.com
unfortunatly most of my advertisers want to give me a block of javascript code to use rather than a direct link, so I can't just make the individual subdomains header redirects.I'd rather use the subdomains that way I can manage multiple advertisers without changing any code on page, just code in my php admin page. Any ideas on how I can stick this jscript into the page so I don't need to worry about a blank ads1.sitename.com as well as the popup coming up?
I doubt you'll find much sympathy for help with pop-up ads.
How about appending a simple window.close() after the advertising code? That way their popup is displayed and your window closes neatly.
I'm not sure that I've ever had a browser complain that the window is being closed. This method has always worked for me. (IE, Firefox, etc.)
At the risk of helping someone who wants to deploy popup ads (which is bound to fail due to most popup blockers anyway), why can't you just have the subdomains load pages that load the block of Javascript the advertisers give you?
Hey, cut the guy some slack. Popups might not be very nice, but at least he's trying to reduce the amount of them. And popup blockers are going to fix most of it anyway. In any case, someone else might find this question with more altruistic goals (not sure how they'd fit that with popups, but hey-ho).
I don't quite follow your question, but here's some ideas:
Look into Server Side Includes (SSI) to easily add a block of javascript to each page (though you could also do it with a PHP include instead)
Do your advertiser choosing in your PHP script rather than calling the subdomains
Decipher the javascript to work out what it's doing and put a modified version in the subdomain page so it doesn't need an additional popup. Shouldn't be too hard.

Categories