• About
  • Policy
  • Contact

Phan Anh Buổi Sáng

  • Home
  • Kiến thức IT
    • PSD
    • Blogger
  • Translate
Google
Custom Search
Trang chủ » TUTORIALS » Hướng dẫn tạo trang redirect theo tình huống

Hướng dẫn tạo trang redirect theo tình huống

Unknown Labels: TUTORIALS Leave A Comment 06:52
Download:
http://www.mediafire.com/?v4c8bjuacbp272t

1. Reditect theo referer: Tức là ta set nếu request từ 1 domain cho trước thì redirect đến trang A, tất cả request còn lại thì redirect tới trang B dựa vào script check referer của PHP. Không biết bạn hình dung ra chưa nhưng xem đoạn script dưới đây thì bạn sẽ nhận ra thôi

Code:
<?php
$referer=$_SERVER["HTTP_REFERER"];
$referer=parse_url($referer);
$referer=$referer['host'];
$referer=str_replace("www.","",$referer);

if ($referer=="hacker4a.net") {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.vncracking.com/web-tools/" ); }
else {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.vncracking.com/" ); }
?>
Với đoạn script trên thì mọi request từ domain hacker4a.net sẽ được chuyển đến http://www.vncracking.com/web-tools/ và những request bất kỳ còn lại sẽ được chuyển đến domain gốc http://www.vncracking.com

Redirect theo địa chỉ IP cho trước:
Trích dẫn:
<?php
$ip=$_SERVER["REMOTE_ADDR"];

if ($ip=="210.245.120.84"){
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://yahoo.com/" ); }
else {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.vncracking.com/" ); }
?> 
 Khi đó máy có IP là 210.245.120.84 sẽ được redirect sang http://www.yahoo.com/ còn tất cả IP còn lại sẽ được chuyển sang http://www.vncracking.com/

Tương tự với 2 địa chỉ IP cho trước:

Code:

<?php
$ip=$_SERVER["REMOTE_ADDR"];

if ($ip=="210.245.120.84") {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.yahoo.com/" ); }
elseif ($ip=="230.162.5.184") {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.google.com/" ); }
else {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.vncracking.com/" ); }
?>
- IP mới thêm vào sẽ được chuyển sang http://www.google.com/
- Và nhiều hơn 2 IP thì ta cũng làm tương tự với elseif.


Lấy một trường hợp khác. Ta có 2 địa chỉ IP là: 210.245.120.84 và 230.162.5.18 khi truy cập vào trang web ta muốn máy có IP là 210.245.120.84 sẽ bị chuyển sang yahoo.com, máy có IP là 230.162.5.18 sẽ bị pasword protect chặn lại còn tất cả máy khác thì được chuyển sang vncracking.com. Ta làm như sau:

Code:

<?php
$ip=$_SERVER["REMOTE_ADDR"];

if ($ip=="210.245.120.84") {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.yahoo.com/" ); }
elseif ($ip=="230.162.5.18") {
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="VNP Community"'); }
else {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.vncracking.com/" ); }
?>
 Mốt số mẫu khác :

- Lưu ý: Ở các mẫu bên dưới các bạn thay http://www.new-url.com bằng url mà các bạn muốn redirect tới.

ColdFusion Redirect:

<.cfheader statuscode="301" statustext="Moved permanently">
<.cfheader name="Location" value="http://www.new-url.com">
PHP Redirect:

Code:

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>
 ASP Redirect:

Code:

<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently";
Response.AddHeader("Location","http://www.new-url.com/");
%>
ASP .NET Redirect:

Code:

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.new-url.com");
}
</script>
 JSP (Java) Redirect:

Code:

<%
response.setStatus(301);
response.setHeader( "Location", "http://www.new-url.com/" );
response.setHeader( "Connection", "close" );
%>
CGI PERL Redirect:

Code:

$q = new CGI;
print $q->redirect("http://www.new-url.com/");
 Ruby on Rails Redirect:

Code:

def old_action
headers["Status"] = "301 Moved Permanently"
redirect_to "http://www.new-url.com/"
end
Htaccess Redirect:

Code:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
 HTML Metatag Redirect: (Not 301 Redirect)

Code:

<meta http-equiv="refresh" content="x; URL=http://www.new-url.com">
- x là số thời gian bạn muốn trang web chuẩn bị tự động di chuyển tính bằng giây (sec).

Java-Script Redirect: (Not 301 Redirect)

Code:
<script>window.location.replace('http://www.new-url.com');</script>

Bài viết liên quan

← Bài đăng mới hơn Bài đăng cũ hơn → Trang chủ
Powered by Blogger.

Các Bình Luận Gần Đây

Bài đăng phổ biến

  • PSD - Người & Ta
    DOWNLOAD PSD
  • Share CMND Nữ Cho Anh Em Để Unlock & Report
    COPYRIGHT : MINH HAKU IT                                               
  • Ảnh bìa chế Phía sau một cô gái - Soobin Hoàng Sơn - Zoy Thủ Thuật #Zoy
    Đôi lúc em tránh ánh mắt của anh. vì dường như lúc nào em cũng hiểu thấu lòng anh Demo Cover Download PSD loading...
  • [PHP] Get list username - vBulletin
    <?php // GET user function duyk_get_all_usr($link, $total_usr) { $max_page = $total_usr/100; $ma...
  • [PSD] Hacker - Đặng Khắc ĐứcPSD
    Demo Click here Download Click here
  • The List of Function dangerous in PHP development
    apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd, eval, exec, fp, fput, ftp_connect, ftp_exec,...
  • Hướng dẫn hack game rắn ăn mồi Slither.Io trên máy tính 2016 - Zoy Thủ Thuật #Zoy
    Hướng dẫn hack game rắn ăn mồi Slither.Io trên máy tính với Tampermonkey . Bản hack bao gồm: hack zoom, hack tự xoay tròn, hack tự động chơi...
  • TUT bypass ACCESS DENIED
    Tut bypass ACCESS DENIED  By [BYG] Kid Link dowload : http://www.mediafire.com/?0m6xxvthh08603a
  • [PSD] THUỐC PHIỆN - PSD
    Demo Click here Download Click here [PSD] THUỐC PHIỆN - PSD loading...
  • Tổng Hợp Các Dạng Tut Hack Web Cơ Bản
    Vui Lòng xem và thực hành trên máy ảo 1. Local Attack 1.26MB – Tác Giả: Unlock_virus Video Hướng dẫn sử dụng Shell và local ( rất căn bản c...

Pageviews from the past week

Chuyên mục

Bài đăng phổ biến

  • PSD - Người & Ta
    PSD - Người & Ta
    DOWNLOAD PSD
  • Share CMND Nữ Cho Anh Em Để Unlock & Report
    Share CMND Nữ Cho Anh Em Để Unlock & Report
    COPYRIGHT : MINH HAKU IT                                               
  • Ảnh bìa chế Phía sau một cô gái - Soobin Hoàng Sơn - Zoy Thủ Thuật #Zoy
    Ảnh bìa chế Phía sau một cô gái - Soobin Hoàng Sơn - Zoy Thủ Thuật #Zoy
    Đôi lúc em tránh ánh mắt của anh. vì dường như lúc nào em cũng hiểu thấu lòng anh Demo Cover Download PSD loading...
  • [PHP] Get list username - vBulletin
    <?php // GET user function duyk_get_all_usr($link, $total_usr) { $max_page = $total_usr/100; $ma...
  • [PSD] Hacker - Đặng Khắc ĐứcPSD
    [PSD] Hacker - Đặng Khắc ĐứcPSD
    Demo Click here Download Click here
  • The List of Function dangerous in PHP development
    apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd, eval, exec, fp, fput, ftp_connect, ftp_exec,...
  • Hướng dẫn hack game rắn ăn mồi Slither.Io trên máy tính 2016 - Zoy Thủ Thuật #Zoy
    Hướng dẫn hack game rắn ăn mồi Slither.Io trên máy tính 2016 - Zoy Thủ Thuật #Zoy
    Hướng dẫn hack game rắn ăn mồi Slither.Io trên máy tính với Tampermonkey . Bản hack bao gồm: hack zoom, hack tự xoay tròn, hack tự động chơi...
  • TUT bypass ACCESS DENIED
    Tut bypass ACCESS DENIED  By [BYG] Kid Link dowload : http://www.mediafire.com/?0m6xxvthh08603a
  • [PSD] THUỐC PHIỆN - PSD
    [PSD] THUỐC PHIỆN - PSD
    Demo Click here Download Click here [PSD] THUỐC PHIỆN - PSD loading...
  • Tổng Hợp Các Dạng Tut Hack Web Cơ Bản
    Vui Lòng xem và thực hành trên máy ảo 1. Local Attack 1.26MB – Tác Giả: Unlock_virus Video Hướng dẫn sử dụng Shell và local ( rất căn bản c...
Google
Custom Search
Support: Facebook | Twitter | Google+ | Giới thiệu
Copyright © 2015 • Phan Anh Buổi Sáng • All Right Reserved. Template by Template Việt