PHPIndex

This page lists files in the current directory. You can view content, get download/execute commands for Wget, Curl, or PowerShell, or filter the list using wildcards (e.g., `*.sh`).

categories.php
wget 'https://sme10.lists2.roe3.org/swapshop/admin/categories.php'
View Content
<?php include_once("inc_header.php");
	  include_once("../inc_dbcon.php");
 ?>
<html>
<head>
<title>Swap Shop Category Administration</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="JavaScript" >
	function editCat(cid, cname, corder){
		d = document.form2
		d.cat_id.value = cid;
		d.cat_name.value = cname;
		d.cat_order.value = corder;
		document.getElementById('editCat').style.display = ''
	}	
	function cancel(){
		document.getElementById('editCat').style.display = 'none'
	}
	function deleteCategory(category, label)
		{
		if (confirm('Are you sure you want delete the category: ' + label+ '?\nAll postings in it will not be linked.\nDelete?'))
		window.location = "controller.php?op=delete&cat_id=" + category;
	}
	</script>
<link href="md_admin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 class="title">Swap Shop Categories Administration</h1>
<form name="form1" action="controller.php" method="get">
<p><a href="index.php"><img src="../images/bullet.gif" width="16" height="16" hspace="6"  border="0" align="absmiddle"></a> 
  <a href="index.php">Admin Home</a> </p>
  <p>Enter the categories for your site or update / delete existing categoires.</p>
  <table border="0" cellspacing="0" cellpadding="4" style="border:1px solid #cccccc;">
    <tr bgcolor="#ebebeb" background="../images/bg_table.gif"> 
      <td><strong>Name</strong></td>
      <td><strong>Tab Order</strong></td>
	  <td>&nbsp;</td>
    </tr>
	<tr bgcolor="#DAD8C5"> 
      <td> 
        <input type="text" name="cat_name" size="10"></td>	
      <td> 
        <input type="text" name="cat_order" size="2"></td>	
      <td> 
        <input type="submit" name="add" value="Add Category">
			<input type="hidden" name="op" value="newCategory"></td>
	</tr>
  <?php 
	$result = mysqli_query($dbConn,"SELECT * FROM md_categories order by cat_order");
	if (!$result){    
		print("Houston we have a problem: " . mysqli_error());    
		exit();  
	}
	$counter = 1;
		while ($row = mysqli_fetch_array($result)){
			$cat_name = $row["cat_name"] ;
			$cat_order =  $row["cat_order"];
			$counter++;
?>
    <tr> 
      <td><?php echo $cat_name;?></td>
      <td><?php echo $cat_order;?></td>
	  <td><a href='javascript:editCat("<?php echo $row["cat_id"]; ?>", "<?php echo $cat_name;?>", "<?php echo $cat_order;?>")'>Edit</a> 
	    | <a href="javascript:deleteCategory('<?php echo $row["cat_id"] . "','" . $cat_name; ?>')"  style="color:maroon">Delete</a></td>
    </tr>
	<?php 
	$counter = $cat_order + 1;
	} ?>

  </table>
   </form>
  <script language="JavaScript">
  document.form1.cat_order.value = <?php echo $counter ; ?>
  </script>
  <div id='editCat' style="background-color:#ebebeb; width:300px; border:4px solid #6699ff; display:none; xposition:absolute;">
	<form name="form2" action="controller.php" method="get">
	<table>
	<tr>
		<td><strong>Name</strong></td>
		<td><strong>Tab Order</strong></td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td><input type="text" name="cat_name" size="12"></td>
		<td><input type="text" name="cat_order" value="" size="3"></td>
		<td nowrap>
<input type="submit" value="Update">
          <a href='javascript:cancel()'>Cancel</a></td>
	</tr>
	</table>
 	<input type="hidden" name="cat_id" value=''>
	<input type="hidden" name="op" value="editCategory">
	</form>
</div>
  <p><strong>Name - </strong>The name of the category. This will appear in the 
    tabs and when a person creates a new post, they will be asked to select a 
    category.<br>
    <strong>Tab Order</strong> - This is the order you want the tabs to appear 
    in. Enter numbers 1,2,3,4,5...etc. <br>
    <strong>Edit</strong> - Change the name or the Tab Order. If you change the 
    name, all postings within that category will not be affected.<br>
    <strong>Delete</strong> - If you delete a category, all posts within that 
    category will not be deleted, but live soley in the 'All' category.</p>
  <p> If you are unsure about what categories to add, fewer is better. Let your 
    community tell you what categories you are lacking and then add it then. Less 
    is more. </p>

<p>&nbsp; </p>
</body>
</html>
config.php
wget 'https://sme10.lists2.roe3.org/swapshop/admin/config.php'
View Content
<?php 
/* This is the email address that will be used for outgoing emails */

	$emailAdmin = "admin@lists2.roe3.org";   		

/* This is the location of the swapshop.  It is used in email links 
   to activate postings  */
   
	$urlPath = "https://lists2.roe3.org/swapshop";     
 
/* These two are used to log into the admin mode, change them to something 
   you'll remember */

	$username = "admin";
	$password = "sx2bu2";
	
/* This defines what language and corresponds with the file in the folder. */

	$languageFile = "language/lang_english.php";  
	
/* This key is used to remove postings, change the value inside the quotes to 
   something obscure,  you will never need to remember it, so make it really
   obscure. */
	$key  = "fjmzryhbxwepqgnktdlcv";
	
// Strings for the RSS file 
	$rss_title = "The TG Swap Shop";
	$rss_description = "Share the Wealth: Sell, Trade or Giveway";

?>
controller.php
wget 'https://sme10.lists2.roe3.org/swapshop/admin/controller.php'
View Content
<?php
 include_once("inc_header.php");
 include_once("../inc_dbcon.php");
 
$op = $_REQUEST["op"];

if ($op == "newCategory"){	
	$cat_name = $_GET["cat_name"];
	$cat_order = $_GET["cat_order"];
	$sql = "insert INTO md_categories SET cat_name='$cat_name', cat_order='$cat_order'";
		if (mysqli_query($dbConn,$sql))
			{
				header("Location:categories.php?msg=Added");
			} else {
				print("Hmmm... something went wrong creating a categorys:<br><b>" . mysqli_error());
			}
}
if ($op == "editCategory"){
	$cat_name = $_GET["cat_name"];
	$cat_order = $_GET["cat_order"];
	$cat_id = $_GET["cat_id"];

$sql = "UPDATE md_categories SET cat_name='$cat_name', cat_order='$cat_order' WHERE cat_id ='$cat_id'";

		if (mysqli_query($dbConn,$sql))
			{
				header("Location:categories.php?msg=Updated");
			} else {
				print("Hmmm... something went wrong updating a category:<br><b>" . mysqli_error());
			}
}

if ($op == "delete"){	
	$cat_id = $_GET["cat_id"];
	$sql = "DELETE FROM md_categories WHERE cat_id='$cat_id'";
		if (mysqli_query($dbConn,$sql))
			{
				header("Location:categories.php?msg=Deleted");
			} else {
				print("Hmmm... something went wrong deleting a category:<br><b>" . mysqli_error());
			}
}

?>
inc_header.php
wget 'https://sme10.lists2.roe3.org/swapshop/admin/inc_header.php'
View Content
<?php 
session_start();

if (!isset($_SESSION['username'])){
	header("Location: login.php?msg=Please%20Login");
	// This stuff is here if you have redirection turned off in browser - eg Opera
	print("<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>");
	include("inc_header.php");
	print("<p>Please <a href='index.php'><b>login</b></a> to begin.");
	exit();	
} 
$username = $_SESSION['username'];
?>
login.php
wget 'https://sme10.lists2.roe3.org/swapshop/admin/login.php'
View Content
<?php 
session_start();

if (isset($_POST['op'])) {
  if ($_POST['op'] == "login"){
     include("config.php");
      if ($_POST['p'] == $password && $_POST['u'] == $username) {
 	   $_SESSION['username'] = $username;
           header("Location:index.php?m=yes");
	} else {
	   header("Location:login.php?msg=Login%20Failed,%20Please%20Try%20Again");
	}
     }	
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Swap Shop Administrator Log In</title>
<link href="../md_style.css" rel="stylesheet" type="text/css" />
<link href="md_admin.css" rel="stylesheet" type="text/css" />
</head>

<body>
<h1 class="title">Swap Shop Administrator Login</h1>
<?php 
	if (isset($_GET["msg"])){
	print("<div class='md_msg'>" . $_GET["msg"]. "</div>&nbsp;<br>"); 
	}
?>

<form name='form1' method='post' action="login.php">
  <table cellpadding="4" style='border:1px solid #cccccc; background-color:#ebebeb;'>
    <tr> 
      <td>User Name</td>
      <td><input type="text" name='u' maxlength='22'></td>
    </tr>
    <tr> 
      <td>Password</td>
      <td><input type="password" name='p' maxlength='22'> <input type='hidden' name='op' value='login'> 
      </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" name="Submit" value="Sign In" /></td>
    </tr>
  </table>
</form>
<script language="JavaScript">
document.form1.u.focus();
</script>

</body>
</html>
md_admin.css
wget 'https://sme10.lists2.roe3.org/swapshop/admin/md_admin.css'
View Content
body, td, div {
	font-family:helvetica, arial, sans-serif;
	font-size:12px;
}
.row{border-bottom:1px solid #ccc;}
.tableHeader{ background-color:#333; color:white;}

li {
	line-height: 20px;
}
.title{border-bottom:4px solid #4B76CA}