Untitled
unknown
plain_text
a year ago
12 kB
6
Indexable
<%@ Page Title="" Language="C#" MasterPageFile="~/Existence.Master" AutoEventWireup="true" CodeBehind="updateUser.aspx.cs" Inherits="FinalProject_NoamGamzu.updateUser" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> <script> function chkForm() { //--- שם משתמש קצר מדי או לא קיים --- var uName = document.getElementById("uName").value; if (uName.length < 2) { document.getElementById("mUName").value = "שם משתמש קצר מדי "; document.getElementById("mUName").style.display = "inline"; return false; } else document.getElementById("mUName").style.display = "none"; //--- שם פרטי קצר מדי או לא קיים --- var fName = document.getElementById("fName").value; if (fName.length < 2) { document.getElementById("mFName").value = "שם פרטי קצר מדי או לא קיים "; document.getElementById("mFName").style.display = "inline"; return false; } else document.getElementById("mFName").style.display = "none"; //--- שם משפחה קצר מדי או לא קיים --- var lName = document.getElementById("lName").value; if (lName.length < 2) { document.getElementById("mLName").value = "שם משפחה קצר מדי או לא קיים "; document.getElementById("mLName").style.display = "inline"; return false; } else document.getElementById("mLName").style.display = "none"; var yCity = document.getElementById("yCity").value; if (yCity.length < 2) { document.getElementById("mYCity").value = "שם עיר קצר מדי או לא קיים "; document.getElementById("mYCity").style.display = "inline"; return false; } else document.getElementById("mYCity").style.display = "none"; var yCountry = document.getElementById("yCountry").value; if (yCountry.length < 2) { document.getElementById("mYCountry").value = "שם מדינה קצר מדי או לא קיים "; document.getElementById("mYCountry").style.display = "inline"; return false; } else document.getElementById("mYCountry").style.display = "none"; var email = document.getElementById("email").value; var atSign = email.indexOf('@'); var dotSign = email.indexOf('.', atSign); function isHebres(email) { var len = email.length; var i = 0, ch; while (i < len) { ch = email.charAt(i); if (ch >= 'א' && ch <= 'ת') { return false; } i++; } return true; } if (email.length > 30 || email.length < 6) { document.getElementById("mEMail").value = "כתובת אימייל קצרה או ארוכה מדי "; document.getElementById("mEMail").style.display = "inline"; return false; } else if (atSign == -1) { document.getElementById("mEMail").value = "סימן @ לא קיים בכתובת"; document.getElementById("mEMail").style.display = "inline"; return false; } // בודק אם @ נמצא באינדקס באימייל else if (atSign != email.lastIndexOf('@')) { document.getElementById("mEMail").value = "אסור יותר מ@ אחד באימייל"; document.getElementById("mEMail").style.display = "inline"; return false; } //בודק אם ה@ הראשון זה גם ה@ האחרון else if (atSign < 2 || email.lastIndexOf('@') == email.length - 1) { document.getElementById("mEMail").value = "סימן ה@ אינו יכול להיות במקום הראשון או השני או אחרון"; document.getElementById("mEMail").style.display = "inline"; return false; } // בודק אם ה@ בכתובת אימייל בשני האותיות הראשונות או ה@ האחרון שווה לאורך האימייל פחות אחד else if (email.indexOf('.') == 0 || email.lastIndexOf('.') == email.length - 1) { document.getElementById("mEMail").value = "הנקודה לא יכול להיות במקום הראשון או אחרון"; document.getElementById("mEMail").style.display = "inline"; return false; } // בודק אם הנקודה במקום הראשון או אחרון else if (dotSign - atSign < 2) { document.getElementById("mEMail").value = "הנקודה חייבת להיות לפחות 2 תווים לאחר ה@ באימייל"; document.getElementById("mEMail").style.display = "inline"; return false; } // מחסר את האינדקס של מיקום הנקודה ומיקום ה@ ובודק עם הההפרש את הרווח ביניהם else if (!isHebres(email)) { document.getElementById("mEMail").value = "כתובת אימייל לא יכולה להכיל עברית"; document.getElementById("mEMail").style.display = "inline"; return false; } else { document.getElementById("mEMail").style.display = "none"; } var password = document.getElementById("password").value; if (password.length < 6) { document.getElementById("mPassword").value = "הסיסמא חייבת להיות מעל 6 תווים. "; document.getElementById("mPassword").style.display = "inline"; return false; } else document.getElementById("mPassword").style.display = "none"; var cPassword = document.getElementById("cPassword").value; if (cPassword != password) { document.getElementById("mCPassword").value = "סיסמאות לא תואמות"; document.getElementById("mCPassword").style.display = "inline"; return false; } else { document.getElementById("mCPassword").style.display = "none"; } var YearBorn = document.getElementById("YearBorn").value; var d = new Date(); var year = d.getFullYear(); if (YearBorn.length < 4) { document.getElementById("mYearBorn").value = "שנת לידה חייבת לכלול לפחות 4 מספרים"; document.getElementById("mYearBorn").style.display = "inline"; mYearBorn.size = 100; return false; } else if (isNaN(YearBorn)) { document.getElementById("mYearBorn").value = "שנת לידה בנוייה ממספרים"; document.getElementById("mYearBorn").style.display = "inline"; mYearBorn.size = 100; return false; } else if (YearBorn < 1900) { document.getElementById("mYearBorn").value = "שנת לידדה חייבת להיות מעל 1900"; document.getElementById("mYearBorn").style.display = "inline"; mYearBorn.size = 100; return false; } else if (YearBorn > year - 5) { document.getElementById("mYearBorn").value = "צעיר מדי בשביל להרשם לאתר"; document.getElementById("mYearBorn").style.display = "inline"; mYearBorn.size = 100; return false; } else document.getElementById("mYearBorn").style.display = "none"; } </script> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <link href="css/StyleSheet.css" rel="stylesheet" type="text/css" /> <center><h1>עדכן פרטים</h1></center> <%=msg %> <form method="post" runat="server" onsubmit="return chkForm();"> <table> <tr> <td>שם פרטי</td> <td><input type="text" id="fName" name="fName" value="<%= fName %>" /></td> <td><input type="text" id="mFName" size="30" style="display:none; background-color:silver; font-weight:bold;" disabled="disabled" /></td> </tr> <tr> <td>שם משפחה</td> <td><input type="text" id="lName" name="lName" value="<%= lName %>" /></td> <td><input type="text" id="mLName" size="30" style="display:none; background-color:silver; font-weight:bold;" disabled="disabled" /></td> </tr> <tr> <td>מדינה</td> <td><input type="text" id="yCountry" size="40" name="yCountry" value="<%= yCountry %>" /></td> <td><input type="text" id="mYCountry" size="30" style="display:none;background-color:silver;font-weight:bold;" disabled="disabled" /></td> </tr> <tr> <td>עיר</td> <td><input type="text" id="yCity" size="40" name="yCity" value="<%= yCity %>" /></td> <td><input type="text" id="mYCity" size="30" style="display:none;background-color:silver;font-weight:bold;" disabled="disabled" /></td> </tr> <tr> <td>כתובת דוא"ל</td> <td><input type="email" id="email" name="email" size="40" value="<%= email %>" /></td> <td><input type="text" id="mEMail" size="30" style="display:none;background-color:silver;font-weight:bold;" disabled="disabled" /></td> </tr> <tr> <td>סיסמא</td> <td><input type="password" name="password" id="password" size="10" value="<%= password %>" /></td> <td><input type="text" name="mPassword" id="mPassword" style="display:none;background-color:black;color:white;font-weight:bold;" disabled="disabled" /></td> </tr> <tr> <td>אימות סיסמא</td> <td><input type="password" name="cPassword" id="cPassword" size="10" value="<%= password %>" /></td> <td><input type="text" name="mCPassword" id="mCPassword" style="display:none;background-color:black;color:white;font-weight:bold;" disabled="disabled" /></td> </tr> <tr> <td>שנת לידה</td> <td><input type="number" id="YearBorn" name="YearBorn" size="40" value="<%= YearBorn %>" /></td> <td><input type="text" id="mYearBorn" size="4" style="display:none;background-color:silver;font-weight:bold;" disabled="disabled" /></td> </tr> <tr> <td colspan="2" style="text-align:center;"> <input type="submit" name="submit" value="עדכן" /> </td> </tr> </table> </form> </asp:Content>
Editor is loading...
Leave a Comment