...

View Full Version : I need help piecing this code together



elitis
12-27-2010, 07:24 PM
So I found this script that alerts the links of buttons on a site I use:
javascript:

array=document.getElementsByTagName('a');
for (x in array){

if (array[x].getAttribute('class')=="clickthru-link"){

alert(array[x].href);
}
}
void(0);


Then I also found that you have to edit the script. This is what your suppose to do:


At the beginning of code:

document.body.innerHTML+='<textbox id="sd"> </textbox>';
and instead of alert:

document.getElementById('sd').value+= the href thing + "\n"


The problem is I can't get it to work. I might be editing the code in the wrong places but I'm not sure.

Old Pedant
12-27-2010, 07:42 PM
This makes no sense:


document.body.innerHTML+='<textbox id="sd"> </textbox>';

(1) There is no such tag in HTML as <textbox>

(2) If you meant <textarea>, then you should be adding the textarea to a <form>, in the proper place in the form, not just appending it to the end of the document.body.

Maybe you need to show the actual page/code, not just an illegal fragment of it.

elitis
12-27-2010, 07:51 PM
This makes no sense:


document.body.innerHTML+='<textbox id="sd"> </textbox>';

(1) There is no such tag in HTML as <textbox>

(2) If you meant <textarea>, then you should be adding the textarea to a <form>, in the proper place in the form, not just appending it to the end of the document.body.

Maybe you need to show the actual page/code, not just an illegal fragment of it.

This actually is the whole code.

Old Pedant
12-27-2010, 07:58 PM
Well, there's still no such thing as <textbox>.

But if this really is the entire code for the page, then there's no problem: Since there aren't any <a> tags in what you showed, your code that does getElementsByTagName("a") will never find any, and so there will never be anything to report. So you don't need any of this code.

[In other words, I don't think I believe that this is *really* the "whole code".]

Old Pedant
12-27-2010, 07:59 PM
If this is a homework assignment, maybe you need to go read the entire assignment again.

If it's not homework, then maybe you could show us the actual web page you are trying to work with??

elitis
12-27-2010, 10:48 PM
as I said the script finds the links of buttons and displays them in an alert.One after another. This link is an example of one the script would display
<a href="/clickthrough/click/LDOsynZQAs6NNKrsOJcrqHcWQaQ_Iq2o5XzxYdLzv5EeZZz52RWSPg..">

as for showing you the page. The site requires you to be a member to see any content. But luckily I have 2 accounts.

1) Go to http://www.lockerz.com/profile/14225424
2) Login with email as 'e.holloway01@yahoo.com' and password as 'hellboy98'
3) It will redirect you to that page after login.
4) Enter the script into the address bar on that page so you can see exactly what it does.

Old Pedant
12-27-2010, 10:58 PM
I believe you about that. But you still aren't addressing the other problems. Such as the fact that there's no such thing as <textbox>

You say you don't want the list to appear via an alert() any more. Fine. So where *DO* you want it to appear???? In a <form> field? If so, where's the <form>? In a <div>?? If so, where on the page should the <div> appear?

elitis
12-27-2010, 11:14 PM
I believe you about that. But you still aren't addressing the other problems. Such as the fact that there's no such thing as <textbox>

You say you don't want the list to appear via an alert() any more. Fine. So where *DO* you want it to appear???? In a <form> field? If so, where's the <form>? In a <div>?? If so, where on the page should the <div> appear?

Ok, so when I use document.write instead of alert() it displays the link on the same page but only the first link. What I want it to do is display all the links on the page or go to the next link on a refresh.

Old Pedant
12-27-2010, 11:31 PM
You can't use document.write after the page is created. It will WIPE OUT the existing page and replace it with ONLY what the document.write does. SO that explains that part.

But what I don't get is why you want to display all the links as URLs??? I mean, they are already all there on the page a <a> tags, no?

And as for going to "the next link on a refresh": Huh? What's your definition of "next link"? And what constitutes a refresh? The user hitting the F5 key or some JavaScript function that reloads the page or???

elitis
12-27-2010, 11:42 PM
You can't use document.write after the page is created. It will WIPE OUT the existing page and replace it with ONLY what the document.write does. SO that explains that part.

But what I don't get is why you want to display all the links as URLs??? I mean, they are already all there on the page a <a> tags, no?

And as for going to "the next link on a refresh": Huh? What's your definition of "next link"? And what constitutes a refresh? The user hitting the F5 key or some JavaScript function that reloads the page or???

This will all be much easier if you login to the site so you can see everything I'm telling you for yourself. The links are all hidden and can only be found in the source code. I want document.write to wipe out the page and replace it with only what it does. As for going to the next link on a refresh. It really doesn't matter whether the refresh is made through a javascript function or through F5. I'll put it like this ANY time a refresh is made, I want it to display the next link.

Or like I said if theres a way to get it to display all the links after replacing the page with what document.write does that would be good as well.

Old Pedant
12-27-2010, 11:59 PM
Okay, now I see what you are trying to do.

Sorry, I won't help you. It's unethical and quite possibly illegal, in that it likely violates the terms of the user agreement you almost surely had to sign.

Maybe somebody else won't have my same scruples.

elitis
12-28-2010, 08:33 PM
Okay, now I see what you are trying to do.

Sorry, I won't help you. It's unethical and quite possibly illegal, in that it likely violates the terms of the user agreement you almost surely had to sign.

Maybe somebody else won't have my same scruples.

how is it illegal to make a script that gets the links of buttons?

Old Pedant
12-28-2010, 09:32 PM
Oh, come on.

That's a site that (supposedly) pays you for reading advertisements. Obviously, they expect that if you read enough ads you'll eventually find something you will buy, so they get money from the advertiser and they share (a tiny bit of it, I'll bet) with you.

But if you don't actually *read* the ads--if you use an automated script such as you want us to give you to skip through the ads as fast as possible--then of course there is no hope that you will buy anything, and so your use of their site is worthless to them.

I am dead sure that when you signed up for this "service" you agreed to terms that, among other things, specified that you can't use an automated system to bypass the reading of the ads. By doing what you want to do, you are violating the terms of that agreement.

Now, I'll grant you that the only penalties that anyone could impose on you are surely simply a loss of the benefits you would get if you did this legitimately. But technically what you are doing is fraud, and that is illegal. The fact that there's virtually no chance that you will be prosecuted for it doesn't make it less illegal.

Part of me wants to help you, since I think all these surf-for-pay sites are themselves immoral and should be shut down. They surely are taking advantage of idiots who will end up spending more than they will ever "earn". But like them or not, they are legal. What you want to do is not. Unless you can prove to me that there is nothing in their agreement that says you can't do what you want to do.

[And in any case, if you really wanted to do this "right", you wouldn't do it from JavaScript. You'd use PHP or some other server-side system.]

elitis
12-28-2010, 10:38 PM
Oh, come on.

That's a site that (supposedly) pays you for reading advertisements. Obviously, they expect that if you read enough ads you'll eventually find something you will buy, so they get money from the advertiser and they share (a tiny bit of it, I'll bet) with you.

But if you don't actually *read* the ads--if you use an automated script such as you want us to give you to skip through the ads as fast as possible--then of course there is no hope that you will buy anything, and so your use of their site is worthless to them.

I am dead sure that when you signed up for this "service" you agreed to terms that, among other things, specified that you can't use an automated system to bypass the reading of the ads. By doing what you want to do, you are violating the terms of that agreement.

Now, I'll grant you that the only penalties that anyone could impose on you are surely simply a loss of the benefits you would get if you did this legitimately. But technically what you are doing is fraud, and that is illegal. The fact that there's virtually no chance that you will be prosecuted for it doesn't make it less illegal.

Part of me wants to help you, since I think all these surf-for-pay sites are themselves immoral and should be shut down. They surely are taking advantage of idiots who will end up spending more than they will ever "earn". But like them or not, they are legal. What you want to do is not. Unless you can prove to me that there is nothing in their agreement that says you can't do what you want to do.

[And in any case, if you really wanted to do this "right", you wouldn't do it from JavaScript. You'd use PHP or some other server-side system.]

reading ads? where do you see this? lockerz is a gpt (get paid to) site yes, but has nothing to do with reading ads. When you click the buttons (decalz) you earn points. What I'm trying to do is get the decalz links. Now tell me how that is fraud.

Old Pedant
12-28-2010, 10:55 PM
Excerpts from the terms that YOU agreed to when YOU signed up.
The page is http://www.lockerz.com/terms



Prohibited Activities You or anyone acting on your behalf or for your benefit may not create or use multiple, fake or temporary e–mail accounts, messages or related means, including, without limitation, creating or using websites or programs specifically designed to solicit information from individuals for purposes of inviting members, hacking into our system or creating or using programs to specifically circumvent proper and authorized use of our Website and its functionality for any purpose in conjunction with sending invites, earning PTZ or otherwise utilizing Website functionality and features. ... You may not abuse, manipulate, or engage in any activity related to Lockerz’ policies, practices or offerings to wrongfully earn or acquire PTZ, goods or services of any kind through Lockerz. ... You may not use, promote, or enable others to use or promote any device, software or routine that is intended to or likely to damage or interfere with the proper working of the Website or involves the use of deception, false information, fraud, manipulation, avoidance, or cheating of any kind, including, without limitation, creating or utilizing programs, scripts, bots, or any method to mimic or fake actual user activity on the Website, ...


I rest my case.

Philip M
12-29-2010, 07:31 AM
But luckily I have 2 accounts.


Sounds as though that is contrary to the TOS as well. "You or anyone acting on your behalf or for your benefit may not create or use multiple, fake or temporary e–mail accounts"



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum