פורסם 2007 ביוני 2918 שנים שלום, שתי שאלות פשוטות, אבל לצערי לא הצלחתי לפתור וזה די דחוף..הראשונה, יש לי דף HTML עם כמה כפתורי רדיו (שם הקבוצה - role), איך אני יכול בעזרת Js לוודא שאחד מהכפתורים מסומן?השנייה, איך הולך תנאי מורכב במשפט Select? משהו בסגנון של (select * from XXX where (name=abc AND pass=123? מה הסינטקס המדוייק?תודה רבה!
פורסם 2007 ביוני 3018 שנים קוד בשביל ה SQL >>> SELECT * FROM usersWHERE users.name like '%whatever%' AND users.password like '%whatever%'תשנה רק את שם הטבלאות ואת ה whatever תשאיר את סימני ה % לפני ואחרי השם והסיסמה הם בודקים שהשם הוא במדיוק כמו שהכנסת ולא חלק ממשהו למשלhello ו hello2 יעברו את זה שניהם אם תוריד את ה%
פורסם 2007 ביוני 3018 שנים 1) תחפש בגוגל JS RADIOBOX, אולי תמצא משהו.2)הסינטקס הוא בידיוק מה שרשמת, רק שחסר לך ' מסביב למחרוזות.select * from XXX where name = 'abc' and pass = '123'עריכה: לא כדאי לך לעשות את השאילתא שלך ככה, מכיוון שהיא פרוצה לSQL INJECTIONS.תשלוף את כל הרשומות עם אותו שם משתמש, ותבדוק האם הסיסמא שווה. לדוגמא בASP:sqlcmd = "select pass from XXX where name = 'abc'"set rs = conn.execute(sqlcmd)if not rs.eofif rs("pass") == "123" then'all ok now, the user is logged in..'make sure u save it in session or cookieselse'bad passwordend ifelse'no userend if
פורסם 2007 ביולי 418 שנים מחבר עריכה:תודה רבה, הJS עובד.עכשיו, האם הקוד הבא תקין?pname=request.form("pname") role=request.form("role") team=request.form("team") minH=request.form("minHeight") maxH=request.form("maxHeight") sestr="select * from player where " if pname<>"" then sestr=sestr&"pname='"&pname&"' AND " end if if role<>"" then sestr=sestr&"role='"&role&"' AND " end if if team<>"" then sestr=sestr&"team='"&team&"' AND " end if if minH<>"" then sestr=sestr&"minH>'"&minH&"' AND " end if if maxH<>"" then sestr=sestr&"maxH<'"&maxH&"' AND " end ifכמובן שבהנחה שחותכים את הAND האחרון.. (אם מישהו יגיד לי איך לעשות זאת, זה יהיה נפלא)[br]פורסם בתאריך: 30.06.2007 בשעה 15:17:19סליחה על ההקפצה, אבל זה די לחוץ...זאת השאילתא הסופית, האם היא תקינה?select * from player where pname='fdsa' AND role='sf' AND team='tre' AND minH>'213' AND maxH<'354'
פורסם 2007 ביולי 418 שנים מחבר <html><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1255"></head><body><% pname=request.form("pname") role=request.form("role") team=request.form("team") minH=request.form("minHeight") maxH=request.form("maxHeight") sestr="select * from player where " if pname<>"" then sestr=sestr&"pname='"&pname&"' AND " end if if role<>"" then sestr=sestr&"role='"&role&"' AND " end if if team<>"" then sestr=sestr&"team='"&team&"' AND " end if if minH<>"" then sestr=sestr&"minH>'"&minH&"' AND " end if if maxH<>"" then sestr=sestr&"maxH<'"&maxH&"' AND " end if path=Server.mappath("../DATABASE/db.mdb") Set oConn = Server.createobject("ADODB.Connection") oConn.open "driver={microsoft access driver (*.mdb)}; DBQ="&path set oRs=server.createobject("ADODB.Recordset") mysql="select * from players" oRs.open mysql, oConn ,2, 2 if oRs.eof and oRs. bof then response.write "Player was not found</br>" response.write "<a href = '../html/search player.htm'>Search_again</a>" else response.write "<table border='1%'>" response.write "<tr><td>Name</td><td>Role</td><td>Height</td><td>team</td></tr>" Ors.movefirst do until oRs.eof response.write "<tr>" response.write "<td>"&oRs.fields("pname")&"</td>" role=oRs.fields("role") if role="" then response.write "<td>Unknow</td>" else response.write "<td>"&oRs.fields("role")&"</td>" end if Height=oRs.fields("Height") if Height="" then response.write "<td>Unknow</td>" else response.write "<td>"&oRs.fields("Height")&"</td>" end if team=oRs.fields("team") if team="" then response.write "<td>Unknow</td>" else response.write "<td>"&oRs.fields("team")&"</td>" end if response.write "<td><a href = '../players/"&oRs.fields("pname")&".asp'>player page</a></td>" response.write "</tr>" oRs.movenext loop response.write sestr end if oRs.close set oRs = nothing oConn.close Set oConn = nothing%></div></body></html>
פורסם 2007 ביולי 418 שנים יש לך בעיה של ניגודיות בין שתי הקודים ...באיזה שיטה לשליחת הנתונים מהטופס אתה משתמש ? POST או GETתגיד לנו וכך נוכל יותר טוב לעזור לך....
פורסם 2007 ביולי 418 שנים מחבר POSTאגב, הניגוד בין הקודים הוא שבמשפט חתכתי ידנית את הAND האחרון... אם מישהו יוכל להגיד לי איך אני עושה זאת בASP, מה טוב.
פורסם 2007 ביולי 418 שנים 1path=Server.mappath("../DATABASE/db.mdb")2Set oConn = Server.createobject("ADODB.Connection")3oConn.open "driver={microsoft access driver (*.mdb)}; DBQ="&path4set oRs=server.createobject("ADODB.Recordset")בקוד 1 אין צורך ב-"/...." לפני מיקום מסד הנתוניםרשמת פעמיים את אותו קוד בתוכנית (קוד 2ו-4) תמחק אחד מהם....אין צורך בקוד 3 משום ששם מסד הנתונים מסתיים ב mdb אז מסד הנתונים שייך ל-ACCESS ולכן אין צורך לציין זאת...
פורסם 2007 ביולי 518 שנים 1. כאשר הדף נמצא בתיקיה הראשית והמסד ותיקיה משנית אז צריך לכתוב רק את שם התיקייה ושם המסד....
פורסם 2007 ביולי 518 שנים אתה יכול לעשות משהו כזהsqlcmd = "select * from bla"conds = ""if needMoreCond thenif conds <> "" thenconds = conds & " and"elseconds = " where"end ifconds = conds & " a = condition"end if
פורסם 2007 ביולי 518 שנים מחבר תודה רבה רבה!עכשיו רק נשאר להגביל בJS את ההקלדה בתאים ספציפיים לאותיות/מספרים בלבד, וסיימתי את הכל.
פורסם 2007 ביולי 618 שנים תודה רבה רבה!עכשיו רק נשאר להגביל בJS את ההקלדה בתאים ספציפיים לאותיות/מספרים בלבד, וסיימתי את הכל.פרט יותר......
פורסם 2007 ביולי 618 שנים מחבר יש לי בטופס שני שדות, אחד אמור להכיל רק מספרים, והשני רק אותיות.יש איזשהי פקודה בJS לבדוק את זה, אבל אני לא ממש זוכר אותה...אם מישהו מכיר הוא מוזמן לספר, ואם לא אני אמצא את זה איפשהו...
ארכיון
דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.