Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" %>
- <%@ Import Namespace="System.Data.SqlClient" %>
- <script runat="server">
- string note = "";
- bool IsExists(string name)
- {
- bool flag = false;
- string connString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True";
- SqlConnection conn = new SqlConnection(connString);
- string cmdString = string.Format("SELECT * FROM myTable WHERE (UserName = N'{0}')", name);
- SqlCommand cmd = new SqlCommand(cmdString, conn);
- conn.Open();
- SqlDataReader dr = cmd.ExecuteReader();
- if (dr.HasRows)
- flag = true;
- conn.Close();
- return flag;
- }
- protected void Page_Load(object sender, EventArgs e)
- {
- if (Request.Form["sub"] != null)
- {
- string userName = Request.Form["txtUser"];
- if (IsExists(userName))
- {
- note = "שם משתמש זה כבר תפוס ! אנא הכנס שם משתמש אחר";
- }
- else
- {
- string user = Request.Form["txtUser"].ToString();
- string pass = Request.Form["txtPass"].ToString();
- string email = Request.Form["txtMail"].ToString();
- string year = Request.Form["yearBirth"].ToString();
- string month = Request.Form["monthBirth"].ToString();
- string day = Request.Form["dayBirth"].ToString();
- string mail = Request.Form["txtMail"].ToString();
- string city = Request.Form["city"].ToString();
- string shop = Request.Form["Shop"].ToString();
- string outfit = Request.Form["outfit"].ToString();
- string fashionItem = Request.Form["fashionItem"].ToString();
- string shopVisit = Request.Form["shopVisit"].ToString();
- string Love = Request.Form["Love"].ToString();
- string conStr = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True";
- string cmdStr = string.Format("INSERT INTO myTable(username, password, email, yearB, monthB, dayB, cityAddress, favShop, favOutfit, favFashionItem, ShopVisit, Love, Notes) VALUES (N'{0}', N'{1}', N'{2}', N'{3}', N'{4}', N'{5}', N'{6}', N'{7}', N'{8}', N'{9}', N'{10}', N'{11}', N'{12}')", user, pass, email, year, month, day, city, shop, outfit, fashionItem, shopVisit, Love, Request.Form["notes"].ToString());
- SqlConnection conObject = new SqlConnection(conStr);
- conObject.Open();
- SqlCommand cmdObject = new SqlCommand(cmdStr, conObject);
- cmdObject.ExecuteNonQuery();
- conObject.Close();
- }
- }
- }
- </script>
- <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
- <script type="text/javascript">
- function username() {
- if (document.getElementById("txtUser").value == "") {
- document.getElementById("user").innerHTML = "הכנס שם משתמש";
- return false;
- }
- document.getElementById("user").innerHTML = "";
- return true;
- }
- function password() {
- if (document.getElementById("txtPass").value == "") {
- document.getElementById("pass").innerHTML = "הכנס סיסמא";
- return false;
- }
- document.getElementById("pass").innerHTML = "";
- return true;
- }
- function passConfirmation() {
- if (document.getElementById("txtPassConfirm").value == "") {
- document.getElementById("passConfirm").innerHTML = "הכנס אימות סיסמא";
- return false;
- }
- document.getElementById("passConfirm").innerHTML = "";
- return true;
- }
- function passSimilar() {
- if (document.getElementById("txtPassConfirm").value == document.getElementById("txtPass").value) {
- document.getElementById("passConfirm").innerHTML = "";
- return true;
- }
- document.getElementById("passConfirm").innerHTML = "הסיסמאות אינן זהות";
- return false;
- }
- function year() {
- if (document.getElementById("yearSelect").selectedIndex == 0) {
- document.getElementById("yearCheck").innerHTML = "בחר שנת לידה";
- return false;
- }
- document.getElementById("yearCheck").innerHTML = "";
- return true;
- }
- function month() {
- if (document.getElementById("monthSelect").selectedIndex == 0) {
- document.getElementById("monthCheck").innerHTML = "בחר חודש";
- return false;
- }
- document.getElementById("monthCheck").innerHTML = "";
- return true;
- }
- function day() {
- if (document.getElementById("daySelect").selectedIndex == 0) {
- document.getElementById("dayCheck").innerHTML = "בחר יום";
- return false;
- }
- document.getElementById("dayCheck").innerHTML = "";
- return true;
- }
- function email() {
- var check = document.getElementById("txtMail").value;
- for (var i = 0; i < check.length; i++) {
- if (check.charAt(i) == "@" && check.charAt(0) != "@" && check.indexOf("@") == check.lastIndexOf("@") && check.indexOf(".") > check.indexOf("@") && check.charAt((check.length) - 1) != ".") {
- document.getElementById("mailCheck").innerHTML = "";
- return true;
- }
- }
- document.getElementById("mailCheck").innerHTML = "אימייל לא תקין";
- return false;
- }
- function city() {
- if (document.getElementById("citySelect").selectedIndex == 0) {
- document.getElementById("cityCheck").innerHTML = "בחר עיר";
- return false;
- }
- document.getElementById("cityCheck").innerHTML = "";
- return true;
- }
- function shops() {
- if (document.getElementById("Shop").value == "") {
- document.getElementById("favShop").innerHTML = "לא בחרת חנות מועדפת";
- return false;
- }
- document.getElementById("favShop").innerHTML = "";
- return true;
- }
- function outfit() {
- if (document.getElementById("outfitSelect").selectedIndex == 0) {
- document.getElementById("favOutfit").innerHTML = "לא בחרת פריט לבוש מועדף";
- return false;
- }
- document.getElementById("favOutfit").innerHTML = "";
- return true;
- }
- function item() {
- if (document.getElementById("fashionItemSelect").selectedIndex == 0) {
- document.getElementById("favFashionItem").innerHTML = "לא בחרת אביזר אופנה מועדף";
- return false;
- }
- document.getElementById("favFashionItem").innerHTML = "";
- return true;
- }
- function shopV() {
- if (document.getElementById("shopVisit").selectedIndex == 0) {
- document.getElementById("checkShopVisit").innerHTML = "לא בחרת";
- return false;
- }
- document.getElementById("checkShopVisit").innerHTML = "";
- return true;
- }
- function loveYesNO() {
- if (document.getElementById("yesLove").checked == true || document.getElementById("noLove").checked) {
- document.getElementById("shopsLike").innerHTML = "תודה על בחירתך";
- return true;
- }
- document.getElementById("shopsLike").innerHTML = "בחר בבקשה";
- return false;
- }
- function page() {
- a = username();
- b = password();
- c = passSimilar();
- d = passConfirmation();
- e = year();
- f = month();
- g = day();
- h = email();
- i = city();
- j = shops();
- k = outfit();
- l = item();
- m = shopV();
- n = loveYesNO();
- if (a == true && b == true && c == true && d == true && e == true && f == true && g == true && h == true && i == true && j == true && k == true && l == true && m == true && n == true) {
- return true;
- }
- return false;
- }
- </script>
- <form method="post" action="Register.aspx" dir="rtl" onsubmit="return page()" ><center>
- <table width="550">
- <tr align="center">
- <td colspan="2"><h1>הרשמה</h1><br /><br />
- </td>
- </tr>
- <tr>
- <td>שם משתמש:</td>
- <td><input type="text" id="txtUser" name="txtUser" /></td>
- <td id="user"></td>
- </tr>
- <tr>
- <td>סיסמא:</td>
- <td><input type="password" id="txtPass" name="txtPass" /></td>
- <td id="pass"></td>
- </tr>
- <tr>
- <td>אימות סיסמא:</td>
- <td><input type="password" id="txtPassConfirm" name="txtPassConfirm"/></td>
- <td id="passConfirm"></td>
- </tr>
- <tr>
- <td>שנת לידה</td>
- <td><select id="yearSelect" name="yearBirth">
- <option>בחר שנת לידה</option>
- <option>1960</option>
- <option>1961</option>
- <option>1962</option>
- <option>1963</option>
- <option>1964</option>
- <option>1965</option>
- <option>1966</option>
- <option>1967</option>
- <option>1968</option>
- <option>1969</option>
- <option>1970</option>
- <option>1971</option>
- <option>1972</option>
- <option>1973</option>
- <option>1974</option>
- <option>1975</option>
- <option>1976</option>
- <option>1977</option>
- <option>1978</option>
- <option>1979</option>
- <option>1980</option>
- <option>1981</option>
- <option>1982</option>
- <option>1983</option>
- <option>1984</option>
- <option>1985</option>
- <option>1986</option>
- <option>1987</option>
- <option>1988</option>
- <option>1989</option>
- <option>1990</option>
- <option>1991</option>
- <option>1992</option>
- <option>1993</option>
- <option>1994</option>
- <option>1995</option>
- <option>1996</option>
- <option>1997</option>
- <option>1998</option>
- <option>1999</option>
- <option>2000</option>
- <option>2001</option>
- <option>2002</option>
- <option>2003</option>
- <option>2004</option>
- <option>2005</option>
- <option>2006</option>
- <option>2007</option>
- <option>2008</option>
- <option>2009</option>
- <option>2010</option>
- <option>2011</option>
- <option>2012</option>
- <option>2013</option>
- <option>2014</option>
- <option>2015</option>
- <option>2016</option>
- </select></td>
- <td id="yearCheck"></td>
- </tr>
- <tr>
- <td>חודש</td>
- <td><select id="monthSelect" name="monthBirth">
- <option>בחר חודש</option>
- <option>1</option>
- <option>2</option>
- <option>3</option>
- <option>4</option>
- <option>5</option>
- <option>6</option>
- <option>7</option>
- <option>8</option>
- <option>9</option>
- <option>10</option>
- <option>11</option>
- <option>12</option>
- </select></td>
- <td id="monthCheck"></td>
- </tr>
- <tr>
- <td>יום</td>
- <td><select id="daySelect" name="dayBirth">
- <option>בחר יום</option>
- <option>1</option>
- <option>2</option>
- <option>3</option>
- <option>4</option>
- <option>5</option>
- <option>6</option>
- <option>7</option>
- <option>8</option>
- <option>9</option>
- <option>10</option>
- <option>11</option>
- <option>12</option>
- <option>13</option>
- <option>14</option>
- <option>15</option>
- <option>16</option>
- <option>17</option>
- <option>18</option>
- <option>19</option>
- <option>20</option>
- <option>21</option>
- <option>22</option>
- <option>23</option>
- <option>24</option>
- <option>25</option>
- <option>26</option>
- <option>27</option>
- <option>28</option>
- <option>29</option>
- <option>30</option>
- </select></td>
- <td id="dayCheck"></td>
- </tr>
- <tr>
- <td>אימייל:</td>
- <td><input type="text" id="txtMail" name="txtMail"/></td>
- <td id="mailCheck"></td>
- </tr>
- <tr>
- <td>עיר:</td>
- <td><select id="citySelect" name="city">
- <option>בחר עיר</option>
- <option>תל אביב</option>
- <option>חולון</option>
- <option>רעננה</option>
- <option>חיפה</option>
- <option>ראשלצ</option>
- <option>ירושלים</option>
- <option>בת ים</option>
- <option>נתניה</option>
- <option>אשדוד</option>
- <option>אשקלון</option>
- <option>טבריה</option>
- <option>אחר</option>
- </select></td>
- <td id="cityCheck"></td>
- </tr>
- <tr>
- <td>
- חנות בגדים מועדפת:
- </td>
- <td>
- <input type="text" id="Shop" name="Shop"/>
- </td>
- <td id="favShop"></td>
- </tr>
- <tr>
- <td>פריט לבוש אהוב : </td>
- <td><select id="outfitSelect" name="outfit" >
- <option>בחר פריט לבוש אהוב</option>
- <option>חולצה</option>
- <option>מכנס</option>
- <option>חצאית</option>
- <option>שמלה</option>
- <option>ג'קט</option>
- <option>נעליים</option>
- <option>אחר</option>
- </select></td>
- <td id="favOutfit"></td>
- </tr>
- <tr>
- <td>אביזר אופנה מועדף : </td>
- <td><select id="fashionItemSelect" name="fashionItem">
- <option>בחר אביזר אופנה מועדף</option>
- <option>תיק</option>
- <option>צעיף</option>
- <option>כובע</option>
- <option>טבעת</option>
- <option>צמיד</option>
- <option>שרשרת</option>
- <option>שעון</option>
- <option>אחר</option>
- </select></td>
- <td id="favFashionItem"></td>
- </tr>
- <tr>
- <td>בכמה חנויות בגדים היית בשבוע האחרון(בערך) ?</td>
- <td><select id="shopVisit" name="shopVisit">
- <option>בחר</option>
- <option>0</option>
- <option>1</option>
- <option>2</option>
- <option>3</option>
- <option>4</option>
- <option>5</option>
- <option>6</option>
- <option>7</option>
- <option>8</option>
- <option>9</option>
- <option>יותר</option>
- </select></td>
- <td id="checkShopVisit"></td>
- </tr>
- <tr>
- <td>האם אתה אוהב את החנויות שמפורסמות באתר זה ?</td>
- <td>
- כן<input type="radio" id="yesLove" name="Love" value="yes"/>
- לא<input type="radio" id="noLove" name="Love" value="no"/>
- </td>
- <td id="shopsLike"></td>
- </tr>
- <tr>
- <td>הערות על האתר</td>
- <td><textarea id="area" name="notes" rows="5" cols="25"></textarea></td>
- </tr>
- <tr align="center">
- <td colspan="2"><input name="sub" type="submit" id="send" value="שלח"/> <input type="reset" id="reset" /></td>
- </tr>
- <tr>
- <td colspan="2"><%=note %></td>
- </tr>
- </table>
- </center>
- </form>
- </asp:Content>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement