Subversion Repositories ALCASAR

Rev

Rev 3088 | Rev 3139 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 3088 Rev 3137
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: intercept.php 3088 2022-11-06 22:55:08Z rexy $
2
# $Id: intercept.php 3137 2023-05-21 15:44:02Z rexy $
3
#
3
#
4
# intercept.php for ALCASAR captive portal
4
# intercept.php for ALCASAR captive portal
5
# By Mondru AB.
5
# By Mondru AB.
6
# Modify by Rexy & steweb57
6
# Modify by Rexy & steweb57
7
# UI & css style by Stéphane ERARD & Alexandre VEZIN
7
# UI & css style by Stéphane ERARD & Alexandre VEZIN
Line 467... Line 467...
467
//check if we need to warn user about the imputability logs.
467
//check if we need to warn user about the imputability logs.
468
if ($result === 1) {
468
if ($result === 1) {
469
	if ((is_file('./acc/manager/lib/sql/drivers/mysql/functions.php')) && (is_file('/etc/freeradius-web/config.php'))) {
469
	if ((is_file('./acc/manager/lib/sql/drivers/mysql/functions.php')) && (is_file('/etc/freeradius-web/config.php'))) {
470
		include_once('/etc/freeradius-web/config.php');
470
		include_once('/etc/freeradius-web/config.php');
471
		include_once('./acc/manager/lib/sql/drivers/mysql/functions.php');
471
		include_once('./acc/manager/lib/sql/drivers/mysql/functions.php');
472
		$link = @da_sql_pconnect($config); // on affiche pas les erreurs
472
		$link = @da_sql_pconnect($config);
473
		if ($link) {
473
		if ($link) {
474
			$user_uid = da_sql_escape_string($link, $_GET['uid']);
474
			$user_uid = da_sql_escape_string($link, $_GET['uid']);
475
			$sql = "SELECT value FROM radreply WHERE username='$user_uid' AND attribute='Alcasar-Imputability-Warning'";
475
			$sql = "SELECT value FROM radreply WHERE username='$user_uid' AND attribute='Alcasar-Imputability-Warning'";
476
			$res = @da_sql_query($link, $config, $sql); // on affiche pas les erreurs
476
			$res = @da_sql_query($link, $config, $sql);
477
			if ($res) {
477
			if ($res) {
478
				$row = @da_sql_fetch_array($res, $config);
478
				$row = @da_sql_fetch_array($res, $config);
479
				if ($row['value'] === '1') {
479
				if ($row['value'] === '1') {
480
					$sql = "DELETE FROM radreply WHERE username='$user_uid' AND attribute='Alcasar-Imputability-Warning'";
480
					$sql = "DELETE FROM radreply WHERE username='$user_uid' AND attribute='Alcasar-Imputability-Warning'";
481
					@da_sql_query($link, $config, $sql);
481
					@da_sql_query($link, $config, $sql);
Line 494... Line 494...
494
}
494
}
495
 
495
 
496
//////////////////////////////////////////////
496
//////////////////////////////////////////////
497
///////////// TEST VARIABLES /////////////////
497
///////////// TEST VARIABLES /////////////////
498
//////////////////////////////////////////////////////////////////
498
//////////////////////////////////////////////////////////////////
499
//$result = 5;     // = 1/2/3/4/5 
499
//$result = 5;     // = 1/2/3/4/5 (reply is a displayed sentence)
500
// reply is a displayed sentence
-
 
501
//$reply = 'dsfsdfsdfdsf';    //  = ''/'Incorrect user/password'
500
//$reply = 'dsfsdfsdfdsf';    //  = ''/'Incorrect user/password'
502
//$service_SMS_status = true;    // = true/false
501
//$service_SMS_status = true;    // = true/false
503
//$service_Email_status = true;    // = true/false
502
//$service_Email_status = true;    // = true/false
-
 
503
//$service_wifi4eu_status = true;    // = true/false
504
// test of domain Allowed
504
// test of domain Allowed
505
//////////////////////////////////////////////////////////////////
505
//////////////////////////////////////////////////////////////////
506
 
506
 
507
// Cleaning the cache
507
// Cleaning the cache
508
header('Expires: Tue, 01 Jan 2000 00:00:00 GMT');
508
header('Expires: Tue, 01 Jan 2000 00:00:00 GMT');
Line 537... Line 537...
537
			} else if (redirurl !== '') {
537
			} else if (redirurl !== '') {
538
				url = redirurl;
538
				url = redirurl;
539
			} else if (userurl !== '') {
539
			} else if (userurl !== '') {
540
				url = userurl;
540
				url = userurl;
541
			}
541
			}
542
 
-
 
543
			if (typeof url !== 'undefined') {
542
			if (typeof url !== 'undefined') {
544
				var win = window.open('<?= $statuspath ?>', '_blank');
543
				var win = window.open('<?= $statuspath ?>', '_blank');
545
 
544
 
546
				if ((win === null) || (typeof win === 'undefined')) { // Pop-up blocked
545
				if ((win === null) || (typeof win === 'undefined')) { // Pop-up blocked
547
					window.location = '<?= $statuspath ?>';
546
					window.location = '<?= $statuspath ?>';
Line 596... Line 595...
596
									}
595
									}
597
								}
596
								}
598
								echo '</ul>';
597
								echo '</ul>';
599
							}
598
							}
600
							?>
599
							?>
601
 
-
 
602
							</div>
600
							</div>
603
						</div>
601
						</div>
604
						<div>
602
						<div>
605
						<?php if ($result === 2): // failed ?>
603
						<?php if ($result === 2): // failed ?>
606
							<h3 class="titre-erreur"><?= $l_loginfailed ?>
604
							<h3 class="titre-erreur"><?= $l_loginfailed ?>
Line 609... Line 607...
609
							<?php endif; ?>
607
							<?php endif; ?>
610
							</h3>
608
							</h3>
611
						<?php endif;
609
						<?php endif;
612
						if ($userurl === 'http://logout/') $userurl = 'http://www.google.com'; // Avoid cyclic logout
610
						if ($userurl === 'http://logout/') $userurl = 'http://www.google.com'; // Avoid cyclic logout
613
						?>
611
						?>
614
 
-
 
615
						</div>
612
						</div>
616
 
-
 
617
						<div class="row inputs">
613
						<div class="row inputs">
618
							<div class="d-none d-md-block col-md-2">
614
							<div class="d-none d-md-block col-md-2">
619
								 <img id="logo-organ" class="img-fluid" src="/images/organisme.png">
615
								 <img id="logo-organ" class="img-fluid" src="/images/organisme.png">
620
							</div>
616
							</div>
621
							<div class="col-12 col-md-8">
617
							<div class="col-12 col-md-8">
Line 637... Line 633...
637
										<input type="password" class="form-control boite-info-text" name="password" placeholder="<?= $l_password ?>">
633
										<input type="password" class="form-control boite-info-text" name="password" placeholder="<?= $l_password ?>">
638
									</div>
634
									</div>
639
								</div>
635
								</div>
640
							</div>
636
							</div>
641
							<div class="d-none d-md-block col-md-2">
637
							<div class="d-none d-md-block col-md-2">
642
							
-
 
643
							</div>
638
							</div>
644
						</div>
639
						</div>
645
						<div class="row row_button">
640
						<div class="row row_button">
646
							<div class="col-12 text-center">
641
							<div class="col-12 text-center">
647
								<input value="<?= $l_boutonO ?>" class="btn btn-primary button" type="submit" name="button">
642
								<input value="<?= $l_boutonO ?>" class="btn btn-primary button" type="submit" name="button">
Line 689... Line 684...
689
						<img id="logo-alcasar" class="img-fluid img-xs-bottom" src="/images/logo-alcasar.png">
684
						<img id="logo-alcasar" class="img-fluid img-xs-bottom" src="/images/logo-alcasar.png">
690
					</div>
685
					</div>
691
 
686
 
692
				<div class="col-6 d-sm-none d-md-none d-lg-none">
687
				<div class="col-6 d-sm-none d-md-none d-lg-none">
693
					<img id="logo-organ" class="img-fluid img-xs-bottom" src="/images/organisme.png">
688
					<img id="logo-organ" class="img-fluid img-xs-bottom" src="/images/organisme.png">
694
 
-
 
695
				</div>
689
				</div>
696
			</div>
690
			</div>
697
		<div class="row" style="text-align: center">
691
		<div class="row" style="text-align: center">
698
			<div class="col-8 offset-xs-2 col-md-6 offset-sm-3 d-md-none d-sm-none d-lg-none">
692
			<div class="col-8 offset-xs-2 col-md-6 offset-sm-3 d-md-none d-sm-none d-lg-none">
699
			<?php
693
			<?php