Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > help me with a program

Reply
Thread Tools

help me with a program

 
 
boris
Guest
Posts: n/a
 
      07-26-2007
How to create a java program to validate date and email id entered.I
think an algorithm will also do just fine. I am still learning java
please help.

 
Reply With Quote
 
 
 
 
Daniel Pitts
Guest
Posts: n/a
 
      07-26-2007
On Jul 26, 7:09 am, boris <(E-Mail Removed)> wrote:
> How to create a java program to validate date and email id entered.I
> think an algorithm will also do just fine. I am still learning java
> please help.


First, you should give a better subject line when posting here. "Help
with Date and Email validation" would have been better. And simply
"Date and Email validation" would have been even better.

Back to your question:
regex (java.util.Pattern) to "help" validate these, but in general, e-
mail addresses can only be validated by sending a message with a
"secret" to that address, and having the recipient inform your system
of the secret.

I once spent some time creating a regex that validates the syntax of
an e-mail address, but it really was pointless after all.

As for the date, you could also probably use SimpleDateFormat class to
try to parse the date.

 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      07-26-2007
On Thu, 26 Jul 2007 07:09:20 -0700, boris <(E-Mail Removed)> wrote,
quoted or indirectly quoted someone who said :

>How to create a java program to validate date and email id entered.I
>think an algorithm will also do just fine. I am still learning java
>please help.


for a very elaborate algorithm to validate email address, look at the
code posted at http://mindprod.com/products1.html#BULK

For code to parse a date, and in the process validate it, see
http://mindprod.com/jgloss/calendar.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
Twisted
Guest
Posts: n/a
 
      07-27-2007
On Jul 26, 11:19 am, Roedy Green <(E-Mail Removed)>
wrote:
> for a very elaborate algorithm to validate email address, look at the
> code posted athttp://mindprod.com/products1.html#BULK


YOUR WEB SERVER HAS BEEN HACKED. TAKE IT OFFLINE AND FIX THE SECURITY
HOLE AND THE ALTERED CONTENT ASAP.

This is not a drill. The URL above, which I trust you intended to be
simply informative, instead completely wedges Firefox and probably is
trying to do something that would have much nastier consequences in
the presence of Internet Exploder. This indicates that your webhost
was compromised and the file contents altered (probably adding a 1x1
iframe linking to an evil script hosted somewhere else entirely;
that's what these jokers usually do) to try to exploit browser bugs
and do something malicious like install spyware on visitors'
computers.

If you can patch the server's security yourself do so. If not, change
hosting provider to someone other than Dreamhost (a guess but likely
correct; there's been a lot of discussion in certain circles of their
recent repeated major security breaches, adding exactly these sorts of
malicious but subtle changes to honest web pages) and from your
current provider (if different). Then fix or restore all the altered
files (restoring every single file from a known-good backup is safest
but may lose recent changes) and put the site back on the air.

If you do change host, do be sure to tell them exactly, in
excruciating detail, why you are doing so as well. Maybe they'll
eventually shape up if they get enough such negative feedback. If you
host yourself and can't find out how the attack was done and how to
prevent it happening again, you probably want to change server
software (if it's IIS then for Christ's sake change it NOW!) and you
may want to change to professional hosting that knows what they're
doing security-wise (i.e. not Dreamhost!) ...

I hope this has been caught and gets fixed before anyone has genuinely
been burned. Otherwise your excellent Java site's reputation is
probably irretrievably in the toilet.

 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      07-27-2007
Twisted wrote:
> On Jul 26, 11:19 am, Roedy Green <(E-Mail Removed)>
> wrote:
>> for a very elaborate algorithm to validate email address, look at the
>> code posted athttp://mindprod.com/products1.html#BULK

>
> YOUR WEB SERVER HAS BEEN HACKED. TAKE IT OFFLINE AND FIX THE SECURITY
> HOLE AND THE ALTERED CONTENT ASAP.
>
> This is not a drill. The URL above, which I trust you intended to be
> simply informative, instead completely wedges Firefox and probably is
> trying to do something that would have much nastier consequences in
> the presence of Internet Exploder. This indicates that your webhost
> was compromised and the file contents altered (probably adding a 1x1
> iframe linking to an evil script hosted somewhere else entirely;
> that's what these jokers usually do) to try to exploit browser bugs
> and do something malicious like install spyware on visitors'
> computers.


Works fine for me. Firefox, even. No difficulties whatsoever.

--
Lew
 
Reply With Quote
 
Twisted
Guest
Posts: n/a
 
      07-27-2007
On Jul 27, 7:48 am, Lew <(E-Mail Removed)> wrote:
> Works fine for me. Firefox, even. No difficulties whatsoever.


So he fixed it in at most an hour -- good. Still alarming that this
happened. I've run into malicious iframes myself once or twice before
but without such a drastic consequence. This time, click a link and
boom! Dead browser, ctrl-alt-del end-task, and God knows what the
buggy page content was trying to do probably under the faulty
assumption that the user-agent was IE.


 
Reply With Quote
 
Christopher Benson-Manica
Guest
Posts: n/a
 
      07-27-2007
Lew <(E-Mail Removed)> wrote:

> Twisted wrote:


> > On Jul 26, 11:19 am, Roedy Green <(E-Mail Removed)>
> > wrote:
> >> http://mindprod.com/products1.html#BULK


> > This is not a drill. The URL above, which I trust you intended to be
> > simply informative, instead completely wedges Firefox


What, just because a page toasts Firefox it's indicative of some kind
of security flaw? *shrug* Firefox may not be M$ crap, but it's got
bugs. If it's tripping your antivirus, of course, that's a different
story. Looking at the page source, however, I see no <iframe> tags at
all, nor any particularly unsavory-looking script, nor does Firefox so
much as blink. I would not be so quick to don the tin-foil hat in the
absence of more convincing evidence.

--
C. Benson Manica | I appreciate all corrections, polite or otherwise.
cbmanica(at)gmail.com |
----------------------| I do not currently read any posts posted through
sdf.lonestar.org | Google groups, due to rampant unchecked spam.
 
Reply With Quote
 
Twisted
Guest
Posts: n/a
 
      07-28-2007
On Jul 27, 5:02 pm, Christopher Benson-Manica
<(E-Mail Removed)> wrote:
> Lew <(E-Mail Removed)> wrote:
> > Twisted wrote:
> > > On Jul 26, 11:19 am, Roedy Green <(E-Mail Removed)>
> > > wrote:
> > >>http://mindprod.com/products1.html#BULK
> > > This is not a drill. The URL above, which I trust you intended to be
> > > simply informative, instead completely wedges Firefox

>
> What, just because a page toasts Firefox it's indicative of some kind
> of security flaw?


That's a denial-of-service attack, even assuming it wasn't an attempt
at something worse.

> *shrug* Firefox may not be M$ crap, but it's got bugs.


Evidently. And trying to exploit them, as the defaced site code
evidently did, is still an attack even if they aren't M$ bugs.

Most likely the evil script someone snuck in there tried to do
something that would have compromised a sufficiently out of date IE
and, being malformed in some way in order to exploit that bug, also
tripped a less severe bug in Firefox.

> Looking at the page source, however, I see no <iframe> tags at
> all, nor any particularly unsavory-looking script, nor does Firefox so
> much as blink.


That's because it was fixed (indeed, within 1 hour of my reporting
it). Nonetheless that page did crash Firefox and no longer does,
meaning something on that page changed. I find it highly unlikely that
someone of Roedy's reputation constructed the page to crash Firefox in
the first place, which suggests it actually changed to do so and then
changed BACK. The first change would be a defacement perpetrated by
someone else not authorized by Roedy to alter his Web site's code and
the second would be Roedy undoing the damage after receiving a heads-
up.

Unless you have an alternative theory to explain it? (Other than that
I'm simply making this up, a theory that I know to be false even if I
can't prove it to anyone else -- since the browser hung as soon as it
tried to load the page I had no way of getting a look at the page
source until it was fixed, whereupon obviously there'd be nothing
relevant to see in said source anymore, so I don't have and could
never have had a copy of the source with the malicious edit still
intact. And I was sure as *hell* not going to try to access it in IE
to get a look at the source! Maybe I should have tried viewing it in
FF with JS disabled but it didn't occur to me until it was too late
and the page had been fixed.)

 
Reply With Quote
 
RedGrittyBrick
Guest
Posts: n/a
 
      07-28-2007
Twisted wrote:
> since the browser hung as soon as it tried to load the page I had no
> way of getting a look at the page source until it was fixed,


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;

public class Wget {
public static void main(String[] args) throws Exception {
URL url = new URL("http://mindprod.com/products1.html#BULK");
URLConnection connection = url.openConnection();
HttpURLConnection httpConn = (HttpURLConnection) connection;
InputStreamReader isr =
new InputStreamReader(httpConn.getInputStream());
BufferedReader in = new BufferedReader(isr);
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}
 
Reply With Quote
 
blmblm@myrealbox.com
Guest
Posts: n/a
 
      08-04-2007
In article <(E-Mail Removed)>,
Lew <(E-Mail Removed)> wrote:
> Twisted wrote:
> > On Jul 26, 11:19 am, Roedy Green <(E-Mail Removed)>
> > wrote:
> >> for a very elaborate algorithm to validate email address, look at the
> >> code posted athttp://mindprod.com/products1.html#BULK

> >
> > YOUR WEB SERVER HAS BEEN HACKED. TAKE IT OFFLINE AND FIX THE SECURITY
> > HOLE AND THE ALTERED CONTENT ASAP.
> >
> > This is not a drill. The URL above, which I trust you intended to be
> > simply informative, instead completely wedges Firefox and probably is
> > trying to do something that would have much nastier consequences in
> > the presence of Internet Exploder. This indicates that your webhost
> > was compromised and the file contents altered (probably adding a 1x1
> > iframe linking to an evil script hosted somewhere else entirely;
> > that's what these jokers usually do) to try to exploit browser bugs
> > and do something malicious like install spyware on visitors'
> > computers.

>
> Works fine for me. Firefox, even. No difficulties whatsoever.
>


Was there ever any public confirmation that the above-mentioned
Web page was maliciously changed, and then fixed? As the revised
subject line indicates, I'm mildly curious ....

--
B. L. Massingill
ObDisclaimer: I don't speak for my employers; they return the favor.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help! Can't identify program that resullts in Win 7 on starting to display a message re opening mystery "Program" Seagull NZ Computing 4 12-27-2011 03:46 AM
Looking for a module/program author, or help with program... Kris Stark Perl Misc 1 09-08-2005 01:47 AM
Help !I want to write a program to count the running time of another program freehomesp@yahoo.com.cn C Programming 1 08-12-2005 06:13 AM
Calling Java program in another Java program Rey Java 4 12-12-2003 10:18 PM
passing data between Java program and C program--help pipi Java 1 07-21-2003 05:02 AM



Advertisments