Skip to content

Commit

Permalink
fixed radio buttons for NX, replaced isset w/ array_key_exists
Browse files Browse the repository at this point in the history
  • Loading branch information
kedarv committed Jun 6, 2015
1 parent 0e08211 commit ac9a100
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 38 deletions.
4 changes: 2 additions & 2 deletions sources/admin/banned.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
</thead>
<tbody>";
while($row = $result->fetch_assoc()){
if(!isset($row['banreason']) || $row['banreason'] == ""){$row['banreason'] = "Unknown";}
if(!isset($row['ip']) || $row['ip'] == ""){$row['ip'] = "Unknown";}
if(!array_key_exists('banreason', $row) || $row['banreason'] == ""){$row['banreason'] = "Unknown";}
if(!array_key_exists('ip', $row) || $row['ip'] == ""){$row['ip'] = "Unknown";}
echo "
<tr>
<td>
Expand Down
14 changes: 7 additions & 7 deletions sources/admin/nxpacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
elseif(empty($nx)) {
echo "<div class=\"alert alert-error\">You need to enter an NX amount.</div><hr/><button onclick=\"goBack()\" class=\"btn btn-primary\">&laquo; Go Back</button>";
}
elseif(!is_numeric($meso)) {
echo "<div class=\"alert alert-error\">You can only enter numbers.</div><hr/><button onclick=\"goBack()\" class=\"btn btn-primary\">&laquo; Go Back</button>";
elseif(!is_numeric($meso) || (is_numeric($meso) && $meso < 0)) {
echo "<div class=\"alert alert-error\">You can only enter positive numbers.</div><hr/><button onclick=\"goBack()\" class=\"btn btn-primary\">&laquo; Go Back</button>";
}
elseif(!is_numeric($nx)) {
elseif(!is_numeric($nx) || (is_numeric($nx) && $nx < 0)) {
echo "<div class=\"alert alert-error\">You can only enter numbers.</div><hr/><button onclick=\"goBack()\" class=\"btn btn-primary\">&laquo; Go Back</button>";
}
else {
Expand Down Expand Up @@ -99,11 +99,11 @@
elseif(empty($nx)) {
echo "<div class=\"alert alert-danger\">You need to have a value in nx.</div><hr/><button onclick=\"goBack()\" class=\"btn btn-primary\">&laquo; Go Back</button>";
}
elseif(!is_numeric($meso)) {
echo "<div class=\"alert alert-danger\">You can only use numbers.</div><hr/><button onclick=\"goBack()\" class=\"btn btn-primary\">&laquo; Go Back</button>";
elseif(!is_numeric($meso) || (is_numeric($meso) && $meso < 0)) {
echo "<div class=\"alert alert-danger\">You can only use positive numbers.</div><hr/><button onclick=\"goBack()\" class=\"btn btn-primary\">&laquo; Go Back</button>";
}
elseif(!is_numeric($nx)) {
echo '<div class="alert alert-danger">You can only use numbers. <a href="javascript:history.go(-1);">Go Back</a></div>';
elseif(!is_numeric($nx) || (is_numeric($nx) && $nx < 0)) {
echo '<div class="alert alert-danger">You can only use positive numbers. <a href="javascript:history.go(-1);">Go Back</a></div>';
}
else {
$mysqli->query("INSERT INTO ".$prefix."buynx (meso, nx) VALUES ('".$meso."', '".$nx."')") or die();
Expand Down
45 changes: 22 additions & 23 deletions sources/admin/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,30 @@
echo '<hr/><a href="?base=admin&amp;page=theme&amp;do=apply" class="btn btn-primary">Configure Theme &raquo;</a>';
break;
case 'apply':
if(!isset($_POST['apply']))
{
if(!isset($_POST['apply'])) {
echo '
<form name="applytheme" method="post">
<label class="radio"><input type="radio" name="theme" value="bootstrap" checked/>Default Bootstrap</label>
<label class="radio"><input type="radio" name="theme" value="cerulean"/>Cerulean <a href="http://bootswatch.com/cerulean/" target="_blank"><i class="fa fa-external-link"></i></a></label>
<label class="radio"><input type="radio" name="theme" value="cosmo"/>Cosmo <a href="http://bootswatch.com/cosmo/" target="_blank"><i class="fa fa-external-link"></i></a></label>
<label class="radio"><input type="radio" name="theme" value="cyborg"/>Cyborg <a href="http://bootswatch.com/cyborg/" target="_blank"><i class="fa fa-external-link"></i></a></label>
<label class="radio"><input type="radio" name="theme" value="darkly"/>Darkly <a href="http://bootswatch.com/darkly/" target="_blank"><i class="fa fa-external-link"></i></a></label>
<label class="radio"><input type="radio" name="theme" value="flatly"/>Flatly <a href="http://bootswatch.com/flatly/" target="_blank"><i class="fa fa-external-link"></i></a></label>
<label class="radio"><input type="radio" name="theme" value="journal"/>Journal <a href="http://bootswatch.com/journal/" target="_blank"><i class="fa fa-external-link"></i></a></label>
<label class="radio"><input type="radio" name="theme" value="lumen"/>Lumen <a href="http://bootswatch.com/lumen/" target="_blank"><i class="fa fa-external-link"></i></a></label>
<label class="radio"><input type="radio" name="theme" value="paper"/>Paper <a href="http://bootswatch.com/paper/" target="_blank"><i class="fa fa-external-link"></i></a></label>
<label class="radio"><input type="radio" name="theme" value="readable"/>Readable <a href="http://bootswatch.com/readable/" target="_blank"><i class="fa fa-external-link"></i></a></label>
<label class="radio"><input type="radio" name="theme" value="sandstone"/>Sandstone <a href="http://bootswatch.com/sandstone/" target="_blank"><i class="fa fa-external-link"></i></a></label>
<label class="radio"><input type="radio" name="theme" value="slate"/>Slate <a href="http://bootswatch.com/slate/" target="_blank"><i class="fa fa-external-link"></i></a></label>
<label class="radio"><input type="radio" name="theme" value="simplex"/>Simplex <a href="http://bootswatch.com/simplex/" target="_blank"><i class="fa fa-external-link"></i></a></label>
<label class="radio"><input type="radio" name="theme" value="spacelab"/>Spacelab <a href="http://bootswatch.com/spacelab/" target="_blank"><i class="fa fa-external-link"></i></a></label>
<label class="radio"><input type="radio" name="theme" value="superhero"/>Superhero <a href="http://bootswatch.com/superhero/" target="_blank"><i class="fa fa-external-link"></i></a></label>
<label class="radio"><input type="radio" name="theme" value="united"/>United <a href="http://bootswatch.com/united/" target="_blank"><i class="fa fa-external-link"></i></a></label>
<label class="radio"><input type="radio" name="theme" value="yeti"/>Yeti <a href="http://bootswatch.com/yeti/" target="_blank"><i class="fa fa-external-link"></i></a></label>
<hr/>
<label class="radio"><input type="radio" name="nav" value="0" checked/>Normal Navigation Bar</label>
<label class="radio"><input type="radio" name="nav" value="1" />Inverse Navigation Bar</label>
<hr/>
<div class="radio"><label class="radio"><input type="radio" name="theme" value="bootstrap" checked/>Default Bootstrap</label></div>
<div class="radio"><label class="radio"><input type="radio" name="theme" value="cerulean"/>Cerulean <a href="http://bootswatch.com/cerulean/" target="_blank"><i class="fa fa-external-link"></i></a></label></div>
<div class="radio"><label class="radio"><input type="radio" name="theme" value="cosmo"/>Cosmo <a href="http://bootswatch.com/cosmo/" target="_blank"><i class="fa fa-external-link"></i></a></label></div>
<div class="radio"><label class="radio"><input type="radio" name="theme" value="cyborg"/>Cyborg <a href="http://bootswatch.com/cyborg/" target="_blank"><i class="fa fa-external-link"></i></a></label></div>
<div class="radio"><label class="radio"><input type="radio" name="theme" value="darkly"/>Darkly <a href="http://bootswatch.com/darkly/" target="_blank"><i class="fa fa-external-link"></i></a></label></div>
<div class="radio"><label class="radio"><input type="radio" name="theme" value="flatly"/>Flatly <a href="http://bootswatch.com/flatly/" target="_blank"><i class="fa fa-external-link"></i></a></label></div>
<div class="radio"><label class="radio"><input type="radio" name="theme" value="journal"/>Journal <a href="http://bootswatch.com/journal/" target="_blank"><i class="fa fa-external-link"></i></a></label></div>
<div class="radio"><label class="radio"><input type="radio" name="theme" value="lumen"/>Lumen <a href="http://bootswatch.com/lumen/" target="_blank"><i class="fa fa-external-link"></i></a></label></div>
<div class="radio"><label class="radio"><input type="radio" name="theme" value="paper"/>Paper <a href="http://bootswatch.com/paper/" target="_blank"><i class="fa fa-external-link"></i></a></label></div>
<div class="radio"><label class="radio"><input type="radio" name="theme" value="readable"/>Readable <a href="http://bootswatch.com/readable/" target="_blank"><i class="fa fa-external-link"></i></a></label></div>
<div class="radio"><label class="radio"><input type="radio" name="theme" value="sandstone"/>Sandstone <a href="http://bootswatch.com/sandstone/" target="_blank"><i class="fa fa-external-link"></i></a></label></div>
<div class="radio"><label class="radio"><input type="radio" name="theme" value="slate"/>Slate <a href="http://bootswatch.com/slate/" target="_blank"><i class="fa fa-external-link"></i></a></label></div>
<div class="radio"><label class="radio"><input type="radio" name="theme" value="simplex"/>Simplex <a href="http://bootswatch.com/simplex/" target="_blank"><i class="fa fa-external-link"></i></a></label></div>
<div class="radio"><label class="radio"><input type="radio" name="theme" value="spacelab"/>Spacelab <a href="http://bootswatch.com/spacelab/" target="_blank"><i class="fa fa-external-link"></i></a></label></div>
<div class="radio"><label class="radio"><input type="radio" name="theme" value="superhero"/>Superhero <a href="http://bootswatch.com/superhero/" target="_blank"><i class="fa fa-external-link"></i></a></label></div>
<div class="radio"><label class="radio"><input type="radio" name="theme" value="united"/>United <a href="http://bootswatch.com/united/" target="_blank"><i class="fa fa-external-link"></i></a></label></div>
<div class="radio"><label class="radio"><input type="radio" name="theme" value="yeti"/>Yeti <a href="http://bootswatch.com/yeti/" target="_blank"><i class="fa fa-external-link"></i></a></label></div>
<hr/>
<div class="radio"><label class="radio"><input type="radio" name="nav" value="0" checked/>Normal Navigation Bar</label></div>
<div class="radio"><label class="radio"><input type="radio" name="nav" value="1" />Inverse Navigation Bar</label></div>
<hr/>
<input type="submit" name="apply" value="Apply Theme &raquo;" class="btn btn-primary"/>
</form>
';
Expand Down
4 changes: 2 additions & 2 deletions sources/gmcp/banned.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
</thead>
<tbody>";
while($row = $result->fetch_assoc()){
if(!isset($row['banreason']) || $row['banreason'] == ""){$row['banreason'] = "Unknown";}
if(!isset($row['ip']) || $row['ip'] == ""){$row['ip'] = "Unknown";}
if(!array_key_exists('banreason', $row) || $row['banreason'] == ""){$row['banreason'] = "Unknown";}
if(!array_key_exists('ip', $row) || $row['ip'] == ""){$row['ip'] = "Unknown";}
echo "
<tr>
<td>
Expand Down
18 changes: 14 additions & 4 deletions sources/ucp/buynx.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,34 @@
if(!isset($_POST['buyNX'])) {
echo "<form name=\"buynx\" method=\"post\">
<h2 class=\"text-left\">Buy NX</h2><hr/>
<h4>Select a Character</h4>";
<h4>Select a Character <small>(Must have enough mesos on this character)</small></h4>";
$fetchChar = $mysqli->query("SELECT * FROM `characters` WHERE `accountid` = '".$_SESSION['id']."'") or die();
$countChar = $fetchChar->num_rows;
if($countChar == 0) {
echo "<div class=\"alert alert-danger\">Oops! You don't have any characters!</div></form>";
}
else {
while($getChar = $fetchChar->fetch_assoc()) {
echo '<label class="radio"><input type="radio" name="selChar" value="'.$getChar['id'].'"/>'.$getChar['name'].'</label>';
echo '
<div class="radio">
<label class="radio">
<input type="radio" name="selChar" value="'.$getChar['id'].'">'.$getChar['name'].'
</label>
</div>';
}
echo "<h4>Select a Package</h4>";
echo "<hr/><h4>Select a Package</h4>";
$fetchPack = $mysqli->query("SELECT * FROM `".$prefix."buynx`");
if($fetchPack->num_rows == 0){
echo "<div class=\"alert alert-danger\">Oops! Looks like there's no NX packages available right now!</div></form>";
}
else{
while($getPack = $fetchPack->fetch_assoc()) {
echo '<label class="radio"><input type="radio" name="selPack" value="'.$getPack['meso'].'">'.number_format($getPack['nx']).' NX for '.number_format($getPack['meso']).' Mesos</input></label>';
echo '
<div class="radio">
<label class="radio">
<input type="radio" name="selPack" value="'.$getPack['meso'].'">'.number_format($getPack['nx']).' NX for '.number_format($getPack['meso']).' Mesos
</label>
</div>';
}
echo "
<br/><input type=\"submit\" name=\"buyNX\" value=\"Buy NX &raquo\" class=\"btn btn-primary\"/>
Expand Down

0 comments on commit ac9a100

Please sign in to comment.