Има ли код?

Post Reply
skate
Турист
Турист
Posts: 508
Joined: Sat May 06, 2006 6:43 pm
Location: Велико Търново

Има ли код?

Post by skate » Tue May 30, 2006 9:26 am

Имали код който да е за регистрация във сайта ми ,но да е или HTML или JavaShip?

User avatar
NetCutter
Потребител
Потребител
Posts: 1242
Joined: Mon Jan 09, 2006 9:54 am
Location: In Your Hard Drive!!!
Contact:

Post by NetCutter » Tue May 30, 2006 9:45 am

Еми аз мисля че няма :)

User avatar
mute
Шаман
Шаман
Posts: 3127
Joined: Sun Sep 25, 2005 10:14 pm
Answers: 167
Location: between mind & heart
Contact:

Post by mute » Tue May 30, 2006 1:39 pm

NetCutter wrote:Еми аз мисля че няма :)
правилно мислиш, няма, наи лесно ще стане с PHP и MySQL .

Admin
Site Admin
Site Admin
Posts: 4
Joined: Thu Jan 01, 1970 12:00 am
Answers: 224

Post by Admin » Tue May 30, 2006 3:52 pm

С javascript е несериозна работа но все пак може нещо да се направи.
НЯма никаква сигурност обаче.
Пример:
http://www.javascriptkit.com/script/cut16.shtml

User avatar
LiRiX
Шаман
Шаман
Posts: 4330
Joined: Fri Mar 31, 2006 8:52 am
Answers: 165
Location: Търговище

Post by LiRiX » Wed May 31, 2006 7:36 pm

Админа е прав. Аз се опитах на стария ми сайт(който беше х хит.бг(без пхп ест))но беше абослютно бъгаво, просто не си струва да опиташ дори.
Ако някой има по хубам да ти го даде(лично аз се самнявам).
Та идеята ми е, понеже видях подписа ти, регистрирай си един безплатен хост който поддържа пхп и си го пренасочи към домейна. Естествено безплатиния хостинг си има и минуси, но вече си се фанал на хорото и ще го играеш :)

skate
Турист
Турист
Posts: 508
Joined: Sat May 06, 2006 6:43 pm
Location: Велико Търново

Post by skate » Wed May 31, 2006 7:37 pm

Би ли ми предложил някой?(двече разбрах че free.bg и hit.bg не стават)

User avatar
LiRiX
Шаман
Шаман
Posts: 4330
Joined: Fri Mar 31, 2006 8:52 am
Answers: 165
Location: Търговище

Post by LiRiX » Wed May 31, 2006 7:43 pm

Ми аз мога да ти предложа само два, защото толкова знам.
http://pandela.com
http://awardspace.com
Би трябвало да ти свършат работа :) те подъжат пхп.

User avatar
vesku
Потребител
Потребител
Posts: 1268
Joined: Sat Oct 01, 2005 4:33 pm
Answers: 50
Location: Чирпан
Contact:

Post by vesku » Tue Jun 27, 2006 12:56 pm

да бе наистина с жаваскрипт нема да е хубо ето жи един с регистрацоя и логин

Code: Select all

<html>
<head>
<title>password</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
</head>

<body bgcolor="#FFFFFF" text="#000000" onLoad="retrieveData&#40;'jim'&#41;">
<p>Този скрип помага на вашите посетители да влезат в защитени с парола страници</p>
<p>Когато някой се запише, вие му изпращате е-маил. Информацията за потребителите 
  се</p>
<p>пази на техните компютри под формата на <font color="#0000FF">&quot;cookie&quot; 
  които се зареждат когато дойде</font></p>
<p><font color="#0000FF">пак на същата страница. Има съответно страница с достъп 
  и страница с отказ от вход,</font></p>
<p><font color="#0000FF">които вие сами трябва да създадете&#58;</font></p>
<p><font color="#0000FF">*Тук няма защитени с парола страници*</font></p>
<p><font color="#0000FF">Ети как изглежда&#58;</font></p>
<p>&nbsp;</p>
<p>
  <script language="JavaScript1.2">


<!--
/*
This header must remain in place

Applies to Security aspect of script only
Title&#58; Password Protection
http&#58;//www.thehomeofmummy.com
Owner&#58; Fire
http&#58;//www.plebius.org
*/


var GrantedURL = 'http&#58;//accept.html';
var DeniedURL = 'http&#58;//dontaccept.html';


var jim;
var gotoit;
suzy="0"
var capable;
var name = navigator.appName.toLowerCase&#40;&#41;;
var vers = parseFloat&#40;navigator.appVersion&#41;;

if &#40;&#40;name.indexOf&#40;"netscape"&#41; >= 0 && vers >= 4&#41; || &#40;name.indexOf&#40;"microsoft"&#41; >= 0 && vers >= 4&#41;&#41;
capable = true;
else
capable = false;

// Constants.

var FLDSEP; // Special characters used as separators in cookie data string.
var IDXSEP;

if &#40;capable&#41; &#123;
FLDSEP = String.fromCharCode&#40;1&#41;;
IDXSEP = String.fromCharCode&#40;2&#41;;
&#125;

//----------------------------------------------------------------------------
// Stores data currently entered on a form as cookies. Always returns true.
//
// name - The form name.
// months - Number of months to keep the cookies.
// exclude - A comma-delimited list of field names that should not be
// stored. Use to exclude sensitive data such as password,
// credit card numbers, etc.
//---------------------------------------------------------------------------- 

function storeData&#40;name, months, exclude&#41; &#123;

var f;
var expdate;
var list, include;
var i;
var fld;
var data;
if &#40;&#40;document.myForm.pass.value==document.myForm.pass1.value&#41;&&&#40;document.jim.hiduser.value==""&#41;&&&#40;document.myForm.pass.value!=""&#41;&#41;&#123;
name="jim";
document.jim.hidpass.value=document.myForm.pass.value;
document.jim.hiduser.value=document.myForm.user.value;
document.jim.hidname.value=document.myForm.name.value;
document.jim.hidhint.value=document.myForm.hint.value;
if &#40;!capable&#41;
return true;

// Get the named form, skip processing if not found.

if &#40;!&#40;f = document.forms&#91;name&#93;&#41;&#41;
return true;

// Initialize the data field.

// Set the expiration date.

if &#40;months == ""&#41;
months = 12;
expdate = new Date&#40;&#41;;
expdate.setMonth&#40;expdate.getMonth&#40;&#41; + months&#41;;

// Build a list of field names for exclusion.

list = new Array&#40;&#41;;
if &#40;exclude != ""&#41; &#123;
i = 0;
while &#40;&#40;i = exclude.indexOf&#40;","&#41;&#41; >= 1&#41; &#123;
list&#91;list.length&#93; = exclude.substr&#40;0, i&#41;;
exclude = exclude.substr&#40;i + 1&#41;
&#125;
list&#91;list.length&#93; = exclude;
&#125;

// Run through the fields and add field name/value pairs to the data string.

data = FLDSEP;
for &#40;i = 0; i < f.length; i++&#41; &#123;
fld = f.elements&#91;i&#93;;

// Is field in exclusion list?

include = true;
for &#40;j = 0; j < list.length; j++&#41;
if &#40;fld.name == list&#91;j&#93;&#41;
include = false;

if &#40;include&#41; &#123;

// Checkboxes and radio buttons.

if &#40;&#40;fld.type == "checkbox" || fld.type == "radio"&#41; && fld.checked&#41;
data += setData&#40;fld.name, fld.value&#41;;

// Selection lists &#40;single&#41;.

if &#40;fld.type == "select-one"&#41;
if &#40;fld.selectedIndex >= 0&#41;
data += setData&#40;fld.name, fld.options&#91;fld.selectedIndex&#93;.value&#41;;

// Selection lists &#40;multiple&#41;. Add a unique name/value pair for each selected item.

if &#40;fld.type == "select-multiple"&#41;
for &#40;j = 0; j < fld.options.length; j++&#41;
if &#40;fld.options&#91;j&#93;.selected&#41;
data += setData&#40;fld.name + IDXSEP + j, fld.options&#91;j&#93;.value&#41;;

// Text fields.

if &#40;fld.type == "hidden" || fld.type == "password" || fld.type == "text" || fld.type == "textarea"&#41;
data += setData&#40;fld.name, fld.value&#41;;
&#125;
&#125;

// Set the cookie.

deleteCookie&#40;name&#41;;
setCookie&#40;name, data, expdate&#41;;
alert&#40;"user "+document.jim.hiduser.value+" has been added"&#41;;

&#125;
else if&#40;document.myForm.pass.value==""||document.myForm.name.value==""||document.myForm.user.value==""||document.myForm.hint.value==""||document.myForm.pass1.value==""&#41; 
alert&#40;'fill in the form loser'&#41;;
else alert&#40;"either your passwords don't match or you have registered with us before"&#41;;
return true;
&#125;
//----------------------------------------------------------------------------
// Retrieves data from the cookie and sets the values in the corresponding
// form fields. Returns true if data was found, false otherwise.
//
// name - The form name.
//----------------------------------------------------------------------------

function retrieveData&#40;name&#41; &#123;

var f;
var i, j;
var fld;
var s;
var data;

if &#40;!capable&#41;
return false;

// Get the named form, return if not found.

if &#40;!&#40;f = document.forms&#91;name&#93;&#41;&#41;
return false;

// Get the cookie for this form.

data = getCookie&#40;name&#41;;
if &#40;data == ""&#41;
return false;

// Run through the fields and retrieve the values.

for &#40;i = 0; i < f.elements.length; i++&#41; &#123;
fld = f.elements&#91;i&#93;;

// Checkboxes and radio buttons.

if &#40;&#40;fld.type == "checkbox" || fld.type == "radio"&#41; && &#40;s = getData&#40;fld.name, data&#41;&#41; != null && fld.value == s&#41;
fld.checked = true;

// Selection lists &#40;single&#41;.

if &#40;fld.type == "select-one" && &#40;s = getData&#40;fld.name, data&#41;&#41; != null&#41;
for &#40;j = 0; j < fld.options.length; j++&#41;
if &#40;fld.options&#91;j&#93;.value == s&#41;
fld.options&#91;j&#93;.selected = true;

// Selection lists &#40;multiple&#41;.

if &#40;fld.type == "select-multiple"&#41;
for &#40;j = 0; j < fld.options.length; j++&#41;
if &#40;&#40;s = getData&#40;fld.name + IDXSEP + j, data&#41;&#41; != null && fld.options&#91;j&#93;.value == s&#41;
fld.options&#91;j&#93;.selected = true;

// Text fields.

if &#40;&#40;fld.type == "hidden" || fld.type == "password" || fld.type == "text" || fld.type == "textarea"&#41; && &#40;s = getData&#40;fld.name, data&#41;&#41; != null&#41;
fld.value = s;
&#125;

return true;
&#125;

/*****************************************************************************
* These functions set and retrieve the field name/value pairs stored in the *
* cookie. *
*****************************************************************************/

//----------------------------------------------------------------------------
// Given a field name and value, creates a name/value string that can be
// appended to the cookie data. A null string is returned if the given value
// is null.
//----------------------------------------------------------------------------

function setData&#40;name, value&#41; &#123;

if &#40;value != ""&#41;
return name + "=" + value + FLDSEP;
else
return "";
&#125;

//----------------------------------------------------------------------------
// Given a field name, this function will extract the matching value found
// in the data string. Null is returned if no match is found.
//----------------------------------------------------------------------------

function getData&#40;name, data&#41; &#123;

var i, j;
var s;

if &#40;data == ""&#41;
return null;

s = FLDSEP + name + "=";
i = data.indexOf&#40;s&#41;;
if &#40;i >= 0&#41; &#123;
i += s.length;
j = data.indexOf&#40;FLDSEP, i&#41;;
if &#40;j >= 0&#41;
return data.substr&#40;i, j - i&#41;;
&#125;

return null;
&#125;

/*****************************************************************************
* These are the basic functions to set, get and delete a cookie. *
*****************************************************************************/

//----------------------------------------------------------------------------
// Set a cookie given a name, value and expiration date.
//----------------------------------------------------------------------------


function setCookie &#40;name, value, expires&#41; &#123;

document.cookie = name + "=" + escape&#40;value&#41; + "; expires=" + expires.toGMTString&#40;&#41; + "; path=/";
&#125;

//----------------------------------------------------------------------------
// Returns the value of the named cookie.
//----------------------------------------------------------------------------

function getCookie&#40;name&#41; &#123;

var search;

search = name + "="
offset = document.cookie.indexOf&#40;search&#41; 
if &#40;offset != -1&#41; &#123;
offset += search.length ;
end = document.cookie.indexOf&#40;";", offset&#41; ;
if &#40;end == -1&#41;
end = document.cookie.length;
return unescape&#40;document.cookie.substring&#40;offset, end&#41;&#41;;
&#125;
else
return "";
&#125;

//----------------------------------------------------------------------------
// Delete the named cookie.
//----------------------------------------------------------------------------

function deleteCookie&#40;name&#41; &#123;

var expdate = new Date&#40;&#41;; 
expdate.setMonth&#40;expdate.getMonth&#40;&#41; - 1&#41;;
setCookie&#40;name, "", expdate&#41;;
&#125;
function checkpass&#40;&#41;&#123;
var bob;
if &#40;document.jim.hiduser.value==document.jim.user.value&#41;jim=true;
else jim=false;
if &#40;document.jim.hidpass.value==document.jim.pass.value&#41;bob=true;
else bob=false;
if &#40;&#40;jim==bob&#41;&&&#40;jim==true&#41;&#41;&#123;

alert&#40;"access granted"&#41;;window.location=GrantedURL&#125; 
else &#123;
suzy=suzy+1;
if &#40;suzy>3&#41;&#123;
alert&#40;"access denied, you will now be taken far away"&#41;;
window.location=DeniedURL &#125;
if &#40;suzy<=3&#41;
alert&#40;"access denied"&#41;;
&#125;
&#125;
function getit&#40;&#41;&#123;
if &#40;document.jim.hidhint.value==""&#41;&#123;
alert&#40;"i\'m sorry "+document.jim.hidname.value+" but it appears you didn\'t answer the hint when you registered"&#41;;&#125;
else if &#40;document.jim.hidhint.value==document.jim.hint.value&#41;&#123;
alert&#40;"your password is "+document.jim.hidpass.value+"."&#41;;&#125;
else &#123;alert&#40;"nope, that's not it"&#41;&#125;
&#125;
//-->

</script>
  <!-- STEP TWO&#58; Place the following in the BODY of your document -->
</p>
<table border=0 cellpadding=8 cellspacing=0 width=550>
  <tr>
    <td align=center colspan=2> 
      <hr noshade>
      <font face="arial" size=4><b>Register here</b></font> 
      <hr noshade>
    </td>
  </tr>
  <tr valign=top> 
    <td bgcolor="#cccccc" width=100> </td>
    <td width=450> 
      <!-- ANOTHER STEP&#58; Set the form action to action="mailto&#58;your email address" -->
      <form name="myForm" method=post action="mailto&#58;your-email-address.com" onSubmit="storeData&#40;this.name, 12,'user,pass,pass1,hint,name'&#41;">
        <hr noshade>
        <font size=3><b>input info here</b></font> 
        <p> 
        <table border=0 cellpadding=2 cellspacing=0>
          <tr valign=bottom> 
            <td><font face="Courier New, Courier" size=2><b>your name</b></font></td>
            <td colspan=3>
              <input name="name" size=30 value="">
            </td>
          </tr>
          <tr valign=bottom> 
            <td><font face="Courier New, Courier" size=2><b>username</b></font></td>
            <td colspan=3>
              <input name="user" size=30 value="">
            </td>
          </tr>
          <tr valign=bottom> 
            <td><font face="Courier New, Courier" size=2><b>password</b></font></td>
            <td colspan=3>
              <input type="password" name="pass" size=30 value="">
            </td>
          </tr>
          <tr> 
            <td><font face="Courier New, Courier" size=2><b>re-enter password</b></font></td>
            <td>
              <input type="password" name="pass1" size=30 value="">
            </td>
          </tr>
          <tr valign=bottom> 
            <td><font face="Arial,Helvetica" size=2><b>password hint answer</b></font></td>
            <td colspan=3>
              <input name="hint" size=30 value="">
              <input type="button" value="see the question" onClick="alert&#40;'your favorite sport is'&#41;" name="button">
            </td>
          </tr>
        </table>
        <hr noshade>
        <p> 
          <input type="submit" value="Submit" name="submit">
          <input type=reset value="Clear" name="reset">
      </form>
      <form name="jim" method=post>
        <hr noshade>
        <font size=3><b>LOGIN</b></font> 
        <p> 
        <table border=0 cellpadding=2 cellspacing=0>
          <tr valign=bottom> 
            <td><font face="Courier New, Courier" size=2><b>username</b></font></td>
            <td colspan=3>
              <input name="user" size=30 value="">
            </td>
          </tr>
          <tr valign=bottom> 
            <td><font face="Courier New, Courier" size=2><b>password</b></font></td>
            <td colspan=3>
              <input type="password" name="pass" size=30 value="">
            </td>
          </tr>
          <input type="hidden" name="hiduser" value="">
          <input type="hidden" name="hidpass" value="">
          <input type="hidden" name="hidname" value="">
          <input type="hidden" name="hidhint" value="">
        </table>
        <hr noshade>
        <p> 
          <input type="button" value="login" onClick="checkpass&#40;&#41;" name="button">
      </form>
  <tr valign=bottom> 
    <td><font face="Courier New, Courier" size=2><b>forgotten password? answer 
      <input type="button" value="this" onClick="alert&#40;'your favorite sport is'&#41;" name="button">
      </b></font></td>
    <td colspan=3>
      <input name="hint" size=30 value="">
      <br>
      <input type="button" value="get password" onClick="getit&#40;&#41;" name="button">
    </td>
  </tr>
</table>
<p>&nbsp;</p><p><font color="#0000FF">ето го и скрипта&#58;</font></p>
<p>&lt;script language=&quot;JavaScript1.2&quot;&gt;</p>
<p><br>
  &lt;!--<br>
  /*<br>
  This header must remain in place</p>
<p>Applies to Security aspect of script only<br>
  Title&#58; Password Protection<br>
  http&#58;//www.thehomeofmummy.com<br>
  Owner&#58; Fire<br>
  http&#58;//www.plebius.org<br>
  */</p>
<p><br>
  var GrantedURL = 'http&#58;//accept.html';<br>
  var DeniedURL = 'http&#58;//dontaccept.html';</p>
<p><br>
  var jim;<br>
  var gotoit;<br>
  suzy=&quot;0&quot;<br>
  var capable;<br>
  var name = navigator.appName.toLowerCase&#40;&#41;;<br>
  var vers = parseFloat&#40;navigator.appVersion&#41;;</p>
<p>if &#40;&#40;name.indexOf&#40;&quot;netscape&quot;&#41; &gt;= 0 &amp;&amp; vers &gt;= 4&#41; || 
  &#40;name.indexOf&#40;&quot;microsoft&quot;&#41; &gt;= 0 &amp;&amp; vers &gt;= 4&#41;&#41;<br>
  capable = true;<br>
  else<br>
  capable = false;</p>
<p>// Constants.</p>
<p>var FLDSEP; // Special characters used as separators in cookie data string.<br>
  var IDXSEP;</p>
<p>if &#40;capable&#41; &#123;<br>
  FLDSEP = String.fromCharCode&#40;1&#41;;<br>
  IDXSEP = String.fromCharCode&#40;2&#41;;<br>
  &#125;</p>
<p>//----------------------------------------------------------------------------<br>
  // Stores data currently entered on a form as cookies. Always returns true.<br>
  //<br>
  // name - The form name.<br>
  // months - Number of months to keep the cookies.<br>
  // exclude - A comma-delimited list of field names that should not be<br>
  // stored. Use to exclude sensitive data such as password,<br>
  // credit card numbers, etc.<br>
  //---------------------------------------------------------------------------- 
</p>
<p>function storeData&#40;name, months, exclude&#41; &#123;</p>
<p> var f;<br>
  var expdate;<br>
  var list, include;<br>
  var i;<br>
  var fld;<br>
  var data;<br>
  if &#40;&#40;document.myForm.pass.value==document.myForm.pass1.value&#41;&amp;&amp;&#40;document.jim.hiduser.value==&quot;&quot;&#41;&amp;&amp;&#40;document.myForm.pass.value!=&quot;&quot;&#41;&#41;&#123;<br>
  name=&quot;jim&quot;;<br>
  document.jim.hidpass.value=document.myForm.pass.value;<br>
  document.jim.hiduser.value=document.myForm.user.value;<br>
  document.jim.hidname.value=document.myForm.name.value;<br>
  document.jim.hidhint.value=document.myForm.hint.value;<br>
  if &#40;!capable&#41;<br>
  return true;</p>
<p> // Get the named form, skip processing if not found.</p>
<p> if &#40;!&#40;f = document.forms&#91;name&#93;&#41;&#41;<br>
  return true;</p>
<p> // Initialize the data field.</p>
<p> // Set the expiration date.</p>
<p> if &#40;months == &quot;&quot;&#41;<br>
  months = 12;<br>
  expdate = new Date&#40;&#41;;<br>
  expdate.setMonth&#40;expdate.getMonth&#40;&#41; + months&#41;;</p>
<p> // Build a list of field names for exclusion.</p>
<p> list = new Array&#40;&#41;;<br>
  if &#40;exclude != &quot;&quot;&#41; &#123;<br>
  i = 0;<br>
  while &#40;&#40;i = exclude.indexOf&#40;&quot;,&quot;&#41;&#41; &gt;= 1&#41; &#123;<br>
  list&#91;list.length&#93; = exclude.substr&#40;0, i&#41;;<br>
  exclude = exclude.substr&#40;i + 1&#41;<br>
  &#125;<br>
  list&#91;list.length&#93; = exclude;<br>
  &#125;</p>
<p> // Run through the fields and add field name/value pairs to the data string.</p>
<p> data = FLDSEP;<br>
  for &#40;i = 0; i &lt; f.length; i++&#41; &#123;<br>
  fld = f.elements&#91;i&#93;;</p>
<p> // Is field in exclusion list?</p>
<p> include = true;<br>
  for &#40;j = 0; j &lt; list.length; j++&#41;<br>
  if &#40;fld.name == list&#91;j&#93;&#41;<br>
  include = false;</p>
<p> if &#40;include&#41; &#123;</p>
<p> // Checkboxes and radio buttons.</p>
<p> if &#40;&#40;fld.type == &quot;checkbox&quot; || fld.type == &quot;radio&quot;&#41; &amp;&amp; 
  fld.checked&#41;<br>
  data += setData&#40;fld.name, fld.value&#41;;</p>
<p> // Selection lists &#40;single&#41;.</p>
<p> if &#40;fld.type == &quot;select-one&quot;&#41;<br>
  if &#40;fld.selectedIndex &gt;= 0&#41;<br>
  data += setData&#40;fld.name, fld.options&#91;fld.selectedIndex&#93;.value&#41;;</p>
<p> // Selection lists &#40;multiple&#41;. Add a unique name/value pair for each selected 
  item.</p>
<p> if &#40;fld.type == &quot;select-multiple&quot;&#41;<br>
  for &#40;j = 0; j &lt; fld.options.length; j++&#41;<br>
  if &#40;fld.options&#91;j&#93;.selected&#41;<br>
  data += setData&#40;fld.name + IDXSEP + j, fld.options&#91;j&#93;.value&#41;;</p>
<p> // Text fields.</p>
<p> if &#40;fld.type == &quot;hidden&quot; || fld.type == &quot;password&quot; || 
  fld.type == &quot;text&quot; || fld.type == &quot;textarea&quot;&#41;<br>
  data += setData&#40;fld.name, fld.value&#41;;<br>
  &#125;<br>
  &#125;</p>
<p> // Set the cookie.</p>
<p> deleteCookie&#40;name&#41;;<br>
  setCookie&#40;name, data, expdate&#41;;<br>
  alert&#40;&quot;user &quot;+document.jim.hiduser.value+&quot; has been added&quot;&#41;;</p>
<p>&#125;<br>
  else if&#40;document.myForm.pass.value==&quot;&quot;||document.myForm.name.value==&quot;&quot;||document.myForm.user.value==&quot;&quot;||document.myForm.hint.value==&quot;&quot;||document.myForm.pass1.value==&quot;&quot;&#41; 
  <br>
  alert&#40;'fill in the form loser'&#41;;<br>
  else alert&#40;&quot;either your passwords don't match or you have registered with 
  us before&quot;&#41;;<br>
  return true;<br>
  &#125;<br>
  //----------------------------------------------------------------------------<br>
  // Retrieves data from the cookie and sets the values in the corresponding<br>
  // form fields. Returns true if data was found, false otherwise.<br>
  //<br>
  // name - The form name.<br>
  //----------------------------------------------------------------------------</p>
<p>function retrieveData&#40;name&#41; &#123;</p>
<p> var f;<br>
  var i, j;<br>
  var fld;<br>
  var s;<br>
  var data;</p>
<p> if &#40;!capable&#41;<br>
  return false;</p>
<p> // Get the named form, return if not found.</p>
<p> if &#40;!&#40;f = document.forms&#91;name&#93;&#41;&#41;<br>
  return false;</p>
<p> // Get the cookie for this form.</p>
<p> data = getCookie&#40;name&#41;;<br>
  if &#40;data == &quot;&quot;&#41;<br>
  return false;</p>
<p> // Run through the fields and retrieve the values.</p>
<p> for &#40;i = 0; i &lt; f.elements.length; i++&#41; &#123;<br>
  fld = f.elements&#91;i&#93;;</p>
<p> // Checkboxes and radio buttons.</p>
<p> if &#40;&#40;fld.type == &quot;checkbox&quot; || fld.type == &quot;radio&quot;&#41; &amp;&amp; 
  &#40;s = getData&#40;fld.name, data&#41;&#41; != null &amp;&amp; fld.value == s&#41;<br>
  fld.checked = true;</p>
<p> // Selection lists &#40;single&#41;.</p>
<p> if &#40;fld.type == &quot;select-one&quot; &amp;&amp; &#40;s = getData&#40;fld.name, data&#41;&#41; 
  != null&#41;<br>
  for &#40;j = 0; j &lt; fld.options.length; j++&#41;<br>
  if &#40;fld.options&#91;j&#93;.value == s&#41;<br>
  fld.options&#91;j&#93;.selected = true;</p>
<p> // Selection lists &#40;multiple&#41;.</p>
<p> if &#40;fld.type == &quot;select-multiple&quot;&#41;<br>
  for &#40;j = 0; j &lt; fld.options.length; j++&#41;<br>
  if &#40;&#40;s = getData&#40;fld.name + IDXSEP + j, data&#41;&#41; != null &amp;&amp; fld.options&#91;j&#93;.value 
  == s&#41;<br>
  fld.options&#91;j&#93;.selected = true;</p>
<p> // Text fields.</p>
<p> if &#40;&#40;fld.type == &quot;hidden&quot; || fld.type == &quot;password&quot; || 
  fld.type == &quot;text&quot; || fld.type == &quot;textarea&quot;&#41; &amp;&amp; 
  &#40;s = getData&#40;fld.name, data&#41;&#41; != null&#41;<br>
  fld.value = s;<br>
  &#125;</p>
<p> return true;<br>
  &#125;</p>
<p>/*****************************************************************************<br>
  * These functions set and retrieve the field name/value pairs stored in the 
  *<br>
  * cookie. *<br>
  *****************************************************************************/</p>
<p>//----------------------------------------------------------------------------<br>
  // Given a field name and value, creates a name/value string that can be<br>
  // appended to the cookie data. A null string is returned if the given value<br>
  // is null.<br>
  //----------------------------------------------------------------------------</p>
<p>function setData&#40;name, value&#41; &#123;</p>
<p> if &#40;value != &quot;&quot;&#41;<br>
  return name + &quot;=&quot; + value + FLDSEP;<br>
  else<br>
  return &quot;&quot;;<br>
  &#125;</p>
<p>//----------------------------------------------------------------------------<br>
  // Given a field name, this function will extract the matching value found<br>
  // in the data string. Null is returned if no match is found.<br>
  //----------------------------------------------------------------------------</p>
<p>function getData&#40;name, data&#41; &#123;</p>
<p> var i, j;<br>
  var s;</p>
<p> if &#40;data == &quot;&quot;&#41;<br>
  return null;</p>
<p> s = FLDSEP + name + &quot;=&quot;;<br>
  i = data.indexOf&#40;s&#41;;<br>
  if &#40;i &gt;= 0&#41; &#123;<br>
  i += s.length;<br>
  j = data.indexOf&#40;FLDSEP, i&#41;;<br>
  if &#40;j &gt;= 0&#41;<br>
  return data.substr&#40;i, j - i&#41;;<br>
  &#125;</p>
<p> return null;<br>
  &#125;</p>
<p>/*****************************************************************************<br>
  * These are the basic functions to set, get and delete a cookie. *<br>
  *****************************************************************************/</p>
<p>//----------------------------------------------------------------------------<br>
  // Set a cookie given a name, value and expiration date.<br>
  //----------------------------------------------------------------------------</p>
<p><br>
  function setCookie &#40;name, value, expires&#41; &#123;</p>
<p> document.cookie = name + &quot;=&quot; + escape&#40;value&#41; + &quot;; expires=&quot; 
  + expires.toGMTString&#40;&#41; + &quot;; path=/&quot;;<br>
  &#125;</p>
<p>//----------------------------------------------------------------------------<br>
  // Returns the value of the named cookie.<br>
  //----------------------------------------------------------------------------</p>
<p>function getCookie&#40;name&#41; &#123;</p>
<p> var search;</p>
<p> search = name + &quot;=&quot;<br>
  offset = document.cookie.indexOf&#40;search&#41; <br>
  if &#40;offset != -1&#41; &#123;<br>
  offset += search.length ;<br>
  end = document.cookie.indexOf&#40;&quot;;&quot;, offset&#41; ;<br>
  if &#40;end == -1&#41;<br>
  end = document.cookie.length;<br>
  return unescape&#40;document.cookie.substring&#40;offset, end&#41;&#41;;<br>
  &#125;<br>
  else<br>
  return &quot;&quot;;<br>
  &#125;</p>
<p>//----------------------------------------------------------------------------<br>
  // Delete the named cookie.<br>
  //----------------------------------------------------------------------------</p>
<p>function deleteCookie&#40;name&#41; &#123;</p>
<p> var expdate = new Date&#40;&#41;; <br>
  expdate.setMonth&#40;expdate.getMonth&#40;&#41; - 1&#41;;<br>
  setCookie&#40;name, &quot;&quot;, expdate&#41;;<br>
  &#125;<br>
  function checkpass&#40;&#41;&#123;<br>
  var bob;<br>
  if &#40;document.jim.hiduser.value==document.jim.user.value&#41;jim=true;<br>
  else jim=false;<br>
  if &#40;document.jim.hidpass.value==document.jim.pass.value&#41;bob=true;<br>
  else bob=false;<br>
  if &#40;&#40;jim==bob&#41;&amp;&amp;&#40;jim==true&#41;&#41;&#123;<br>
  <br>
  alert&#40;&quot;access granted&quot;&#41;;window.location=GrantedURL&#125; <br>
  else &#123;<br>
  suzy=suzy+1;<br>
  if &#40;suzy&gt;3&#41;&#123;<br>
  alert&#40;&quot;access denied, you will now be taken far away&quot;&#41;;<br>
  window.location=DeniedURL &#125;<br>
  if &#40;suzy&lt;=3&#41;<br>
  alert&#40;&quot;access denied&quot;&#41;;<br>
  &#125;<br>
  &#125;<br>
  function getit&#40;&#41;&#123;<br>
  if &#40;document.jim.hidhint.value==&quot;&quot;&#41;&#123;<br>
  alert&#40;&quot;i\'m sorry &quot;+document.jim.hidname.value+&quot; but it appears 
  you didn\'t answer the hint when you registered&quot;&#41;;&#125;<br>
  else if &#40;document.jim.hidhint.value==document.jim.hint.value&#41;&#123;<br>
  alert&#40;&quot;your password is &quot;+document.jim.hidpass.value+&quot;.&quot;&#41;;&#125;<br>
  else &#123;alert&#40;&quot;nope, that's not it&quot;&#41;&#125;<br>
  &#125;<br>
  //--&gt;</p>
<p>&lt;/script&gt;</p>
<p></p>
<p></p>
<p><br>
  &lt;!-- STEP TWO&#58; Place the following in the BODY of your document --&gt;</p>
<p>&lt;BODY onLoad=&quot;retrieveData&#40;'jim'&#41;&quot;&gt;</p>
<p>&lt;table border=0 cellpadding=8 cellspacing=0 width=550&gt;<br>
  &lt;tr&gt;&lt;td align=center colspan=2&gt;<br>
  &lt;hr noshade&gt;<br>
  &lt;font face=&quot;arial&quot; size=4&gt;&lt;b&gt;Register here&lt;/b&gt;&lt;/font&gt;<br>
  &lt;hr noshade&gt;<br>
  &lt;/td&gt;&lt;/tr&gt;<br>
  &lt;tr valign=top&gt;<br>
  &lt;td bgcolor=&quot;#cccccc&quot; width=100&gt; &lt;/td&gt;<br>
  &lt;td width=450&gt;</p>
<p><br>
  &lt;!-- ANOTHER STEP&#58; Set the form action to action=&quot;mailto&#58;your email 
  address&quot; --&gt;<br>
  &lt;form name=&quot;myForm&quot; method=post action=&quot;mailto&#58;your-email-address.com&quot; 
  onSubmit=&quot;storeData&#40;this.name, 12,'user,pass,pass1,hint,name'&#41;&quot;&gt;</p>
<p></p>
<p>&lt;hr noshade&gt;</p>
<p>&lt;font size=3&gt;&lt;b&gt;input info here&lt;/b&gt;&lt;/font&gt;</p>
<p>&lt;p&gt;</p>
<p>&lt;table border=0 cellpadding=2 cellspacing=0&gt;</p>
<p>&lt;tr valign=bottom&gt;</p>
<p> &lt;td&gt;&lt;font face=&quot;Courier New, Courier&quot; size=2&gt;&lt;b&gt;your 
  name&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;<br>
  &lt;td colspan=3&gt;&lt;input name=&quot;name&quot; size=30 value=&quot;&quot;&gt;&lt;/td&gt;</p>
<p>&lt;/tr&gt;<br>
  &lt;tr valign=bottom&gt;</p>
<p> &lt;td&gt;&lt;font face=&quot;Courier New, Courier&quot; size=2&gt;&lt;b&gt;username&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;<br>
  &lt;td colspan=3&gt;&lt;input name=&quot;user&quot; size=30 value=&quot;&quot;&gt;&lt;/td&gt;</p>
<p>&lt;/tr&gt;</p>
<p>&lt;tr valign=bottom&gt;<br>
  &lt;td&gt;&lt;font face=&quot;Courier New, Courier&quot; size=2&gt;&lt;b&gt;password&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;<br>
  &lt;td colspan=3&gt;&lt;input type=&quot;password&quot; name=&quot;pass&quot; 
  size=30 value=&quot;&quot;&gt;&lt;/td&gt;<br>
  &lt;/tr&gt;<br>
  &lt;tr&gt;<br>
  &lt;td&gt;&lt;font face=&quot;Courier New, Courier&quot; size=2&gt;&lt;b&gt;re-enter 
  password&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;<br>
  &lt;td&gt;&lt;input type=&quot;password&quot; name=&quot;pass1&quot; size=30 
  value=&quot;&quot;&gt;&lt;/td&gt;<br>
  &lt;/tr&gt;</p>
<p>&lt;tr valign=bottom&gt;</p>
<p> &lt;td&gt;&lt;font face=&quot;Arial,Helvetica&quot; size=2&gt;&lt;b&gt;password 
  hint answer&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;<br>
  &lt;td colspan=3&gt;&lt;input name=&quot;hint&quot; size=30 value=&quot;&quot;&gt;<br>
  &lt;input type=&quot;button&quot; value=&quot;see the question&quot; onClick=&quot;alert&#40;'your 
  favorite sport is'&#41;&quot;&gt;&lt;/td&gt;<br>
  &lt;/tr&gt;<br>
  &lt;/table&gt;<br>
  &lt;hr noshade&gt;</p>
<p>&lt;p&gt;<br>
  &lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&gt;<br>
  &lt;input type=reset value=&quot;Clear&quot;&gt;</p>
<p><br>
  &lt;/form&gt;</p>
<p>&lt;/font&gt;<br>
  &lt;form name=&quot;jim&quot; method=post&gt;</p>
<p></p>
<p>&lt;hr noshade&gt;<br>
  &lt;font size=3&gt;&lt;b&gt;LOGIN&lt;/b&gt;&lt;/font&gt;<br>
  &lt;p&gt;<br>
  &lt;table border=0 cellpadding=2 cellspacing=0&gt;<br>
  &lt;tr valign=bottom&gt;<br>
  &lt;td&gt;&lt;font face=&quot;Courier New, Courier&quot; size=2&gt;&lt;b&gt;username&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;<br>
  &lt;td colspan=3&gt;&lt;input name=&quot;user&quot; size=30 value=&quot;&quot;&gt;&lt;/td&gt;<br>
  &lt;/tr&gt;</p>
<p>&lt;tr valign=bottom&gt;<br>
  &lt;td&gt;&lt;font face=&quot;Courier New, Courier&quot; size=2&gt;&lt;b&gt;password&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;<br>
  &lt;td colspan=3&gt;&lt;input type=&quot;password&quot; name=&quot;pass&quot; 
  size=30 value=&quot;&quot;&gt;&lt;/td&gt;<br>
  &lt;/tr&gt;<br>
  &lt;input type=&quot;hidden&quot; name=&quot;hiduser&quot; value=&quot;&quot;&gt;<br>
  &lt;input type=&quot;hidden&quot; name=&quot;hidpass&quot; value=&quot;&quot;&gt;<br>
  &lt;input type=&quot;hidden&quot; name=&quot;hidname&quot; value=&quot;&quot;&gt;<br>
  &lt;input type=&quot;hidden&quot; name=&quot;hidhint&quot; value=&quot;&quot;&gt;<br>
  &lt;/table&gt;<br>
  &lt;hr noshade&gt;</p>
<p>&lt;p&gt;<br>
  &lt;input type=&quot;button&quot; value=&quot;login&quot; onClick=&quot;checkpass&#40;&#41;&quot;&gt;</p>
<p>&lt;tr valign=bottom&gt;<br>
  &lt;td&gt;&lt;font face=&quot;Courier New, Courier&quot; size=2&gt;&lt;b&gt;forgotten 
  password? answer &lt;input type=&quot;button&quot; value=&quot;this&quot; onClick=&quot;alert&#40;'your 
  favorite sport is'&#41;&quot;&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;<br>
  &lt;td colspan=3&gt;&lt;input name=&quot;hint&quot; size=30 value=&quot;&quot;&gt;&lt;BR&gt;&lt;input 
  type=&quot;button&quot; value=&quot;get password&quot; onClick=&quot;getit&#40;&#41;&quot;&gt;&lt;/td&gt;<br>
  &lt;/tr&gt;<br>
  &lt;/form&gt;<br>
  &lt;/tr&gt;<br>
  &lt;/table&gt;<br>
</p>
</body>
</html>

Post Reply