i get erros here:
Deprecated: Function ereg() is deprecated in C:\xampp\htdocs\a_upload\zoom.php on line 48
<?php
$visitors = 0;
$handle = opendir(session_save_path());
while(($file = readdir($handle)) != FALSE)
{
if($file != "."&&$file !="..")
{
if(ereg("^sess",$file))
$visitors++;
}
}
echo "there are $visitors online";
?>
here is my full code if you need to see it
<?php
include("include/header.php");
//grab submitted data
if($_SERVER['REQUEST_METHOD'] == 'POST') //if user add comment
{
if(empty($_POST['comment']))
{
}
else
{
$count = 0;
$comment_p = $_POST['comment'];
$user_id_s = $_SESSION['user_id'];
$image_id_g = isset($_GET['img']) ? $_GET['img'] : 0;
//success
$comment = mysql_query("INSERT INTO comment VALUES(NULL,'$user_id_s','$image_id_g','$comment_p')");
//count comments and update comments
$queryget = mysql_query("SELECT comment FROM comment WHERE image_id = $image_id_g");
while($row2 = mysql_fetch_assoc($queryget))
{
$count++;
}
$result2 = mysql_query("UPDATE image SET image_comment = '$count' WHERE image_id = '$image_id_g'");
}
}
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel='stylesheet' type='text/css' href='css/top_menu.css' />
<link rel='stylesheet' type='text/css' href='css/all_css.css' />
</head>
<body>
<?php
$visitors = 0;
$handle = opendir(session_save_path());
while(($file = readdir($handle)) != FALSE)
{
if($file != "."&&$file !="..")
{
if(ereg("^sess",$file))
$visitors++;
}
}
echo "there are $visitors online";
$image_id = $_GET['img'];
$user_name_s = $_SESSION['username'];
//$img = intval($_GET['img']);
//get image from database
$queryget = mysql_query("SELECT image FROM image WHERE image_id = $image_id");
$row = mysql_fetch_assoc($queryget);
$image_db = $row['image'];
$src = "data:image/gif;base64," . $image_db;
//get image name from database
$queryget = mysql_query("SELECT image_short_name FROM image WHERE image_id = '$image_id'");
$row = mysql_fetch_assoc($queryget);
$image_short_name_db = $row['image_short_name'];
//get image size from database
$queryget = mysql_query("SELECT image_des FROM image WHERE image_id = '$image_id'");
$row = mysql_fetch_assoc($queryget);
$image_des_db = $row['image_des'];
//get image size from database
$queryget = mysql_query("SELECT image_size FROM image WHERE image_id = '$image_id'");
$row = mysql_fetch_assoc($queryget);
$image_size_db = $row['image_size'];
//get image size from database
$queryget = mysql_query("SELECT image_resolution FROM image WHERE image_id = '$image_id'");
$row = mysql_fetch_assoc($queryget);
$image_resolution_db = $row['image_resolution'];
//get image views from database
$queryget = mysql_query("SELECT image_view FROM image WHERE image_id = '$image_id'");
$row = mysql_fetch_assoc($queryget);
$image_view_db = $row['image_view'];
//get image size from database
$queryget = mysql_query("SELECT image_comment FROM image WHERE image_id = '$image_id'");
$row = mysql_fetch_assoc($queryget);
$image_comment_db = $row['image_comment'];
//get all comments
$result2 = mysql_query("SELECT * FROM comment WHERE image_id = '$image_id' ORDER BY image_id DESC");
echo"
<div id ='bg4'>
<div id='context4'>
<div class='image_nu'>
<br/><img src=\"$src\" class='image' /><br/><br/>
<b><font color='#1d98d6'> " . $image_short_name_db . "</font></b><br/>
<b><font color='#1d98d6'>By: " . $user_name_s . "</font></b><hr/>
</div>
<div id='image_des'>
" . $image_des_db . "<br/><br/>
</div>
<div id='image_bottom'>
<form class='form' action='zoom.php?img=$image_id' method='post'>
<b> " . $user_name_s . " - Add a Comment:</b><br/>
<pre> <textarea class='textarea' name='comment'></textarea></pre>
<pre> <input type='submit' class='button' name='submit' value='Add comment' /></pre>
</form>
</div>
<div id='image_right'>
<div id = 'nav2'>
<ul>
<li><a href=\"editimage.php?img=".$image_id."\">Edit</a></li>
<li><a href='#'>Delete</a></li>
</ul>
</div>
</div>
<div id='image_right2'>
<div class='form'>
<b>Statistics:</b><br/>
<b>View: " . $image_view_db . "</b><br/>
<b>Comment: " . $image_comment_db . "</b><br/><hr/>
Image information:<br/>
<b>Size: " . $image_size_db . "</b><br/>
<b>Resolution: " . $image_resolution_db . "</b><br/>
</div>
</div>
<div id='image_comment' class='form'> ";
while($row2 = mysql_fetch_assoc($result2))
{
$comment_db = $row2['comment']; //get comment from comment table
$user_id_db = $row2['user_id']; //get user id from comment table
//get user name from user table
$queryget = mysql_query("SELECT username FROM user WHERE user_id = '$user_id_db'");
$row = mysql_fetch_assoc($queryget);
$user_name_db = $row['username'];
echo"<font color='#DBDBDB'>$user_name_db</font><br/>";
echo"$comment_db <br/><br/><hr/><hr/>";
}
echo"</div>
<br/>
</div>
</div>
";
?>
</body>
<?php
include("include/footer.php");
?>