<?php

@session_start();

@include 'config.php';

@include 'includes/meta.php';

@include 'class/Main.class.php';

$Main = new Main();

if (isset($_SESSION['user_id'])) {
    $Main->RedirectPage('index.php');
}
if(!isset($_SESSION['usr_type'])){
    $_SESSION['usr_name'] = $_POST['name'];
    $_SESSION['usr_country'] = $_POST['country'];
    $_SESSION['usr_contactno'] = $_POST['contactno'];
    $_SESSION['usr_type'] = $_POST['corporat'];
}

if(!isset($_SESSION['usr_type']) || empty($_SESSION['usr_type'])){
    $Main->RedirectPage('index.php');
}

/* BEGIN SOS LINKS CODE */

$info_array = array(

    "primarykey" => "id",

    "fields" => "logo_image",

    "limit" => "1",

);



$logo_array = $Main->GetRecord("lts_site_settings", $info_array);

/* END SOS LINKS CODE */
if($_SESSION['language_direction']=='0'){?>
<link rel="stylesheet" href="<?php echo SITE_URL ?>/css/style_ar.css" />
<?php }?>
<link rel="stylesheet" href="<?php echo SITE_URL ?>/validation/css/validationEngine.jquery.css" type="text/css" />
<?php if($_SESSION['language_direction']=='0'){?>
  <script src="<?php echo SITE_URL ?>/validation/js/jquery.validationEngine-ar.js" type="text/javascript" charset="utf-8"></script>
<?php } else {?>
  <script src="<?php echo SITE_URL ?>/validation/js/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
<?php } ?>
<script src="<?php echo SITE_URL ?>/validation/js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
<div id="wrapper" class="wrap2">

    <div class="sign1">

        <div class="signh1">

            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="sign-table">

                <tr>

                    <td><a href="index.php"><img src="<?php echo SITE_URL ?>/images/<?php echo $logo_array['']['logo_image'] ?>" width="56" height="46"  /></a></td>

                    <td><a href="index.php"><?php $Main->LanguageString("Haveanaccount"); ?></a></td>

                </tr>

            </table>

        </div>

        <!--signh1-->

    </div>

    <!---sign1-->

    <div class="sign2">

        <div class="sign_mid">

            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="sign-table2">

                <tr>

                    <td>

                        <p> <?php $Main->LanguageString("Now saving Money & Time is just on finger tips"); ?></p>

                        <p>  <?php $Main->LanguageString("Auction Introduction text area : In this area of text you may like to describe the reasons why you are holding an online auction. Your online auction could be for a business, charity, school, club,"); ?> </p>

                    </td>

                    <td>

                        <form method="post" id="RegisterForm">

                            <table width="64%" border="0" cellspacing="0" cellpadding="0" class="sign-table3">

                                <tr>

                                    <td><strong class="sign-strng"><?php $Main->LanguageString("Newtots"); ?>?</strong>

                                        <?php $Main->LanguageString("Jointoday"); ?>

                                    </td>

                                </tr>

                                <tr>

                                <tr>

                                    <td>

                                        <input type="hidden" name="user_type" id="user_type" value="<?php echo $_SESSION['usr_type']; ?>" placeholder="user_type" class="sign_inp" />

                                    </td>

                                </tr>

                                <tr>

                                <tr>

                                    <td>

                                        <input type="text" name="fullname" id="fullname" value="<?php echo $_SESSION['usr_name']; ?>" placeholder="<?php $Main->LanguageString(" Name "); ?>" class="validate[required] sign_inp <?php echo $Main->SetFontFace(); ?>" />

                                    </td>

                                </tr>

                                <tr>

                                <tr>

                                    <td>

                                        <?php

                                        $ch = curl_init(); // initiate curl

                                        $url = SITE_URL . "/LTS_REST_API/countrygetdata.php"; // where you want to post data

                                        curl_setopt($ch, CURLOPT_URL, $url);

                                        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return the output in string format

                                        $output = curl_exec($ch); // execute



                                        curl_close($ch); // close curl handle

                                        $response = json_decode($output, true);

                                        ?>

                                        <select name="country" id="country" class="validate[required] select-in sign_inp" style="width:99%">

                                            <option selected="selected" value="">

                                                <?php $Main->LanguageString("Country"); ?>

                                            </option>

                                            <?php foreach ($response['data'] as $key => $value) {

                                                ?>

                                                <option <?php if ($_SESSION['usr_country'] == $value['id']) { echo "selected"; } ?> value="<?php echo $value['id']; ?>">

                                                <?php $Main->LanguageString($value['country_name']); ?>

                                                </option>

<?php }

?>

                                        </select>

                                    </td>

                                </tr>

                                </tr>

                                <tr>

                                    <td>

                                        <input type="text" name="contactno" id="contactno" maxlength="16" value="<?php echo $_SESSION['usr_contactno']; ?>" placeholder="<?php $Main->LanguageString(" Phone "); ?>" class="validate[required,custom[integer]] sign_inp" />

                                    </td>

                                </tr>

                                <tr>

                                    <td>

                                        <input type="email" name="email" id="email" class="validate[required,custom[email]] sign_inp" placeholder="<?php $Main->LanguageString("Email"); ?>" value="<?php echo $_SESSION['usr_email']; ?>"/>

                                    </td>

                                </tr>

                                <tr>

                                    <td>

                                        <input type="password" name="password" id="password" value="" class="validate[required] sign_inp" placeholder="<?php $Main->LanguageString("Password"); ?>" />

                                    </td>

                                </tr>

                                <tr>

                                    <td>

                                        <input type="password" name="confrim_password" id="confrim_password" value="" class="validate[required,equals[password]] sign_inp" placeholder="<?php $Main->LanguageString("Confirmpassword"); ?>" />

                                    </td>

                                </tr>

                                <tr>

                                    <td>

                                        <input type="submit" name="" value="<?php $Main->LanguageString('Sign up'); ?>" class="Singup_btn">
                                    </td>

                                </tr>

                            </table>

                            <input type="hidden" name="submit_signup" value="signup" />

                        </form>

                    </td>

                </tr>

            </table>

        </div>

    </div>

    <!---sign2-->

    <div class="sign3">

    </div>

    <!---sign3-->

    <div class="sign4">

        <div class="sign4-mid">

            <table width="73%" border="0" cellspacing="0" cellpadding="0" class="sign-table4">

                <tr>

                    <td><?php $Main->LanguageString("By signing up, you agree to the"); ?> <strong class="sign4-strng"><a class="sign4-strng" style="text-decoration:none;" href="<?php echo SITE_URL; ?>/Termsandconditions.php"><?php $Main->LanguageString("Termsandconditions"); ?></a></strong> <?php $Main->LanguageString("and"); ?> <strong class="sign4-strng"><a style="text-decoration:none;" class="sign4-strng" href="<?php echo SITE_URL; ?>/cms.php?pg=privacypolicy"><?php $Main->LanguageString("Privacypolicy"); ?></a></strong>, <?php $Main->LanguageString("including Cookie use. Others will be able to find you by email or phone number when provided."); ?></td>

                </tr>

                <tr>

                    <td><?php $Main->LanguageString("Languages"); ?> : <a href="<?php echo $Main->pagefilename ?>?lan=arabic"><?php $Main->LanguageString("Arabic"); ?></a><b>,</b> <a href="<?php echo $Main->pagefilename ?>?lan=english"><?php $Main->LanguageString("English"); ?></a><b>,</b>

                        <a href="<?php echo $Main->pagefilename ?>?lan=urdu">

<?php $Main->LanguageString("Urdu"); ?>

                        </a>

                    </td>

                </tr>

            </table>

        </div>

    </div>

    <!---sign4-->

</div>

<!---wrapper-->

<?php if(isset($_SESSION['message']) && $_SESSION['message'] != "") { ?>
<script type="text/javascript">
$(function() {
    $('#modal .title').html('<h2 style="color: #ce0e0e  ;"><?php if ($_SESSION['message']['status'] == 0) {$Main->LanguageString("Error");} else {$Main->LanguageString("Success");} ?></h2>');
    $('#modal .modalBody').html('<h2><?php $Main->LanguageString($_SESSION['message']['message']); ?></h2>');

    $('body').addClass('bodyOverFlow');
    $('#modal a').text("<?php $Main->LanguageString('Close'); ?>");
    $('#modal').show();
});
</script>
<?php
unset($_SESSION['message']);
}
?>
<div id="modal" style="display: none;">
    <div class="modalContent">
        <div class="title">
            <h2>Error</h2></div>
        <div class="modalBody"></div>
        <div class="footer clearfix">
            <a href="javascript:void(0)" class="close"><?php $Main->LanguageString("Close");?></a>
        </div>
    </div>
</div>
<script type="text/javascript">
$(function() {
    $('#modal .close').click(function(e) {
        $('body').removeClass('bodyOverFlow');
        $('#modal .title').html('');
        $('#modal .modalBody').html('');
        $('#modal').hide();
    });
});
</script>

<script>

    $(document).ready(function() {

        $("#RegisterForm").validationEngine({
            <?php //if($_SESSION['language_direction']=='0') { ?>
                //promptPosition: "centerLeft",
            <?php //} else { ?>
                promptPosition: "centerRight",
            <?php //} ?>
            scroll: false,
            autoHidePrompt: true ,
            autoHideDelay : 1500

        });

    });

</script>

<script type="text/javascript">

    var config = {

        '.chzn-select': {},

        '.chzn-select-deselect': {

            allow_single_deselect: true

        },

        '.chzn-select-no-single': {

            disable_search_threshold: 10

        },

        '.chzn-select-no-results': {

            no_results_text: 'Oops, nothing found!'

        },

        '.chzn-select-width': {

            width: "95%"

        }

    }

    for (var selector in config) {

        $(selector).chosen(config[selector]);

    }

</script>
<script>
history.pushState({ page: 1 }, "Title 1", "#no-back");
window.onhashchange = function (event) {
window.location.hash = "no-back";
};
</script>