Fix PHP warnings when user not logged in

This commit is contained in:
Miraty 2022-05-31 23:39:26 +02:00
parent 5579c8bcd8
commit 1beeb45280
4 changed files with 20 additions and 17 deletions

View file

@ -17,13 +17,11 @@
<br>
<select required="" name="zone" id="zone">
<option value="" disabled="" selected="">-</option>
<?php
$zones = nsListUserZones($_SESSION['username']);
if (!empty($zones))
foreach ($zones as $zone)
echo "<option value='" . $zone . "'>" . $zone . "</option>";
?>
<?php
if (isset($_SESSION['username']))
foreach (nsListUserZones($_SESSION['username']) as $zone)
echo "<option value='" . $zone . "'>" . $zone . "</option>";
?>
</select>
</div>

View file

@ -7,12 +7,15 @@
<label for="domain">Domaine ciblé</label><br>
<select required="" name="domain">
<option value="" disabled="" selected="">---</option>
<?php
<?php
if (isset($_SESSION['username'])) {
$sites = selectSites($_SESSION['username'], "dns", "http", false);
$leAvailable = selectSites($_SESSION['username'], "dns", "http", true);
foreach ($sites as $site) { ?>
<option value="<?= $site['domain'] ?>"><?= $site['domain'] . " (/" . $site['siteDir'] . ")" ?></option>
<?php } ?>
foreach ($sites as $site)
echo '<option value="' . $site['domain'] . '">' . $site['domain'] . " (/" . $site['siteDir'] . ")</option>";
}
?>
</select>
<br>
<input value="Valider" type="submit">

View file

@ -12,11 +12,12 @@
<select required="" name="zone" id="zone">
<option value="" disabled="" selected="">---</option>
<?php
if (isset($_SESSION['username'])) {
$domains = regListUserDomains($_SESSION['username']);
$domains = regListUserDomains($_SESSION['username']);
foreach($domains as $domain)
echo " <option value='" . $domain . "'>" . $domain . "</option>";
foreach($domains as $domain)
echo " <option value='" . $domain . "'>" . $domain . "</option>";
}
?>
</select>

View file

@ -12,8 +12,9 @@
<select required="" name="domain" id="domain">
<option value="" disabled="" selected="">---</option>
<?php
foreach(regListUserDomains($_SESSION['username']) as $suffix)
echo " <option value='" . $suffix . "'>." . $suffix . "</option>\n";
if (isset($_SESSION['username']))
foreach(regListUserDomains($_SESSION['username']) as $suffix)
echo " <option value='" . $suffix . "'>." . $suffix . "</option>\n";
?>
</select>