General SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesGeneral SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old February 24th, 2003, 07:54 PM
tracis tracis is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 11 tracis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Need to get on with life:

This is the code that is giving me problems below. The first is the cnnection and such, the last part is the form. It is a login page accessing a MySQl database using Javascript and ASP. CAn anyone help me? I REALLY need to get this done


<%
var conn = Server.CreateObject("ADODB.Connection");
conn.Open(MM_test1_STRING);
var user = "" + Request("email");
user = user.replace(/\'/g, "''" );
var pwd = "" + Request("pass");
pwd = pwd.replace( /\'/g, "''" );
var SQL = "SELECT * FROM customers WHERE email = '" + user + "' "
+ " AND password = '" + pwd + "' ";
var RS = conn.Execute( SQL );
if ( RS.EOF )
{
RS.Close();
conn.Close();
Response.Redirect ("login.asp");
}
RS.Close();
conn.Close();
Response.Redirect ("Userpage.asp");
%>

This is the form code:

<form ACTION="Userpage.asp" name="login" method="POST">
<tr valign="center">
<td width="20%"><b>E-Mail Address:</b><br>
<input type="Text" name="email" maxlength="35">
<p><b>Password</b><br>
<input type="password" name="pwd" maxlength="20">
<br><input type="checkbox" name = "remember" value="ON" checked>
Remember me </p>
<p>
<input name="Submit" type="Submit" value="Login">&nbsp;&nbsp;
<INPUT TYPE="RESET">
</p>

Reply With Quote
  #2  
Old February 25th, 2003, 08:09 AM
ramz ramz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Juiz de Fora - MG- Brazil
Posts: 93 ramz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to ramz Send a message via MSN to ramz
I think that you should use something like this, an ASP page instead of using JavaScript, because at your code you're putting JavaScript inside the <% and %> tags...


<%
Dim Conn, Conninfo, strUser, strPass, SQL, RS

Conn = Server.CreateObject("ADODB.Connection")
ConnInfo = "DSN=MyDSN_Name;UID=MyUSER;PWD=MyPASS;"
Conn.Open ConnInfo
strUser = Replace("'","''",Trim(Request.Form("email")))
strPass = Replace("'","''",Trim(Request.Form("pwd")))
SQL = "SELECT * FROM customers WHERE email = '" & strUser & "' AND password = '" & strPass & "'";
Set RS = Conn.Execute(SQL)
if RS.BOF And RS.EOF Then
RS.Close
Conn.Close
Set RS = Nothing
Set Conn = Nothing
Response.Redirect("login.asp")
Else
RS.Close
Conn.Close
Set RS = Nothing
Set Conn = Nothing
Response.Redirect("Userpage.asp")
End If
%>
__________________
Regards,
Ramiro Varandas Jr.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesGeneral SQL Development > Need to get on with life:


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway