JavaScript Form Validation

<script type=”text/javascript”>
function validate() {

var name = document.getElementById(‘name’)
var email = document.getElementById(’email’)
var mob = document.getElementById(‘mob’)
var detail = document.getElementById(‘detail’)
var Cname = document.getElementById(‘Cname’)

if (name.value == “”) {

alert(“Please Enter Name”)

name.focus()

return false;
}
if (email.value == “”) {
alert(“Please Enter email”)
email.focus()
return false;
}

var x = document.getElementById(’email’).value;
var atpos = x.indexOf(“@”);
var dotpos = x.lastIndexOf(“.”);
if (atpos < 1 || dotpos < atpos + 2 || dotpos + 2 >= x.length) {
alert(“Not a valid e-mail address”);
email.focus()
return false;

}
if (mob.value == “”) {
alert(“Please Enter mobile”)
mob.focus()
return false;
}
if (detail.value == “”) {
alert(“Please Enter Details”)
detail.focus()
return false;
}
if (Cname.value == “”) {
alert(“Please Enter Quantity”)
Qty.focus()
return false;
}

}
</script>

MySql Script for kannel for storing response from SMPP

step -1

Mysql;

step-2

create database kannel_engine;

step-3

use kannel_engine;

step -4
CREATE TABLE dlr (
smsc varchar(40),
ts varchar(40),
destination varchar(40),
source varchar(40),
service varchar(40),
url varchar(255),
mask int(10),
status int(10),
boxc varchar(40)
)

step-5

#--- mysql connection

  group = mysql-connection
  id = mydlr
  host = localhost
  port = 3306
  username = root
  password = xxxxx
  database = kannel
  max-connections = 1

  #---- DLR table structure

  group = dlr-db
  id = mydlr
  table = dlr
  field-smsc = smsc
  field-timestamp = ts
  field-destination = destination
  field-source = source
  field-service = service
  field-url = url
  field-mask = mask
  field-status = status
  field-boxc-id = boxc

How to install MySQL

Install MySQL


yum install mysql-server mysql php-mysql

 

How to configure MySQL

 

  1. Set the MySQL service to start on boot
    chkconfig –levels 235 mysqld on
  2. Start the MySQL service
    service mysqld start
  3. Log into MySQL
    mysql -u root
  4. Set the root user password for all local domains
    SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘new-password‘);
    SET PASSWORD FOR ‘root’@’localhost.localdomain’ = PASSWORD(‘new-password‘);
    SET PASSWORD FOR ‘root’@’127.0.0.1’ = PASSWORD(‘new-password‘);
  5. Drop the Any user
    DROP USER ”@’localhost’;
    DROP USER ”@’localhost.localdomain’;
  6. Exit MySQL
    exit

 

How to restrict SQL Login to see only ONE database – SQL 2005/2008

I found this online and it actually works in SQL 2005/2008 where user can only see the database that he/she has access to. I had to create a dll to handle the whole process and there are some tweaks that need to be done for proper execution but here is the raw logic. If you need the dll let me know. 
You many need to drop teh schema first and it depends on how you are creating users 

USE [master] 
GO 
— make sure they can view all databases for the moment. 
GRANT VIEW ANY DATABASE TO UserLoginName_HERE 
GO 

USE DataBaseName_HERE 
go 

— drop the user in the database if it already exists. 
IF EXISTS (SELECT * 
FROM sys.database_principals 
WHERE name = N’UserLoginName_HERE’) 
DROP USER UserLoginName_HERE 
GO 

— grant them ownership to of the database (ownership of dbo schema). 
ALTER AUTHORIZATION ON DATABASE::DataBaseName_HERE to UserLoginName_HERE 
go 

USE MASTER 
go 

— deny ability to see ohter databases 
DENY VIEW ANY DATABASE TO UserLoginName_HERE 
go

How to restrict SQL Login to see only ONE database – SQL 2005/2008

I found this online and it actually works in SQL 2005/2008 where user can only see the database that he/she has access to. I had to create a dll to handle the whole process and there are some tweaks that need to be done for proper execution but here is the raw logic. If you need the dll let me know. 
You many need to drop teh schema first and it depends on how you are creating users 

USE [master] 
GO 
— make sure they can view all databases for the moment. 
GRANT VIEW ANY DATABASE TO UserLoginName_HERE 
GO 

USE DataBaseName_HERE 
go 

— drop the user in the database if it already exists. 
IF EXISTS (SELECT * 
FROM sys.database_principals 
WHERE name = N’UserLoginName_HERE’) 
DROP USER UserLoginName_HERE 
GO 

— grant them ownership to of the database (ownership of dbo schema). 
ALTER AUTHORIZATION ON DATABASE::DataBaseName_HERE to UserLoginName_HERE 
go 

USE MASTER 
go 

— deny ability to see ohter databases 
DENY VIEW ANY DATABASE TO UserLoginName_HERE 
go