wayland
12-28-2007, 04:21 AM
I have a online dating site. I am moving it from PHP Version 4.3.10 To PHP version 5.2.5
After installing the script I noticed the pictures would not post after upload. I think the problem is in the file below. Can anyone see a problem I am missing?
What I have been getting when I try to upload picture is User not Specified.
<?php
session_start();
// Database connection variables
require("./config.php");
$dbServer = $server1;
$dbUser = $username1;
$dbPass = $password1;
$dbDatabase = $database1;
$active1=$ShowPicture;
$pixallowed=$PicsAllowed;
//echo "****" . $UserID;
$sConn = mysql_connect($dbServer, $dbUser, $dbPass)
or die("Couldn't connect to database server");
$dConn = mysql_select_db($dbDatabase, $sConn)
or die("Couldn't connect to database $dbDatabase");
if($UserID == "")
{
die("User Not Specified.");
}
$dbQuery = "SELECT * FROM date_images Where User_ID = '" . $UserID . "'";
$result=mysql_query($dbQuery);
$num_results=mysql_num_rows($result);
if ($num_results<=$pixallowed)
{
//echo "Allowed";
if($fileUpload1 == "")
{
}
else
{
$fileHandle = fopen($fileUpload1, "r");
$fileContent1 = fread($fileHandle, filesize($fileUpload1));
$fileContent1 = addslashes($fileContent1);
$dbQuery = "INSERT INTO date_images (User_ID, Picture1, pactive) VALUES ('" . $UserID . "','" . $fileContent1 . "','" . $active1 . "')";
mysql_query($dbQuery) or die("Couldn't add file to database");
}
}
else
{
//echo "Not Allowed";
die("Maximum allowed pictures already uploaded. Use the Member Menu to delete uploaded pictures.");
}
//echo " " . $dbQuery;
echo "<h1>File(s) Uploaded</h1>";
echo "Return to the Home page by clicking below:<br><br>";
echo "<a href='Main.php'>Home</a>";
?>
After installing the script I noticed the pictures would not post after upload. I think the problem is in the file below. Can anyone see a problem I am missing?
What I have been getting when I try to upload picture is User not Specified.
<?php
session_start();
// Database connection variables
require("./config.php");
$dbServer = $server1;
$dbUser = $username1;
$dbPass = $password1;
$dbDatabase = $database1;
$active1=$ShowPicture;
$pixallowed=$PicsAllowed;
//echo "****" . $UserID;
$sConn = mysql_connect($dbServer, $dbUser, $dbPass)
or die("Couldn't connect to database server");
$dConn = mysql_select_db($dbDatabase, $sConn)
or die("Couldn't connect to database $dbDatabase");
if($UserID == "")
{
die("User Not Specified.");
}
$dbQuery = "SELECT * FROM date_images Where User_ID = '" . $UserID . "'";
$result=mysql_query($dbQuery);
$num_results=mysql_num_rows($result);
if ($num_results<=$pixallowed)
{
//echo "Allowed";
if($fileUpload1 == "")
{
}
else
{
$fileHandle = fopen($fileUpload1, "r");
$fileContent1 = fread($fileHandle, filesize($fileUpload1));
$fileContent1 = addslashes($fileContent1);
$dbQuery = "INSERT INTO date_images (User_ID, Picture1, pactive) VALUES ('" . $UserID . "','" . $fileContent1 . "','" . $active1 . "')";
mysql_query($dbQuery) or die("Couldn't add file to database");
}
}
else
{
//echo "Not Allowed";
die("Maximum allowed pictures already uploaded. Use the Member Menu to delete uploaded pictures.");
}
//echo " " . $dbQuery;
echo "<h1>File(s) Uploaded</h1>";
echo "Return to the Home page by clicking below:<br><br>";
echo "<a href='Main.php'>Home</a>";
?>