Browse Source

initial commit

everything from the includes directory
pull/16/head
Rick Payton 7 years ago
parent
commit
63479f27ef
5 changed files with 108 additions and 0 deletions
  1. +23
    -0
      includes/account-registration.php
  2. +5
    -0
      includes/title-add.php
  3. +28
    -0
      includes/title-editor.php
  4. +39
    -0
      includes/titleranks-add.php
  5. +13
    -0
      includes/titleranks-submit.php

+ 23
- 0
includes/account-registration.php View File

@@ -0,0 +1,23 @@
<form action="register.php" method="post">
<table border="1">
<tr><th colspan="2">Username desired</th></tr>
<tr><td colspan="2"><input type="text" size="45" required="required" name="username"></td></tr>
<tr><th colspan="2">E-Mail address</th></tr>
<tr><td colspan="2"><input type="text" size="45" required="required" name="useremail"></td></tr>
<tr><th>Password</th><th>Verify password</th></tr>
<tr><td><input type="password" required="required" name="userpass1" id="up1"></td><td><input type="password" required="required" name="userpass2" id="up2"></td></tr>
</table>
<script type="text/javascript">
function Validate() {
var userpass1 = document.getElementById("up1").value;
var userpass2 = document.getElementById("up2").value;
if (userpass1 != userpass2) {
alert("Passwords do not match.");
return false;
}
return true;
}
</script>
<input type="hidden" name="reguser" value="1">
<input type="submit" name="submission" value="Go! Go! Go!" onclick="return Validate()" id="btnSubmit">
</form>

+ 5
- 0
includes/title-add.php View File

@@ -0,0 +1,5 @@
<?php
echo '<form action="titlemanager.php" method="post"><table border="1"><tr><th>Title Name</th><th>Title Type</th></tr>';
echo '<tr><td><input type="text" name="titlename" placeholder="Friend of the Kurzicks" required autofocus></td><td style="text-align:left"><input type="radio" name="titletype" value="0" checked> Account<br /><input type="radio" name="titletype" value="1">Character</td></tr>';
echo '</table><br /><input type="hidden" name="title" value="titlesubmit"><input type="submit" value="Add new title ..."></form>';
?>

+ 28
- 0
includes/title-editor.php View File

@@ -0,0 +1,28 @@
<?php
echo '<form action="titlemanager.php" method="post">';
echo '<table border="1"><tr><th>titlenameid</th><th>titlename</th><th>titletype</th></tr>';
$stmtview = $con->prepare("SELECT * FROM gwtitles WHERE titlenameid = ?");
$stmtview->bind_param("i", $_POST['tid']);
$stmtview->execute();
$result = $stmtview->get_result();
while ($row = $result->fetch_assoc()) {
$tid = $row['titlenameid'];
$tname = $row['titlename'];
$ttype = $row['titletype'];
echo '<tr><td><input readonly size="3" name="titlenameid" value="' . $tid . '"></td><td><input size="40" type="text" name="titlename" value="' . $tname . '"></td><td style="text-align:left">';
echo '<input type="radio" name="titletype" ';
if ($ttype == 0) {
echo 'checked ';
}
echo 'value="0">Account<br />';
echo '<input type="radio" name="titletype" ';
if ($ttype == 1) {
echo 'checked ';
}
echo 'value="1">Character</td></tr>';
}
$stmtview->close();
echo '</table><table><tr><th>Delete title?</th></tr><tr><td><input type="checkbox" name="deltitle" value="yes"></td></tr></table><br /><br />';
echo '<input type="hidden" name="title" value="updatetitle"><input type="submit" value="Modify title ..."></form><br />';
echo 'Return to <a href="titlemanager.php" class="navlink">title manager</a>';
?>

+ 39
- 0
includes/titleranks-add.php View File

@@ -0,0 +1,39 @@
<?php
# delete this block when shit finally works.
ini_set('display_errors', 'on');
error_reporting(E_ALL);
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
# delete the above when shit finally works

# use "$_POST['tid']" to show title ranks already associated with the selected title
# and above that list put the input boxes for text and number_format
# investigate if we can put multiple input boxes and loop through them to insert into the database
# https://stackoverflow.com/questions/34469482/how-to-insert-multiple-inputs-into-the-database-using-the-power-of-php

if (isset($_SESSION['tid'])) {
$_POST['tid'] = $_SESSION['tid'];
} else {
echo 'The session data isn\'t set, using post data instead!<br />';
}
echo '<form action="titlemanager.php" method="post"><table border="1"><tr><th>Title Rank Name</th><th>Title Points</th><th>Rank Level</th></tr>';
echo '<tr><td><input type="text" name="titlerankname" required autofocus></td><td><input type="number" name="titlepoints" required></td><td><input type="number" name="titlerank" min="1" max="15"</tr>';
echo '</table><br /><input type="hidden" name="title" value="titleranksubmit"><input type="hidden" name="titlenameid" value="' . $_POST['tid'] . '"><input type="submit" value="Add title rank ..."></form>';

echo 'Here are the currently associated title ranks, starting with rank 1:<br />';
echo '<table border="1"><tr><th>stnameid</th><th>titlenameid</th><th>stname</th><th>stpoints</th><th>strank</th></tr>';
$stmtview = $con->prepare("SELECT * FROM gwsubtitles WHERE titlenameid = ? ORDER BY strank ASC");
$stmtview->bind_param("i", $_POST['tid']);
$stmtview->execute();
$result = $stmtview->get_result();
while ($row = $result->fetch_assoc()) {
$stnid = $row['stnameid'];
$tnid = $row['titlenameid'];
$stname = $row['stname'];
$stpoints = $row['stpoints'];
$strank = $row['strank'];
echo '<tr><td>' . $stnid . '<td>' . $tnid . '</td><td>' . $stname . '</td><td>' . number_format($stpoints) . '</td><td>' . $strank . '</td></tr>';
}
$stmtview->close();
echo '</table><br />If anything looks off, please fix it!<br /><br />';
echo 'Return to <a href="titlemanager.php" class="navlink">title manager</a>'; //this line needs to go away soon. Maybe?
?>

+ 13
- 0
includes/titleranks-submit.php View File

@@ -0,0 +1,13 @@
<?php
# investigate if we can put multiple input boxes and loop through them to insert into the database (see includes/titleranks-add.php)
# https://stackoverflow.com/questions/34469482/how-to-insert-multiple-inputs-into-the-database-using-the-power-of-php

$stmtstins = $con->prepare("INSERT INTO gwsubtitles (titlenameid, stname, stpoints, strank) VALUES (?, ?, ?, ?)");
$stmtstins->bind_param("isii", $_POST['titlenameid'], $_POST['titlerankname'], $_POST['titlepoints'], $_POST['titlerank']);
$stmtstins->execute();
$stmtstins->close();
$_SESSION['title'] = "repeat";
$_SESSION['tid'] = $_POST['titlenameid'];
echo 'Title rank added, redirecting!';
header ("Refresh:1; url=titlemanager.php");
?>

Loading…
Cancel
Save