Selasa, 31 Desember 2013

No copy and no select

Diposting oleh Unknown
No copy

No copy

You can disable the select function of your web page and thus disabling the copying function of the web page.
This little JavaScript snippet will prevent someone from highlighting your text and using the copy function to copy it and rip it off. It also prevents them from using Ctrl + A to select all the text, or using the right-click menu to Select All.

<script type="text/JavaScript">function killCopy(e){return false}function reEnable(){return true}document.onselectstart=new Function ("return false")if (window.sidebar){document.onmousedown=killCopydocument.onclick=reEnable}</script>
Just add the above code to the head tag of your web page. Now I will show few useful scripts without description. I think only the title is enough.

Right Click Message code

<script language='JavaScript' type='text/JavaScript'>var tenth='';function ninth() {if (document.all) {(tenth);alert("Right Click Disable"); return false;}}function twelfth(e) {if (document.layers||(document.getElementById&&!document.all)) {if (e.which==2||e.which==3) {(tenth);return false;}}}if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=twelfth;}else{document.onmouseup=twelfth;document.oncontextmenu=ninth;}document.oncontextmenu=new Function('alert("Right Click Disable"); return false')</script>

Left click Right Click Message code

<body onmousedown="alert('disable'); return false;">

Right Click Silent Disable code

<body oncontextmenu="return false;">

Image Right Click Message code

<img src="http://gumoti.blogspot.com/uploads/1/2/3/0/12309515/1357477089.png"
onmousedown="alert('This image is copyrighted!');return false;">
<script type="javascript">function protect(){alert("This image is copyrighted!");return false;}</script>

Image Right Click Silent Disable code

<IMG border=0 src="http://gumoti.blogspot.com/uploads/1/2/3/0/12309515/1357477089.png" oncontextmenu="return false;">

Image drag and drop Message code

<script langauge="javascript">function onDrag(){alert("selected");
}</script>

<div id="myDic" onmousedown="onDrag()"><img src="http://gumoti.blogspot.com/uploads/1/2/3/0/12309515/1357477089.png" ></div>

Image drag and drop Silent Disable code

<IMG border=0 src="http://gumoti.blogspot.com/uploads/1/2/3/0/12309515/1357477089.png" onselectstart="return false;" ondragstart="return false;">
Read More

Kamis, 26 Desember 2013

IDM full version free

Diposting oleh Unknown
IDM full version free

IDM full version free

Check out the below trick on how to make IDM full version free (Internet Download Manager ) through HOSTS File Trick. The procedure is really easy to follow and you can make this happen just in few seconds.

Follow below steps for IDM full version free:

1. Make sure you have installed the latest version of IDM if you do not have it you can download it from the official creators website.
2. Now after you have downloaded and installed the latest version just close the IDM and now go to start menu and make a search for Notepad.
3. Now right click on Notepad and than Run It As Administrator.
4. Now notepad will be opened and then click on file>open. Now navigate to C: > Windows > System 32 > Drivers > etc. > Hosts.
5. When you are in the etc. folder you might not see any files their as you have click on show all files on the right hand side below.
6. Now open the Hosts file and paste all the below lines like in the image.


127.0.0.1    tonec.com

127.0.0.1    www.tonec.com

127.0.0.1    registeridm.com
127.0.0.1    www.registeridm.com
127.0.0.1    secure.registeridm.com
127.0.0.1    internetdownloadmanager.com
127.0.0.1    www.internetdownloadmanager.com
127.0.0.1    secure.internetdownloadmanager.com
127.0.0.1    mirror.internetdownloadmanager.com
127.0.0.1    mirror2.internetdownloadmanager.com

IDM full version free

7. So now as you can see in the above image how I have pasted all the lines @ the end of the Hosts file, you have to do same as above, now hit save.
8. Now when you have saved the HOSTS File you can simply enter any serials from below in your IDM Registration page.


RLDGN-OV9WU-5W589-6VZH1
HUDWE-UO689-6D27B-YM28M
UK3DV-E0MNW-MLQYX-GENA1
398ND-QNAGY-CMMZU-ZPI39
GZLJY-X50S3-0S20D-NFRF9
W3J5U-8U66N-D0B9M-54SLM
EC0Q6-QN7UH-5S3JB-YZMEK
UVQW0-X54FE-QW35Q-SNZF5
FJJTJ-J0FLF-QCVBK-A287M

9. Now enjoy your IDM full version free. Its totally genuine and totally legal, you can update and it will still work like a charm so if you still have any queries than make sure to comment below.
NOTE: I faced some problems first time, when my avira antivirus was activated. So you should inactivate or uninstall you antivirus temporarily before this work.
Read More

PHPWord

Diposting oleh Unknown

PHPWord

About PHPWord


PHPWord is a library written in PHP that create word documents. Windows operating system is not required to work with it because the results are docx files (Office Open XML) that can be opened by all major office software.



In this tutorial, I will not describe all the basics instead ‘PHPWord template add table’. Assuming that you are already familiar with PHPWord and only describe how to add table row/cell on an existing template by coding. If you are a newbie, I suggest to visit PHPWord website.

Note: Though I took help from http://jeroen.is/phpword-templates-with-repeating-rows/ to write this post, I like open office xml (oox) technique given in http://officeopenxml.com/. I saw that oox is more powerful and reliable for coding for PHPWord. You should learn oox instead of this tutorial.


PHPWord template add table

When we load any template, we can set the value of any variable with setValue() function.
Unfortunately we can’t add table cell/row dynamically to any template. But you can do it using my techniques ‘PHPWord template add table’.
How it works:
  1. Create a template Word document, containing the tables you would like to use.
    For each table, add one row to use as a template with the tags you would like to replace. Your template would be something like this:
FIRST NAME
LAST NAME
${first_name}
${last_name}
  1. Call the cloneRow($variable, $numberOfRows) function before setValue() to duplicate the template row. Provide any variable on that row as $variable and the required number of rows as $numberOfRows. For example, calling cloneRow('first_name', 3) would transform the working copy of your template into something like this:
FIRST NAME
LAST NAME
${first_name#1}
${last_name#1}
${first_name#2}
${last_name#2}
${first_name#3}
${last_name#3}
  1. Now call setValue($variable, $value) adding #rowNumber to the original tags.
    To finish the example:
$doc->setValue(‘first_name#1′, ‘Rejaul’);

$doc->setValue(‘last_name#1′, ‘Karim’);
$doc->setValue(‘first_name#2′, ‘Gumoti’);
$doc->setValue(‘last_name#2′, ‘dotcom’);
$doc->setValue(‘first_name#3′, ‘Bangla’);
$doc->setValue(‘last_name#3′, ‘desh’);
Would result in:
FIRST NAME
LAST NAME
Rejaul
Karim
Gumoti
dotcom
Bangla
desh
To get this thing working you’ll have to replace the Template.php file found in side the PHPWord directory by this one Template.php or add the function below by hand.
/**

* Clone a table row
*
* @param mixed $search
* @param mixed $numberOfClones
*/
public function cloneRow($search, $numberOfClones) {
if(substr($search, 0, 2) !== ‘${‘ && substr($search, -1) !== ‘}’) {
$search = ‘${‘.$search.’}';
}
$tagPos = strpos($this->_documentXML, $search);
$rowStartPos = strrpos($this->_documentXML, “_documentXML) – $tagPos) * -1));
$rowEndPos = strpos($this->_documentXML, “”, $tagPos) + 7;
$result = substr($this->_documentXML, 0, $rowStartPos);
$xmlRow = substr($this->_documentXML, $rowStartPos, ($rowEndPos – $rowStartPos));
for ($i = 1; $i <= $numberOfClones; $i++) {
$result .= preg_replace(‘/${(.*?)}/’,'${\1#’.$i.’}', $xmlRow);
}
$result .= substr($this->_documentXML, $rowEndPos);
$this->_documentXML = $result;
}
Note: Don’t try to use color for the table cells. I faced problem when tried to add color to the table header.
Any feedback is welcome!

Read More

Sabtu, 21 Desember 2013

copy protect

Diposting oleh Unknown
There are lots of ways for source code copy protect. But in reality, all these ways are not able to protect HTML code absolutely. The only absolute way is not to publish the code on internet :).
Well seriously, I’m going to describe several processes for source code copy protect.


Process one (Empty line)

The first way but most stupid :) way is putting a lot of empty lines at the starting of the HTML source. If the user looks at the source will see just empty white page. But if he scrolls down on bottom of the page he will see the source.

Process two (Disable right click)

The second method is to disable right click on page. To do that just takes a look at next code:
<script>
function clickIE() {
if (document.all) {
alert(“Message1″);
return false;
}
}
function clickNS(e) {
if (document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {
alert(“Message2″);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;
} else {
document.onmouseup=clickNS;document.oncontextmenu=clickIE;
}
document.oncontextmenu=new Function(“return false”)
</script>
Use the following code to disable right click without an alert message:
<script>
function clickIE() {
if (document.all) {
return false;
}
}
function clickNS(e) {
if (document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;
} else {
document.onmouseup=clickNS;document.oncontextmenu=clickIE;
}
document.oncontextmenu=new Function(“return false”)
</script>
Now user can do right click but nothing will be displayed. Still, there are few ways to view the source code i.e.

  • Clicking Ctrl+u.
  • By disabling JavaScript.

Process three (Converting to hexadecimal)

The third method is to use JavaScript to hide the HTML content. A short example is presented next:
Let’s suppose that the page has the following code:
<! 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>Sample HTML-hide source code</title>
</head>
<body>
Source code copy protect
</body>
</html>
Now what we have to do next is to “encrypt” this content, go to http://www.swingnote.com/tools/texttohex.php.
You will obtain something similar to this:
%3c%21%44%4f%43%54%59%50%45%20%68%74%6d%6c%20%50%55%42%4c%49%43%20%93%2d%2f%2f%57%33%43%2f%2f%44%54%44%20%58%48%54%4d%4c%20%31%2e%30%20%54%72%61%6e%73%69%74%69%6f%6e%61%6c%2f%2f%45%4e%94%20%93%68%74%74%70%3a%2f%2f%77%77%77%2e%77%33%2e%6f%72%67%2f%54%52%2f%78%68%74%6d%6c%31%2f%44%54%44%2f%78%68%74%6d%6c%31%2d%74%72%61%6e%73%69%74%69%6f%6e%61%6c%2e%64%74%64%94%3e%20%3c%68%74%6d%6c%20%78%6d%6c%6e%73%3d%94%68%74%74%70%3a%2f%2f%77%77%77%2e%77%33%2e%6f%72%67%2f%31%39%39%39%2f%78%68%74%6d%6c%94%3e%20%3c%68%65%61%64%3e%20%3c%6d%65%74%61%20%68%74%74%70%2d%65%71%75%69%76%3d%94%43%6f%6e%74%65%6e%74%2d%54%79%70%65%94%20%63%6f%6e%74%65%6e%74%3d%94%74%65%78%74%2f%68%74%6d%6c%3b%20%63%68%61%72%73%65%74%3d%75%74%66%2d%38%26%23%38%32%34%33%3b%20%2f%3e%20%3c%74%69%74%6c%65%3e%53%61%6d%70%6c%65%20%48%54%4d%4c%2d%68%69%64%65%20%73%6f%72%65%63%65%20%63%6f%64%65%3c%2f%74%69%74%6c%65%3e%20%3c%2f%68%65%61%64%3e%20%3c%62%6f%64%79%3e%20%48%54%4d%4c%20%63%6f%64%65%20%70%72%6f%74%65%63%74%69%6f%6e%20%3c%2f%62%6f%64%79%3e%20%3c%2f%68%74%6d%6c%3e
The output is same but code have a different representation that is strange to a common user but remember that is a Meta protection method an advanced user can and will do the reverse method to obtain you’re source.
Now create a HTML document and write the content below:
<script>
document.write(unescape(“%3c%21%44%4f%43%54%59%50%45%20%68%74%6d%6c%20%50%55%42%4c%49%43%20%93%2d%2f%2f%57%33%43%2f%2f%44%54%44%20%58%48%54%4d%4c%20%31%2e%30%20%54%72%61%6e%73%69%74%69%6f%6e%61%6c%2f%2f%45%4e%94%20%93%68%74%74%70%3a%2f%2f%77%77%77%2e%77%33%2e%6f%72%67%2f%54%52%2f%78%68%74%6d%6c%31%2f%44%54%44%2f%78%68%74%6d%6c%31%2d%74%72%61%6e%73%69%74%69%6f%6e%61%6c%2e%64%74%64%94%3e%20%3c%68%74%6d%6c%20%78%6d%6c%6e%73%3d%94%68%74%74%70%3a%2f%2f%77%77%77%2e%77%33%2e%6f%72%67%2f%31%39%39%39%2f%78%68%74%6d%6c%94%3e%20%3c%68%65%61%64%3e%20%3c%6d%65%74%61%20%68%74%74%70%2d%65%71%75%69%76%3d%94%43%6f%6e%74%65%6e%74%2d%54%79%70%65%94%20%63%6f%6e%74%65%6e%74%3d%94%74%65%78%74%2f%68%74%6d%6c%3b%20%63%68%61%72%73%65%74%3d%75%74%66%2d%38%26%23%38%32%34%33%3b%20%2f%3e%20%3c%74%69%74%6c%65%3e%53%61%6d%70%6c%65%20%48%54%4d%4c%2d%68%69%64%65%20%73%6f%72%65%63%65%20%63%6f%64%65%3c%2f%74%69%74%6c%65%3e%20%3c%2f%68%65%61%64%3e%20%3c%62%6f%64%79%3e%20%48%54%4d%4c%20%63%6f%64%65%20%70%72%6f%74%65%63%74%69%6f%6e%20%3c%2f%62%6f%64%79%3e%20%3c%2f%68%74%6d%6c%3e”));
</script>
If the above code does not work, convert “and” to double quotation. If user has the JavaScript disabled he will not see anything because the code will not execute. Most of search engine as Google or Yahoo crawl the web in text mode.

Process four (Adding text)

The next step is to create the “protected” page, create a new HTML document and add the next code:
As you can see all we are doing is to use JavaScript to write the content (document.write method).
!!! Important: if user has the JavaScript disabled he will not see anything because the code will not execute, therefore will be nothing displayed. Also remember that most of search engine as Google or Yahoo crawl the web in text mode, remember that JavaScript is luxury not a necessity.
Now is time to get serious and speak about some more advanced, a little bit harder to break (not impossible to break), technique to keep you HTML source protected. The base idea is to encrypt the content of the HTML page, this time really encryption. Let imagine a function for encryption this time a simple one that is using xor logic function to achieve encryption. The code to do that is showed next:
//Encryption function encrypt(text, key){
var rez=new Array(text.length);
for(i=0;i rez[i]=text.charCodeAt(i) ^key.charCodeAt(i%key.length);
}
return rez;
}
//Decryption
function decrypt(text,key){
var rez=””;
for(i=0;i rez+=String.fromCharCode(text[i] ^key.charCodeAt(i%key.length));
}
return rez;
}
Using the functions in this form won’t help to much because the user will see clear what is about, so I am going to obfuscate the code (if you don’t know what is that Google it :)). Now the code looks not so friendly:
eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!”.replace(/^/,String)){while(c–){d
?
1
=k
?
1
||c.toString(a)}k=[function(e){return d[e]}];e=function(){return’\w+’};c=1};while(c–){if(k
?
1
){p=p.replace(new RegExp(‘\b’+e(c)+’\b’,’g’),k
?
1
)}}return p}(’8 c(2,4){9 3=d b(2.5);7(1=0;1
The next step is to convert you’re page in hex as showed previously in this post, suppose that we are using the same page the hex will be:
%3c%21%44%4f%43%54%59%50%45%20%68%74%6d%6c%20%50%55%42%4c%49%43%20%5c%22%2d%2f%2f%57%33%43%2f%2f%44%54%44%20%58%48%54%4d%4c%20%31%2e%30%20%54%72%61%6e%73%69%74%69%6f%6e%61%6c%2f%2f%45%4e%5c%22%20%5c%22%68%74%74%70%3a%2f%2f%77%77%77%2e%77%33%2e%6f%72%67%2f%54%52%2f%78%68%74%6d%6c%31%2f%44%54%44%2f%78%68%74%6d%6c%31%2d%74%72%61%6e%73%69%74%69%6f%6e%61%6c%2e%64%74%64%5c%22%3e%20%3c%68%74%6d%6c%20%78%6d%6c%6e%73%3d%5c%22%68%74%74%70%3a%2f%2f%77%77%77%2e%77%33%2e%6f%72%67%2f%31%39%39%39%2f%78%68%74%6d%6c%5c%22%3e%20%3c%68%65%61%64%3e%20%3c%6d%65%74%61%20%68%74%74%70%2d%65%71%75%69%76%3d%5c%22%43%6f%6e%74%65%6e%74%2d%54%79%70%65%5c%22%20%63%6f%6e%74%65%6e%74%3d%5c%22%74%65%78%74%2f%68%74%6d%6c%3b%20%63%68%61%72%73%65%74%3d%75%74%66%2d%38%5c%22%20%2f%3e%20%3c%74%69%74%6c%65%3e%53%61%6d%70%6c%65%20%48%54%4d%4c%2d%68%69%64%65%20%73%6f%72%65%63%65%20%63%6f%64%65%3c%2f%74%69%74%6c%65%3e%20%3c%2f%68%65%61%64%3e%20%20%3c%62%6f%64%79%3e%20%09%42%6c%61%68%20%62%6c%61%68%20%62%6c%61%68%20%3c%2f%62%6f%64%79%3e%20%3c%2f%68%74%6d%6c%3e
Now is time to encrypt the hex representation with a key, so apply encrypt(“…hex text ….”,”…you personal key…”) . I used as key “secret” and have obtained this:
86,86,0,87,87,69,86,81,87,87,81,18,86,81,80,87,80,64,86,80,90,87,80,68,86,81,86,87,87,68,86,83,91,87,82,64,86,83,7,87,83,23,86,87,83,87,80,68,86,80,86,87,81,70,86,81,0,87,81,77,86,81,80,87,87,68,86,80,0,87,87,70,86,87,7,87,87,18,86,87,5,87,80,67,86,86,80,87,81,71,86,87,5,87,87,18,86,81,87,87,80,64,86,81,87,87,87,68,86,80,91,87,81,76,86,80,87,87,81,16,86,81,0,87,87,68,86,86,82,87,87,17,86,86,83,87,87,68,86,80,87,87,82,70,86,83,82,87,83,17,86,82,80,87,83,77,86,82,87,87,83,77,86,83,5,87,83,17,86,83,82,87,83,23,86,87,5,87,87,18,86,81,86,87,81,17,86,80,0,87,87,70,86,87,83,87,80,23,86,87,81,87,83,76,86,82,87,87,82,64,86,82,83,87,86,21,86,87,5,87,87,18,86,82,84,87,82,67,86,82,84,87,87,17,86,82,84,87,86,71,86,87,6,87,83,18,86,82,81,87,83,67,86,87,5,87,80,64,86,80,81,87,87,18,86,82,91,87,83,76,86,82,87,87,83,16,86,83,0,87,86,69,86,87,5,87,81,64,86,80,87,87,81,64,86,87,5,87,82,76,86,83,91,87,82,64,86,83,7,87,83,23,86,86,82,87,87,16,86,82,87,87,82,70,86,83,82,87,83,17,86,82,80,87,83,77,86,82,87,87,83,77,86,83,5,87,83,17,86,83,82,87,83,23,86,87,6,87,83,64,86,82,87,87,83,64,86,80,0,87,87,70,86,86,6,87,87,68,86,86,0,87,83,76,86,82,87,87,83,16,86,83,0,87,87,68,86,82,91,87,83,16,86,83,0,87,83,17,86,82,80,87,86,16,86,80,0,87,87,70,86,83,91,87,82,64,86,82,87,87,82,68,86,86,2,87,87,18,86,87,5,87,82,67,86,82,84,87,82,67,86,87,6,87,82,67,86,86,80,87,87,17,86,83,5,87,82,70,86,83,84,87,87,18,86,86,82,87,86,77,86,86,90,87,86,77,86,87,5,87,82,76,86,83,91,87,82,64,86,83,7,87,83,23,86,80,0,87,87,70,86,86,6,87,87,68,86,86,0,87,83,76,86,83,86,87,83,69,86,83,87,87,86,17,86,87,83,87,86,23,86,83,7,87,83,65,86,82,87,87,83,69,86,87,83,87,83,76,86,82,87,87,82,64,86,82,83,87,87,16,86,83,86,87,82,69,86,82,86,87,83,77,86,82,85,87,86,16,86,80,0,87,87,70,86,81,80,87,83,18,86,83,6,87,82,64,86,83,86,87,83,17,86,82,87,87,87,16,86,80,87,87,82,77,86,82,83,87,83,65,86,80,0,87,87,70,86,87,83,87,83,71,86,83,5,87,83,17,86,82,87,87,83,65,86,83,6,87,82,64,86,86,7,87,80,23,86,87,81,87,82,64,86,83,86,87,82,76,86,82,87,87,87,18,86,83,91,87,82,64,86,83,7,87,83,23,86,86,1,87,87,68,86,83,80,87,83,76,86,83,82,87,82,70,86,82,80,87,83,65,86,82,87,87,86,16,86,82,86,87,82,64,86,83,85,87,87,16,86,86,91,87,80,23,86,87,81,87,87,68,86,87,5,87,86,17,86,87,83,87,86,23,86,82,87,87,83,77,86,82,87,87,83,23,86,83,86,87,86,17,86,80,80,87,83,69,86,83,7,87,82,68,86,83,0,87,83,65,86,87,83,87,81,76,86,80,87,87,81,16,86,81,0,87,87,16,86,83,91,87,83,77,86,83,87,87,83,65,86,87,83,87,82,71,86,83,5,87,82,70,86,83,86,87,83,71,86,83,86,87,87,68,86,83,80,87,83,18,86,83,87,87,83,65,86,86,0,87,87,18,86,82,87,87,83,77,86,82,87,87,83,23,86,83,86,87,86,17,86,87,83,87,86,23,86,87,5,87,83,76,86,83,86,87,83,69,86,83,87,87,86,17,86,87,83,87,87,68,86,86,0,87,83,70,86,83,5,87,83,64,86,82,90,87,86,17,86,87,83,87,85,77,86,81,81,87,83,23,86,83,82,87,83,76,86,87,83,87,83,70,86,83,0,87,83,69,86,83,91,87,87,68,86,83,81,87,83,23,86,83,82,87,83,76,86,87,83,87,86,23,86,87,5,87,83,70,86,83,5,87,83,64,86,82,90,87,86,17,86,87,83,87,86,23,86,87,5,87,83,76,86,82,87,87,83,16,86,83,0,87,86,17
Now let’s create the script, that will display the content of page, that will be the final step:
document.write(unescape(decrypt(new Array(86,86,0,87,87,69,86,81,87,87,81,18,86,81,80,87,80,64,86,80,90,87,80,68,86,81,86,87,87,68,86,83,91,87,82,64,86,83,7,87,83,23,86,87,83,87,80,68,86,80,86,87,81,70,86,81,0,87,81,77,86,81,80,87,87,68,86,80,0,87,87,70,86,87,7,87,87,18,86,87,5,87,80,67,86,86,80,87,81,71,86,87,5,87,87,18,86,81,87,87,80,64,86,81,87,87,87,68,86,80,91,87,81,76,86,80,87,87,81,16,86,81,0,87,87,68,86,86,82,87,87,17,86,86,83,87,87,68,86,80,87,87,82,70,86,83,82,87,83,17,86,82,80,87,83,77,86,82,87,87,83,77,86,83,5,87,83,17,86,83,82,87,83,23,86,87,5,87,87,18,86,81,86,87,81,17,86,80,0,87,87,70,86,87,83,87,80,23,86,87,81,87,83,76,86,82,87,87,82,64,86,82,83,87,86,21,86,87,5,87,87,18,86,82,84,87,82,67,86,82,84,87,87,17,86,82,84,87,86,71,86,87,6,87,83,18,86,82,81,87,83,67,86,87,5,87,80,64,86,80,81,87,87,18,86,82,91,87,83,76,86,82,87,87,83,16,86,83,0,87,86,69,86,87,5,87,81,64,86,80,87,87,81,64,86,87,5,87,82,76,86,83,91,87,82,64,86,83,7,87,83,23,86,86,82,87,87,16,86,82,87,87,82,70,86,83,82,87,83,17,86,82,80,87,83,77,86,82,87,87,83,77,86,83,5,87,83,17,86,83,82,87,83,23,86,87,6,87,83,64,86,82,87,87,83,64,86,80,0,87,87,70,86,86,6,87,87,68,86,86,0,87,83,76,86,82,87,87,83,16,86,83,0,87,87,68,86,82,91,87,83,16,86,83,0,87,83,17,86,82,80,87,86,16,86,80,0,87,87,70,86,83,91,87,82,64,86,82,87,87,82,68,86,86,2,87,87,18,86,87,5,87,82,67,86,82,84,87,82,67,86,87,6,87,82,67,86,86,80,87,87,17,86,83,5,87,82,70,86,83,84,87,87,18,86,86,82,87,86,77,86,86,90,87,86,77,86,87,5,87,82,76,86,83,91,87,82,64,86,83,7,87,83,23,86,80,0,87,87,70,86,86,6,87,87,68,86,86,0,87,83,76,86,83,86,87,83,69,86,83,87,87,86,17,86,87,83,87,86,23,86,83,7,87,83,65,86,82,87,87,83,69,86,87,83,87,83,76,86,82,87,87,82,64,86,82,83,87,87,16,86,83,86,87,82,69,86,82,86,87,83,77,86,82,85,87,86,16,86,80,0,87,87,70,86,81,80,87,83,18,86,83,6,87,82,64,86,83,86,87,83,17,86,82,87,87,87,16,86,80,87,87,82,77,86,82,83,87,83,65,86,80,0,87,87,70,86,87,83,87,83,71,86,83,5,87,83,17,86,82,87,87,83,65,86,83,6,87,82,64,86,86,7,87,80,23,86,87,81,87,82,64,86,83,86,87,82,76,86,82,87,87,87,18,86,83,91,87,82,64,86,83,7,87,83,23,86,86,1,87,87,68,86,83,80,87,83,76,86,83,82,87,82,70,86,82,80,87,83,65,86,82,87,87,86,16,86,82,86,87,82,64,86,83,85,87,87,16,86,86,91,87,80,23,86,87,81,87,87,68,86,87,5,87,86,17,86,87,83,87,86,23,86,82,87,87,83,77,86,82,87,87,83,23,86,83,86,87,86,17,86,80,80,87,83,69,86,83,7,87,82,68,86,83,0,87,83,65,86,87,83,87,81,76,86,80,87,87,81,16,86,81,0,87,87,16,86,83,91,87,83,77,86,83,87,87,83,65,86,87,83,87,82,71,86,83,5,87,82,70,86,83,86,87,83,71,86,83,86,87,87,68,86,83,80,87,83,18,86,83,87,87,83,65,86,86,0,87,87,18,86,82,87,87,83,77,86,82,87,87,83,23,86,83,86,87,86,17,86,87,83,87,86,23,86,87,5,87,83,76,86,83,86,87,83,69,86,83,87,87,86,17,86,87,83,87,87,68,86,86,0,87,83,70,86,83,5,87,83,64,86,82,90,87,86,17,86,87,83,87,85,77,86,81,81,87,83,23,86,83,82,87,83,76,86,87,83,87,83,70,86,83,0,87,83,69,86,83,91,87,87,68,86,83,81,87,83,23,86,83,82,87,83,76,86,87,83,87,86,23,86,87,5,87,83,70,86,83,5,87,83,64,86,82,90,87,86,17,86,87,83,87,86,23,86,87,5,87,83,76,86,82,87,87,83,16,86,83,0,87,86,17),”secret”)));
As you can see the key is “secret” you must chose a better one dynamic generate on each session stored in cookies. For extra security obfuscate this cod too:
eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!”.replace(/^/,String)){while(c–){d[e(c)]=k
?
1
||e(c)}k=[function(e){return d[e]}];e=function(){return’\w+’};c=1};while(c–){if(k
?
1
){p=p.replace(new RegExp(‘\b’+e(c)+’\b’,’g’),k
?
1
)}}return p}(‘y.w(A(v(t z(4,4,0,3,3,m,4,b,3,3,b,j,4,b,a,3,a,c,4,a,r,3,a,f,4,b,4,3,3,f,4,8,l,3,9,c,4,8,7,3,8,e,4,3,8,3,a,f,4,a,4,3,b,g,4,b,0,3,b,k,4,b,a,3,3,f,4,a,0,3,3,g,4,3,7,3,3,j,4,3,5,3,a,o,4,4,a,3,b,q,4,3,5,3,3,j,4,b,3,3,a,c,4,b,3,3,3,f,4,a,l,3,b,h,4,a,3,3,b,i,4,b,0,3,3,f,4,4,9,3,3,d,4,4,8,3,3,f,4,a,3,3,9,g,4,8,9,3,8,d,4,9,a,3,8,k,4,9,3,3,8,k,4,8,5,3,8,d,4,8,9,3,8,e,4,3,5,3,3,j,4,b,4,3,b,d,4,a,0,3,3,g,4,3,8,3,a,e,4,3,b,3,8,h,4,9,3,3,9,c,4,9,8,3,4,u,4,3,5,3,3,j,4,9,p,3,9,o,4,9,p,3,3,d,4,9,p,3,4,q,4,3,6,3,8,j,4,9,b,3,8,o,4,3,5,3,a,c,4,a,b,3,3,j,4,9,l,3,8,h,4,9,3,3,8,i,4,8,0,3,4,m,4,3,5,3,b,c,4,a,3,3,b,c,4,3,5,3,9,h,4,8,l,3,9,c,4,8,7,3,8,e,4,4,9,3,3,i,4,9,3,3,9,g,4,8,9,3,8,d,4,9,a,3,8,k,4,9,3,3,8,k,4,8,5,3,8,d,4,8,9,3,8,e,4,3,6,3,8,c,4,9,3,3,8,c,4,a,0,3,3,g,4,4,6,3,3,f,4,4,0,3,8,h,4,9,3,3,8,i,4,8,0,3,3,f,4,9,l,3,8,i,4,8,0,3,8,d,4,9,a,3,4,i,4,a,0,3,3,g,4,8,l,3,9,c,4,9,3,3,9,f,4,4,2,3,3,j,4,3,5,3,9,o,4,9,p,3,9,o,4,3,6,3,9,o,4,4,a,3,3,d,4,8,5,3,9,g,4,8,p,3,3,j,4,4,9,3,4,k,4,4,r,3,4,k,4,3,5,3,9,h,4,8,l,3,9,c,4,8,7,3,8,e,4,a,0,3,3,g,4,4,6,3,3,f,4,4,0,3,8,h,4,8,4,3,8,m,4,8,3,3,4,d,4,3,8,3,4,e,4,8,7,3,8,n,4,9,3,3,8,m,4,3,8,3,8,h,4,9,3,3,9,c,4,9,8,3,3,i,4,8,4,3,9,m,4,9,4,3,8,k,4,9,s,3,4,i,4,a,0,3,3,g,4,b,a,3,8,j,4,8,6,3,9,c,4,8,4,3,8,d,4,9,3,3,3,i,4,a,3,3,9,k,4,9,8,3,8,n,4,a,0,3,3,g,4,3,8,3,8,q,4,8,5,3,8,d,4,9,3,3,8,n,4,8,6,3,9,c,4,4,7,3,a,e,4,3,b,3,9,c,4,8,4,3,9,h,4,9,3,3,3,j,4,8,l,3,9,c,4,8,7,3,8,e,4,4,1,3,3,f,4,8,a,3,8,h,4,8,9,3,9,g,4,9,a,3,8,n,4,9,3,3,4,i,4,9,4,3,9,c,4,8,s,3,3,i,4,4,l,3,a,e,4,3,b,3,3,f,4,3,5,3,4,d,4,3,8,3,4,e,4,9,3,3,8,k,4,9,3,3,8,e,4,8,4,3,4,d,4,a,a,3,8,m,4,8,7,3,9,f,4,8,0,3,8,n,4,3,8,3,b,h,4,a,3,3,b,i,4,b,0,3,3,i,4,8,l,3,8,k,4,8,3,3,8,n,4,3,8,3,9,q,4,8,5,3,9,g,4,8,4,3,8,q,4,8,4,3,3,f,4,8,a,3,8,j,4,8,3,3,8,n,4,4,0,3,3,j,4,9,3,3,8,k,4,9,3,3,8,e,4,8,4,3,4,d,4,3,8,3,4,e,4,3,5,3,8,h,4,8,4,3,8,m,4,8,3,3,4,d,4,3,8,3,3,f,4,4,0,3,8,g,4,8,5,3,8,c,4,9,r,3,4,d,4,3,8,3,s,k,4,b,b,3,8,e,4,8,9,3,8,h,4,3,8,3,8,g,4,8,0,3,8,m,4,8,l,3,3,f,4,8,b,3,8,e,4,8,9,3,8,h,4,3,8,3,4,e,4,3,5,3,8,g,4,8,5,3,8,c,4,9,r,3,4,d,4,3,8,3,4,e,4,3,5,3,8,h,4,9,3,3,8,i,4,8,0,3,4,d),”x”)));’,37,37,’|||87|86||||83|82|80|81|64|17|23|68|70|76|16|18|77|91|69|65|67|84|71|90|85|new|21|decrypt|write|secret|document|Array|unescape’.split (‘|’), 0, {}))
We have a pretty good protection, must remember a Meta HTML protection because this can be broken by a good hacker.
I hope that this article was helpful I am waiting for your feedback.
Read More

Selasa, 17 Desember 2013

jQuery Validation

Diposting oleh Unknown

There are a lot of client side form validation plugin. Right, there are a lot of non-jQuery-based solutions (which you’d avoid since you found jQuery) and some jQuery-based solutions. Here, I will discuss about one of the oldest jQuery plugins, jQuery Validation, (started in July 2006) and which proved itself in projects all around the world. Look at the example below:

Please provide your name, email address (won’t be published) and a comment









Click on the above submit button and see what happen(in case of incomplete/mistake). Don’t you like this? It works nice. Let us introduce with this nice plugin to get a efficient html form.
Here I will only introduce you with jQuery Validation Plugin and then provide few links for your advance learning. Look at the code for the above form:
<form id="commentForm" class="cmxform" action="" method="get">
<fieldset><legend>Please provide your name, email address (won’t be published) and a comment</legend>
<label for="cname">Name (required)</label>
<input id="cname" type="text" name="name" />
<label for="cemail">E-Mail (required)</label>
<input id="cemail" type="email" name="email" />
<label for="curl">URL (optional)</label>
<input id="curl" type="url" name="url" />
<label for="ccomment">Your comment (optional)</label>
<textarea id="ccomment" name="comment"></textarea>
<input class="submit" type="submit" value="Submit" />
</fieldset>
<span>Click on the above submit button and see what happen. Don’t you like this? It works nice. Let us introduce with this nice plugin to get a efficient html form.</span>
</form>
Here I used the following css file and plugins (jQuery Validation Plugin):
<link rel="stylesheet" href="http://jquery.bassistance.de/validate/demo/css/screen.css" />
<script src="http://jquery.bassistance.de/validate/lib/jquery.js"></script>
<script src="http://jquery.bassistance.de/validate/jquery.validate.js"></script>
I also used the following scripts:
<script>
$.validator.setDefaults({
submitHandler: function() {
alert("submitted!");
}
});
$().ready(function() {
// validate signup form on key-up and submit
$("#commentForm").validate({
//Name of the field: "required" (if required)
rules: {
name: "required",
firstname: "required",
lastname: "required",
username: {
required: true,
minlength: 2
},
password: {
required: true,
minlength: 5
},
confirm_password: {
required: true,
minlength: 5,
equalTo: "#password"
},
email: {
required: true, email: true
},
topic: {
required: "#newsletter:checked",
minlength: 2
},
agree: "required"
},
messages: {
//Name of the field: "Write any message"
name: "Please enter your name",
firstname: "Please enter your firstname",
lastname: "Please enter your lastname",
username: {
required: "Please enter a username",
minlength: "Your username must consist of at least 2 characters"
},
password: {
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long"
},
confirm_password: {
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long",
equalTo: "Please enter the same password as above" },
email: "Please enter a valid email address", agree: "Please accept our policy"
}
});
});
</script>
Here is a small description of the above scripts (jQuery Validation):

jQuery Validation

Description: Validates the selected form.

validate( [options ] )

options
Type: Object
debug (default: false)
Type: Boolean
Enables debug mode. If true, the form is not submitted and certain errors are displayed on the console (will check if a window.console property exists). Try to enable when a form is just submitted instead of validation stopping the submit.Example: Prevents the form from submitting and tries to help setting up the validation with warnings about missing methods and other debug messages.
$(".selector").validate({
debug: true
});
submitHandler (default: native form submit)
Type: Function()
Callback for handling the actual submit when the form is valid. Gets the form as the only argument. Replaces the default submit. The right place to submit a form via Ajax after it validated.Example: Submits the form via Ajax when valid.
$(".selector").validate({
submitHandler: function(form) {
$(form).ajaxSubmit();
}
});
Example: Use submitHandler to process something and then using the default submit. Note that “form” refers to a DOM element, this way the validation isn’t triggered again.
$(".selector").validate({
submitHandler: function(form) {
// do other stuff for a valid form
form.submit();
}
});
The callback gets passed one argument:
form
Type: Element
The form currently being validated, as a DOMElement.
invalidHandler
Type: Function()
Callback for custom code when an invalid form is submitted. Called with a event object as the first argument, and the validator as the second.Example: Displays a message above the form, indicating how many fields are invalid when the user tries to submit an invalid form.
$(".selector").validate({
invalidHandler: function(event, validator) {
// 'this' refers to the form
var errors = validator.numberOfInvalids();
if (errors) {
var message = errors == 1
? 'You missed 1 field. It has been highlighted'
: 'You missed ' + errors + ' fields. They have been highlighted';
$("div.error span").html(message);
$("div.error").show();
} else {
$("div.error").hide();
}
}
});
The callback gets passed two arguments:
event
Type: Event
A custom event object, since this function is bound as an event handler.
validator
Type: Validator
The validator instance for the current form.
ignore (default: ":hidden")
Type: Selector
Elements to ignore when validating, simply filtering them out. jQuery’s not-method is used, therefore everything that is accepted by not() can be passed as this option. Inputs of type submit and reset are always ignored, so are disabled elements.Example: Ignores all element with the class “ignore” when validating.
$("#myform").validate({
ignore: ".ignore"
});
rules (default: rules are read from markup (classes, attributes, data))
Type: Object
Key/value pairs defining custom rules. Key is the name of an element (or a group of checkboxes/radio buttons), value is an object consisting of rule/parameter pairs or a plain String. Can be combined with class/attribute/data rules. Each rule can be specified as having a depends-property to apply the rule only in certain conditions. See the second example below for details.Example: Specifies a name element as required and an email element as required (using the shortcut for a single rule) and a valid email address (using another object literal).
$(".selector").validate({
rules: {
// simple rule, converted to {required:true}
name: "required",
// compound rule
email: {
required: true,
email: true
}
}
});
Example: Specifies a contact element as required and as email address, the latter depending on a checkbox being checked for contacting via email.
$(".selector").validate({
rules: {
contact: {
required: true,
email: {
depends: function(element) {
return $("#contactform_email:checked")
}
}
}
}
});
messages (default: the default message for the method used)
Type: Object
Key/value pairs defining custom messages. Key is the name of an element, value the message to display for that element. Instead of a plain message another map with specific messages for each rule can be used. Overrides the title attribute of an element or the default message for the method (in that order). Each message can be a String or a Callback. The callback is called in the scope of the validator and with the rule’s parameters as the first and the element as the second argument, it must return a String to display as the message.Example: Specifies a name element as required and an email element as required and a valid email address. A single message is specified for the name element, and two messages for email.
$(".selector").validate({
rules: {
name: "required",
email: {
required: true,
email: true
}
},
messages: {
name: "Please specify your name",
email: {
required: "We need your email address to contact you",
email: "Your email address must be in the format of name@domain.com"
}
}
});
Example: Validates the name-field as required and having at least two characters. Provides a callback message using jQuery.format to avoid having to specify the parameter in two places.
$(".selector").validate({
rules: {
name: {
required: true,
minlength: 2
}
},
messages: {
name: {
required: "We need your email address to contact you",
minlength: jQuery.format("At least {0} characters required!")
}
}
});
groups
Type: Object
Specify grouping of error messages. A group consists of an arbitrary group name as the key and a space separated list of element names as the value. Use error Placement to control where the group message is placed.Example: Use a table layout for the form, placing error messages in the next cell after the input.
$("#myform").validate({
groups: {
username: "fname lname"
},
errorPlacement: function(error, element) {
if (element.attr("name") == "fname" || element.attr("name") == "lname" ) {
error.insertAfter("#lastname");
} else {
error.insertAfter(element);
}
}
});
onsubmit (default: true)
Type: Boolean
Validate the form on submit. Set to false to use only other events for validation.Set to a Function to decide yourself when to run validation.A Boolean true is not a valid value.Example: Disables onsubmit validation, allowing the user to submit whatever he wants, while still validating on keyup/blur/click events (if not specified otherwise).
$(".selector").validate({
onsubmit: false
});
onfocusout
Type: Boolean or Function()
Validate elements (except checkboxes/radio buttons) on blur. If nothing is entered, all rules are skipped, except when the field was already marked as invalid.Set to a Function to decide yourself when to run validation.A boolean true is not a valid value. Example: Disables onblur validation.
$(".selector").validate({
onfocusout: false
});
The callback gets passed two arguments: You can learn details about jQuery Validation from: http://jqueryvalidation.org/ or http://jqueryvalidation.org/documentation/
Read More