Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ three d's old php catalogue
Fixed up handling of some odd characters in searches and also the needsEncoding field in queries added by Michael to handle Digital Submission file encoding.
affects cdedit.php cdsearchadv.php cdsearch.php cdshow.php session_report_hi.php
Also fixed URLs to use https intead of http

Requires PGSQL-PHP
- sudo apt-get install php-pgsql on Ubuntu/Debian
Requires PHP-curl
- sudo apt-get install php-curl on Ubuntu/Debian
2 changes: 1 addition & 1 deletion adminmotd.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<input type=hidden name=xupdate value=1>
<table border=0 cellspacing=0 cellpadding=2>
<tr valign=top bgcolor="#CCCCFF">
<td><textarea name="xmotd" rows="10" cols="60"><?php echo htmlentities($r[note])?></textarea></td>
<td><textarea name="xmotd" rows="10" cols="60"><?php echo htmlentities($r['note'])?></textarea></td>
</tr>
</table>
<p><input type=submit name=xbutton value=Save>
Expand Down
22 changes: 11 additions & 11 deletions adminuseredit.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,17 @@

<tr bgcolor="#AAAAFF">
<td><b>Username</b></td>
<td><input type=text name=xusername value="<?php $a=htmlentities($row[username]); echo "$a"; ?>" size=30 maxlength=50></td>
<td><input type=text name=xusername value="<?php $a=htmlentities($row['username']); echo "$a"; ?>" size=30 maxlength=50></td>
</tr>

<tr bgcolor="#CCCCFF">
<td><b>First Name</b></td>
<td><input type=text name=xfirst value="<?php $a=htmlentities($row[first]); echo "$a"; ?>" size=30 maxlength=50></td>
<td><input type=text name=xfirst value="<?php $a=htmlentities($row['first']); echo "$a"; ?>" size=30 maxlength=50></td>
</tr>

<tr bgcolor="#AAAAFF">
<td><b>Last Name</b></td>
<td><input type=text name=xlast value="<?php $a=htmlentities($row[last]); echo "$a"; ?>" size=30 maxlength=50></td>
<td><input type=text name=xlast value="<?php $a=htmlentities($row['last']); echo "$a"; ?>" size=30 maxlength=50></td>
</tr>

<tr bgcolor="#CCCCFF">
Expand All @@ -122,32 +122,32 @@
<tr bgcolor="#AAAAFF">
<td><b>Active</b></td>
<td>
<input type=radio id=2 name=xactive value=t<?php if ($row[active] == 't') { echo " checked"; } ?>>Yes</input>
<input type=radio id=2 name=xactive value=f<?php if ($row[active] != 't') { echo " checked"; } ?>>No</input>
<input type=radio id=2 name=xactive value=t<?php if ($row['active'] == 't') { echo " checked"; } ?>>Yes</input>
<input type=radio id=2 name=xactive value=f<?php if ($row['active'] != 't') { echo " checked"; } ?>>No</input>
</td>
</tr>

<tr bgcolor="#CCCCFF">
<td><b>Admin</b></td>
<td>
<input type=radio id=2 name=xadmin value=t<?php if ($row[admin] == 't') { echo " checked"; } ?>>Yes</input>
<input type=radio id=2 name=xadmin value=f<?php if ($row[admin] != 't') { echo " checked"; } ?>>No</input>
<input type=radio id=2 name=xadmin value=t<?php if ($row['admin'] == 't') { echo " checked"; } ?>>Yes</input>
<input type=radio id=2 name=xadmin value=f<?php if ($row['admin'] != 't') { echo " checked"; } ?>>No</input>
</td>
</tr>

<tr bgcolor="#AAAAFF">
<td><b>CD Editor</b></td>
<td>
<input type=radio id=2 name=xcdeditor value=t<?php if ($row[cdeditor] == 't') { echo " checked"; } ?>>Yes</input>
<input type=radio id=2 name=xcdeditor value=f<?php if ($row[cdeditor] != 't') { echo " checked"; } ?>>No</input>
<input type=radio id=2 name=xcdeditor value=t<?php if ($row['cdeditor'] == 't') { echo " checked"; } ?>>Yes</input>
<input type=radio id=2 name=xcdeditor value=f<?php if ($row['cdeditor'] != 't') { echo " checked"; } ?>>No</input>
</td>
</tr>

<tr bgcolor="#AAAAFF">
<td><b>Booking Admin</b></td>
<td>
<input type=radio id=2 name=xadminbook value=t<?php if ($row[adminbook] == 't') { echo " checked"; } ?>>Yes</input>
<input type=radio id=2 name=xadminbook value=f<?php if ($row[adminbook] != 't') { echo " checked"; } ?>>No</input>
<input type=radio id=2 name=xadminbook value=t<?php if ($row['adminbook'] == 't') { echo " checked"; } ?>>Yes</input>
<input type=radio id=2 name=xadminbook value=f<?php if ($row['adminbook'] != 't') { echo " checked"; } ?>>No</input>
</td>
</tr>

Expand Down
22 changes: 16 additions & 6 deletions adminusernew.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,24 @@
$error = "<p><font color=red><b>That Username Already Exists!</b></font>";
}
}

if (!$error) {
$uquery = "INSERT INTO users (username, admin) VALUES ($q$xusername$q, 'f');";
$uquery = "INSERT INTO users (username, admin) VALUES ($q$xusername$q, 'f') RETURNING id;";
$uresult = pg_query($db, $uquery);
$lastoid = pg_last_oid($uresult);
$kquery = "SELECT id FROM users WHERE OID = $q$lastoid$q;";
$kresult = pg_query($db, $kquery);
$kr = pg_fetch_array($kresult, 0, PGSQL_ASSOC);
header("Location: http://".$_SERVER['HTTP_HOST'] .dirname($_SERVER['PHP_SELF']) ."/adminuseredit.php?gid=".$kr[id]);

if ($uresult && pg_num_rows($uresult) > 0) {
$id_of_new_row = pg_fetch_row($uresult)[0];
$kquery = "SELECT id FROM users WHERE id = $q$id_of_new_row$q;";
$kresult = pg_query($db, $kquery);

if ($kresult && pg_num_rows($kresult) > 0) {
$kr = pg_fetch_array($kresult, 0, PGSQL_ASSOC);
header("Location: http://".$_SERVER['HTTP_HOST'] .dirname($_SERVER['PHP_SELF']) ."/adminuseredit.php?gid=".$kr['id']);
exit;
}
}

header("Location: http://".$_SERVER['HTTP_HOST'] .dirname($_SERVER['PHP_SELF']) ."/users.php");
}
}
?>
Expand Down
6 changes: 3 additions & 3 deletions assetedit.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@
<table border=1 cellspacing=0 cellpadding=2>
<tr bgcolor="#AAAAFF">
<td><b>Name</b></td>
<td><input type=text name=xname value="<?php $a=htmlentities($row[name]); echo "$a"; ?>" size=30 maxlength=100></td>
<td><input type=text name=xname value="<?php $a=htmlentities($row['name']); echo "$a"; ?>" size=30 maxlength=100></td>
</tr>
<tr bgcolor="#AAAAFF">
<td><b>Active</b></td>
<td>
<input type=radio id=2 name=xactive value=t<?php if ($row[active] == 't') { echo " checked"; } ?>>Yes</input>
<input type=radio id=2 name=xactive value=f<?php if ($row[active] != 't') { echo " checked"; } ?>>No</input>
<input type=radio id=2 name=xactive value=t<?php if ($row['active'] == 't') { echo " checked"; } ?>>Yes</input>
<input type=radio id=2 name=xactive value=f<?php if ($row['active'] != 't') { echo " checked"; } ?>>No</input>
</td>
</tr>
</table>
Expand Down
22 changes: 16 additions & 6 deletions assetnew.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,23 @@
$error = 0;
if ($xnew) {
$xname = trim($xname);
$uquery = "INSERT INTO bookingthing (name, active) VALUES ($q$xname$q, 't');";
$uquery = "INSERT INTO bookingthing (name, active) VALUES ($q$xname$q, 't') RETURNING id;";
$uresult = pg_query($db, $uquery);
$lastoid = pg_last_oid($uresult);
$kquery = "SELECT id FROM bookingthing WHERE OID = $q$lastoid$q;";
$kresult = pg_query($db, $kquery);
$kr = pg_fetch_array($kresult, 0, PGSQL_ASSOC);
header("Location: http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/assetedit.php?gid=".$kr[id]);

if ($uresult && pg_num_rows($uresult) > 0) {
$id_of_new_row = pg_fetch_row($uresult)[0];
$kquery = "SELECT id FROM bookingthing WHERE id = $q$id_of_new_row$q;";
$kresult = pg_query($db, $kquery);

if ($kresult && pg_num_rows($kresult) > 0) {
$kr = pg_fetch_array($kresult, 0, PGSQL_ASSOC);
header("Location: http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/assetedit.php?gid=".$kr['id']);
exit;
}
}

// Just go back to assets if there is any failure.
header("Location: http://".$_SERVER['HTTP_HOST'] .dirname($_SERVER['PHP_SELF']) ."/assets.php");
}
?>

Expand Down
10 changes: 5 additions & 5 deletions assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
$num = pg_num_rows($result);
if ($num == 1) {
$row = pg_Fetch_array($result, 0, PGSQL_ASSOC);
if ($row[active] == 't') { $newin = 'f'; } else { $newin = 't'; }
if ($row['active'] == 't') { $newin = 'f'; } else { $newin = 't'; }
$uquery = "UPDATE bookingthing SET active = $q$newin$q WHERE id = $q$xid$q;";
$uresult = pg_query($db, $uquery);
}
Expand All @@ -51,21 +51,21 @@
echo ">";
$r = pg_Fetch_array($result, $i, PGSQL_ASSOC);

$a = htmlentities($r[name]);
$a = htmlentities($r['name']);
echo "<td>";
if ($a) { echo "$a"; }
else { echo "&nbsp;"; }
echo "</td>\n";

$a = "no";
if ($r[active] == 't') { $a = "<font color=red>yes</font>"; }
if ($r['active'] == 't') { $a = "<font color=red>yes</font>"; }
echo "<td align=center>";
echo '<A HREF="assets.php?xid='.$r[id].'&togactive=1'.'">'.$a.'</A>';
echo '<A HREF="assets.php?xid='.$r['id'].'&togactive=1'.'">'.$a.'</A>';
echo "</td>\n";

echo "<td align=center>";
echo "<a HREF=assetedit.php?";
echo 'gid=' . $r[id] . ">Edit<a>";
echo 'gid=' . $r['id'] . ">Edit<a>";
echo "</td></TR>\n";

echo "</TR>\n";
Expand Down
Loading