Error 404 message is a common error. You will never be able to control every link on your website, or can solve all the 404 error message.
1.404 error Page not found
Page not found (PAGE NOT FOUND) appears when a request is sent to the web server is not carried out or do not find that request.
Overall, 404 error page (HTTP 404 status code) is returned when accessing an URL (address) does not exist - causing by deleted or edited URL, but do not be redirected (301 redirect) the old URL to the new URL. Or maybe because of misspelled the link to share somewhere.
2.Handle 404 Error
+If the error from link on your site
Please edit or remove the link.
+If the error link from external sites
you can "take advantage" to navigate the user to your site using a 301 redirect function.
Hocinat
Tuesday, August 16, 2016
Catching And Debugging In PHP
1.Common syntax errors in PHP
Named Function and Variables do not follow the rules. Lack of parameter passed to the function.
Misspellings: coders can write or call the wrong name of the function, the variable name.
Beyond calculation: When programmers require exceed the capabilities of the server will cause the errors that sometimes can not be determined
2.Use the command Die();
Die ($ variable) print out the contents of the variable and end the program at the location calling the die ()
3.Hide errors for users
Do not display the error message to the user which cause a negative impact on users and websites.
4.Setting the notification section is displayed
Hide all errors: error_reporting (0);
Show all errors: error_reporting (E_ALL);
Displays the warning: error_reporting (E_WARNING);
Displays the notice: error_reporting (E_NOTICE);
The value displayed is the default setting: error_reporting (E_ALL ^ E_NOTICE);
Named Function and Variables do not follow the rules. Lack of parameter passed to the function.
Misspellings: coders can write or call the wrong name of the function, the variable name.
Beyond calculation: When programmers require exceed the capabilities of the server will cause the errors that sometimes can not be determined
2.Use the command Die();
Die ($ variable) print out the contents of the variable and end the program at the location calling the die ()
3.Hide errors for users
Do not display the error message to the user which cause a negative impact on users and websites.
4.Setting the notification section is displayed
Hide all errors: error_reporting (0);
Show all errors: error_reporting (E_ALL);
Displays the warning: error_reporting (E_WARNING);
Displays the notice: error_reporting (E_NOTICE);
The value displayed is the default setting: error_reporting (E_ALL ^ E_NOTICE);
Monday, August 15, 2016
17 Steps You Must Check After Coding
One of the most important things before release a website that you must check all security methods as possible. Here are the following steps.
1. Cross site scripting
Check your code if there are any embedded vulnerabilities code as javascript, html ... into input field.
2.Stealth command
Check if you can run OS, LINUX command from outside to call your website function or not.
3.SQL injection
Can you run SQL from CMD and affect to DB?
4.Buffer overflow
Input big data and check the Buffer overflow.
5.Risk
Check 3D party tool, app server, OS hay web server
6.Browsing coercion
Check if user input a invalid direct URL, website return page and data or not?
7.hidden field
Check if user try to change data from hidden field and cause to undesireable action or not?
8.backup file
Check backup file
9.3rd party product
Check 3rd party product whether there are nothing suitable?
10.Backddor, debug option
Check debug code and backdoor exist?
11.Comment in HTML
Check comment in html whether they show some secret key and password?
12.Directory traversal
Check at the current directory can access to other directory ?
13. Session Risk
check access and login of user, check open page and tab when using session.
14. Web Service Risk
check attack xml
15.parameter
Check Parameter Input
16.Check error
Check message error
17.Cross site request
Check cross site request.
1. Cross site scripting
Check your code if there are any embedded vulnerabilities code as javascript, html ... into input field.
2.Stealth command
Check if you can run OS, LINUX command from outside to call your website function or not.
3.SQL injection
Can you run SQL from CMD and affect to DB?
4.Buffer overflow
Input big data and check the Buffer overflow.
5.Risk
Check 3D party tool, app server, OS hay web server
6.Browsing coercion
Check if user input a invalid direct URL, website return page and data or not?
7.hidden field
Check if user try to change data from hidden field and cause to undesireable action or not?
8.backup file
Check backup file
9.3rd party product
Check 3rd party product whether there are nothing suitable?
10.Backddor, debug option
Check debug code and backdoor exist?
11.Comment in HTML
Check comment in html whether they show some secret key and password?
12.Directory traversal
Check at the current directory can access to other directory ?
13. Session Risk
check access and login of user, check open page and tab when using session.
14. Web Service Risk
check attack xml
15.parameter
Check Parameter Input
16.Check error
Check message error
17.Cross site request
Check cross site request.
8 MOST IMPORTANT CSS TRICKS
Here are top 30 css tricks that a designer can not be ignore. Some tips may be new, other already are familiar to you And We looking forward you can find some useful things through this article.
1.Centered horizontally
To center an object horizontally in block type. you must specify the with and set the css properties left and right is auto.
div#page {width: 960px; margin: 0 auto}
2.Centered Text Vertically
to center the text vertically in the div tag. you must specify the height of this tag and add the line-height properties with the height of div.
<div id="content">your content here</div>
3.Conditional Comment
If you want your desired css just applied for only certain browser. you can use conditional comments. For example, to apply its own css for IE.
1.Centered horizontally
To center an object horizontally in block type. you must specify the with and set the css properties left and right is auto.
div#page {width: 960px; margin: 0 auto}
2.Centered Text Vertically
to center the text vertically in the div tag. you must specify the height of this tag and add the line-height properties with the height of div.
<div id="content">your content here</div>
-----
div#content {position: absolute; top: 50%; height: 500px; margin-top: -250px}3.Conditional Comment
If you want your desired css just applied for only certain browser. you can use conditional comments. For example, to apply its own css for IE.
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="ie-stylesheet.css" />
< ![endif]-->
4. Fluid Images
<link rel="stylesheet" type="text/css" href="ie-stylesheet.css" />
< ![endif]-->
4. Fluid Images
Fluid Image is the image that its size is not exceed its container. If an image size is 300px and placed inside an 200px container. so the image scaled to 200px. To do this, you can simply set max-width properties is 100px.
img{max-width: 100%}
As for IE, replace max-width by width
img{width: 100%}
5.3D button
By setting the border color and background color. you can make a 3D button with div tag.
div#button {height:30px; width: 70px; background: #888;
border: 2px solid; border-color: #999 #777 #777 #999 }
6.CSS SHORTHAND
6.CSS SHORTHAND
body {font: font-style font-variant font-weight font-size line-height font-family;}
7.MULTIPLE CLASS
<div class="class-1 class-2 class-3"></div>
7.MULTIPLE CLASS
<div class="class-1 class-2 class-3"></div>
In cases where a property is declared in multiple layers, the value declared in the final grade will be effective.
8. a style
A link with a tag will have 4 states: link, visited, hover, active. You can style for each different states:
Top 8 Jquery Trick You must know
1. Back to top
By using the method animate and scrolltop in jquery. You do not need to add any more plugin to create the scroll-to-top effect.
$('a.top').click(function (e) {
e.preventDefault();
$(document.body).animate({scrollTop: 0}, 800);
});
----
<a class="top" href="#">Back to top</a>
2.Preload images
If your site use multiple images and they have not been loaded then you can use an temporary image.
$.preloadImages = function () {
for (var i = 0; i < arguments.length; i++) {
$('<img>').attr('src', arguments[i]);
}
};
$.preloadImages('img/hover-on.png', 'img/hover-off.png');
3.Check image loaded
$('img').load(function () {
console.log('image load successful');
});
4.Toggle class on hover
If you want to change the class of an element when you mouse over. the following command can be applied
$('.btn').hover(function () {
$(this).toggleClass('hover');
});
5.Disabling the Input field
Take an example when user click on the checkbox to agree a new term.
$('input[type="submit"]').prop('disabled', true);
$('input[type="submit"]').prop('disabled', false);
6.Prevent a default action
Ex. you click on a button link to redirect a special page but in some case you want to prevent this default action. Simply by using the following func.
$('a.no-link').click(function (e) {
e.preventDefault();
});
7.Hide And show a div tag
you can apply Fade and Slide to toggle an element.
$('.btn').click(function () {
$('.element').fadeToggle('slow');
});
// Toggle
$('.btn').click(function () {
$('.element').slideToggle('slow');
});
8. Search element based on text
By using the method contains in jquery you can find the div tag that contain the div tag with keyword
var search = $('#search').val();
$('div:not(:contains("' + search + '"))').hide();
By using the method animate and scrolltop in jquery. You do not need to add any more plugin to create the scroll-to-top effect.
$('a.top').click(function (e) {
e.preventDefault();
$(document.body).animate({scrollTop: 0}, 800);
});
----
<a class="top" href="#">Back to top</a>
2.Preload images
If your site use multiple images and they have not been loaded then you can use an temporary image.
$.preloadImages = function () {
for (var i = 0; i < arguments.length; i++) {
$('<img>').attr('src', arguments[i]);
}
};
$.preloadImages('img/hover-on.png', 'img/hover-off.png');
3.Check image loaded
$('img').load(function () {
console.log('image load successful');
});
4.Toggle class on hover
If you want to change the class of an element when you mouse over. the following command can be applied
$('.btn').hover(function () {
$(this).toggleClass('hover');
});
5.Disabling the Input field
Take an example when user click on the checkbox to agree a new term.
$('input[type="submit"]').prop('disabled', true);
$('input[type="submit"]').prop('disabled', false);
6.Prevent a default action
Ex. you click on a button link to redirect a special page but in some case you want to prevent this default action. Simply by using the following func.
$('a.no-link').click(function (e) {
e.preventDefault();
});
7.Hide And show a div tag
you can apply Fade and Slide to toggle an element.
$('.btn').click(function () {
$('.element').fadeToggle('slow');
});
// Toggle
$('.btn').click(function () {
$('.element').slideToggle('slow');
});
8. Search element based on text
By using the method contains in jquery you can find the div tag that contain the div tag with keyword
var search = $('#search').val();
$('div:not(:contains("' + search + '"))').hide();
Sunday, August 14, 2016
Simple 5 tips for PHP Newbie
1.Single Quotation is always faster than Quotation
Because quotation always check the content inside which contain any variable or not. While the Single Quotation is not checked because the content within a single quotation is alway a chain.
2. Loop in PHP
Whenever using loop to browser an element in array. You often use count function to count the number of elements in array. This will make our application become slow because every element in loop we must recall the count function.
Improve by using count outside loop.
<?php
$b = count($a);
for($i=0; $i<=$b; $i++){
// action
}
?>
3. Dont Use Relative Path Folder PHP
Because your system must takes time to search for and sharing the path.That will make the resource-consuming applications in the implementation of this operation.
Improve:
<?php
include BASE.'/path/a.php';
?>
4.Connect the string with a comma "," will be faster than mark "."
PHP programming habits are often connecting Strings and Variables by mark ".". But the fact that the connection strings with a comma ",", will be faster.
5.Always use Single quotes to access key 1 array:
$a = $b['abc']; // faster
Because quotation always check the content inside which contain any variable or not. While the Single Quotation is not checked because the content within a single quotation is alway a chain.
2. Loop in PHP
Whenever using loop to browser an element in array. You often use count function to count the number of elements in array. This will make our application become slow because every element in loop we must recall the count function.
Improve by using count outside loop.
<?php
$b = count($a);
for($i=0; $i<=$b; $i++){
// action
}
?>
3. Dont Use Relative Path Folder PHP
Because your system must takes time to search for and sharing the path.That will make the resource-consuming applications in the implementation of this operation.
Improve:
<?php
include BASE.'/path/a.php';
?>
4.Connect the string with a comma "," will be faster than mark "."
PHP programming habits are often connecting Strings and Variables by mark ".". But the fact that the connection strings with a comma ",", will be faster.
5.Always use Single quotes to access key 1 array:
$a = $b['abc']; // faster
Top 5 Tips For Css Web Designer
1. Simplified rules in font css
font-size: 1em;
line-height: 1.5em;
font-weight: bold;
font-style: italic;
font-varient: small-caps;
font-family: verdana,serif
you can simplify this:
font: 1em/1.5em bold italic small-caps verdana,serif
2.Add more than 1 class to html object
<p class="text side">...</p>
3.!important
override all other css statment and not working on IE.
margin-top: 3.5em !important; margin-top: 2em
4.Replace Text By Image
Sometime you need to use the image contains text that were made from separate font in Photoshop to show web more beautiful. But the ability of google search on your web will be lower. so how to be able to meet both the needs above. Very simple you just need to refer the following example.
<h1><span>Buy widgets</span></h1>
You can apply the following css:
h1
{
background: url(widget-image.gif) no-repeat;
}
h1 span
{
position: absolute;
left:-2000px
}
5. CSS positioning inside a Container
One of the best things about css that you can location an object inside another object. Quite Simpy you just need to set the css properties as follows.
#container
{
position: relative
}
and then you now place an object insde the container object and apply the css properties as follow.
#navigation
{
position: absolute;
left: 30px;
top: 5px
}
font-size: 1em;
line-height: 1.5em;
font-weight: bold;
font-style: italic;
font-varient: small-caps;
font-family: verdana,serif
you can simplify this:
font: 1em/1.5em bold italic small-caps verdana,serif
2.Add more than 1 class to html object
<p class="text side">...</p>
3.!important
override all other css statment and not working on IE.
margin-top: 3.5em !important; margin-top: 2em
4.Replace Text By Image
Sometime you need to use the image contains text that were made from separate font in Photoshop to show web more beautiful. But the ability of google search on your web will be lower. so how to be able to meet both the needs above. Very simple you just need to refer the following example.
<h1><span>Buy widgets</span></h1>
You can apply the following css:
h1
{
background: url(widget-image.gif) no-repeat;
}
h1 span
{
position: absolute;
left:-2000px
}
5. CSS positioning inside a Container
One of the best things about css that you can location an object inside another object. Quite Simpy you just need to set the css properties as follows.
#container
{
position: relative
}
and then you now place an object insde the container object and apply the css properties as follow.
#navigation
{
position: absolute;
left: 30px;
top: 5px
}
Subscribe to:
Posts (Atom)