deamondisk
پنج شنبه 09 اردیبهشت 1389, 07:57 صبح
سلام من میخوام تو قسمت چند تا مدیر تعرف کردم حالا میخوام هر پستی که ارسال شد زیرش بنویسه بوسیله فلان یوزر ارسال شده
چطور آی دی اون رو بدست بیارم
?>
<?php require_once('../Connections/conect.php'); ?>
<?php
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")) {
$insertSQL = sprintf("INSERT INTO posts (id, title, subject, body, exbody, `time`, `date`) VALUES (%s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['id'], "int"),
GetSQLValueString($_POST['title'], "text"),
GetSQLValueString($_POST['subject'], "text"),
GetSQLValueString($_POST['body'], "text"),
GetSQLValueString($_POST['exbody'], "text"),
GetSQLValueString($_POST['time'], "text"),
GetSQLValueString($_POST['date'], "date"));
mysql_select_db($database_conect, $conect);
$Result1 = mysql_query($insertSQL, $conect) or die(mysql_error());
}
mysql_select_db($database_conect, $conect);
$query_posts = "SELECT title, subject, body, exbody, `time`, `date`, sentby FROM posts";
$posts = mysql_query($query_posts, $conect) or die(mysql_error());
$row_posts = mysql_fetch_assoc($posts);
$totalRows_posts = mysql_num_rows($posts);
mysql_select_db($database_conect, $conect);
$query_subject = "SELECT * FROM subjects";
$subject = mysql_query($query_subject, $conect) or die(mysql_error());
$row_subject = mysql_fetch_assoc($subject);
$totalRows_subject = mysql_num_rows($subject);
?>
اینک کدشه تو پایگاه داده هم یه فیلد برای sender گذاشتم فقط نمیدونم چطوری آی دیشو از sesion بدست بیارم
چطور آی دی اون رو بدست بیارم
?>
<?php require_once('../Connections/conect.php'); ?>
<?php
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")) {
$insertSQL = sprintf("INSERT INTO posts (id, title, subject, body, exbody, `time`, `date`) VALUES (%s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['id'], "int"),
GetSQLValueString($_POST['title'], "text"),
GetSQLValueString($_POST['subject'], "text"),
GetSQLValueString($_POST['body'], "text"),
GetSQLValueString($_POST['exbody'], "text"),
GetSQLValueString($_POST['time'], "text"),
GetSQLValueString($_POST['date'], "date"));
mysql_select_db($database_conect, $conect);
$Result1 = mysql_query($insertSQL, $conect) or die(mysql_error());
}
mysql_select_db($database_conect, $conect);
$query_posts = "SELECT title, subject, body, exbody, `time`, `date`, sentby FROM posts";
$posts = mysql_query($query_posts, $conect) or die(mysql_error());
$row_posts = mysql_fetch_assoc($posts);
$totalRows_posts = mysql_num_rows($posts);
mysql_select_db($database_conect, $conect);
$query_subject = "SELECT * FROM subjects";
$subject = mysql_query($query_subject, $conect) or die(mysql_error());
$row_subject = mysql_fetch_assoc($subject);
$totalRows_subject = mysql_num_rows($subject);
?>
اینک کدشه تو پایگاه داده هم یه فیلد برای sender گذاشتم فقط نمیدونم چطوری آی دیشو از sesion بدست بیارم