2 posts
  • Has collected 10+ items on Envato Market
  • Located in Turkey
  • Has been part of the Envato Community for over 3 years
agulnur says

Hi,

i need to convert PHP code to ASP

Here is the code;

<?php $error = false;

// Lib to enable support for json_encode for php < 5.2.0 - remove if your version is 5.2.0 or upper
require('_errors/libError.php');
// If login form submitted
if (isset($_POST['a']))
{
    $valid = false;
    $redirect = isset($_REQUEST['redirect']) ? $_REQUEST['redirect'] : 'index.php';
}
// Check fields
if (!isset($_POST['login']) or strlen($_POST['login']) == 0)
{
    $error = 'Please enter your user name';
}
elseif (!isset($_POST['pass']) or strlen($_POST['pass']) == 0)
{
    $error = 'Please enter your password';
}
else
{
    /*
     * Do whatever here to check user login
     /
    $valid = ($_POST['login']  'admin' and $_POST['pass']  'admin');
}
if (!$valid)
{
    $error = 'Wrong user/password, please try again';
}
// Check if AJAX request
$ajax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and strtolower($_SERVER['HTTP_X_REQUESTED_WITH'])  'xmlhttprequest');
// If user valid
if ($valid)
{
    // Handle the keep-logged option
    if (isset($_POST['keep-logged']) and $_POST['keep-logged']  1)
    {
        // Set cookie or whatever here
    }
}
else
{
    if ($ajax)
    {
        header('Cache-Control: no-cache, must-revalidate');
        header('Expires: '.date('r', time()+(86400365)));
        header('Content-type: application/json');
}
echo json_encode(array(
        'valid' => false,
        'error' => $error
    ));
    exit();
}

?>

Please Help Me :’(

Thanks.

1141 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 1+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+2 more
KarmaThemes says

If it’s simple, why couldn’t you do it? :D

Paste your code here so we can read it: http://pastie.org/

2 posts
  • Has collected 10+ items on Envato Market
  • Located in Turkey
  • Has been part of the Envato Community for over 3 years
agulnur says

Its not simple for me, i dont know PHP :D I think its simple who knows PHP :)

Here is the code;

http://pastie.org/2631223

Thanks

by
by
by
by
by
by