2017-04-13 86 views
-1

HTML代碼: 如何在鏈接中使用php插入變量?

<html> 
 
<body> 
 
    <?php 
 
     if (isset($_POST['submit'])){ 
 
      $idfb = $_POST['idfb']; 
 
      $url = "http://graph.facebook.com/$idfb/picture?type=$size"; 
 
     } 
 
    ?> 
 
    <input name="idfb" id="idfb" required placeholder="Enter the ID in this field" type="text"> 
 
    <button type="submit" class="button" href="loading.php">Hack this Facebook Account</button> 
 
    <center><img class="thumbnail" src="http://graph.facebook.com/<?php echo $idfb ?>/picture?type=large"></center> 
 
</body> 
 
</html>

所以我想從輸入插入Facebook的ID爲鏈接,並抓住這個帳戶ID的資料圖片。 這是對的嗎?

+1

是的,如果我們假設'$ _POST'有數據 - 但'

'已被棄用,並且您不能在按鈕中使用'href'。我認爲你應該使用'
'來做這個「黑客行爲」的事情 –

+0

不工作:它在做什麼?它是否爲'$ idfb'放置任何東西?你在用'$ url'做什麼?它是否獲得'$ idfb'的值? – alanlittle

+0

如果你回顯你的變量和url,你會得到你期待的值嗎?你也正確地通過另一個表單的POST方法發送你的變量= – Lixus

回答

1

試試這個:

<html> 
    <head> 
    </head> 
    <body> 
     <?php 
if (isset($_POST['submit'])) 
{ 
    $idfb = $_POST['idfb']; 
    $url = "http://graph.facebook.com/".$idfb."/picture?type=large"; 
} 
     ?> 
     <form action="" method="POST"> 
      <input name="idfb" id="idfb" required placeholder="Enter the ID in this field" type="text"> 
      <input type="submit" name="submit" class="button" value="Hack this Facebook Account" /> 
      <?php if(isset($url)) { ?> 
      <center> 
       <img class="thumbnail" src=" 
<?php echo $url; ?>"> 
      </center> 
      <?php } ?> 
     </form> 
    </body> 
</html> 

你必須在HTML代碼一些錯誤,以獲得正確的價值觀。

+0

Nop。它不工作。 當點擊提交鏈接需要看起來像這樣「http://graph.facebook.com/100000302821078/picture?type=large 在這裏你可以看到它是如何工作在網站:http://www.hypercracker.com /hack.php –

+0

轉到這裏:http://phpfiddle.org/並複製此代碼並運行。它的工作非常好。 –

+0

我可以在您的網站上看到它及其工作。現在有什麼問題? –