Had to make 2 posts ....
Code For page that creates the page
<?php include('../Connections/fvccon.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "index.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?><?php
mysql_select_db($database_fvccon, $fvccon);
$query_StoreList = "SELECT * FROM store";
$StoreList = mysql_query($query_StoreList, $fvccon) or die(mysql_error());
$row_StoreList = mysql_fetch_assoc($StoreList);
$totalRows_StoreList = mysql_num_rows($StoreList);
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
mysql_select_db($database_fvccon, $fvccon);
$query_StoreList2 = "SELECT * FROM store WHERE storeid='$_POST[storeid]'";
$StoreList2 = mysql_query($query_StoreList2, $fvccon) or die(mysql_error());
$row_StoreList2 = mysql_fetch_assoc($StoreList2);
$totalRows_StoreList2 = mysql_num_rows($StoreList2);
// create page code
$title = $_POST['title'];
$keywords = $row_GetStoreDetails['mkeywords'];
$store = $row_GetStoreDetails['store'];
$storetext = $row_GetStoreDetails['text'];
$filename = fopen('../'.$row_StoreList2['store'].'/'.$title.'.php', 'a+');
$template = "THE CODE PASTED IN THE ABOVE POST GOES HERE";
fwrite($filename,$template);
fclose($filename);
// end create page code
$insertSQL = sprintf("INSERT INTO vc (vcid, storeid, dateadded, title, code, expires, mkeywords, mdesc, mtitle, launchurl, active) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['vcid'], "int"),
GetSQLValueString($_POST['storeid'], "int"),
GetSQLValueString($_POST['dateadded'], "text"),
GetSQLValueString($_POST['title'], "text"),
GetSQLValueString($_POST['code'], "text"),
GetSQLValueString($_POST['expires'], "text"),
GetSQLValueString($_POST['mkeywords'], "text"),
GetSQLValueString($_POST['mdesc'], "text"),
GetSQLValueString($_POST['mtitle'], "text"),
GetSQLValueString($_POST['launchurl'], "text"),
GetSQLValueString($_POST['active'], "text"));
mysql_select_db($database_fvccon, $fvccon);
$Result1 = mysql_query($insertSQL, $fvccon) or die(mysql_error());
$insertGoTo = "voucher-add.php?msg=Operation Completed Successfully";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?><!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=iso-8859-1" />
<title>FVC Admin</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="850" height="438" border="0" cellpadding="0" cellspacing="10">
<tr>
<td height="80" colspan="2" valign="top"><img src="../img/logo.jpg" width="392" height="80" /></td>
</tr>
<tr>
<td width="160" height="299" valign="top"><div class="catheader">Store</div>
<a href="store-add.php" class="copytxt">Add</a> / <a href="store-edit.php" class="copytxt">Edit</a> / <a href="store-delete.php" class="copytxt">Delete</a><br />
<br />
<div class="catheader">Voucher Codes </div>
<a href="voucher-add.php" class="copytxt">Add</a> / <a href="voucher-edit.php" class="copytxt">Edit</a> / <a href="voucher-delete.php" class="copytxt">Delete</a><br />
<br />
<div class="catheader">News</div>
<a href="news-add.php" class="copytxt">Add</a> / <a href="news-edit.php" class="copytxt">Edit</a> / <a href="news-delete.php" class="copytxt">Delete</a><br />
<br />
<a href="logout.php" class="msg">Logout</a><br />
<br /></td>
<td width="667" valign="top" bgcolor="#DCD8E2" class="normaltxt"><p><strong>Add Voucher Code </strong> </p>
<p align="center"><div class="msg" align="center"><?php echo $_GET['msg'];?></div>
<form id="form2" name="form2" method="get" action="<?php echo $_SERVER['PHP_SELF'];?>">
<p>
<select name="storeid" id="storeid">
<?php
do {
?>
<option value="<?php echo $row_StoreList['storeid']?>"><?php echo $row_StoreList['store']?></option>
<?php
} while ($row_StoreList = mysql_fetch_assoc($StoreList));
$rows = mysql_num_rows($StoreList);
if($rows > 0) {
mysql_data_seek($StoreList, 0);
$row_StoreList = mysql_fetch_assoc($StoreList);
}
?>
</select>
<input type="submit" name="Submit" value="Select Store" />
</p>
</form>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td width="112" align="right" nowrap class="normaltxt"><div align="left"><strong>Date added:</strong></div></td>
<td width="256"><input type="text" name="dateadded" value="<?php echo date('d/m/Y');?>" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap class="normaltxt"><div align="left"><strong>Title:</strong></div></td>
<td><input type="text" name="title" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap class="normaltxt"><div align="left"><strong>Code:</strong></div></td>
<td><input type="text" name="code" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap class="normaltxt"><div align="left"><strong>Expires:</strong></div></td>
<td><input type="text" name="expires" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap class="normaltxt"><div align="left"><strong>Mkeywords:</strong></div></td>
<td><input type="text" name="mkeywords" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap class="normaltxt"><div align="left"><strong>Mdesc:</strong></div></td>
<td><input type="text" name="mdesc" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap class="normaltxt"><div align="left"><strong>Mtitle:</strong></div></td>
<td><input type="text" name="mtitle" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap class="normaltxt"><div align="left"><strong>Launchurl:</strong></div></td>
<td><input type="text" name="launchurl" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap class="normaltxt"><div align="left"><strong>Active:</strong></div></td>
<td><select name="active">
<option value="Y" <?php if (!(strcmp("Y", ""))) {echo "SELECTED";} ?>>Yes</option>
<option value="N" <?php if (!(strcmp("N", ""))) {echo "SELECTED";} ?>>No</option>
</select> </td>
</tr>
<tr valign="baseline">
<td align="right" nowrap class="normaltxt"><div align="left"></div></td>
<td><input type="submit" value="Add Voucher"></td>
</tr>
</table>
<input type="hidden" name="vcid" value="">
<input type="hidden" name="storeid" value="<?php echo $_GET['storeid'];?>">
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
<p> </p></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<p> </p>
<p> </p>
</body>
</html>
<?php
mysql_free_result($StoreList);
?>
if anyone would like me to email them certain files .. again please pm me
thanks guys this is very very urgent as in if its not solved today i could lose my job so $100 to whoever solves it
thanks