User Login with JQUERY and ASP
I have this jquery mobile page designed with asp classic. when i test and
i try to login it bounces me back to the login page again instead of
taking me to the index page of the authenticated user. Here's my code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/VT.asp" -->
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString <> "" Then MM_LoginAction = MM_LoginAction +
"?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername = CStr(Request.Form("username"))
If MM_valUsername <> "" Then
Dim MM_fldUserAuthorization
Dim MM_redirectLoginSuccess
Dim MM_redirectLoginFailed
Dim MM_loginSQL
Dim MM_rsUser
Dim MM_rsUser_cmd
MM_fldUserAuthorization = ""
MM_redirectLoginSuccess = "source.asp"
MM_redirectLoginFailed = "error.asp"
MM_loginSQL = "SELECT Username, Password"
If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL &
"," & MM_fldUserAuthorization
MM_loginSQL = MM_loginSQL & " FROM dbo.Test_Register_Users WHERE
Username = ? AND Password = ?"
Set MM_rsUser_cmd = Server.CreateObject ("ADODB.Command")
MM_rsUser_cmd.ActiveConnection = MM_VT_STRING
MM_rsUser_cmd.CommandText = MM_loginSQL
MM_rsUser_cmd.Parameters.Append
MM_rsUser_cmd.CreateParameter("param1", 200, 1, 70,
MM_valUsername) ' adVarChar
MM_rsUser_cmd.Parameters.Append
MM_rsUser_cmd.CreateParameter("param2", 200, 1, 50,
Request.Form("password")) ' adVarChar
MM_rsUser_cmd.Prepared = true
Set MM_rsUser = MM_rsUser_cmd.Execute
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") =
CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(Request.QueryString("accessdenied")) <> "" And true Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css"
rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"
type="text/javascript"></script>
<script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"
type="text/javascript"></script>
</head>
<body>
<div data-role="page" id="page">
<div data-role="header">
<h1>Header</h1>
</div>
<div data-role="content">
<form id="form1" name="form1" method="POST" action="login_code.asp">
<table width="325" border="0" cellpadding="3" cellspacing="3">
<tr>
<td width="94"> </td>
<td width="210"> </td>
</tr>
<tr>
<td>Username</td>
<td><input type="text" name="username" id="username" /></td>
</tr>
<tr>
<td>Password</td>
<td><input type="text" name="password" id="password" /></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="button" id="button" value="Submit" />
</div></td>
</tr>
</table>
</form>
</div>
<div data-role="footer">
<h4>Footer</h4>
</div>
</div>
</body>
</html>
Thursday, 3 October 2013
Wednesday, 2 October 2013
Simple query to search a terms in MySQL
Simple query to search a terms in MySQL
I build a little search input in my site, its kind of working, the problem
is that it show all the items as results, so it isnt really searching, it
just throw all the table..
my query look like this
// Get page data
$query1 = "SELECT id,tienda,descripcion,local,img FROM $tableName WHERE
tienda LIKE '%$term%' ";
$result = mysql_query($query1)or die(mysql_error());
if i remove the % symbol of $term , then i got "no results" , so what am i
missing.
What i need is to search for exact and partial coincidences, for example,
"Go" should throw "google" as result..
thanks,
I build a little search input in my site, its kind of working, the problem
is that it show all the items as results, so it isnt really searching, it
just throw all the table..
my query look like this
// Get page data
$query1 = "SELECT id,tienda,descripcion,local,img FROM $tableName WHERE
tienda LIKE '%$term%' ";
$result = mysql_query($query1)or die(mysql_error());
if i remove the % symbol of $term , then i got "no results" , so what am i
missing.
What i need is to search for exact and partial coincidences, for example,
"Go" should throw "google" as result..
thanks,
Pasting text from clipboard to Firefox and Chrome
Pasting text from clipboard to Firefox and Chrome
I am using this function that pastes text from clipboard into multiple
text fields.
function pasteFromClipboard(className) {
var data = window.clipboardData.getData('Text');
if (data != null) {
var cells = data.split('\n');
var columns = $$('.'+className);
for (i = 0; i < cells.length; i++) {
if ( columns[i] != undefined ){
columns[i].value = cells[i];
}
}
}
}
This stuff that is attached to button via "onClick" works in IE, but not
in FF or Chrome. Now I know FF restricts access to clip, but I have
manipulated the values in preferences with no success.
Can anyone help me out with this functionality, so it would work in Chrome?
Best regards, no9
I am using this function that pastes text from clipboard into multiple
text fields.
function pasteFromClipboard(className) {
var data = window.clipboardData.getData('Text');
if (data != null) {
var cells = data.split('\n');
var columns = $$('.'+className);
for (i = 0; i < cells.length; i++) {
if ( columns[i] != undefined ){
columns[i].value = cells[i];
}
}
}
}
This stuff that is attached to button via "onClick" works in IE, but not
in FF or Chrome. Now I know FF restricts access to clip, but I have
manipulated the values in preferences with no success.
Can anyone help me out with this functionality, so it would work in Chrome?
Best regards, no9
VB.NET Adding Interactive User Account to folder permissions
VB.NET Adding Interactive User Account to folder permissions
I am having a little problem, adding a user to a folders permission, the
account in question is a SCCM account "Interactive" in which the account
is used when deploying an application.
I have looked about and not found anything apart from adding a system
account (Authenticated user using a SID) and to get the permissions to
inherit from a parent.
Any help of examples would be greatly appreciated.
AntonSK
I am having a little problem, adding a user to a folders permission, the
account in question is a SCCM account "Interactive" in which the account
is used when deploying an application.
I have looked about and not found anything apart from adding a system
account (Authenticated user using a SID) and to get the permissions to
inherit from a parent.
Any help of examples would be greatly appreciated.
AntonSK
Processing Dynamic Form
Processing Dynamic Form
I've a JS dynamic form, where i can add or remove fields:
Field 1
Field 2
Field 3
Field 4
Now if I remove Field 2 and add a new field:
Field 1
Field 3
Field 4
Field 5
K, I'm sending this through Ajax POST inside a form element. My problem is
server side PHP processing...how can I know how many fields I have insde
$_POST array and what are their ids? I'm generating unique id using
"field" + counterIndex, but following the example how can I be able to
understand that I have a total of 4 fields and that number 2 is missing?
By the way, inside the form I have static fields too.
I've a JS dynamic form, where i can add or remove fields:
Field 1
Field 2
Field 3
Field 4
Now if I remove Field 2 and add a new field:
Field 1
Field 3
Field 4
Field 5
K, I'm sending this through Ajax POST inside a form element. My problem is
server side PHP processing...how can I know how many fields I have insde
$_POST array and what are their ids? I'm generating unique id using
"field" + counterIndex, but following the example how can I be able to
understand that I have a total of 4 fields and that number 2 is missing?
By the way, inside the form I have static fields too.
Tuesday, 1 October 2013
Connecting to Amazon RDS instance through EC2 instance using MySQL Workbench
Connecting to Amazon RDS instance through EC2 instance using MySQL Workbench
I AWS I have a VPC set up with a Bastion Host. The bastion host is a
single EC2 instance with a public address trough which you can SSH to any
other server on the VPC.
I have created an RDS MySQL instance within the VPC and I would like to
connect to it using MySQL workbench. I have followed the steps detailed
here, however in "Step 6: Setting up remote SSH Configuration", it asks me
to "Provide the Public DNS of the Amazon EC2 instance" (i.e. the bastion
host).
MySQL workbench then does checks for certain MySQL resources on that
server. However, this is not correct in my opinion as I have provided the
bastion host's address, which does not have MySQL installed. As a result,
the last two checks for "Check location of start/stop commands" and "Check
MySQL configuration file" then fail.
I have then tried using the endpoint address of the RDS MySQL instance but
with no success (as it is in the private subnet so is not publicly
addressable).
It seems that many people have this up and running, but what am I doing
wrong here?
I AWS I have a VPC set up with a Bastion Host. The bastion host is a
single EC2 instance with a public address trough which you can SSH to any
other server on the VPC.
I have created an RDS MySQL instance within the VPC and I would like to
connect to it using MySQL workbench. I have followed the steps detailed
here, however in "Step 6: Setting up remote SSH Configuration", it asks me
to "Provide the Public DNS of the Amazon EC2 instance" (i.e. the bastion
host).
MySQL workbench then does checks for certain MySQL resources on that
server. However, this is not correct in my opinion as I have provided the
bastion host's address, which does not have MySQL installed. As a result,
the last two checks for "Check location of start/stop commands" and "Check
MySQL configuration file" then fail.
I have then tried using the endpoint address of the RDS MySQL instance but
with no success (as it is in the private subnet so is not publicly
addressable).
It seems that many people have this up and running, but what am I doing
wrong here?
Is it possible to redirect to ssl and non www at the same time?
Is it possible to redirect to ssl and non www at the same time?
I have a developer account and the setup is different from a typical host.
With this provider, each domain is allocated an app. 4 domains:
https://example.com https://www.example.com http://example.com
http://www.example.com
The chosen "main" domain is the top one, https://example.com. So, in my
host login panel, I have allocated the website "app" to
https://example.com while the remaining 3 are allocated "redirect" apps.
For the non ssl http domains I have used:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
The purpose of this is to just redirect to ssl. This seems to work fine.
Then, for the www version, which I'd like to redirect to non www version,
I have used:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
Does not work. But, in additon to figuring that out, what I'd really like
is to have the 3 domain variants all served by the same .htaccess file
with 2 purposes: redirect to ssl and to non www version. Is this possible?
I have a developer account and the setup is different from a typical host.
With this provider, each domain is allocated an app. 4 domains:
https://example.com https://www.example.com http://example.com
http://www.example.com
The chosen "main" domain is the top one, https://example.com. So, in my
host login panel, I have allocated the website "app" to
https://example.com while the remaining 3 are allocated "redirect" apps.
For the non ssl http domains I have used:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
The purpose of this is to just redirect to ssl. This seems to work fine.
Then, for the www version, which I'd like to redirect to non www version,
I have used:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
Does not work. But, in additon to figuring that out, what I'd really like
is to have the 3 domain variants all served by the same .htaccess file
with 2 purposes: redirect to ssl and to non www version. Is this possible?
Cannot access Cisco ASA-5505 ASDN
Cannot access Cisco ASA-5505 ASDN
I just got my network up-and-running. I would like the ASDN for some of my
minions to be able to make minor changes without the need to contact me.
This said, I have tried to enable it, and access it, and it seems that I
have mis-configured it. Can anyone see what is wrong with the following
config, that I can't access ASDM through 10.1.10.100??
interface Ethernet0/0
switchport access vlan 2
!
interface Ethernet0/1
!
interface Ethernet0/2
!
interface Ethernet0/3
!
interface Ethernet0/4
!
interface Ethernet0/5
!
interface Ethernet0/6
!
interface Ethernet0/7
!
interface Vlan1
nameif inside
security-level 100
ip address 10.1.10.100 255.255.255.0
!
interface Vlan2
nameif outside
security-level 0
ip address 74.9xx.xx.225 255.255.255.248
!
ftp mode passive
pager lines 24
logging asdm informational
mtu inside 1500
mtu outside 1500
icmp unreachable rate-limit 1 burst-size 1
no asdm history enable
arp timeout 14400
global (outside) 1 interface
nat (inside) 1 0.0.0.0 0.0.0.0
route outside 0.0.0.0 0.0.0.0 74.xx.xx.230 1
timeout xlate 3:00:00
timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 icmp 0:00:02
timeout sunrpc 0:10:00 h323 0:05:00 h225 1:00:00 mgcp 0:05:00 mgcp-pat
0:05:00
timeout sip 0:30:00 sip_media 0:02:00 sip-invite 0:03:00 sip-disconnect
0:02:00
timeout sip-provisional-media 0:02:00 uauth 0:05:00 absolute
timeout tcp-proxy-reassembly 0:01:00
timeout floating-conn 0:00:00
dynamic-access-policy-record DfltAccessPolicy
http server enable
http 10.1.10.0 255.255.255.0 inside
no snmp-server location
no snmp-server contact
snmp-server enable traps snmp authentication linkup linkdown coldstart
crypto ipsec security-association lifetime seconds 28800
crypto ipsec security-association lifetime kilobytes 4608000
telnet timeout 5
ssh timeout 5
console timeout 0
dhcpd dns 75.75.75.75 75.75.76.76
dhcpd auto_config outside
!
dhcpd address 10.1.10.104-10.1.10.254 inside
dhcpd enable inside
!
threat-detection basic-threat
threat-detection statistics access-list
no threat-detection statistics tcp-intercept
webvpn
!
class-map inspection_default
match default-inspection-traffic
!
!
policy-map type inspect dns preset_dns_map
parameters
message-length maximum client auto
message-length maximum 512
policy-map global_policy
class inspection_default
inspect dns preset_dns_map
inspect ftp
inspect h323 h225
inspect h323 ras
inspect rsh
inspect rtsp
inspect esmtp
inspect sqlnet
inspect skinny
inspect sunrpc
inspect xdmcp
inspect sip
inspect netbios
inspect tftp
inspect ip-options
!
From what I gather .. I should be able to access it from anywhere on the
network? What am I missing?
I just got my network up-and-running. I would like the ASDN for some of my
minions to be able to make minor changes without the need to contact me.
This said, I have tried to enable it, and access it, and it seems that I
have mis-configured it. Can anyone see what is wrong with the following
config, that I can't access ASDM through 10.1.10.100??
interface Ethernet0/0
switchport access vlan 2
!
interface Ethernet0/1
!
interface Ethernet0/2
!
interface Ethernet0/3
!
interface Ethernet0/4
!
interface Ethernet0/5
!
interface Ethernet0/6
!
interface Ethernet0/7
!
interface Vlan1
nameif inside
security-level 100
ip address 10.1.10.100 255.255.255.0
!
interface Vlan2
nameif outside
security-level 0
ip address 74.9xx.xx.225 255.255.255.248
!
ftp mode passive
pager lines 24
logging asdm informational
mtu inside 1500
mtu outside 1500
icmp unreachable rate-limit 1 burst-size 1
no asdm history enable
arp timeout 14400
global (outside) 1 interface
nat (inside) 1 0.0.0.0 0.0.0.0
route outside 0.0.0.0 0.0.0.0 74.xx.xx.230 1
timeout xlate 3:00:00
timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 icmp 0:00:02
timeout sunrpc 0:10:00 h323 0:05:00 h225 1:00:00 mgcp 0:05:00 mgcp-pat
0:05:00
timeout sip 0:30:00 sip_media 0:02:00 sip-invite 0:03:00 sip-disconnect
0:02:00
timeout sip-provisional-media 0:02:00 uauth 0:05:00 absolute
timeout tcp-proxy-reassembly 0:01:00
timeout floating-conn 0:00:00
dynamic-access-policy-record DfltAccessPolicy
http server enable
http 10.1.10.0 255.255.255.0 inside
no snmp-server location
no snmp-server contact
snmp-server enable traps snmp authentication linkup linkdown coldstart
crypto ipsec security-association lifetime seconds 28800
crypto ipsec security-association lifetime kilobytes 4608000
telnet timeout 5
ssh timeout 5
console timeout 0
dhcpd dns 75.75.75.75 75.75.76.76
dhcpd auto_config outside
!
dhcpd address 10.1.10.104-10.1.10.254 inside
dhcpd enable inside
!
threat-detection basic-threat
threat-detection statistics access-list
no threat-detection statistics tcp-intercept
webvpn
!
class-map inspection_default
match default-inspection-traffic
!
!
policy-map type inspect dns preset_dns_map
parameters
message-length maximum client auto
message-length maximum 512
policy-map global_policy
class inspection_default
inspect dns preset_dns_map
inspect ftp
inspect h323 h225
inspect h323 ras
inspect rsh
inspect rtsp
inspect esmtp
inspect sqlnet
inspect skinny
inspect sunrpc
inspect xdmcp
inspect sip
inspect netbios
inspect tftp
inspect ip-options
!
From what I gather .. I should be able to access it from anywhere on the
network? What am I missing?
find command in linux unix.stackexchange.com
find command in linux – unix.stackexchange.com
I was told by my friend that one can work with -r switch to find files
recursively in directories and subdirectories.Please tell me the error in
the given statement it does not work find / -type f -r …
I was told by my friend that one can work with -r switch to find files
recursively in directories and subdirectories.Please tell me the error in
the given statement it does not work find / -type f -r …
Subscribe to:
Comments (Atom)