Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php require_once('Connections/tj_forum.php');
- require('logincheck.php'); ?>
- <?php
- if (!function_exists("GetSQLValueString")) {
- function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
- {
- if (PHP_VERSION < 6) {
- $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']);
- }
- $uid=$_SESSION['userID'];
- $topicID=$_GET['topicID'];
- if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
- $insertSQL = sprintf("INSERT INTO threadTable (threadName, initialText, topicID, userID) VALUES (%s, %s, $topicID, '$uid')",
- GetSQLValueString($_POST['threadName'], "text"),
- GetSQLValueString($_POST['initialText'], "text"));
- mysql_select_db($database_tj_forum, $tj_forum);
- $Result1 = mysql_query($insertSQL, $tj_forum) or die(mysql_error());
- $insertGoTo = "comments.php?threadID=".[what do i put here];
- if (isset($_SERVER['QUERY_STRING'])) {
- $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
- $insertGoTo .= $_SERVER['QUERY_STRING'];
- }
- header(sprintf("Location: %s", $insertGoTo));
- }
- mysql_select_db($database_tj_forum, $tj_forum);
- $query_Recordset1 = "SELECT * FROM threadTable";
- $Recordset1 = mysql_query($query_Recordset1, $tj_forum) or die(mysql_error());
- $row_Recordset1 = mysql_fetch_assoc($Recordset1);
- $totalRows_Recordset1 = mysql_num_rows($Recordset1);
- ?>
- <!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>Post Thread</title>
- </head>
- <body>
- <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
- <table align="center">
- <tr valign="baseline">
- <td width="83" align="right" nowrap="nowrap">Title:</td>
- <td width="517"><input type="text" name="threadName" value="" size="100" /></td>
- </tr>
- <tr valign="baseline">
- <td nowrap="nowrap" align="right"> </td>
- <td><textarea name="initialText" cols="100" rows="6"></textarea></td>
- </tr>
- <tr valign="baseline">
- <td nowrap="nowrap" align="right"> </td>
- <td><input type="submit" value="Insert record" /></td>
- </tr>
- </table>
- <input type="hidden" name="MM_insert" value="form1" />
- </form>
- <p> </p>
- </body>
- </html>
- <?php
- mysql_free_result($Recordset1);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement