<?php
$optres['js'][] = $path . "amodules/account/js/my_account.js";
// Hide sides
$cf_show_left_side = false;
$cf_show_right_side = false;
if ( (isset($login_success) && $login_success) || isset($_SESSION['member_id']) && $_SESSION['member_id']>0){
	$member_id = $_SESSION['member_id'];

    if(isset($_POST['gdpr_25052018']) && $_POST['gdpr_25052018'] == "on") {
        $q = "UPDATE members
              SET gdpr_25052018='on',
              gdpr_25052018_dateon=NOW(),
              gdpr_25052018_ipon='{$_SESSION['visitor_ip']}',
              updated_at=NOW()
              WHERE member_id='$member_id';";
        $r = @mysql_query($q);
    }

	$show_page = true;
	$q = "select * from members where member_id='$member_id';";
	$r = @mysql_query($q);
	if($r && mysql_num_rows($r) ==1) {
		$row = mysql_fetch_assoc($r);
        $member = array_map("stripslashes", $row);


		$kind_ind = $row['kind_ind'];
		
		if(isset($_SESSION["member_id"])){
			$ses_id = session_id();
			$queryadv="SELECT * FROM advertisment WHERE member_id='".$_SESSION['member_id']."'";
		 	$resultadv=mysql_query($queryadv);
			$NoOfAdvs=mysql_num_rows($resultadv);
			
			$queryadv="SELECT * FROM banner WHERE member_id='".$_SESSION['member_id']."'";
		 	$resultadv=mysql_query($queryadv);
			$NoOfBans=mysql_num_rows($resultadv);
			
		}
	}
	else {
		$show_page = false;
	}
	
	?>
	<script type="text/javascript">
	function StatWindow(mypage,myname,w,h,scroll){
		LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
		settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable';
		win = window.open(mypage,myname,settings);
	}
	</script>
	
	
	
	
	<?php
	if($show_page) {
        $breadcrumbs [] = array(
            'link' => 'account/my_account.html',
            'title' => 'My Account'
        );

        $breadcrumbs [] = array(
            'link' => '',
            'title' => "Account Tools"
        );

	?>
	<style type="text/css">
		table.pan_container { border: 1px solid #003366; padding: 1px; }
		div.pan_container { border: 1px solid #AFD4FF; padding: 2px; margin: 3px; width: 95%;}
		.pan_header { font: 12px Arial; color: #fff; background-color:#003366; padding: 3px; }
		.pan_stats { background-color: #EFEFEF; padding: 2px; color: #003366; } 
	</style>
	
	<article class="article">
        <header>
            <h1>Account Tools</h1>
        </header>
		<div class="article-body">

            <?php
            if($member['gdpr_25052018'] == "off") {
                ?>
                <div id="gdpr-box" class="">
                    <form method="post" action="account/my_account" role="form">
                        <input type="hidden" name="gdpr_25052018" value="on">
                        <div class="box box-danger">
                            <div class="box-header with-border">
                                <b>EU GDPR Consent</b>
                            </div>
                            <div class="box-body">

                                <h4>Hi There <?=$member['shipname'] . ' ' . $member['shipsurname'];?>,</h4>

                                <p>The privacy and security of your data is extremely important to us. That is why we want to make sure our policies are clear and easily understandable.</p>

                                <p>We have made updates to our Privacy Policy that explain our privacy practices in a simple, shorter, and more transparent way.</p>

                                <p>Here are a few of the changes we would like to highlight:</p>
                                <ul>
                                    <li>We explain in more detail what information we collect about you and the reasons;</li>
                                    <li>We specify how long we retain information about you;</li>
                                    <li>We describe in more detail your rights and choices when it comes to your personal information.</li>
                                </ul>

                                <p>Our commitment to your data privacy and security is unwavering, and we hope you find these updates helpful.</p>
                                <p>Please read our <a href="/article/privacy-policy.html" target="_blank">Privacy Policy</a> in
                                    order to understant how we are using your data.</p>
                                <p>In order to continue to use our services you must consent to our use of your personal data. You have the right to request that your personal data to be erased
                                    from our database.</p>




                            </div>
                            <div class="box-footer text-center">

                                <a href="/article/privacy-policy.html" class="btn btn-warning pull-left" target="_blank">Read
                                    More</a>
                                <button type="submit" id="reg-accept" class="btn btn-success "><i class="fa fa-thumbs-up fa-fw fa-lg"></i> ACCEPT</button>
                            </div>
                        </div>
                    </form>
                </div>
                <?php
            }
            else {
                ?>

                <div class="row">
                    <div class="col-md-5">
                        <div class="info-box bg-green">
                        <span class="info-box-icon">
                            <a href="account/my_info.html" class="text-white"><i class="fa fa-info text-white"></i></a>
                        </span>

                            <div class="info-box-content">
                                <span class="info-box-number"><a href="account/my_info.html" class="text-white">Member
                                        Information</a></span>
                                <span class="info-box-str text-white">Edit your account information.</span>
                            </div>
                            <!-- /.info-box-content -->
                        </div>
                    </div>
                    <div class="col-md-5">
                        <div class="info-box bg-aqua">
                        <span class="info-box-icon">
                            <a href="account/my_account.html#" data-url="classifieds/accountin.html" class="text-white"
                               data-toggle="tooltip" title="Not working at the moment."><i
                                    class="fa fa-cubes text-white"></i></a>
                        </span>

                            <div class="info-box-content">
                                <span class="info-box-number"><a href="account/my_account.html#"
                                                                 data-url="classifieds/accountin.html"
                                                                 class="text-white" data-toggle="tooltip"
                                                                 title="Not working at the moment.">Classifieds Ads</a></span>
                                <span class="info-box-str text-white">Manage your <b>FREE</b> Classifieds Ads.</span>
                                <br><span class="label label-danger"><i class="fa fa-info-circle"></i> Under development</span>
                            </div>
                            <!-- /.info-box-content -->
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-5">
                        <div class="info-box bg-orange">
                        <span class="info-box-icon">
                            <a href="account/jobs/dashboard.html" data-url="account/jobs/my-jobs.html"
                               class="text-white"><i class="fa fa-briefcase text-white"></i></a>
                        </span>

                            <div class="info-box-content">
                            <span class="info-box-number text-white">
                                <a href="account/jobs/my-jobs.html" data-url="account/jobs/my-jobs.html"
                                   class="text-white">Jobs</a>
                                / <a href="account/resume/my-resume.html" data-url="account/resume/my-resume.html"
                                     class="text-white">My Resume</a></span>
                                <span class="info-box-str text-white">Post/Manage Jobs and your Resume.</span>


                            </div>
                            <!-- /.info-box-content -->
                        </div>
                    </div>
                    <div class="col-md-5">
                        <?php
                        if ($kind_ind == 0) {
                            ?>
                            <div class="info-box bg-red">
                            <span class="info-box-icon">
                                <a href="account/my_account.html" data-href="account/my_listing.html"
                                   class="text-white"><i
                                        class="fa fa-desktop text-white"></i></a>
                            </span>

                                <div class="info-box-content">
                                    <span class="info-box-number"><a href="account/my_account.html"
                                                                     data-href="account/my_listing.html"
                                                                     class="text-white">My Free Listing</a></span>
                                    <!--span class="info-box-str text-white">Post or Edit your <b>FREE</b> advertisment.</span-->
                                    <p class="alert alert-danger text-danger"
                                       style="padding: 3px!important; margin-bottom: 0; font-size: 95%;"><i
                                            class="fa fa-info-circle fa-lg"></i>
                                        <b>We regret to inform you that CyprusNet does not accept anymore free
                                            listings.</b>
                                    </p>
                                </div>
                                <!-- /.info-box-content -->
                            </div>
                            <?php
                        } else {
                            if ($NoOfAdvs > 0 || $NoOfBans > 0) {
                                ?>
                                <div class="info-box bg-red">
                                <span class="info-box-icon">
                                    <a href="account/my_stats.html?memberid=<?php print $member_id; ?>"
                                       class="text-white">
                                        <i class="fa fa-desktop text-white"></i></a>
                                </span>

                                    <div class="info-box-content">
                                    <span class="info-box-number">
                                        <a href="account/my_stats.html?memberid=<?php print $member_id; ?>"
                                           class="text-white">Advertisment Stats</a>
                                    </span>
                                        <span class="info-box-str text-white">View your logo and/or banners statistics in all vertical portals.</span>
                                    </div>
                                    <!-- /.info-box-content -->
                                </div>
                                <?php
                            } else {
                                echo '&nbsp;';
                            }

                        }
                        ?>
                    </div>
                </div>
                <?php
            }
            ?>
	</article>
	<?php
	}
}
else {
	if(isset($_REQUEST['logout']) || isset($_REQUEST['logout']) ) {
		//
	}
	else {
        if((isset($login_failed) && $login_failed) || (isset($login_incomplete) && $login_incomplete)) {
            if(isset($logmsg) && $logmsg != '') {
                echo $logmsg;
            }
        }
        else {
            echo '<div class="alert alert-warning">';
            echo '<b>You have been logged out!</b><hr class="no-margin">';
            echo '<p class="text-white">In order to better protect our members accounts we have put in place a mecanism to expire the browser sessions after a predefined amount of time since no website interraction has been detected.</p>
            <p class="text-white">This will ensure that if you forget to logout or leave your computer unattended, no-one can use your account and act on your behalf.</p>
		    <p class="text-white">Kindly use the login form to <b>Login</b> again.</p>
		    ';
            echo '</div>';
        }
	}

    echo '<pre>', var_export($_SESSION, true), '</pre>';
}