查看完整版本: 如何在PHP程序中防止盗链

php 2007-7-28 23:02

如何在PHP程序中防止盗链

[color=#000000][color=#0000cc]<[/color][color=#0000cc]?[/color][color=#0000ff]php[/color]

[color=#0000ff]$[/color][color=#008080]id[/color] [color=#0000cc]=[/color] [color=#0000ff]$[/color][color=#008080]_GET[/color][color=#0000cc][[/color][color=#ff00ff]'id'[/color][color=#0000cc]][/color][color=#0000cc];[/color]
[color=#0000ff]$[/color][color=#008080]act[/color] [color=#0000cc]=[/color] [color=#0000ff]$[/color][color=#008080]_GET[/color][color=#0000cc][[/color][color=#ff00ff]'act'[/color][color=#0000cc]][/color][color=#0000cc];[/color]

[color=#0000ff]switch[/color][color=#0000cc]([/color][color=#0000ff]$[/color][color=#008080]act[/color][color=#0000cc])[/color] [color=#0000cc]{[/color]
[color=#0000ff]default[/color] [color=#0000cc]:[/color]
[color=#0000ff]case[/color] [color=#ff00ff]"display"[/color] [color=#0000cc]:[/color] displayHTML[color=#0000cc]([/color][color=#0000cc])[/color][color=#0000cc];[/color] [color=#0000ff]break[/color][color=#0000cc];[/color]
[color=#0000ff]case[/color] [color=#ff00ff]"down"[/color] [color=#0000cc]:[/color] down[color=#0000cc]([/color][color=#0000cc])[/color][color=#0000cc];[/color] [color=#0000ff]break[/color][color=#0000cc];[/color]
[color=#0000cc]}[/color]

[color=#0000ff]function[/color] displayHTML[color=#0000cc]([/color][color=#0000ff]$[/color][color=#008080]id[/color][color=#0000cc])[/color] [color=#0000cc]{[/color]
[color=#ff0000]setcookie[/color][color=#0000cc]([/color][color=#ff00ff]"visited"[/color][color=#0000cc],[/color] [color=#ff00ff]"true"[/color][color=#0000cc])[/color][color=#0000cc];[/color]

[color=#ff9900]// print your HTML.
[/color]
[color=#0000cc]}[/color]

[color=#0000ff]function[/color] down[color=#0000cc]([/color][color=#0000ff]$[/color][color=#008080]id[/color][color=#0000cc])[/color] [color=#0000cc]{[/color]
[color=#0000ff]if[/color][color=#0000cc]([/color][color=#0000cc]![/color] [color=#ff0000]isset[/color][color=#0000cc]([/color][color=#0000ff]$[/color][color=#008080]_COOKIE[/color][color=#0000cc][[/color][color=#ff00ff]'visited'[/color][color=#0000cc]][/color][color=#0000cc])[/color] [color=#0000cc])[/color] [color=#ff0000]print[/color] [color=#ff00ff]"你盗联?"[/color][color=#0000cc];[/color]

[color=#0000ff]$[/color][color=#008080]sql[/color] [color=#0000cc]=[/color] [color=#ff00ff]"select path from TABLE where id="[/color][color=#0000cc].[/color] [color=#0000ff]$[/color][color=#008080]id[/color][color=#0000cc];[/color]
[color=#ff9900]//..............................
[/color]
[color=#0000cc]}[/color]
[color=#0000cc]?[/color][color=#0000cc]>[/color]

[color=#0000cc]<[/color][color=#0000ff]a[/color] [color=#ff0000]href[/color][color=#0000cc]=[/color][color=#ff00ff]"dl.php?id=1&act=down"[/color][color=#0000cc]>[/color]Download Now[color=#0000cc].[/color][color=#0000cc].[/color][color=#0000cc].[/color][color=#0000cc]<[/color][color=#0000cc]/[/color][color=#0000ff]a[/color][color=#0000cc]>[/color][/color]
页: [1]
查看完整版本: 如何在PHP程序中防止盗链