Programalama > PHP

Etiketler: asp, php

Ort. 0
Puan ver:
<?php

    function selected ($var, $value, $selected = ' selected') {
        if (isset($_POST[$var]) && $_POST[$var] == $value) {
            echo($selected);
        }
    }

    if (isset($_GET['show_source'])) {
        highlight_file($_SERVER['SCRIPT_FILENAME']);
        exit();
    }

    $asp2php = file_exists('/usr/local/bin/asp2php') ? '/usr/local/bin/asp2php' : 'asp2php';
    extract($_POST, EXTR_SKIP, 'asp2php_');
    $asp2php_phpcode = isset($asp2php_phpcode) ? rtrim($asp2php_phpcode) : "<html>\n<body>\n\n\n</body>\n</html>";

    echo('<?xml version="1.0" encoding="iso-8859-1"?>');
    echo("\n");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>Asp2Php</title>
    <meta name="Generator" content="Webalogic.net" />
    <style type="text/css">
    body {
        background-color: white;
        color: black;
        font: 10pt geneva, verdana, arial, sans-serif;
    }
    hr {
        color: grey;
    }
    </style>
</head>
<body>

<h2>Asp to Php</h2> <h3>hataly çevirme yapabilir</h3>

<form action="<?php echo($_SERVER['PHP_SELF']); ?>#converted" method="post">
<b>Enter your html and asp code here</b><br />
<textarea name="asp2php_phpcode" cols="60" rows="8"><?php echo(htmlspecialchars($asp2php_phpcode)); ?></textarea>
<p /><b>Database:</b><br />
<select name="asp2php_dbase">
<option value="mysql">MySQL</option>
<option value="odbc"<?php selected('asp2php_dbase', 'odbc'); ?>>ODBC</option>
<option value="oracle"<?php selected('asp2php_dbase', 'oracle'); ?>>Oracle</option>
<option value="sybase"<?php selected('asp2php_dbase', 'sybase'); ?>>Sybase</option>
<option value="postgres"<?php selected('asp2php_dbase', 'postgres'); ?>>Postgres</option>
</select>
<p /><b>Change variable names:</b><br />
<select name="asp2php_scase">
<option value="-">don't change</option>
<option value="toupper"<?php selected('asp2php_scase', 'toupper'); ?>>To Uppercase</option>
<option value="tolower"<?php selected('asp2php_scase', 'tolower'); ?>>To Lowercase</option>
</select>
<p /><b>Convert references to gifs into pngs:</b><br />
<select name="asp2php_unipiss">
<option value="off">Off</option>
<option value="on"<?php selected('asp2php_unipiss', 'on'); ?>>On</option>
</select>
<p /><b>PHP Extension:</b><br />
<select name="asp2php_php_extension">
<option value="-">.php</option>
<option value="php3"<?php selected('asp2php_php_extension', 'php3'); ?>>.php3</option>
<option value="php4"<?php selected('asp2php_php_extension', 'php4'); ?>>.php4</option>
</select>
<p /><input type="submit" name="asp2php_submit" value="Convert" />
</form>

<?php
    if (isset($_POST['asp2php_submit']) && $asp2php_phpcode != '') {
        echo('<hr />');
        echo('<a name="converted"><h2>Your converted code</h2></a>');
        echo('<pre>');
        echo("\n\n");

        $fname = tempnam('/tmp', 'php');
        $outname = tempnam('/tmp', 'out');

        if ($fp = fopen($fname, 'w')) {
            fputs($fp, $asp2php_phpcode);
            fclose($fp);

            $cmd = $asp2php.' '.$fname.' -o '.$outname.' -'.$asp2php_dbase;
            if ($asp2php_scase != '-')
                $cmd .= ' -'.$asp2php_scase;
            if ($asp2php_unipiss == 'on')
                $cmd .= ' -pngs';
            if ($asp2php_php_extension != '-')
                $cmd .= ' -'.$asp2php_php_extension;

            exec(escapeshellcmd($cmd));

            unlink($fname);

            if ($fp = fopen($outname, 'r')) {
                echo(htmlspecialchars(fread($fp, filesize($outname))));
                fclose($fp);
                unlink($outname);
            }

        } else {
            die('Error: Unable to write to disk.');
        }

        echo("\n\n");
        echo('</pre>');
        echo('<hr />');
    }
?>
<hr />

</body>
</html>


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2024 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.