Skip to content

Instantly share code, notes, and snippets.

@khamer
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save khamer/edc464384d60b95a6081 to your computer and use it in GitHub Desktop.

Select an option

Save khamer/edc464384d60b95a6081 to your computer and use it in GitHub Desktop.
<title>worst.PHP</title>
<body>
<script language="php">
isset($_REQUEST[user]) or $_POST[user] = null;
extract($_REQUEST);
if ($user):
eval("goto greeting");
else:
goto welcome_form;
endif;
greeting:
</script>
<h1>Hello, <%= $user %>!</h1>
<script type="text/javascript">
alert("<script language="php">print $user;</script>!!")
</script>
<ul>
<script language="php">
$variables = array_keys($_POST);
while (count($variables)):
$name = array_shift($variables);
%><li><%= $name ?>: <?= $$name %></li><%
endwhile;
</script>
</ul>
<script language="php">
goto footer;
welcome_form:
</script>
<form method="POST">
<script language="php">
foreach ($_POST as $variable_name => $value):
printf('<div>Enter %s: <input type="text" name="%s" value="" /></div>', $variable_name, $variable_name);
endforeach;
</script>
<script type="text/javascript">
document.write("<button>Save</button>");
</script>
</form>
<script language="php">
goto footer;
footer:
</script>
<p class="copyright">Copyright <% print date(Y); %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment