How to allow only numeric numbers in HTML input box using jQuery

How to allow only numeric numbers in HTML input box using jQuery?
jquery validation only digits

Jquery is very easy and helpful for all type of validation, if we need to allow only digits in the textbox or we need to allow only numeric numbers in the HTML input box then its really very easy using the jquery. below is the code through which its possible to allow only numbers in the textbox.

<script language=”javascript”>
$(document).ready(function()
{

$.validator.addMethod(“numbersonly”, function(value, element) {
return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/i.test(value);
}, “You can insert only numeric numbers”);
$(“#comment_form”).validate();

});

</script>

now give the class name “numbersonly” to the textbox where you want to apply this validation. and you can change the message where i wrote “You can insert only numeric numbers” its the error display message.

 

 

special characters validation using jquery

special characters validation using jquery

Jquery Validation for special characters

if you are working with the PHP or ASP and you wan’t allow user to input the special character in the textbox or in the text area then you need to do validation for the special characters. using jquery its really easy to implement the validation of the special characters. use below jquery code in your web-page if you won’t allow user to input the special characters.

 

<script language=”javascript”>

$(document).ready(function()
{
$.validator.addMethod(“noSpecialChars”, function(value, element) {
return this.optional(element) || /^[a-z0-9.-\_]+$/i.test(value);
}, “Special Character Are not Allowed, Please remove it to submit the Page”);
$(“#yourform”).validate();

});

</script>

Now this code will work for all the textbox and textarea, where you give class name noSpecialChars on the input tags. also please be careful that you give the your form id on the place where i wrote “yourform”.

Here “Special Character Are not Allowed, Please remove it to submit the Page” is the message which will show when user insert in to the textbox or textarea. you can set your own error message at there.

 

 

Incoming search terms:

  • special character validation in jquery
  • special characters validation in jquery

ASP syntax and use of asp tags

ASP syntax nad use of asp tags
when we are working with the ASP (Active Server Pages) then we have to know the syntax of ASP, ASP syntax is very easy to use and you can code anything as you wish.

if you know the html tags, php tags then its very easy to learn ASP tags, ASP tags are required when we do the dynamic code, ASP statement will be dynamic code and when we run this then its execute on the server. but we need to write all ASP code in the ASP tags. Below is the simple example of the ASP syntax.

<%
Response.Write(“Hello World”);
%>

In the above example <% is the start tag of ASP and %> is the close tag of the ASP. all the ASP statement wrote between the start and end tags of ASP.

latlng not defined google maps

latlng not defined google maps

map.setCenter

when you are working with the google maps and when the map is changed dynamically as we choose the city or places then you need to center the map with the latitude and longitude then you use below statement.

map.setCenter(new LatLng(parseFloat(runtimelatitude), parseFloat(runtimelongitude)),parseInt(runtimezoomlevel));

if you use above statement its give error LatLng not define then you need to use either below statement

map.setCenter(new google.maps.LatLng(runtimelatitude, runtimelongitude),runtimezoomlevel);

Or you can use this statement

map.setCenter(new google.maps.LatLng(parseFloat(runtimelatitude), parseFloat(runtimelongitude)),parseInt(runtimezoomlevel));

I hope this will resolve your problem.

text formatting is not working in joomla

text formatting is not working in joomla

joomla text formatting not working in the front-end

when you are working with the Joomla open source and create the article which will display the content in the front-end part of the web-site. some times you format the text like bold, italic, underline or change the color and format the text in the text editor provide by the Joomla text editor.  but when you looking the same article from the front-end page then its not display the text as you format in the administrator control panel of Joomla.  Don’t worry i have solution of this issue and its very easy, just follow below steps and you can format your text using the text editor and resolve the text editor issue.

1) Open Folder where you install the Joomla Open Source.
2) Now Open components Folder and then select com_content folder from all given folders.
3) There is View Folder in which you find the article folder and in the article folder you get the tmpl folder which include the template files.
4) Open Default.php file from the tmpl folder.
6) Search <?php echo strip_tags($this->item->introtext); ?> text and replace it with <?php echo $this->item->introtext; ?>

Now when you look the web-page then you get the text which is formated.

Problem with sending email using php mail() function

Problem with sending email using php mail() function

Recently i am working with the form and that form goes in the email, i found that email is not going even everything is coded perfectly. after doing all the research i knew the problem, why php mail() function not working and email not sent.

when we send any email then we set headers to send the email. if you set the from email id in the header then please be careful on this because some server do not allow gmail, yahoo, hotmail, msm, aim, aol etc.. in the from email id, you need to set the from email id which is sever email id.

Suppose your domain is www.freelancephpdevelopment.com and if you use below code in headers then its not work.

 
<?php
$headers = "From: pinkeshpatel2915@gmail.com\r\n";
$headers .= "Reply-To: pinkeshpatel2915@gmail.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=utf-8\r\n";
?>

Above code is correct but then also if its not send the email that means your server do not allow gmail, yahoo, hotmail, msm, aim, aol etc..

if you use below code then its work.

 
<?php
$headers = "From: pinkeshpatel2915@freelancephpdevelopment.com\r\n";
$headers .= "Reply-To: pinkeshpatel2915@freelancephpdevelopment.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=utf-8\r\n";
?>

I Hope this is clear and you get the solution as well. Enjoy……..

 

what is SQL Injection and SQL injection attacks

What is SQL Injection?
What is SQL injection attack?

When you are working with the SQL in your web-site then you need to careful on SQL injection, make sure that your programmer consider all SQL statements in that way that no one can hack your website using SQL injection. SQL injection is a technique used to hack your website, attacker use the non-validated input vulnerabilities and then pass it to SQL commands via a Web application or web-site for execution in the database. when any web application or web-site made by the programmer then attackers take advantage of that and pass the parameters in the SQL statement which is not done by the programmers, but they pass the parameters with the parameters set by the programmers, and because of that their parameters embed in SQL commands with the programmers parameters. On the result of this attacker/hackers can execute  SQL queries/commands with their conditions on the database server through the Web application or web-site.

All programmers make a query strings using the SQL statement and the parameters, when they need parameters in the web application then they make the sql statement run time and then pass it to the database server. so when they collect their parameter at that time the attackers/hackers pass their parameters and because of that its joint in the SQL statement, this is knows as the SQL Injection. i will show you this with example.

SQL Injection Example:

suppose your site made in php and php programmer made the login screen and take username and password from the end user to login, in this case he wrote below code to make SQL statement.

$SQL = “SELECT * FROM QATRICKS WHERE usename='”.$_REQUEST[“username”].”‘ AND password='”.$_REQUEST[“password”].”‘”;

Here when php programmer collect information from $_REQUEST parameter then attackers pass like as below

USERNAME : php
PASSWORD : qatricks AND password=’php freelancer’ AND password=’patel’

Now in this case SQL statement made wrong because attackers pass parameters in the passwords fields.

I hope this should be clear on the SQL Injection, and if you are going to make your web-site then you need to careful on this and have to inform your programmer so he will be more careful on the SQL Injection.


security issues when you make your web-site

security issues when you make your web-site

when you make your new web-site then you need to careful that which operating systems is installed on server where you host your web-site. almost all content management systems are not hosted on windows server and because of that attackers get more targets and wide number of potential websites to hack. your website is easily hacked if you lack it in phishing, poor registration/login systems, cross-site scripting (XSS), web-site logic flaws used in site are completely independent of the operating system.
use firewall to protect your web-site

firewalls is one of the most important tools of as web server which is control traffic of the server. all web setver will see the web request and its can nobe filtered. web application firewalls can assist in protecting known vulnerabilities and unusual traffic but cannot usually provide protection against business logic vulnerabilities, custom code vulnerabilities, valid use that corrupts data and zero day (new) attacks. firewall can used in temporarily filtering traffic from the server when a vulnerability is discovered, but need to be thought of as a temporary fix rather than a permanent repair. Your internal employee’s access to the website may not even pass through the same firewall, or have different rules, and you may be using internal data feeds which are not screened.

 

Hows your website secure when you use SSL for your website

Hows your website secure when you use SSL for your website.

SSL fullform is Secure Socket Layer.

when we develop any web-site then we do the contract with the php programmer if your site in php and other developers as per we choose the scripting language for our web-site. all web-developer and software company follow some standards but if you do not define the document then security will be lack from your web-site. if there is less security in your web-site then hackers can easily hack your site, so web-security is required for your site.

SSL is used to transfer data in secure mode, secure socket layer is the protocol and when we use it in our web-site then data transmitted between server and user’s computer are encrypted. server use a valid, current and trusted secure sockets layer to transmit the data from user computer and server.

When you use ssl that does not means that your web-site is secure, ssl is one small part of the security and its use is apply any strong cipher when data is transmitted from serve to user and user to server. if you do not cover other security configuration for your web-site and ssl use weak ciphers then hacker can easily hack your web-site.

Defining PHP Security and It’s uses for website

Defining PHP Security and It’s uses for website

PHP is open source and because of that its very popular and most of the people use php as a web programming language when they think to develop their own web-site. php provide highly flexible syntax which perform many functions during working flawless in html and scripting language. php is easy to learn for beginners php programmers, It also working well exceptionally when use open source, such as the Apache web server and MySQL database.

Many php programmers and php developers implement websites in php, but the issue is security and they do not consider the security during development of web-site. security is lack or we can say that insecure code run in the php even they do not develop the secure code. and most of hackers looking for the insecure code. as they found the insecure code then they are working on that and try to hack it. once they find the key point then its not hard to hack the web-site.

PHP security covers minimum programming errors, so you need to develop code with minimum errors and develop proper code in place to protect against possible vulnerabilities. it means in the code put 2 – 3 layers of protection in place to guard sensitive data which will help to protect against hackers. all Developers and programmers call some principle of redundant safeguarding Defense in Depth, and because of this its working as a defense against malicious attacks done by the hackers.