Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Textfields

  1. #1
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Textfields

    is there any JAVASCRIPT thru the text fields like USERNAME ans Password can be saved is Remember Me is Checked..

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    I think that it would be easier to do in PHP considering that not all browsers, and people support javascript.
    Jeremy | jfein.net

  3. #3
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    hmm tell me how to do it in both ways..

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    I could tell you how to do it in PHP.
    I can also make an example for you if you please.
    Jeremy | jfein.net

  5. #5
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    yeah sure please.. go ahead..

  6. #6
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Ok, here it is. I spent around 10 minutes on this simple code(See example below):
    PHP Code:
    <?php
    if(isset($_POST['submit'])){
    if(!empty(
    $_POST[username]) || !empty($_POST[password])){
    if(
    $_POST[jeef8ih]){
    setcookie('ee13ee'$_POST[username], 60 60 24 60 time());
    }
    if(
    $_POST[opppkld]){
    setcookie('aa765d'$_POST[password], 60 60 24 60 time());
    }
    } else {
    }
    header('Location: '.$_SERVER[PHP_SELF]);
    }
    $textInput[1] = (($_COOKIE[ee13ee] == true) ? '<input type="text" name="username" value="'.$_COOKIE[ee13ee].'" />' '<input type="text" name="username" />');
    $textInput[2] = (($_COOKIE[aa765d] == true) ? '<input type="password" name="password" value="'.$_COOKIE[aa765d].'" />' '<input type="password" name="password" />');
    $form = <<< FORM
    <form action="$_SERVER[PHP_SELF]" method="post">
    <div style="padding:10px;background:lightyellow;border:1px solid gray;">
    <span>Username: 
    $textInput[1]<input type="checkbox" name="jeef8ih" />Remember?</span><br />
    <span>Password: 
    $textInput[2]<input type="checkbox" name="opppkld" />Remember?</span><br />
    <input type="submit" name="submit" value="Login!" />
    <b style="color:red;">Note: This is not a real login, it will just remember your details. It will remember your details for two months.</b>
    FORM;
    echo 
    $form;
    ?>
    In some of the cookie values you'll see some random stuff, its for the security.
    Please note that this is not an actual login script, but just a script to remember login details(can be used with text boxes, and more)
    If you need me to explain this I will.
    Example: http://niler.net/examples/rememberMe.php
    Last edited by Nile; 05-30-2008 at 03:14 AM. Reason: example
    Jeremy | jfein.net

  7. #7
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    how about saving both with one Required check? and Forget Me Button and can i put my own customised text fields in them?

  8. #8
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Ok, what about this? Example Below.
    PHP Code:
    <?php
    if(isset($_POST['submit'])){
    if(!empty(
    $_POST[username]) || !empty($_POST[password])){
    if(
    $_POST[jeef8ih]){
    setcookie('ee13ee'$_POST[username], 60 60 24 60 time());
    setcookie('aa765d'$_POST[password], 60 60 24 60 time());
    }
    } else {
    }
    header('Location: '.$_SERVER[PHP_SELF]);
    }
    if(isset(
    $_POST['forget'])){
    setcookie('ee13ee'""60 60 24 60 time());
    setcookie('aa765d'""60 60 24 60 time());
    header('Location: '.$_SERVER[PHP_SELF]);
    }
    $textInput[1] = (($_COOKIE[ee13ee] == true) ? '<input type="text" name="username" value="'.$_COOKIE[ee13ee].'" />' '<input type="text" name="username" />');
    $textInput[2] = (($_COOKIE[aa765d] == true) ? '<input type="password" name="password" value="'.$_COOKIE[aa765d].'" />' '<input type="password" name="password" />');
    $form = <<< FORM
    <form action="$_SERVER[PHP_SELF]" method="post">
    <div style="padding:10px;background:lightyellow;border:1px solid gray;">
    <span>Username: 
    $textInput[1]</span><br />
    <span>Password: 
    $textInput[2]</span>
    <input type="checkbox" name="jeef8ih" />Remember?<br /><input type="submit" name="submit" value="Login!" /><input type="submit" name="forget" value="Forget Me" />
    <b style="color:red;"><br />Note: This is not a real login, it will just remember your details. It will remember your details for two months. You can also overwrite it.</b>
    FORM;
    echo 
    $form;
    ?>
    http://niler.net/examples/rememberMe[2].php
    If you gimme your login code I can plug this one in for you.
    Jeremy | jfein.net

  9. #9
    Join Date
    Apr 2008
    Posts
    104
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    here is my HTML code i don't think so it can be fixed in Php..
    Code:
    <center>
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
      <tr>
        <td width="100%">
        <div align="center">
          <center>
          <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="259" height="5">
            <tr>
              <td width="259" bgcolor="#EBF3F9" height="170">
              <form method="POST" action="go.php" name="login">
                <div align="center">
                  <center>
                  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="240">
                    <tr>
                      <td width="100%"><b>
                      <font face="Arial" size="2" color="#3D3643"><br>
                      Username</font></b></td>
                    </tr>
                    <tr>
                      <td width="100%">
                      <input type="text" name="username" size="22" style="font-size: 20; padding-top: 2; padding-bottom: 5"></td>
                    </tr>
                    <tr>
                      <td width="100%">&nbsp;</td>
                    </tr>
                    <tr>
                      <td width="100%"><b>
                      <font face="Arial" size="2" color="#3D3643">Password</font></b></td>
                    </tr>
                    <tr>
                      <td width="100%">
                      <input type="password" name="password" size="22" style="font-size: 20; padding-top: 2; padding-bottom: 5"></td>
                    </tr>
                    <tr>
                      <td width="100%">&nbsp;</td>
                    </tr>
                    <tr>
                      <td width="100%">
                      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="230">
                        <tr>
                          <td width="50%">
                          <p align="left">
                          <label><input type="checkbox" name="C1" value="ON"><font size="1" face="Verdana">Remember 
                          Me<br>
                          <a href="forget">Forget Me</a></font></label></td>
                          <td width="50%">
                          <p align="right">
                          <input type="submit" value="Log In" style="font-size: 12pt; color: #000000; border: 1px solid #006699; padding-top: 2; padding-bottom: 5; background-color: #C1DAEC"></td>
                        </tr>
                      </table>
                      </td>
                    </tr>
                  </table>
                  </center>
                </div>
                <input type="hidden" name="action" value="dologin">
              </form>
              <br></td>
            </tr>
            </table>
          </center>
        </div>
        </td>
      </tr>
    </table>

  10. #10
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Ok, go.php:
    PHP Code:
    <?php
    if(isset($_POST['submit'])){
    if(!empty(
    $_POST[username]) || !empty($_POST[password])){
    if(
    $_POST[jeef8ih]){
    setcookie('ee13ee'$_POST[username], 60 60 24 60 time());
    setcookie('aa765d'$_POST[password], 60 60 24 60 time());
    }
    } else {
    }
    }
    if(isset(
    $_POST['forget'])){
    setcookie('ee13ee'""60 60 24 60 time());
    setcookie('aa765d'""60 60 24 60 time());
    //your code goes here
    }
    On the page you shows me:
    Code:
    <?php
    $textInput[1] = (($_COOKIE[ee13ee] == true) ? '<input type="text" name="username" size="22" style="font-size: 20; padding-top: 2; padding-bottom: 5" value="'.$_COOKIE[ee13ee].'">' : '<input type="text" name="username" size="22" style="font-size: 20; padding-top: 2; padding-bottom: 5" />');
    $textInput[2] = (($_COOKIE[aa765d] == true) ? '<input type="password" name="password" size="22" style="font-size: 20; padding-top: 2; padding-bottom: 5" value="'.$_COOKIE[aa765d].'">' : '<input type="password" name="password" size="22" style="font-size: 20; padding-top: 2; padding-bottom: 5">');
    $form = <<< FORM
    <center>
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
      <tr>
        <td width="100%">
        <div align="center">
          <center>
          <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="259" height="5">
            <tr>
              <td width="259" bgcolor="#EBF3F9" height="170">
              <form method="POST" action="go.php" name="login">
                <div align="center">
                  <center>
                  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="240">
                    <tr>
                      <td width="100%"><b>
                      <font face="Arial" size="2" color="#3D3643"><br>
                      Username</font></b></td>
                    </tr>
                    <tr>
                      <td width="100%">
                      $textInput[1]</td>
                    </tr>
                    <tr>
                      <td width="100%">&nbsp;</td>
                    </tr>
                    <tr>
                      <td width="100%"><b>
                      <font face="Arial" size="2" color="#3D3643">Password</font></b></td>
                    </tr>
                    <tr>
                      <td width="100%">
                      $textInput[2]</td>
                    </tr>
                    <tr>
                      <td width="100%">&nbsp;</td>
                    </tr>
                    <tr>
                      <td width="100%">
                      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="230">
                        <tr>
                          <td width="50%">
                          <p align="left">
                          <label><input type="checkbox" name="jeef8ih" /><font size="1" face="Verdana">Remember Me?</font><br /><input type="submit" name="forget" value="Forget Me" />
                          <a href="forget">Forget Me</a></font></label></td>
                          <td width="50%">
                          <p align="right">
                          <input type="submit" name="submit" value="Login!" /></td>
                        </tr>
                      </table>
                      </td>
                    </tr>
                  </table>
                  </center>
                </div>
                <input type="hidden" name="action" value="dologin">
              </form>
              <br></td>
            </tr>
            </table>
          </center>
        </div>
        </td>
      </tr>
    </table>
    FORM;
    echo $form; 
    ?>
    See if that works. Although I think it will, tell me.
    Jeremy | jfein.net

Bookmarks

Posting Permissions

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