Umleiten PHP-Datei im Kolben
Ich bin mit localhost website mit Kolben und python. Ich habe einige php-Dateien, die ich ausführen möchten, wenn der Benutzer auf eine Schaltfläche. Problem ist, die Flasche ist nicht die Anerkennung der PHP-Datei als PHP-code und der code wird angezeigt als text auf der Webseite. Es zeigt den text aller echo-Anweisungen, aber die Worte, die in diesen Aussagen entsprechen Variablen im code, die es ermöglichen, den Benutzer login und logout von der website. Was kann ich tun?
Python-Code:
@app.route('/example.php')
def phpexample():
return render_template('example.php')
Dies zeigt eine html-Seite mit text, die aus der echo
Aussagen.
Den PHP-code (example.php):
<?php
require ('steamauth/steamauth.php');
?>
<html>
<head>
<title>Eliminate Phishers! Join Steap now</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<!--[if lte IE 8]><script src="css/ie/html5shiv.js"></script><![endif]-->
<script src="js/jquery.min.js"></script>
<script src="js/skel.min.js"></script>
<script src="js/init.js"></script>
<noscript>
<link rel="stylesheet" href="css/skel.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/style-wide.css" />
</noscript>
<!--[if lte IE 8]><link href="css/ie/v8.css" /><![endif]-->
</head>
<body>
<!-- Header -->
<div id="header">
<span class="logo icon fa-paper-plane-o"></span>
<h1>Welcome. This is Steap</h1>
<p>A website designed to help eliminate phishers
<br />
and hackers on Steam.</p>
</div>
<!-- Main -->
<div id="main">
<header class="major container small">
<h3>
<?php
if(!isset($_SESSION['steamid'])) {
echo "welcome guest! <br />\n please login ";
steamlogin(); //login button
} else {
include ('steamauth/userInfo.php');
$url = $steamprofile['profileurl'];
if ($steamprofile['personastate'] == 0) {
$state = '<span style="color:#616161";>(Offline)</span>';
$picture = '<span style="color:#616161";><img src="'.$steamprofile['avatarfull'].'" title = "" alt = ""></span>';
} else if ($steamprofile['personastate'] == 1) {
$state = '<span style="color:#006EFF";>(Online)</span>';
$picture = '<span style="border: 10px dotted #006EFF;"><img src="'.$steamprofile['avatarfull'].'" title = "" alt = ""></span>';
} else if ($steamprofile['personastate'] == 2) {
$state = '<span style="color:#006EFF";>(Busy)</span>';
$picture = '<span style="border-color:#006EFF border-style: solid";><img src="'.$steamprofile['avatarfull'].'" title = "" alt = ""></span>';
} else if ($steamprofile['personastate'] == 3) {
$state = '<span style="color:#006EFF";>(Away)</span>';
$picture = '<span style="border-color:#006EFF border-style: solid";><img src="'.$steamprofile['avatarfull'].'" title = "" alt = ""></span>';
} else if ($steamprofile['personastate'] == 4) {
$state = '<span style="color:#006EFF";>(Snooze)</span>';
$picture = '<span style="border-color:#006EFF border-style: solid";><img src="'.$steamprofile['avatarfull'].'" title = "" alt = ""></span>';
} else if ($steamprofile['personastate'] == 5) {
$state = '<span style="color:#006EFF";>(Looking to Trade)</span>';
$picture = '<span style="border-color:#006EFF border-style: solid";><img src="'.$steamprofile['avatarfull'].'" title = "" alt = ""></span>';
} else if ($steamprofile['personastate'] == 6) {
$state = '<span style="color:#006EFF";>(Looking to Play)</span>';
$picture = '<span style="border-color:#006EFF border-style: solid";><img src="'.$steamprofile['avatarfull'].'" title = "" alt = ""></span>';
}
//Protected content
echo "Welcome back" . "</br> </br>" . $picture ."</br>". $steamprofile['personaname'] . "</br>" .$state . "</br>". "Steam ID: ". $steamprofile['steamid'] . "</br>";
echo '<a href="' . $url . '">Steam Profile</a>' . "</br> </br>" . "<form action=\"steamauth/logout.php\" method=\"post\"><input value=\"Logout\" type=\"submit\" /></form>"; //Display their avatar!
}
?>
</h3>
</header>
<footer class="major container small">
<ul class="actions">
<li><a href="index.html" class="button">Get Phishers</a></li>
</ul>
</footer>
</div>
<!-- Footer -->
<div id="footer">
<div class="container small">
<header class="major last">
<h2>Questions or comments?</h2>
</header>
<p>Program not working? Not detecting the phishers properly? <br \> Send us a message. We'll be sure to back to you as soon as possible.</p>
<form method="post" action="#">
<div class="row collapse-at-2">
<div class="6u">
<input type="text" name="name" placeholder="Name" />
</div>
<div class="6u">
<input type="email" name="email" placeholder="Email" />
</div>
</div>
<div class="row">
<div class="12u">
<textarea name="message" placeholder="Message" rows="6"></textarea>
</div>
</div>
<div class="row">
<div class="12u">
<ul class="actions">
<li><input type="submit" value="Send Message" /></li>
</ul>
</div>
</div>
</form>
<ul class="icons">
<li><a href="#" class="icon fa-twitter"><span class="label">Twitter</span></a></li>
<li><a href="#" class="icon fa-facebook"><span class="label">Facebook</span></a></li>
<li><a href="#" class="icon fa-instagram"><span class="label">Instagram</span></a></li>
<li><a href="#" class="icon fa-github"><span class="label">Github</span></a></li>
<li><a href="#" class="icon fa-dribbble"><span class="label">Dribbble</span></a></li>
</ul>
<ul class="copyright">
<li>© Steap 2014 All rights reserved.</li><li>Design: <a href="http://html5up.net">HTML5 UP</a></li>
</ul>
</div>
</div>
</body>
</html>
- Sie brauchen etwas, das verarbeiten kann, die PHP. Was http-server verwenden Sie?
- Ich bin mit Fläschchen und ich führe das python-code oben in der Eingabeaufforderung. Dann Eröffne ich 127.0.0.1:5000/example.php in google chrome, und die Ausgabe ist nur ein Haufen von text.
- Ich verstehe, was Sie sagen. Eigentlich habe ich nicht wirklich etwas, das verarbeiten kann PHP, verursachen deutlich Fläschchen nicht. Welche software empfehlen Sie, die ich verwende?
- Es hängt davon ab, welche http-server, den Sie verwenden möchten. Ich bin mir nicht sicher, was der Stand der Technik ist in diesen Tagen, aber es verwendet werden, um mod_php mit Apache und php-fpm mit nginx.
- Iyer, obwohl ich denke, das ist eine sehr schlechte Lösung zu kombinieren python in falsk und php, aber es passiert, wenn Bedarf kombinieren-Projekte. Ich bin nun vor dem gleichen Problem. Darf ich wissen, haben Sie es herausfinden und Dosis funktioniert es?
Du musst angemeldet sein, um einen Kommentar abzugeben.
Kolben ist nicht kompatibel mit php. So kann es nicht Lesen php-code.
Haben Sie sich überlegt mit Hilfe von JQuery Ajax?
Hier ein Beispiel:
Haben Sie eine Datei namens get_name.php Hexe enthält:
Mithilfe von Jquery-ajax-Funktion rufe ich das get_name.php
Die Ausgabe in der Konsole wäre:
So, mit den zurückgegebenen Daten können Sie tun, was Sie wollen.