Simpledateformat...not so simple

The Simple Date Format has some weird behavior. I'm trying to test whether a date is in the future, and I initially used a 2 digit year.
SimpleDateFormat sdf = new SimpleDateFormat("ddMMyy");
sdf.setLenient(false);
String inputDate = sdf.format(date);
Date formattedInputDate = sdf.parse(inputDate); The reason for formatting the input date and then parsing it is to basically ignore the hour,minute,second. There are probably other ways to do it.
Anyway, what's really bizarre, is that apparently there is some weird algorithm in the parse method for determining what the 1st 2 digits are.
For example, if the year is 89 it gets translated to 1989. 05 gets translated to 2005. OK, that seems to make sense. But how about this
1)Anything from 00 to <current date>2026 gets translated to the years 2000-2026.
2)Anything after the current date, 20 years from today gets translated to 19xx! So 061026 gets translated to Oct 6, 2026 (a future date), whereas 071026 gets translated to Oct 7, 1926 (a past date)
Ok, I got around this with a 4 digit year, but BIZARRE behavior, huh?

The Simple Date Format has some weird behavior. I'm
trying to test whether a date is in the future, and I
initially used a 2 digit year.
SimpleDateFormat sdf = new
SimpleDateFormat("ddMMyy");
sdf.setLenient(false);
String inputDate = sdf.format(date);
Date formattedInputDate = sdf.parse(inputDate); The reason for formatting the input date and then
parsing it is to basically ignore the
hour,minute,second. There are probably other ways to
do it.
Anyway, what's really bizarre, is that apparently
there is some weird algorithm in the parse method for
determining what the 1st 2 digits are.
For example, if the year is 89 it gets translated
to 1989. 05 gets translated to 2005. OK, that seems
to make sense. But how about this
)Anything from 00 to <current date>2026 gets
translated to the years 2000-2026.
2)Anything after the current date, 20 years from
today gets translated to 19xx! So 061026 gets
translated to Oct 6, 2026 (a future date), whereas
071026 gets translated to Oct 7, 1926 (a past date)
Ok, I got around this with a 4 digit year, but
BIZARRE behavior, huh?Actually, this behavior is documented in the Java api for SimpleDateFormat:
http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html
Pattern letters are usually repeated, as their number determines the exact presentation:
* Year: For formatting, if the number of pattern letters is 2, the year is truncated to 2 digits; otherwise it is interpreted as a number.
For parsing, if the number of pattern letters is more than 2, the year is interpreted literally, regardless of the number of digits. So using the pattern "MM/dd/yyyy", "01/11/12" parses to Jan 11, 12 A.D.
For parsing with the abbreviated year pattern ("y" or "yy"), SimpleDateFormat must interpret the abbreviated year relative to some century. It does this by adjusting dates to be within 80 years before and 20 years after the time the SimpleDateFormat instance is created. For example, using a pattern of "MM/dd/yy" and a SimpleDateFormat instance created on Jan 1, 1997, the string "01/11/12" would be interpreted as Jan 11, 2012 while the string "05/04/64" would be interpreted as May 4, 1964. During parsing, only strings consisting of exactly two digits, as defined by Character.isDigit(char), will be parsed into the default century. Any other numeric string, such as a one digit string, a three or more digit string, or a two digit string that isn't all digits (for example, "-1"), is interpreted literally. So "01/02/3" or "01/02/003" are parsed, using the same pattern, as Jan 2, 3 AD. Likewise, "01/02/-3" is parsed as Jan 2, 4 BC.
"

Similar Messages

  • SimpleDateFormat not that simple

    I have a time represented in an int as a number of seconds from midnight and wish to display it in the form "hh:mm:ss" (e.g. "09:15:00") What is the easiest way to do this please? Assume there is no crossing of midnight.
    After little success with String.format I tried the following
    SimpleDateFormat hhmmss = new SimpleDateFormat("HH:mm:ss");
                lblETA.setText(hhmmss.format(2000));and it displayed "01:00:02". Seems to have added on an hour somehow. I don't want it to be concerned with time zones, but all experiments I have tried so far have not given me the desired result. In any case we are in winter here (UK) and there is no daylight saving now. Yet TimeZone.getDefault() gives a GMT offset of 1 hour.

    rps774 wrote:
    Thank for the answers.
    There are many classes and methods for processing and formatting dates and times but whatever I try it seems to treat the Epoch as 01:00:00 on Jan 1 1970, not 00:00:00 Jan 1 1970 as one would expect and as the documentation says.
    For example
    Calendar c = Calendar.getInstance();
    c.setTimeInMillis(0);
    String.format("%tc", c)  // Gives "Thu Jan 01 01:00:00 GMT 1970" Where does the unwanted 1 hour come from, and how can it be avoided?Probably Daylight Saving Time which is one reason not to use SimpleDateFormat for this task (also Leap Seconds and Leap Years).
    >
    All I want to do is to hold a time as a number of seconds and to format it as hh:mm:ss. Certainly this can be hand-coded but I am surprised there is nothing amongst the plethora of Java methods that does the job for me.Then use something like -
        static String format(int seconds)
            return String.format("%02d:%02d:%02d", seconds / 3600, (seconds % 3600) / 60, seconds % 60);
        but if you just want to fix your 'brittle' SimpleDateFormat approach then use -
        static final SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
        static
            formatter.setTimeZone(TimeZone.getTimeZone("UTC"));
        static String format(int seconds)
            return formatter.format( new Date(1000L * seconds));
        Edited by: sabre150 on Nov 26, 2007 4:42 PM

  • Simple PL/SQL Report - Using Break on and Compute Sum - Not So Simple

    Good morning, All:
    I have a simple pl/sql report that is not so simple. Basic on the code below, would like to add a blank line/row after the resulting "sum" row to make it easier to read. Any and all help would be appreciated.
    Thank you.
    Preston@Large
    Code:
    =======================
    BREAK ON ALM_OG_CAMPAIGN_CODE
    COMPUTE SUM OF ALM_OG_AMOUNT ON ALM_OG_CAMPAIGN_CODE
    set linesize 1024
    set pagesize 60
    set newpage 0
    set serveroutput on
    SPOOL &so_outfile;
    ttitle center 'Wayne State University' skip 1 Left 'WSU Online Giving Essentials Report' skip 2
    select TO_CHAR(sysdate, 'mm/dd/yyyy hh:mm AM') "Report Date" from dual;
    CLEAR COLUMNS
    column ALM_OG_ACCI_CODE heading "ACCI|CODE" format a10
    column ALM_OG_AMOUNT heading "AMOUNT|DONATED" format $999,999,999.99
    column ALM_OG_CAMPAIGN_CODE heading "CAMPAIGN|CODE" format a14
    select
    ALM_OG_CAMPAIGN_CODE,
    ALM_OG_ACCI_CODE,
    ALM_OG_AMOUNT
    From WSUALUMNI.WSU_ONLINE_GIVING_TABLE
    ORDER BY ALM_OG_CAMPAIGN_CODE;
    CLEAR COLUMNS
    spool off
    Output:
    WSU Online Giving Essentials Report
    Report Date
    ======================
    06/05/2009 10:06 AM
    1 row selected.
    Wayne State University
    WSU Online Giving Essentials Report
    CAMPAIGN ACCI AMOUNT
    CODE CODE DONATED
    ====== ======== ==========
    sum $560.00
    NUR 444814 $10.00
    ***** =======
    sum $10.00
    PHS 445216 $10.00
    ***** =======
    sum $10.00
    PRES 445211 $450.00
    445211 $60.00
    445211 $250.00
    ***** =======
    sum $760.00
    SBA 444216 $10.00
    ***** =======
    sum $10.00
    SSW 444469 $10.00
    ***** =======
    sum $10.00

    Prestone,
    Welcome to the Forum!
    I have used skip 2 lines you can use 1
    SQL> break on job report skip 2
    SQL> compute sum of sal on job report
    SQL> select job , sal from emp order by job ;
    JOB              SAL
    ANALYST         3000
                    3000
    sum             6000
    CLERK           1300
                     950
                     800
                    1100
    sum             4150
    MANAGER         2850
                    2975
                    2450
    sum             8275
    PRESIDENT       5000
    sum             5000
    SALESMAN        1500
                    1250
                    1250
                    1600
    sum             5600
    14 rows selected.READ
    Quick SQL*Plus Guide
    http://download.oracle.com/docs/cd/B14117_01/server.101/b12171/toc.htm
    SQL*Plus Reference
    http://download.oracle.com/docs/cd/B14117_01/server.101/b12170/toc.htm
    SS

  • Composite key field is not a simple type or enum

    According to the docs here - http://www.oracle.com/technology/documentation/berkeley-db/je/java/index.html?com/sleepycat/persist/model/PrimaryKey.html - you can use "A composite key class containing one or more simple type or enum fields" as a key field. When we try that we get "java.lang.IllegalArgumentException: Composite key field is not a simple type or enum: Result$Key.recordId". Am I misreading the docs?
    Thanks,
    Trevor
    @Persistent
    public final class RecordKey {
    @KeyField(1)
    private final String name;
    @KeyField(2)
    private final int duplicateNumber;
    RecordKey(final String name, final int duplicateNumber) {
    this.name = name;
    this.duplicateNumber = duplicateNumber;
    RecordKey() {
    this.name = null;
    this.duplicateNumber = -1;
    @Persistent
    static final class Key {
    @KeyField(1)
    private final RecordKey recordId;
    @KeyField(2)
    private final String key;
    Key(final RecordKey recordId, final String key) {
    this.recordId = recordId;
    this.key = key;
    Key() {
    this.recordId = null;
    this.key = null;
    }

    Hi Trevor,
    You're nesting one key class inside another. All fields of a key class must be simple types or enums, which is what the exception message is trying to say. If you want all those fields in your key class, you'll have to include them in a single flattened class.
    Neither nesting of key classes nor inheritance of key classes is supported. We have enhancements filed to support these in the future, but no concrete plans.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Did not know simple things such as removing hyphen from phone numbers will be so complicated. How do i remove the hyphen from stored phone numbers since i am not able to make a phone call using VOIP. Everytime i make a phone call i have to type the number

    Did not know simple things such as removing hyphen from phone numbers will be so complicated. How do i remove the hyphen from stored phone numbers since i am not able to make a phone call using MobileVOIP. Everytime i make a phone call i have to type the number.

    Go into your contacts and edit them.

  • Extend the EPM install to a new EOI and remove the old EOI's (server decommissioning). EPM version 11.1.2.1 and having essbase and planning; I understand removing EOI's is not as simple as 11.1.2.3 but any suggestion/steps would be of great help.

    Extend the EPM install to a new EOI and remove the old EOI's (server decommissioning). EPM version 11.1.2.1 and having essbase and planning; I understand removing EOI's is not as simple as 11.1.2.3 but any suggestion/steps would be of great help....

    Next time try to create a topic that is not the question.
    There was no option to remove epm instances in 11.1.2.1, basically the cloest you get is uninstalling the products on the server and hope that some of the info is removed from the epm registry
    Cheers
    John

  • Is there a wat to bypass a iphone 4 password lock, not the simple 4 digit passcode lock without having to resotre the iphone?

    Is there a way to bypass a iPhone 4 password lock, not the simple 4 digit pass code lock without having to restore the iPhone? My friend owns her phone but upgraded to the iPhone 5s and wants to get her baby photos and videos off the old phone.
    She can provide ownership of the device but is very worried that she cannot access the phone without a restore as she cannot remember her password for the old phone. Can she go into an Apple store and can they do something to bypass the password when she proves ownership the device to them?
    Any help is greatly appreciated

    No. They can't bypass the lock screen password. All they could do would be restore the phone, which will wipe it.

  • Could JAXB (1.2.x) not handle simple extensions

    I've implemented a simple JAXB (1.2) unmarshaller for our xml files,
    which are using simple extensions like this:
    <xsd:complexType name="Format" abstract="true"/>
    <xsd:complexType name="FormatNumber">
          <xsd:complexContent>
             <xsd:extension base="br:Format">
                 <xsd:attribute name="decimalplace" type="br:Decimalplace" use="required"/>
             </xsd:extension>
          </xsd:complexContent>
    </xsd:complexType>  If i unmarshall the follwing xml file, an exception is thrown on validation of the format tag.
    <data>
        <column>
            <format xsi:type="br:FormatNumber" decimalplace="0"/>
        </column>
    </data>
    [...]JAXB reports that the decimal attribute definition is unknown for the format tag. This
    is correct, but JAXB should recognize that this is an extension of the FormatNumber
    complex type. Could JAXB not handle simple Extensions like this one?
    Knows anyone a solution, how i could solve this problem?
    Thanks for any hint.
    Best regards,
    Christian

    well, you could always go to a blank sheet, set your options to navigate without data, zoom in to all levels of the dimension you want to get the full list of members then search on that using the excel search function

  • Pages for ipad2 - how do you get text to wrap around the contours of a picture? Not the simple square wrap, but I saw text following the contours of a bike wheel at the Apple store demo

    Pages for ipad2 - how do you get text to wrap around the contours of a picture?  Not the simple square wrap, but I saw text following the contours of a picture of a bike wheel at the Apple store demo

    Sjazbec,
    Thanks for the reply.
    I did read the help and went through the tutorial - the butterfly text wrap (and the wrap around the curved contour of the bicycle wheel at the Apple store) is the reason I am asking this question.  I don't know how to use one of my own pictures and tell Pages what contour to wrap around.  Is there some additional image editing software that I need to "creatively crop" one of my own pictures, so that Pages will be able to wrap around that contour?
    Thanks / Danke!!

  • Simple Button Listener not so simple

    Here is code that works fine without the Listener:
    myButton_Zoom = function () {
    bt_zoombig_mc._visible = !bt_zoombig_mc._visible;
    Now when I try to add a listener it will not listen. Here is
    the code with the Listener:
    listener = new Object();
    listener.myButton_Zoom = function(objEvt) {
    bt_zoombig_mc._visible = !bt_zoombig_mc._visible;
    myList.addEventListener("myButton_Zoom",listener);
    Can anybody please tell me why?

    This is the same code as you attached above. It will not work
    for 2 reasons.
    Will not toggle visibility and will not call a function.
    Maybe think from scratch and make 2 buttons:
    ButtonUp_mc and ButtonDn_mc
    Place ButtonUp_mc on top of the other.
    Put the same code on both
    If you can achieve the visibility then we are half way there.
    Next, make 2 simple functions in the root like:
    goto_frame = function () {
    nextFrame();
    goBack_frame = function () {
    prevFrame();
    One function is called from either button (goes to next frame
    and then goes back)
    The goes back function is on the bottom and executes with the
    toggle code after
    the user has clicked the top button and made it _visible =
    false.
    Now we need to call these functions when the user clicks
    either button so
    this function has to appear in the toggle code with the
    Listener either embbeded
    with the Listener code or, outside following the listener
    code.
    In short, the button executes the _visible code, then calls
    the function.

  • OBIEE 11g: Dashboard not invoking simple javascript alert

    Hi Experts,
    I'm trying to invoke one simple ALERT command with javascript in obiee 11g dashboard. The purpose is when it loads, it should print one ALERT message and also when we change something in the prompt and clicking Apply button.
    Here is code written in a text item (Checked html markup option) after prompts;
    <script language="Javascript">
    alert ("Hello");
    </script>
    The Javascript alert message is showing when the dashboard page loads, but its not coming when we click the Apply button after changing the prompts.
    Can anyone give helpful hint, how to check it and why its not showing up when we press Apply button?
    Any hint or some useful links will b highly appreciated.
    Thanks in advance.

    You just used code and I would say the default event is onload of the page, thats the reason you are able to see alert.
    Since you didnt ask or written code onClick event to show alert, its not showing.
    You need to tell to browser when to prompt alert message instead of onload.
    Hope you are more confuse about 'how to do'
    if yes, mark :)
    give some more info about your actual req. that helps any other gurus to help.
    Edited by: Srini VEERAVALLI on Mar 27, 2013 8:42 AM

  • Simple PRC file transfer between devices or via PC not so simple, sigh.

    Greeting, this is my first post so excuse me if I make some faux pas.
    I was unpleasantly surprised how difficult, almost imposible it is to take a [custom] PRC off one Palm device and put it on a second, even using a Windows PC as the intermediary.
    The devices use Palm 4.1 OS and are bar code scanners, SPT1800, made by Symbol and now legacy devices since Motorola bought them out.
    So one PRC is a tiny program that allows the main program to be downloaded via a network. Without this tiny program, can't get the devices to do anything.
    I tried terminal programs and what not. I can talk to the devices via COM1 and even 9600 n81, a simple protocol. They do have some kind of binary file transfer capability. But I cannot even get a Directory listing, nothing from the Palm device. That file capability is simple not there. Really surprised me.
    Desktop software is useless so far, from Symbol/Motorola. Have not tried Palm's but it looks almost identical and only allows PRC to be transferred to the device for installation, not vice versa.
    I am trying to avoid installing linux and using pilot-xfer only because that takes a couple of days before I can download and debug everything. But Pilot can make a backup of the Palm device, purportedly, any Palm device just about.
    Any suggestions? Pilot-xfer is still not ready for Windows?
    I am using Windows XP Pro with the Com1 port. I did try Telnet and a Terminal program but I cannot get the Palm device to do much.
    I guess they did this on purpose so the files can't be messed up?
    Anyway to just make a backup of the regular memory, not the ROM?
    I have emailed a few Palm service companies if they can sell me a program to do this but I doubt they will. We did send some Palm devices out to one of these companies and it's almost 2 months now. It's murder.
    Thanks, AdamPalm
    Post relates to: None

     Your references are appreciated. I look forward to testing this out. It's interesting how complicated this gets and all the little deadly false steps. For example, I use 98se and XP Pro mostly [Win 2000 and linux sometimes]. I shut down the serial ports. No problem I thought. I just open them up when I need COM1 and that particular IRQ.
    BIG PROBLEM NOW. Machine can't work now with COM1 in 98se. That IRQ is not moving back. XP PRO does not have this problem since presumably lots of IRQs and not used that much.
    This complete collapse of the computer with something as dumb as enabling/disabling COM ports in the BIOS has me gobsmacked. It's so bad it's funny. Never saw this problem before in all the various operating systems. I better not see this again. I might really go over to linux as soon as I figure out how to play all those proprietary formats that don't play in linux.
    What should take minutes will probably take days to sort out all the problems.
    Do others encounter this too? Sorry to whine but that's fun too.
    Thanks for all the comments fellow. Appreciated.
    Post relates to: None

  • Not-so-simple programming task

    Hie!
    I am currently working on GPS device on iPAQ pocket PC. Can anyone give me example of source code for my reference. I just need the details on how to get the data from the PCMCIA port,which the GPS receiver attached) & how to calculate, process into the map. How do I create a digitized map to be show on the screen? It need not be the whole runable program but just a simple explanation & the main source code. I am very in need of your help.
    Thank you in advance.

    It need not be the whole runable program If I do give the entire runnable program do I get all the revenues from it along with the production costs? Aw, forget it. I will sell it myself.

  • IPhoto not saving simple edits

    I have been using this current version of iPhoto for several weeks with no problems. Yesterday, it stopped saving simple edits even after hitting the done button. For example, I would crop a photo, click done, move onto the next photo and the previous edit would just disappear. It won't save simple enhancements or more complex adjustments either.
    I am using iPhoto '11, version 9.2.3. There are no further updates available. I have not added any new software to my computer. I am at a loss. Any suggestions would be welcome!

    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Repair Database. If that doesn't help, then try again, this time using Rebuild Database.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. (In Library Manager it's the FIle -> Rebuild command)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. 
    Regards
    TD 

  • Simple email form not so simple UGH!!! Could really use some help!

    All I need is a simple form for name, email addy and comment.  I've been working on this all day/night and am pulling my hair out!!!
    Any help is appreciated!!
    It is sitting here:   http://loonstyn.com/contact-form.html
    Here is the code I'm using (both pages):
    For the form page:
    <HTML>
    <HEAD><title>Contact Form</title></HEAD>
    <BODY>
    <form method="POST" name="contact_form" action="http://www.loonstyn.com/contact-form-handler.php">
    Enter Name: <input type="text" name="name"> <br>
    Enter Email Address: <input type="text" name="email"> <br>
    Enter Postal Address: <input type="text" name="postal_address"> <br>
    Enter Message: <textarea name="message"></textarea><br>
    <input type="submit" value="Submit"><br>
    </form>
    </BODY>
    </HTML>
    For the handler:
    <?php
    $error_occured = "no";
    $name = $_POST['name']; // getting the value of name
    $email_address = $_POST['email']; // getting the value of email address
    $postal_address = $_POST['postal_address']; // getting the value of postal address
    $message = $_POST['message']; // getting the value of user message
    ////////////////// Data Validation ////////////////
    if($name=="" || $name==" ") {
    $error_occured = "yes";
    echo "Error: You have NOT entered your name. Please click on BACK button of your browser and correct this error to proceed.";
    if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email_address)){
    $error_occured = "yes";
    echo "Error: You have NOT entered the correct email address. Please click on BACK button of your browser and correct this error to proceed.";
    if($postal_address=="" || $postal_address==" ") {
    $error_occured = "yes";
    echo "Error: You have NOT entered your postal address. Please click on BACK button of your browser and correct this error to proceed.";
    if($message=="" || $message==" ") {
    $error_occured = "yes";
    echo "Error: You have NOT entered your message. Please click on BACK button of your browser and correct this error to proceed.";
    if($error_occured=="no") {
    $to = "[email protected]";
    $email_from = $email_address;
    $email_subject = "New Message For you";
    $email_body = "You have received a new message. Here are the details: Name = " . $name . ", Postal Address = " . $postal_address . ", Message = ". $message;
    $headers = "From: $email_from";
    mail($to,$email_subject,$email_body,$headers);
    echo "Your message was sent successfully";
    ?>

    Try this contact form. It may give you some ideas for yours. This form is set up to require 3 additional files, a header file, a menu and a footer file. You can pust what ever you want in them. The header and footer are excellent for any repetitive portions that are needed on multiple web pages. Feel free to remove the includes and inject the necessary code to finish the web page.
    <?php
    $pagetitle='Contact';
    include ('header.inc');
    print '<h1>Contact</h1>';
    include ('menu.inc');
    if ($_POST['B1']!=true) {
    print <<<FORM
    <div class="contact">
    <form method="post" action="{$_SERVER['PHP_SELF']}">
      <p><sup style="color: red; font-size: 150%">*</sup>Name:<br /><input type="text" name="T1" size="30" value="" /></p>
      <p><sup style="color: red; font-size: 150%">*</sup>E-mail address:<br /><input type="text" name="T2" size="30" value="" /></p>
      <p><sup style="color: red; font-size: 150%">*</sup>Subject:<br /><input type="text" name="T3" size="50" value="" /></p>
      <p><sup style="color: red; font-size: 150%">*</sup>Message:<br /><textarea name="S1" rows="10" cols="80" style="vertical-align: bottom"></textarea></p>
      <p style="text-align: center"><input type="submit" value="Submit" name="B1" />        <input type="reset" value="Reset"
      name="B2" /></p>
    </form>
    <p><sup style="color: red; font-size: 150%">*</sup>Required</p>
    </div>
    FORM;
    if ($_POST['B1']==true) {
    $to='[email protected]';
    $ip=htmlentities(trim($_SERVER['REMOTE_ADDR']));
    $name=htmlentities(trim($_POST['T1']));
    $email=htmlentities(trim($_POST['T2']));
    $inputsubject=htmlentities(trim($_POST['T3']));
    $subject="A message from a your website";
    $header='From: your name's Contact Page <[email protected]>';
    $message="Name: " . $name . "\nEmail: " . $email. "\nRemote IP: " . $ip . "\nSubject: " . $inputsubject . "\nMessage:\n" . htmlentities(trim($_POST['S1']));
    if (($name==null)||($email==null)||($subject==null)||($_POST['S1']==null)) {
    print "<h3>Sorry, but you did not provide enough information, Make sure all sections are filled in<br />Please try again</h3>";
    print <<<BACK
    <input type="submit" value="Back" onclick = "history.back()">
    BACK;
    die();
    mail ($to, $subject, $message, $header);
    print "<h3>" . $name . "<br />" . 'Thank you for contacting example.com' . "</h3>";
    print "<p style=\"color: rgb(128,128,255)\"><--- Please use menu to navigate from this page!</p><br /><br /><br /><br />&nbsp<br /><br /><br /><br /><br />&nbsp<br /><br /><br />&nbsp<br />";
    include ('footer.inc');
    ?>
    On your form, a word of warning - Never allow input from a user to be used as a value for the mail header. As this allows someone to inject code including javascript into your email. Forcing you to email someone else with spam. It is best to create you fixed value that you know for the mail header and place their input in your message body where it won't hurt anything. And always use htmlentities to strip their inmput from any html tags.
    Good luck...

Maybe you are looking for

  • Problems with Flash in Win8.1/IE11

    I recently upgraded my Windows 8 laptop to Windows 8.1, and I am running the latest version of Internet Explorer (IE11) -- but everytime I try to load Flash content, it tell me Flash is not installed or needs updating. I know it is installed and it i

  • Download Link for Database 9i wrong

    Hi, I tried to download a trial version of Database 9i for windows server 2003, but the link only leads me to a patch for this (or maybe even another) version. Can someone please fix this link or give me a correct link? Here is the wrong link http://

  • Driver problem, Colour Sensor not working properly?

    Hey! My W530 came with windows 8 preinstalled. Unfortunately I got sick of it after 2 months of use and decided to install windows 7. After turning off safety boot in the bios menu, windows 7 worked pretty good. I'm only having a few issues at the mo

  • Reader X breaks system

    In Windows 7, with Acrobat Pro 8 installed and operating nicely, the update to X disabled Firefox's ability to ready PDFs. Reader X will not uninstall, nor will it re-install. Suggestions? Thank you -- Tony

  • Fade in and Out

    Hello Everyone, I would like to ask the Pro a question. I have a video clip which i want to cut and fade in and Fade Out the video and Audio. I have searched on internet but i can not seems to find the right answer.Is it that complicated to do fade i