PHP中的变量帮助

时间:2013-05-21 21:42:34

标签: php

问题答案:https://stackoverflow.com/a/16721000/2217905

<?php
if(isset($_POST["act"])) {
$uname = $_POST['username']; //Username
$uname = str_replace(array('!','"','£','$','%','%','^','&','*','(',')','-','+','=','\\','/','[',']','{','}',';',':','@','#','~','<',',','>','.','?','|',' '), '', $uname); 


// Set some variables and values that you want to be propogated through the URL

$variable['1'] = $_POST['username'];

// We now set the base of the dynamic link

$link = "http://yunodev.com/skinstealer.php"; 

// Add on a question mark to the link, to identify that variables are now being set
$link .= "?"; 
// Lets add on our first variable to the link
$link .= $variable['1']; 


}
?>
<!-- THIS PAGE IS skinstealer.php -->
<html>
<head>
<title>Minecraft Skin Stealer - Image View</title>
</head>
<body>
<img src="http://s3.amazonaws.com/MinecraftSkins/<?php echo $uname; ?>.png"  width="800" height="400" alt="Error">
<p><b>Image scaled by 800x400pixels. Will be much smaller, and no blur when downloaded.</b></p>
<p><a href="http://s3.amazonaws.com/MinecraftSkins/<?php echo $uname; ?>.png">Download Skin</a></p>a

这是我现在的代码,基本上我想要的是当用户转到链接时:http://example.com/skinstealer.php?id=Laim它显示了皮肤。如果这是有道理的。

之前从未做过变量,所以这对我来说是新鲜事。

GEORGE评论后编辑

目前我所得到的(如果我回音)是http://example.com/skinstealer.php?laim 如果我转到该链接,它只显示我的错误图像。如果需要,我可以上传现场演示。

1 个答案:

答案 0 :(得分:0)

得到它,最后。 (好吧,前几天我得到了它,但忘了为有这个问题的其他人更新这个问题。)

删除代码:

<?php
if(isset($_POST["act"])) {

// Set some variables and values that you want to be propogated through the URL

$variable['1'] = $_POST['username'];

// We now set the base of the dynamic link

$link = "http://yunodev.com/skinstealer.php"; 

// Add on a question mark to the link, to identify that variables are now being set
$link .= "?"; 
// Lets add on our first variable to the link
$link .= $variable['1']; 


} <!-- REMOVE THIS

然后您将所有'POST'更改为'GET',例如:http://yunodev.com/download/minecraft/(V5)