• 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 - Xin Hãy Rời Xa
    Download PSD
  • [PHP] Get list username - vBulletin
    <?php // GET user function duyk_get_all_usr($link, $total_usr) { $max_page = $total_usr/100; $ma...
  • 403 Forbidden and cant read /etc/named.conf Error Bypass
    This Tut has been submitted by Sen Haxor Now days most of the 2012 Linux Kernel server show this error when you try to symlink the serve...
  • Ả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...
  • Share CMND Nữ Cho Anh Em Để Unlock & Report
    COPYRIGHT : MINH HAKU IT                                               
  • PSD - Người & Ta
    DOWNLOAD PSD
  • vBulletin 5 Multiple Full Path Disclosure vulnerabilities
    /core/vb5/route/channel.php /core/vb5/route/conversation.php /core/vb5/route/*.php /includes/api/ interface /noncollapsed.php /includes/api/...
  • Tấn công PHP File Inclusion
    Thấy có người thắc mắc về vụ File inclusion này,mình sẽ lập 1 topic để giải đáp mọi vấn đề Local File Inclusion Basic Level: ví dụ trong trư...
  • [Share] TUT Rip Facebook Chất 2017 - Zoy Thủ Thuật Blog
    [Share] TUT Rip Facebook Chất 2017 - Zoy Thủ Thuật Blog B1 : Fake IP Th ổ Nhĩ Kì B2 : Vô Link RIP:  http://ouo.io/G9AbfU - Ch ọ n 9 năm - C...
  • Tổng hợp list password dùng cho brute force, crack
    Link các trang chia sẻ: Sắp xếp theo thứ tự giảm dần về số lượng. http://www.skullsecurity.org/wiki/index.php/Passwords http://www.moehre.or...

Pageviews from the past week

Chuyên mục

Bài đăng phổ biến

  • PSD - Xin Hãy Rời Xa
    PSD - Xin Hãy Rời Xa
    Download PSD
  • [PHP] Get list username - vBulletin
    <?php // GET user function duyk_get_all_usr($link, $total_usr) { $max_page = $total_usr/100; $ma...
  • 403 Forbidden and cant read /etc/named.conf Error Bypass
    This Tut has been submitted by Sen Haxor Now days most of the 2012 Linux Kernel server show this error when you try to symlink the serve...
  • Ả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...
  • Share CMND Nữ Cho Anh Em Để Unlock & Report
    Share CMND Nữ Cho Anh Em Để Unlock & Report
    COPYRIGHT : MINH HAKU IT                                               
  • PSD - Người & Ta
    PSD - Người & Ta
    DOWNLOAD PSD
  • vBulletin 5 Multiple Full Path Disclosure vulnerabilities
    /core/vb5/route/channel.php /core/vb5/route/conversation.php /core/vb5/route/*.php /includes/api/ interface /noncollapsed.php /includes/api/...
  • Tấn công PHP File Inclusion
    Thấy có người thắc mắc về vụ File inclusion này,mình sẽ lập 1 topic để giải đáp mọi vấn đề Local File Inclusion Basic Level: ví dụ trong trư...
  • [Share] TUT Rip Facebook Chất 2017 - Zoy Thủ Thuật Blog
    [Share] TUT Rip Facebook Chất 2017 - Zoy Thủ Thuật Blog
    [Share] TUT Rip Facebook Chất 2017 - Zoy Thủ Thuật Blog B1 : Fake IP Th ổ Nhĩ Kì B2 : Vô Link RIP:  http://ouo.io/G9AbfU - Ch ọ n 9 năm - C...
  • Tổng hợp list password dùng cho brute force, crack
    Link các trang chia sẻ: Sắp xếp theo thứ tự giảm dần về số lượng. http://www.skullsecurity.org/wiki/index.php/Passwords http://www.moehre.or...
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