کد PHP:
<?php require_once('Connections/cn.php'); ?>
<?php
mysql_select_db($database_cn, $cn);
$query_rs1 = "SELECT * FROM cat";
$rs1 = mysql_query($query_rs1, $cn) or die(mysql_error());
$row_rs1 = mysql_fetch_assoc($rs1);
$totalRows_rs1 = mysql_num_rows($rs1);
?>
<?php require_once('Connections/cn.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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"] == "form3")) {
$insertSQL = sprintf("INSERT INTO news (catname, title, text, `date`) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['catname'], "text"),
GetSQLValueString($_POST['title'], "text"),
GetSQLValueString($_POST['text'], "text"),
GetSQLValueString($_POST['date'], "date"));
mysql_select_db($database_cn, $cn);
$Result1 = mysql_query($insertSQL, $cn) or die(mysql_error());
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>New Page 1</title>
<style>
ul{
float:right;
width:100%;
margin:10;
}
li{
display:inline
}
a.menu
{
float:right;
width:65pt;
text-decoration:none;
background-color:#d6aa5e;
padding:2pt 2pt;
border-right:1px solidwhite;
}
a.menu:hover{
color:#000000;
font:bold;
background-color:#FFCC66;
text-align: center;
}
.sootoon{
width:233;
height:377;
background:#d6aa5e;
}
.footer{
background:#390101;
width:auto;
height:auto;
}
.body{
background:#FFFFFF;
font-family:Arial, Helvetica, sans-serif;
font-size:14px;
}
.style1 {color: #FFFFFF}
.style3 {font-size: 10px}
.style4 {color: #990000}
</style>
</head>
<body bgcolor="#6b0000">
<p>
<img border="0" src="img/cartoon.jpg" width="179" height="163" style="position: absolute; left: 423; top: 26">
<img border="0" src="img/world%20it.jpg" width="224" height="73" style="position: absolute; left: 613; top: 21">
<img border="0" src="img/center%20download.jpg" width="246" height="73" style="position: absolute; left: 850; top: 19"></p>
<div style="position: absolute; width: 821px; height: 178px; z-index: 1; left: 402px; top: 15px" id="layer1" align="center"></div>
<p> </p>
<p> </p>
<p> </p>
<div style="position:absolute; width:821px; left: 403px; top: 180px;"><img src="img/down.jpg" width="821" height="50"></div>
<div style="position: absolute; width: 821px; height: 46px; z-index: 2; left: 402px; top: 228px; background-color: #390101; border-bottom-width: thin;" id="layer2" >
<div>
<ul>
<li>
<div align="center"><a href="index.php" class="menu">صفحه اصلی</a></div>
</li>
<li>
<div align="center"><a href="#"class="menu">گالری عکس</a></div>
</li>
<li>
<div align="center"><a href="#"class="menu">عضویت</a></div>
</li>
<li>
<div align="center"><a href="about.php"class="menu">درباره ما</a></div>
</li>
<li>
<div align="center"><a href="#"class="menu">آرشیو</a></div>
</li>
<li>
<div align="center"><a href="news.php"class="menu">اخبار</a></div>
</li>
<li>
<div align="center"><a href="contact.php"class="menu">تماس با ما</a></div>
</li>
</ul>
</div>
</div>
<div style="position:absolute; width:233px; height:515px; left: 990px; top: 278px;" class="sootoon" align="right">
<form name="form1" method="post" action="">
<label></label>
<p> </p>
<p>
<label></label>
</p>
<p><a href="send_pass.php" class="style3"></a> </p>
<p> </p>
</form>
<form name="form2" method="post" action="">
<div style="padding-top:23px" align="right">
<p>
<input name="Submit" type="submit" style="width:43px; height:21px; background:url(src="search.png") no-repeat; border:0px" value="جستجو" />
<input type="text" name="textfield">
</p>
</div>
</form>
<div>
<ol>
<li> مقالات </li>
<br>
<li> نرم افزار</li>
<br>
<li> افزار گرافیک</li>
<br>
<li> برنامه نویسی</li>
<br>
<li> آموزشی</li>
<br>
<li> بازی</li>
<br>
<li></li><br>
</ol>
</div>
</div>
<div class="footer style1" style="position:absolute; width:235px; height:21px; left:989px; top:506px">
<div align="center">اخبار</div>
</div>
<div style="position:absolute; width:821px; height:181px; left:406px; top:795px" class="footer">
<div align="right" class="style1" style="position:absolute; left:55px; top:auto">آخرین اعضاء</div>
<div align="right" class="style1" style="position:absolute; left:391px; top:1px">پربازدید ترین مطالب</div>
<div align="right"><span class="style1"style="position:absolute; left:706px; top:1px">جدید ترین ارساله</span>ا</div>
</div>
<div style="position:absolute; width:585px; height:514px; left:401px; top:278px" class="body">
<div align="right">
<p> </p>
<p> </p>
</div>
<p> </p>
<form method="post" name="form3" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td align="right" nowrap bgcolor="#990000"><select name="catname">
<?php
do {
?>
<option value="<?php echo $row_rs1['catname']?>" ><?php echo $row_rs1['catname']?></option>
<?php
} while ($row_rs1 = mysql_fetch_assoc($rs1));
?>
</select></td>
<td bgcolor="#000000"><span class="style4">شاخه</span></td>
<tr>
<tr valign="baseline">
<td align="right" nowrap bgcolor="#990000"><input type="text" name="title" value="" size="32"></td>
<td bgcolor="#000000"><span class="style4">موضوع</span></td>
</tr>
<tr valign="baseline">
<td align="right" valign="top" nowrap bgcolor="#990000"><textarea name="text" cols="50" rows="5"></textarea></td>
<td bgcolor="#000000"><span class="style4">متن خبر</span></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap bgcolor="#990000"><input type="text" name="date" value="" size="32"></td>
<td bgcolor="#000000"><span class="style4">تاریخ</span></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap bgcolor="#990000"><input name="submit" type="submit" value="درج خبر"></td>
<td bgcolor="#000000"><span class="style4"></span></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form3">
</form>
<p> </p>
</div>
<div style="position:absolute; left: 352px; top: 14px;"><img src="img/left.jpg" width="51" height="785"></div>
<div style="position:absolute; left: 1224px; top: 14px; height: 767px; width: 39px;"><img src="img/right.jpg" alt="1" width="51" height="784"></div>
<div style="position: absolute; width: 92px; height: 36px; z-index: 2; left: 894px; top: 277px; background-color: #390101; border-bottom-width: thin;" id="layer" >
<div align="right" class="style1">:موضوع </div>
</div>
</body>
</html>
<?php
mysql_free_result($rs1);
mysql_free_result($rs1);
mysql_free_result($rs1);
?>
---------- Post added at 04:15 PM ---------- Previous post was at 04:13 PM ----------
وقتی هم موضوعی رو در جدول کتگوری ایجاد میکنم تو صفحه اسمش بصورت علامت سوال ظاهر میشه
اگه میشه اینم راهنمائیم کنید
مرسی
دوستان میخوام در سایتم یک فیلد اضافه کنم که اعضا بتونن برای خودشون آواتار انتخاب کنن
آیا باید براش دیتابس بسازم اگرباید بسازم باید از چه نوعی باشه
مشکل بعدی هم اینه که یک رکورد در دیتابیسم ایجاد کردم به نام اکتیو که دو مقدار 0 و 1 میگیره میوام بدونم از چه نوعی باید باشه؟int درسته؟
int بازه اعداد بزرگي رو در بر ميگره و از -2147483648 تا +2147483648 رو شامل ميشه ! ولي tinyint از -128 تا 128 رو شامل ميشه (يا 0 تا 256)مشکل بعدی هم اینه که یک رکورد در دیتابیسم ایجاد کردم به نام اکتیو که دو مقدار 0 و 1 میگیره میوام بدونم از چه نوعی باید باشه؟int درسته؟
MySQL :: MySQL 5.0 Reference Manual :: 10.2 Numeric Types
کد PHP:
<?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
}
// ** Logout the current user. **
error_reporting("-1");
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);
$logoutGoTo = "index.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?>
<!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>Untitled Document</title>
<style type="text/css">
<!--
ul{
float:right;
width:100%;
margin:10;
}
li{
display:inline
}
a.menu
{
float:right;
width:65pt;
height:35pt;
text-decoration:none;
background-color:#6c6d68;
padding:2pt 2pt;
border-right:1px solidwhite;
}
a.menu:hover{
color:#000000;
font:bold;
background-color:#0097FD;
text-align: center;
}
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
}
body {
background-color: #777777;
}
.style1 {font-family: Tahoma, "Times New Roman"}
.style2 {
font-family: Tahoma, "Times New Roman";
color: #FFFFFF;
font-weight: bold;
}
-->
</style></head>
<body>
<DIV style="position:absolute; left:391PX; top:6px; width:951px; height: 895px; background:#000000" align="center" >
<div style="position:absolute; left:7px; top:10px; height: 358px; width: 951px;"><img src="img/image_4.png" width="277" height="356" /><img src="img/Wallpaper (4).jpg" width="647" height="325" /></div>
<div style="position:absolute; left:269px; top:310px; width: 611px; height: 60px;">
<ul>
<li>
<div align="center"><a href="index.php" class="menu">صفحه اصلی</a></div>
</li>
<li>
<div align="center"><a class="menu">ثبت نام</a></div>
</li>
<li>
<div align="center"><a class="menu">گالری</a></div>
</li>
<li></li>
<li></li>
<li>
<div align="center"><a href="news.php" class="menu">اخبار</a></div>
</li>
<li>
<div align="center"><a href="about.php" class="menu">درباره ما</a></div>
</li>
<li>
<div align="center"><a href="contact.php" class="menu">تماس باما</a></div>
</li>
</ul>
</div>
<div style="position:absolute; left:11px; top:388px; width: 542px; height: 445px; background-color: #777777; layer-background-color: #6C6D68; border: 1px none #000000;">
<table width="200" border="1" align="center">
<tr>
<td colspan="3"><div align="center" class="style2">پنل مدیریت </div></td>
</tr>
<tr>
<td><p align="center" class="style1"><a href="news_add.php"><img src="img/news_add.png" width="48" height="48" /></a></p>
<p align="center" class="style1"><a href="news_add.php">اخبار</a></p></td>
<td><p align="center" class="style1"><a href="cat_add.php"><img src="img/package_add.png" width="48" height="48" /></a></p>
<p align="center" class="style1"><a href="cat_add.php">موضوعات</a></p>
</td>
<td><p align="center" class="style1"><a href="user_add.php"><img src="img/user1_add.png" width="48" height="48" /></a></p>
<p align="center" class="style1"><a href="user_add.php">کاربران</a></p></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><p align="center"><span class="style1"><a href="link_add.php"><img src="img/pawn_add.png" width="48" height="48" /></a></span></p>
<p align="center" class="style1"><a href="link_add.php">لینکها</a></p></td>
</tr>
<tr>
<td><div align="center"><a href="<?php echo $logoutAction ?>">خروج</a></div></td>
<td> </td>
<td> </td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
</div>
<div style="position:absolute; left:565px; top:465px; width: 359px; height: 363px;"><img src="img/strubery.jpg" width="362" height="353" /></div>
</DIV>
</body>
</html>
ای کد صفحه ادمین منه که قبلا گفته بودم خروج رو که میزنم درست کار میکنه و به صفحه ای که میخوام میره ولی وقتی آدرس صفحه مدیریت رو دستی وارد میکنم بازم وارد صفحه ادمین میشه
کدی که شما در بالا گفته بودید رو وارد کردم اگر میشه نگاه کنید ببینید درست وارد کردم یا نه چون هنوز هم همون مشکل رو دارم و حل نشده
اگر اشتباه لطفا ایرادش رو بگید
ممنون از لطفتون
---------- Post added at 04:55 PM ---------- Previous post was at 04:21 PM ----------
دوستان یک داینامیک تیبل ساختم که خبر رو درج کنه توی صفحه اصلی که با این پیغام مواجه شدم
MM_ERROR: MySQL Error#: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'fulltext FROM news' at line 1
مشکل از کجاست؟؟؟مرسی
بچه ها هیچ کدوم بلد نیستید ببینید مشکل این کدهای من چیه؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟
كد رو اول اول بذار تا خطاي احتمالي session مشخص بشه.
براي logout ميشه از session_destroy هم استفاده كرد.
مورد دوم هم بعد از mysql_query از
استفاده كنيد تا اشكال كوئري مشخص بشهکد PHP:
or die(mysql_error())
بچه ها تورو خدا کمک کنید من برای وصل شدن به بانک اطلاعاتی که در درس 3 هست مشکل دارم پیغام زیرو میده وقتی میخوام بانک اطلاعاتی رو انتخاب کنم:
1)there is no testing server runnig on the server machin2
2)The testing server specified for this site does not map to the http://localhost/mmserverscripts/mmhttpdb.php url.verify that the url prefix maps to the root of the sit.
HTT error code 404 filenot found.
here are some possible reasons for the prroblem
---------- Post added at 09:04 PM ---------- Previous post was at 09:02 PM ----------
خواهش میکنم دوستان کمک کنید فردا باید تحویل بدم
سلام !
آقا واقعاً ممنون، من این آموزش ها رو تازه پیدا کردم، جناب ! خدا امواتتون و بیامرزه
چون دارم از اول دانلود می کنم ، اولین مشکل ام اینکه تو صفحه phpMyAdmin این error زرد رنگ و نشون میده :
محبت کنید راهنمایی کنید ممنون میشمامكانات اضافي براي كاركردن با جدولهاي پيوندي غيرفعال شدهاست .. .![]()
واقعاً خدا خیرتون بده که این همون روز بود برای من.persiansoft :اميدوارم حداقل آرشيو مناسبي براي اين زبان گردد . شايد روزي به كار آيد .....![]()
در حال حاضر 1 کاربر در حال مشاهده این موضوع است. (0 کاربران و 1 مهمان ها)