Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Oct 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    password form script that forward to different address

    In a nutshell I need a html code that will accept a sting and based on the string go to site a or site b or wrong password.

    so far I got this
    Code:
    <form>
    Password: <input type="password" name="pwd">
    </form>
    but I need help creating a if/else statement.

    if pwd = 1234567 go to google.com if pwd= 7654321 go to yahoo.com all other will say wrong password.

  • #2
    Regular Coder Nerevarine's Avatar
    Join Date
    Jan 2013
    Location
    Phendrana Drifts, Tallon IV, W-Class
    Posts
    285
    Thanks
    0
    Thanked 17 Times in 17 Posts
    Blog Entries
    3
    This should be in JavaScript. What you are asking for falls outside of the bounds of HTML.
    Time kills us in our sleep and we watch it happen in our dreams. -K.K.
    THE END-ALL PROGRAMMING REFERENCE: CLICK HERE (Courtesy of Major Payne)
    My username was previously L0adOpt1c. :: Please read this before posting in the HTML/CSS forum.
    Validate your HTML here and your CSS here. :: Need basic HTML/CSS tutorials? Click here, don't post about it.

  • #3
    New Coder
    Join Date
    Oct 2013
    Location
    Bangalore, Karnataka
    Posts
    43
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Hi
    just try this coding,
    <!DOCTYPE html>
    <html>
    <head>
    <title>Attach File</title>
    </head>
    <body>
    <h2>Submit Email with Attachment</h2>
    <form method="post" action="ProcessFile.cshtml">
    <div>
    Your name:
    <input type="text" name="customerName" />
    </div>

    <div>
    Your email address:
    <input type="text" name="customerEmail" />
    </div>

    <div>
    Subject line: <br />
    <input type="text" size= 30 name="subjectLine" />
    </div>

    <div>
    File to attach: <br />
    <input type="text" size=60 name="fileAttachment" />
    </div>

    <div>
    <input type="submit" value="Submit" />
    </div>
    </form>
    </body>
    </html>

    Create a page named sFile.cshtml and add the following markup:

    @{
    var customerName = Request["customerName"];
    var customerEmail = Request["customerEmail"];
    var customerRequest = Request["customerRequest"];
    var subjectLine = Request["subjectLine"];
    var fileAttachment = Request["fileAttachment"];
    var errorMessage = "";
    var debuggingFlag = false;

    try {
    // Initialize WebMail helper
    WebMail.SmtpServer = "your-SMTP-host";
    WebMail.SmtpPort = 25;
    WebMail.UserName = "your-user-name-here";
    WebMail.Password = "your-account-password";
    WebMail.From = "your-email-address-here";

    // Create array containing file name
    var filesList = new string [] { fileAttachment };

    // Attach file and send email
    WebMail.Send(to: customerEmail,
    subject: subjectLine,
    body: "File attached. <br />From: " + customerName,
    filesToAttach: filesList);
    }
    catch (Exception ex ) {
    errorMessage = ex.Message;
    }
    }
    <!DOCTYPE html>
    <html>
    <head>
    <title>Request for Assistance</title>
    </head>
    <body>
    <p>Sorry to hear that you are having trouble, <b>@customerName</b>.</p>
    @if(errorMessage == ""){
    <p><b>@customerName</b>, thank you for your interest.</p>
    <p>An email message has been sent to our customer service
    department with the <b>@fileAttachment</b> file attached.</p>
    }
    else{
    <p><b>The email was <em>not</em> sent.</b></p>
    <p>Please check that the code in the ProcessRequest page has
    correct settings for the SMTP server name, a user name,
    a password, and a "from" address.
    </p>
    if(debuggingFlag){
    <p>The following error was reported:</p>
    <p><em>@errorMessage</em></p>
    }
    }
    </body>
    </html>

  • #4
    Regular Coder Nerevarine's Avatar
    Join Date
    Jan 2013
    Location
    Phendrana Drifts, Tallon IV, W-Class
    Posts
    285
    Thanks
    0
    Thanked 17 Times in 17 Posts
    Blog Entries
    3
    That has nothing to do with what he asked.
    Time kills us in our sleep and we watch it happen in our dreams. -K.K.
    THE END-ALL PROGRAMMING REFERENCE: CLICK HERE (Courtesy of Major Payne)
    My username was previously L0adOpt1c. :: Please read this before posting in the HTML/CSS forum.
    Validate your HTML here and your CSS here. :: Need basic HTML/CSS tutorials? Click here, don't post about it.

  • #5
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,178
    Thanks
    23
    Thanked 601 Times in 600 Posts
    If done in javascript any one can see what the password should be. Do it in php on a submitted forum.

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <title>Title of the document</title>
    </head>
    <body>
    
    <form action="userselect.php" method="POST">
    Password: <input type="password" name="pwd">
    <input type="hidden" name="msoft" value="junk">
    <input type="submit" value="Submit">
    </form>
    </body>
    </html>
    And the php
    PHP Code:
    <?php
    if($_POST["msoft"] == 'junk'){
        
    $pass $_POST["pwd"];
        if(
    $pass == 1234567){
            
    header'Location: https://www.google.com/' ) ;
        }else if(
    $pass == 7654321){
            
    header'Location: http://www.yahoo.com/' ) ;
        }else{
            echo 
    "This password is wrong";
        }
    }
    ?>
    If you want the html to stay in place if the wrong PW is entered, you would need to use ajax.
    Last edited by sunfighter; 10-10-2013 at 03:05 PM.
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •