Просмотр исходного кода

add character creation to account creation page. modified supporting files

pull/16/head
mauirixxx 7 лет назад
Родитель
Сommit
ef75015cb6
4 измененных файлов: 35 добавлений и 11 удалений
  1. +19
    -0
      addaccounts.php
  2. +0
    -10
      addcharacters.php
  3. +16
    -0
      includes/addcharacters-submit.php
  4. +0
    -1
      index.php

+ 19
- 0
addaccounts.php Просмотреть файл

@@ -38,6 +38,10 @@ if (!empty($_POST['delchar'])) {
echo 'Character deleted - no preferred character selected.<br /><br />';
}

if (!empty($_POST['newcharname'])) {
include_once ('includes/addcharacters-submit.php');
}

echo '<form action="addaccounts.php" method="post"><table>';
echo '<caption>Add a new Guild Wars account e-mail or alias</caption>';
echo '<tr><td><input type="text" name="accemail" size="35" required></td><td><input type="submit" value="Add account"></td></tr>';
@@ -62,6 +66,21 @@ while ($row = $result->fetch_assoc()) {
$acclist->close();
echo '</table><br />';

// add characters here
echo '<form action="addaccounts.php" method="post"><table>';
echo '<caption style="white-space: nowrap; overflow: hidden;">Add character to account: ' . $_SESSION['prefaccname'] . '</caption>';
echo '<tr><th>Character name</th><th>Birthdate</th><th>Profession</th></tr>';
echo '<tr><td><input type="text" name="newcharname" size="19" required autofocus></td><td><input type="date" name="bdate" placeholder="2005-04-28"></td><td><select name="profid" required>';
// $gp = Get Profession
$gp = $con->prepare("SELECT profid, profession FROM gwprofessions");
$gp->execute();
$result = $gp->get_result();
while ($row = $result->fetch_assoc()) {
echo '<option value=' . $row['profid'] . '>' . $row['profession'] . '</option>';
}
echo '</td></tr>';
echo '<tr><td colspan="3"><input type="submit" value="Add character"></td></tr></table></form><br />';

echo '<form action="addaccounts.php" method="post"><table border="1"><caption style="white-space: nowrap; overflow: hidden;">Available characters</caption>';
echo '<tr><td>charid</td><td>accid</td><td>charname</td><td>Delete?</td></tr>';
$lc = $con->prepare("SELECT charid, accid, charname FROM gwchars WHERE accid = ?");


+ 0
- 10
addcharacters.php Просмотреть файл

@@ -1,10 +0,0 @@
<?php
$pagetitle = "Add Characters";
include_once ('header.php');
echo 'add a new character!';
echo '<form action="addcharacters.php" method="post"><table>';
echo '<caption style="white-space: nowrap; overflow: hidden;">Add character to account: ' . $_SESSION['prefaccname'] . '</caption>';
echo '<tr><td><input type="text" name="newchar" size="19" required></td><td><input type="submit" value="Add character"></td></tr>';
echo '</table></form><br />';
include_once ('footer.php');
?>

+ 16
- 0
includes/addcharacters-submit.php Просмотреть файл

@@ -0,0 +1,16 @@
<?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

// $ac = AddCharacter
$ac = $con->prepare("INSERT INTO gwchars (accid, userid, charname, birthdate, profid) VALUES (?, ?, ?, ?, ?)");
$ac->bind_param("iissi", $_SESSION['prefaccid'], $_SESSION['userid'], $_POST['newcharname'], $_POST['bdate'], $_POST['profid']);
$ac->execute();
$ac->close();
echo $_POST['newcharname'] . ' added to your account!<br /><br />';

?>

+ 0
- 1
index.php Просмотреть файл

@@ -7,7 +7,6 @@ if (isset($_SESSION['userid'])){
echo 'Update character stats <A HREF="updatecharstats.php" class="navlink">here</A><BR /><BR />';
echo 'Update account stats <A HREF="updateaccountstats.php" class="navlink">here</A><BR /><BR />';
echo 'Add Guild Wars accounts and manage characters <a href="addaccounts.php" class="navlink">here</a><br /><br />';
echo 'Add a <a href="addcharacters.php" class="navlink">new character</a> to track<br />';
}
include_once ('footer.php');
?>

Загрузка…
Отмена
Сохранить