Kaynağa Gözat

select preferred character, removed some debug code

pull/16/head
mauirixxx 7 yıl önce
ebeveyn
işleme
b4f26cded1
4 değiştirilmiş dosya ile 30 ekleme ve 10 silme
  1. +0
    -7
      addaccounts.php
  2. +6
    -0
      includes/set-prefacc.php
  3. +23
    -1
      includes/set-prefchar.php
  4. +1
    -2
      preferences.php

+ 0
- 7
addaccounts.php Dosyayı Görüntüle

@@ -3,12 +3,6 @@ $pagetitle = "Add a Guild Wars account to track";
include_once ('header.php');
if (isset($_SESSION['userid'])){
# 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

if (!empty($_POST['accemail'])) {
$addacc = $con->prepare("INSERT INTO gwaccounts (userid, accemail) VALUES (?, ?)");
$addacc->bind_param("is", $_SESSION['userid'], $_POST['accemail']);
@@ -50,7 +44,6 @@ echo '</table></form><br />';

echo '<table border="1"><caption style="white-space: nowrap; overflow: hidden;">Current Guild Wars accounts</caption>';
echo '<tr><th>Account name</th></tr>';
// grab account name from database and loop it in here as a read only bit
$acclist = $con->prepare("SELECT accid, accemail FROM gwaccounts WHERE userid = ?");
$acclist->bind_param("i", $_SESSION['userid']);
$acclist->execute();


+ 6
- 0
includes/set-prefacc.php Dosyayı Görüntüle

@@ -21,6 +21,12 @@ if (isset($_SESSION['userid'])) {
$_SESSION['prefaccid'] = $row['accid'];
$_SESSION['prefaccname'] = $row['accemail'];
}
$ncp = $con->prepare("UPDATE userinfo SET prefcharid = 0, prefcharname = 'No default selected' WHERE userid = ?");
$ncp->bind_param("i", $_SESSION['userid']);
$ncp->execute();
$ncp->close();
$_SESSION['prefcharid'] = "0";
$_SESSION['prefcharname'] = "No default selected";
echo 'Guild Wars preferred account updated! <br />';
}
}

+ 23
- 1
includes/set-prefchar.php Dosyayı Görüntüle

@@ -1,5 +1,27 @@
<?php
if (isset($_SESSION['userid'])) {
echo 'this is the set-prefchar.php file text!<br />';
if ($_POST['prefcharid'] == "nopref") {
$ncp = $con->prepare("UPDATE userinfo SET prefcharid = 0, prefcharname = 'No default selected' WHERE userid = ?");
$ncp->bind_param("i", $_SESSION['userid']);
$ncp->execute();
$ncp->close();
$_SESSION['prefcharid'] = "0";
$_SESSION['prefcharname'] = "No default selected";
echo 'Character preference update - no preferred character selected.<br />';
} else {
$scp = $con->prepare("SELECT charid, charname FROM gwchars WHERE charid = ? AND accid = ? AND userid = ?");
$scp->bind_param("iii", $_POST['prefcharid'], $_SESSION['prefaccid'], $_SESSION['userid']);
$scp->execute();
$result = $scp->get_result();
while ($row = $result->fetch_assoc()) {
$uap = $con->prepare("UPDATE userinfo SET prefcharid = ?, prefcharname = ? WHERE userid = ?");
$uap->bind_param("isi", $_POST['prefcharid'], $row['charname'], $_SESSION['userid']);
$uap->execute();
$uap->close();
$_SESSION['prefcharid'] = $row['charid'];
$_SESSION['prefcharname'] = $row['charname'];
}
echo 'Guild Wars preferred character updated! <br />';
}
}
?>

+ 1
- 2
preferences.php Dosyayı Görüntüle

@@ -23,7 +23,7 @@ if (!empty($_POST['setchar'])) {
include_once ('includes/set-prefchar.php');
}

echo '<h3>Change e-mail or password</h3>';
echo '<h3>Set preferred account & character, or change e-mail or password</h3>';

// select which GW account you want to default to
echo '<form action="preferences.php" method="post"><table border="1"><caption style="white-space: nowrap; overflow: hidden;">Current preferred account: <b>' .$_SESSION['prefaccname'] . '</b></caption>';
@@ -52,7 +52,6 @@ while ($row2 = $reschar->fetch_assoc()) {
echo '<option value="' . $row2['charid'] . '">' . $row2['charname'] . '</option>';
}
echo '</td><td><input type="submit" value="Set character"></td></tr></select></table><input type="hidden" name="setchar" value="updatechar"></form><br />';
# needed code: select charrid from table gwchars selected by accid

// update e-mail address form
echo '<form action="preferences.php" method="post"><table border="1">';


Yükleniyor…
İptal
Kaydet