• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem

 
John Doyle
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one help, can you tell me what s1 and s2 are in the folling;

Thanks
RR- Edited to insert code tags
[ October 20, 2003: Message edited by: Rob Ross ]
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Slightly simplified version of your code:

So, "what are s1 and s2?" As in "what are their values?" or "What is their purpose?" The String s1 is checked against some other value, and if they're the same, then it's encoded using the weak Base64 encoding, and then used as the filename part of a URL to fetch.
Do you need more than that?
 
DUde Love
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am guessing he was asking what are the values. I am beginging coding class at UIC in urbana(which is where he got this from) and we were told if we get the correct url we would get extra credit.. im trying to figure it out myself.... its been standing for 3 years with one being successful

here is the one that was given to us

public void actionPerformed(ActionEvent actionevent)
{
String s = code.getText();
try
{
URL url = new URL("http://asite.com/afile.php");
URLConnection urlconnection = url.openConnection();
String s1 = urlconnection.getHeaderField("Training-code");
if(s.equals(s1))
{
String s2 = Base64.encodeString(s1);
code.setText(s2 + ".php");
answer.setText("Go to: " + s2 + ".php");
} else
{
answer.setText("Incorrect");
}
}
catch(Exception exception)
{
showStatus("An error occured, please report this to the admins");
}
}
 
DUde Love
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bump Up
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, first off, please have a look at the JavaRanch policy on display names. Your display name must be a real first and last name. You can change yours here.

Second, the values of s1 and s2 depend on what's typed into the "code" textfield, and of course also on the real URL of the site in question. But if you type in the right code, you get an answer. So I don't understand the question here. Run the program with the right URL, type in the code, and you're all set. We can't answer the problem without all the information.

Now, it may be that the problem is to figure out what the "code" is, so you can type it in. And of course that has nothing to do with this little program, which basically just confirms that your code is correct. Perhaps you need to go back and look at the original problem, and see where the code is supposed to come from.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic