<?php
if (!class_exists('Database')) require_once("common_cadline_libraries/crm_database.class.php");

$needMessage = false;

if (isset($_POST['bundle_register_button'])) {
    $query2 = "SELECT nUserID 
        FROM cl_hlusers.pro_live_bundle_registrations
        WHERE email = '" . $_POST['question_email_address'] . "'";
    Database::getInstance()->query($query2);
    $res2 = Database::getInstance()->fetchNext();

    if (empty($res2)) {
        $query = "SELECT nUserID 
            FROM cl_hlusers.u_emails
            WHERE email = '" . $_POST['question_email_address'] . "'";
        Database::getInstance()->query($query);
        $res = Database::getInstance()->fetchNext();

        if (empty($res)) {
            $user = array(
                'strName'       => $_POST['question_name'],
                'strEMail'      => $_POST['question_email_address'],
                'nCtrID'        => $_POST['question_country'],
                'nUserProf'     => $_POST['question_prof'],
                'old_db'        => 'clusers_eng'
            );

            $nUserID = Database::getInstance()->insert(CRMADATBAZIS . ".users", $user, 'ssiis');

            $u_email = array(
                'email'       => $_POST['question_email_address'],
                'nUserID'     => $nUserID,
                'default'     => 1,
                'active'      => 1,
                'deleted'     => 0,
                'newsletter'  => 1
            );
            Database::getInstance()->insert(CRMADATBAZIS . ".u_emails", $u_email, 'siiiii');
        } else {
            $nUserID = $res['nUserID'];
        }

        $userHistory = array(
            'nUserID'       => $nUserID,
            'nTopicID'      => 390,
            'dateEvent'     => date('Y-m-d'),
            'strPlace'      => 'Web',
            'nManagerID'     => 36,
            'insertDate'     => date('Y-m-d H:i:s')
        );
        Database::getInstance()->insert(CRMADATBAZIS . ".u_history", $userHistory, 'iissis');

        $usr = array(
            'name'       => $_POST['question_name'],
            'email'      => $_POST['question_email_address'],
            'nUserID'    => $nUserID
        );

        Database::getInstance()->insert(CRMADATBAZIS . ".pro_live_bundle_registrations", $usr, 'ssi');

        $message = "Dear " . $_POST['question_name'] . ", <br/><br/>

        Thank you for registering to the PRO + LIVE bundle. <br/><br/>
        
        We are going to contact soon with the details on how to acquire this package with a discounted price. <br/><br/>
        
        Best wishes, <br/>
        The ARCHLine.XP Team";

        $to      = $_POST['question_email_address'];
        $subject = 'ARCHLine.XP PRO + LIVE bundle registration confirmation';
        $headers = "Content-Type: text/html; charset=utf-8\r\n";
        $headers .= 'Cc: ztoth@cadline.hu' . "\r\n";

        mail($to, $subject, $message, $headers);

        $needMessage = true;
    }
}
?>

<!DOCTYPE html>
<html>

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Pro + LIVE bundle</title>

    <link href="/public/img/icons/favicon_2.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />

    <link href="https://www.archline.hu/templates/shaper_helix3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />

    <style>
        ul {
            margin: 0;
            padding: 0;
        }

        ul li {
            list-style: none;
            margin: 0;
        }

        body {
            color: #333 !important;
            font-family: Raleway, sans-serif !important;
        }

        .container {
            margin-top: 50px;
            background-color: #f3f3f7;
        }

        h1 {
            text-align: center;
            padding-top: 20px;
        }

        .text_label>label {
            font-size: 18px;
        }

        .text_label_2>label {
            font-size: 18px;
        }

        .header_label>label {
            font-size: 18px;
        }

        .header_label {
            text-align: center;
            margin-bottom: 20px;
        }

        .text_label_2 {
            text-align: center;
            margin-bottom: 20px;
        }

        .text_label {
            margin-left: 20px;
            margin-right: 20px;
            margin-bottom: 50px;
        }

        img {
            padding-top: 30px;
            width: 70%;
            display: block;
            margin-left: auto;
            margin-right: auto;
        }

        .crossed_text {
            text-decoration: line-through;
        }

        .alert-success {
            width: 33%;
            margin-left: 33%;
            margin-top: 20px;
        }
    </style>
</head>

<body>
    <?php if ($needMessage) : ?>
        <div class="alert alert-success" role="alert">
            Thank you for registering for the discount <br />
            We'll be in touch with you regarding the next steps shortly
        </div>
    <?php endif; ?>

    <div class="container">
        <img src="/maintenance/public/img/ARCHLineXP_2022_Live_1920_1080px_MEGJELENT_banner_ENG_II.jpg" alt="">
        <h1>ARCHLine.XP PRO + LIVE - a bundle for BIM and instant Visuals</h1>

        <div class="header_label">
            <label>Now with -15% off, only between 9-20 May</label>
        </div>

        <div class="text_label_2">
            <label>ARCHLine.XP PRO+LIVE: <span class="crossed_text">€3148</span> €2675* (*VAT not included)</label>
        </div>

        <div class="text_label">
            <label>
                Get a full-fledged package for BIM and visual design, now with a serious discount. Create breathtaking animations and visuals, fill your 3D design with life, add vivid environment, people, foliage, trees, animated vehicles, in minutes.
            </label>
        </div>

        <form action="" method="post">
            <ul class="rows">
                <li class="col-md-6">
                    <div class="valueKey">
                        <div class="form-group">
                            <label id="label-question_name" for="question_name" class="control-label">
                                Name <i class="required-star">*</i>
                            </label>

                            <div class="controls">
                                <input required="" id="question_name" name="question_name" value="" type="text" maxlength="64" class="form-control">
                            </div>
                        </div>
                    </div>
                </li>

                <li class="col-md-6">
                    <div class="valueKey">
                        <div class="form-group">
                            <label id="label-question_email_address" for="question_email_address" class="control-label">
                                Email address <i class="required-star">*</i>
                            </label>

                            <div class="controls">
                                <input required="" id="question_email_address" name="question_email_address" value="" type="email" maxlength="64" class="form-control">
                            </div>
                        </div>
                    </div>
                </li>

                <li class="col-md-6">
                    <div class="valueKey">
                        <div class="form-group">
                            <label id="label-question_country" for="question_country" class="control-label">
                                Country <i class="required-star">*</i>
                            </label>

                            <div class="controls">
                                <select required="" class="form-control" id="question_country" name="question_country">
                                    <option value="">-- Choose country --</option>
                                    <option value="93">Afghanistan</option>
                                    <option value="355">Albania</option>
                                    <option value="213">Algeria</option>
                                    <option value="1251">Andorra</option>
                                    <option value="1252">Angola</option>
                                    <option value="1253">Antigua and Barbuda</option>
                                    <option value="54">Argentina</option>
                                    <option value="1255">Armenia</option>
                                    <option value="61">Australia</option>
                                    <option value="43">Austria</option>
                                    <option value="1258">Azerbaijan</option>
                                    <option value="1259">Bahamas</option>
                                    <option value="1260">Bahrain</option>
                                    <option value="1261">Bangladesh</option>
                                    <option value="1262">Barbados</option>
                                    <option value="1263">Belarus</option>
                                    <option value="32">Belgium</option>
                                    <option value="1265">Belize</option>
                                    <option value="1266">Benin</option>
                                    <option value="1267">Bhutan</option>
                                    <option value="1268">Bolivia</option>
                                    <option value="387">Bosnia and Herzegovina</option>
                                    <option value="1270">Botswana</option>
                                    <option value="1271">Brazil</option>
                                    <option value="1272">Brunei</option>
                                    <option value="1273">Bulgaria</option>
                                    <option value="1274">Burkina Faso</option>
                                    <option value="1275">Burundi</option>
                                    <option value="1276">Cambodia</option>
                                    <option value="1277">Cameroon</option>
                                    <option value="2">Canada</option>
                                    <option value="1279">Cape Verde</option>
                                    <option value="1280">Central African Republic</option>
                                    <option value="1281">Chad</option>
                                    <option value="1282">Chile</option>
                                    <option value="1283">China</option>
                                    <option value="1284">Colombia</option>
                                    <option value="1285">Comoros</option>
                                    <option value="1286">Congo</option>
                                    <option value="506">Costa Rica</option>
                                    <option value="1288">Cote d'Ivoire</option>
                                    <option value="38">Croatia</option>
                                    <option value="1290">Cuba</option>
                                    <option value="196">Cyprus</option>
                                    <option value="42">Czech Republic</option>
                                    <option value="45">Denmark</option>
                                    <option value="1294">Djibouti</option>
                                    <option value="1295">Dominican Republic</option>
                                    <option value="1297">East Timor (Timor Timur)</option>
                                    <option value="1298">Ecuador</option>
                                    <option value="20">Egypt</option>
                                    <option value="1300">El Salvador</option>
                                    <option value="1301">Equatorial Guinea</option>
                                    <option value="1302">Eritrea</option>
                                    <option value="1303">Estonia</option>
                                    <option value="1304">Ethiopia</option>
                                    <option value="1305">Fiji</option>
                                    <option value="1306">Finland</option>
                                    <option value="33">France</option>
                                    <option value="1308">Gabon</option>
                                    <option value="1309">Gambia, The</option>
                                    <option value="1310">Georgia</option>
                                    <option value="49">Germany</option>
                                    <option value="233">Ghana</option>
                                    <option value="30">Greece</option>
                                    <option value="1314">Grenada</option>
                                    <option value="1315">Guatemala</option>
                                    <option value="1316">Guinea</option>
                                    <option value="1317">Guinea-Bissau</option>
                                    <option value="1318">Guyana</option>
                                    <option value="1319">Haiti</option>
                                    <option value="1320">Honduras</option>
                                    <option value="36">Hungary</option>
                                    <option value="1322">Iceland</option>
                                    <option value="91">India</option>
                                    <option value="969">Indonesia</option>
                                    <option value="1325">Iran</option>
                                    <option value="1326">Iraq</option>
                                    <option value="35">Ireland</option>
                                    <option value="73">Israel</option>
                                    <option value="39">Italy</option>
                                    <option value="1330">Jamaica</option>
                                    <option value="81">Japan</option>
                                    <option value="1332">Jordan</option>
                                    <option value="1333">Kazakhstan</option>
                                    <option value="1334">Kenya</option>
                                    <option value="1335">Kiribati</option>
                                    <option value="82">Korea</option>
                                    <option value="1336">Korea, North</option>
                                    <option value="1337">Korea, South</option>
                                    <option value="1441">Kosovo</option>
                                    <option value="78">Kuwait</option>
                                    <option value="1339">Kyrgyzstan</option>
                                    <option value="1340">Laos</option>
                                    <option value="1341">Latvia</option>
                                    <option value="961">Lebanon</option>
                                    <option value="1343">Lesotho</option>
                                    <option value="1344">Liberia</option>
                                    <option value="1345">Libya</option>
                                    <option value="1346">Liechtenstein</option>
                                    <option value="1347">Lithuania</option>
                                    <option value="1348">Luxembourg</option>
                                    <option value="1349">Macedonia</option>
                                    <option value="1350">Madagascar</option>
                                    <option value="1351">Malawi</option>
                                    <option value="1352">Malaysia</option>
                                    <option value="1353">Maldives</option>
                                    <option value="1354">Mali</option>
                                    <option value="356">Malta</option>
                                    <option value="1356">Marshall Islands</option>
                                    <option value="1357">Mauritania</option>
                                    <option value="1358">Mauritius</option>
                                    <option value="52">Mexico</option>
                                    <option value="1360">Micronesia</option>
                                    <option value="1361">Moldova</option>
                                    <option value="1362">Monaco</option>
                                    <option value="1363">Mongolia</option>
                                    <option value="1364">Montenegro</option>
                                    <option value="978">Morocco</option>
                                    <option value="1366">Mozambique</option>
                                    <option value="1367">Myanmar</option>
                                    <option value="1368">Namibia</option>
                                    <option value="1369">Nauru</option>
                                    <option value="1370">Nepal</option>
                                    <option value="31">Netherland</option>
                                    <option value="975">New Zealand</option>
                                    <option value="1373">Nicaragua</option>
                                    <option value="1374">Niger</option>
                                    <option value="74">Nigeria</option>
                                    <option value="47">Norway</option>
                                    <option value="1377">Oman</option>
                                    <option value="0">Other</option>
                                    <option value="1378">Pakistan</option>
                                    <option value="1379">Palau</option>
                                    <option value="1380">Panama</option>
                                    <option value="1381">Papua New Guinea</option>
                                    <option value="1382">Paraguay</option>
                                    <option value="1383">Peru</option>
                                    <option value="63">Philippines</option>
                                    <option value="48">Poland</option>
                                    <option value="351">Portugal</option>
                                    <option value="1387">Qatar</option>
                                    <option value="40">Romania</option>
                                    <option value="7">Russia</option>
                                    <option value="1390">Rwanda</option>
                                    <option value="1391">Saint Kitts and Nevis</option>
                                    <option value="1392">Saint Lucia</option>
                                    <option value="1393">Saint Vincent</option>
                                    <option value="1394">Samoa</option>
                                    <option value="1395">San Marino</option>
                                    <option value="1396">Sao Tome and Principe</option>
                                    <option value="966">Saudi Arabia</option>
                                    <option value="1398">Senegal</option>
                                    <option value="1400">Seychelles</option>
                                    <option value="1401">Sierra Leone</option>
                                    <option value="1402">Singapore</option>
                                    <option value="421">Slovakia</option>
                                    <option value="1404">Slovenia</option>
                                    <option value="1405">Solomon Islands</option>
                                    <option value="1406">Somalia</option>
                                    <option value="27">South Africa</option>
                                    <option value="34">Spain</option>
                                    <option value="1409">Sri Lanka</option>
                                    <option value="1410">Sudan</option>
                                    <option value="1411">Suriname</option>
                                    <option value="1412">Swaziland</option>
                                    <option value="1413">Sweden</option>
                                    <option value="1414">Switzerland</option>
                                    <option value="1415">Syria</option>
                                    <option value="381">Szerbia</option>
                                    <option value="88">Taiwan</option>
                                    <option value="1417">Tajikistan</option>
                                    <option value="1418">Tanzania</option>
                                    <option value="1419">Thailand</option>
                                    <option value="1420">Togo</option>
                                    <option value="1421">Tonga</option>
                                    <option value="1422">Trinidad and Tobago</option>
                                    <option value="1423">Tunisia</option>
                                    <option value="967">Turkey</option>
                                    <option value="1425">Turkmenistan</option>
                                    <option value="1426">Tuvalu</option>
                                    <option value="1427">Uganda</option>
                                    <option value="1428">Ukraine</option>
                                    <option value="973">United Arab Emirates</option>
                                    <option value="44">United Kingdom</option>
                                    <option value="1">United States of America</option>
                                    <option value="1432">Uruguay</option>
                                    <option value="1433">Uzbekistan</option>
                                    <option value="1434">Vanuatu</option>
                                    <option value="1435">Vatican City</option>
                                    <option value="1436">Venezuela</option>
                                    <option value="1437">Vietnam</option>
                                    <option value="1438">Yemen</option>
                                    <option value="1439">Zambia</option>
                                    <option value="1440">Zimbabwe</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </li>

                <li class="col-md-6">
                    <div class="valueKey">
                        <div class="form-group">
                            <label id="label-question_prof" for="question_prof" class="control-label">
                                Profession <i class="required-star">*</i>
                            </label>

                            <div class="controls">
                                <select required="" class="form-control" id="question_prof" name="question_prof">
                                    <option value="">-- Choose profession --</option>
                                    <option value="4">Professional - Interior Designer</option>
                                    <option value="1">Professional - Architect</option>
                                    <option value="18">Professional - Other</option>
                                    <option value="10">Student Architect</option>
                                    <option value="11">Student Interior Designer</option>
                                    <option value="17">Government/Non-profit</option>
                                    <option value="19">Not professional</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </li>
            </ul>

            <div class="form-group btn-div">
                <div class="controls" style="padding-bottom:30px; margin-left: 15px;">
                    <input type="submit" name="bundle_register_button" style="margin-top: 20px; vertical-align: top; background-color:#0E71EB;border-color:#0E71EB;" id="btnSubmit" class="btn btn-primary btn-lg submit" value="Register">
                </div>
            </div>
        </form>
    </div>
</body>

</html>