3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('ROOT',1); ini_set('display_errors',1); set_time_limit(0); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>ASIN Lookup tool</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <style type="text/css"> body { font:12px/1.4em Verdana, sans-serif; color:#333; background-color:#fff; width:700px; margin:50px auto; padding:0; } a { color:#326EA1; text-decoration:underline; padding:0 1px; } a:hover { background-color:#333; color:#fff; text-decoration:none; } div.header { border-bottom:1px solid #999; } div.item { padding:5px 0; border-bottom:1px solid #999; } </style> </head> <body> <div> <?php if(!empty($_POST['start_bulk'])){ if($_FILES['asin']['error']!=0)echo 'Failed to upload file'; else{ if(!empty($_POST['site']))$site=$_POST['site']; else $site="com"; if(!empty($_POST['idtype']))$idtype=$_POST['idtype']; else $idtype="ASIN"; $email=$_POST['email']; @unlink(dirname(__FILE__)."/input.csv"); $res=move_uploaded_file($_FILES['asin']['tmp_name'],dirname(__FILE__)."/input.csv"); if(!$res)echo 'Failed to upload file'; else{ if(!empty($_POST['inline']))echo '<table cellpadding="5" cellspacing="5" style="border-collapse: collapse" border="1">'; include(dirname(__FILE__).'/converter.php'); if(!empty($_POST['inline']))echo '</table>'; if(!empty($email))echo '<h4 style="color:green" id="res">Check your email for the output. In some cases Email may go in spam folder</h4>'; else echo '<h4 style="color:green" id="res"><a href="output-conversion.csv">Download csv</a></h4>'; } } } else if(!empty($_POST['start_manual']) && !empty($_POST['asin'])){ if(!empty($_POST['site']))$site=$_POST['site']; else $site="com"; if(!empty($_POST['idtype']))$idtype=$_POST['idtype']; else $idtype="ASIN"; $email=$_POST['email']; @unlink(dirname(__FILE__)."/input.csv"); file_put_contents(dirname(__FILE__)."/input.csv", $_POST['asin']); if(!empty($_POST['inline']))echo '<table cellpadding="5" cellspacing="5" style="border-collapse: collapse" border="1">'; include(dirname(__FILE__).'/converter.php'); if(!empty($_POST['inline']))echo '</table>'; if(!empty($email))echo '<h4 style="color:green" id="res">Check your email for the output. In some cases Email may go in spam folder</h4>'; else echo '<h4 style="color:green" id="res"><a href="output-conversion.csv">Download csv</a></h4>'; } ?> <h3>ASIN lookup tool (Bulk)</h3> <hr/> <h4>After submitting check your email for the output. In some cases Email may go in spam folder</h4> <form method="post" action="" enctype="multipart/form-data"> <table cellpadding="5" cellspacing="5"> <tr><td><label>Choose IdType</label></td><td><select name="idtype"><option value="ASIN">ASIN</option><option value="EAN">EAN-13</option><option value="UPC">UPC</option><option value="ISBN">ISBN-10</option></select></td></tr> <tr><td><label>Choose site</label></td><td><select name="site"><option value="com">com</option><option value="fr">fr</option><option value="de">de</option><option value="co.uk">uk</option><option value="ca">ca</option><option value="co.jp" selected="selected">co.jp</option></select></td></tr> <tr><td><label>ASIN input</label></td><td><input type="file" name="asin"/></td></tr> <tr><td><label>Email address to recieve output</label><br/><small>If this field is empty then output<br/> link will be shown</small></td><td><input type="text" name="email" size="32"/></td></tr> <tr><td><label>Display output inline</label></td><td><input type="checkbox" name="inline"/></td></tr> <input type="hidden" name="start_bulk" value="1" /> <tr><td colspan="2"><input type="submit" value="Submit"/></td></tr> </table> </form> <h3>ASIN lookup tool (Manual)</h3> <hr/> <form method="post" action=""> <table cellpadding="5" cellspacing="5"> <tr><td><label>Choose IdType</label></td><td><select name="idtype"><option value="ASIN">ASIN</option><option value="EAN">EAN-13</option><option value="UPC">UPC</option><option value="ISBN">ISBN-10</option></select></td></tr> <tr><td><label>Choose site</label></td><td><select name="site"><option value="com">com</option><option value="fr">fr</option><option value="de">de</option><option value="co.uk">uk</option><option value="ca">ca</option><option value="co.jp" selected="selected">co.jp</option></select></td></tr> <tr><td><label>ASIN input</label></td><td><textarea name="asin" style="width: 200px; height: 250px"></textarea></td></tr> <tr><td><label>Email address to recieve output</label><br/><small>If this field is empty then output<br/> link will be shown</small></td><td><input type="text" name="email" size="32"/></td></tr> <tr><td><label>Display output inline</label></td><td><input type="checkbox" name="inline"/></td></tr> <input type="hidden" name="start_manual" value="1" /> <tr><td colspan="2"><input type="submit" value="Submit"/></td></tr> </table> </form> </div> </body> </html>

preferences:
56.17 ms | 402 KiB | 5 Q