Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

upload image php scripts have a problem

Links for php scripts

Moderators: macek, egami, gesf

upload image php scripts have a problem

Postby begeiste » Thu Jul 29, 2004 9:37 am

I have a table call " photos". The images_upload.php page is for upload images by using browse button in the form and now is running a problem that indicats:
Fatal error: Call to undefined function: select() in /home/symphon1/public_html/admin/images_upload.php on line 26

Or Fatal error: Call to undefined function: author() in /home/symphon1/public_html/admin/images_upload.php on line 25

Can someone to tell me what is problem of that? Here are codes below, Thanks.
<?php require_once('../Connections/apress.php'); ?>
<?php
$currentPage = $HTTP_SERVER_VARS["PHP_SELF"];

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;
}

auth();
$photo=select("$db.photos","id='$photoID'", "" );

if(!empty($upload))
{

//uploads thumbnail
if($_FILES['name']['name']!="")
{
$dir=$admin[dir];
$_FILES['name']['name']-str_replace(" ","",$_FILES['name']['name']);
//check is image is uploaded and move it to the images folder
if(!move_uploaded_file($_FILES['name']['tmp_name'], "images".$_FILES['name']['name']))
$message="Couldn't upload image";
chmod("images".$_FILES['name']['name'],0777);

//choose the image height
$scale="-geometry '115x115>' ";

//image save path
$newThum="images".$_FILES['name']['name']." images".$_FILES['name']['name'];

//imagemagick command format
$command = "/usr/local/bin/convert $scale $newThum";

//execute command
`$command`;

//choose the image height
$scale="-geometry '325x325>' ";

//image save path
$newThum="images".$_FILES['name']['name']." images".$_FILES['name']['name'];

//imagemagick command format
$command = "/usr/local/bin/convert $scale $newThum";

//execute command
`$command`;
}
$_POST[name]=$_FILES['name']['name'];
$remove=array('upload');
insert("$db.images");

}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
<title>uploadimage</title>
<link href="../main.css" rel="stylesheet" media="screen">
</head>

<body leftmargin="20" marginheight="10" marginwidth="20" topmargin="10">
<form action="<?php print $PHP_SELF;?>" method="post" name="form" enctype="multipart/form-data">
<br>
Upload Image to <?php print "$photo[images]"; ?>'s gallery:<hr size=1><br>
<input type="file" name="name" value="" size="19"><br>
<br>
<input type="submit" name="upload" value="Upload Image">
<input type="hidden" name="photoID" value="<?php print $photoID;?>" >


</form>
</body>

</html>
begeiste
New php-forum User
New php-forum User
 
Posts: 83
Joined: Thu Jun 03, 2004 11:27 am

Re: upload image php scripts have a problem

Postby swirlee » Thu Jul 29, 2004 10:53 am

begeiste wrote:Fatal error: Call to undefined function: select() in /home/symphon1/public_html/admin/images_upload.php on line 26

Or Fatal error: Call to undefined function: author() in /home/symphon1/public_html/admin/images_upload.php on line 25


The error messages answered the question for you. You're calling functions called select() and author() that haven't been defined anywhere.
User avatar
swirlee
Moderator
Moderator
 
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back

Postby begeiste » Thu Jul 29, 2004 11:25 am

Maybe I didn't address clearly, actually I know what's wrong with the lines, but don't know how to correct them. Do you know how to correct them? Thanks
begeiste
New php-forum User
New php-forum User
 
Posts: 83
Joined: Thu Jun 03, 2004 11:27 am

Postby begeiste » Thu Jul 29, 2004 4:53 pm

Hi Fellows:

So far I have figured by myself with this codes, but there is a link of Upload Image to gallery! which I still don't know how to open the images.php by click on this. http://www.symphonyimage.com/admin/dis.php


<?php require_once('../Connections/apress.php'); ?>
<?php
$currentPage = $HTTP_SERVER_VARS["PHP_SELF"];

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 = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO photo (photo_ID, name) VALUES (%s, %s)",
GetSQLValueString($HTTP_POST_VARS['photo_ID'], "int"),
GetSQLValueString($HTTP_POST_VARS['name'], "date"));

mysql_select_db($database_apress, $apress);
$Result1 = mysql_query($insertSQL, $apress) or die(mysql_error());
}

if ((isset($HTTP_POST_VARS['photo_ID'])) && ($HTTP_POST_VARS['photo_ID'] != "") && (isset($HTTP_POST_VARS['delete_me']))) {
$deleteSQL = sprintf("DELETE FROM photos WHERE photo_ID=%s",
GetSQLValueString($HTTP_POST_VARS['photo_ID'], "int"));

mysql_select_db($database_apress, $apress);
$Result1 = mysql_query($deleteSQL, $apress) or die(mysql_error());

$deleteGoTo = "/admin/dis.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}

mysql_select_db($database_apress, $apress);
$query_rst_results = "SELECT * FROM photos";
$rst_results = mysql_query($query_rst_results, $apress) or die(mysql_error());
$row_rst_results = mysql_fetch_assoc($rst_results);
$totalRows_rst_results = mysql_num_rows($rst_results);

$queryString_rst_results = "";
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
$params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rst_results") == false &&
stristr($param, "totalRows_rst_results") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rst_results = "&" . implode("&", $newParams);
}
}
$queryString_rst_results = sprintf("&totalRows_rst_results=%d%s", $totalRows_rst_results, $queryString_rst_results);
?>

<?php echo "<?xml version=\"1.0\" encoding=\"big5\"?".">"; ?>

<!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>
<title>dispage</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5" />
<style type="text/css">
<!--
h3 {
font-family: "Verdana", "Arial", "Helvetica", "sans-serif";
color: #000000;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #666666;
}
.title {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: bold;
padding-left: 20px;
border-left-width: 1px;
border-left-style: solid;
border-left-color: #FFFFFF;
}
.t {
color: #FFFFFF;
background-color: #660000;
}
.tborder {
border-top-width: 1px;
border-right-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-left-style: solid;
border-top-color: #666666;
border-right-color: #666666;
border-left-color: #666666;
}
body {
background-color: #CCCCCC;
}
-->
</style>
</head>

<body>



<div align="center">
<h3>Thanks for your visiting our photo Gallery </h3></div>



<div align="center">
<table width="650" border="0" cellspacing="0" cellpadding="0" class="t">
<tr>
<td width="149" class="title">PhotoID</td>
<td width="149" class="title">Name</td>
<td width="352" class="title">Scenery</td>
</tr>
</table>
<?php do { ?>
<table width="650" border="0" cellspacing="2" cellpadding="2" class="tborder">
<tr>
<td width="144"><?php echo $row_rst_results['photo_ID']; ?></td>
<td width="142"><?php echo $row_rst_results['name']; ?>
</td>
<td width="108"><a href="<?php echo $row_rst_results['images'];?>" target="_blank"><img src="<?php echo $row_rst_results['images']; ?>" alt="dynamicimage" name="imageplace" id="imageplace" border="0" /></a></td>
<td width="25"><a href="/admin/edit_image?image=<?php echo $row_rst_results['images']; ?>">edit</a></td>

<td width="118" ><a href="#" onclick="calendar=window.open('images.php?photo_ID=<?php echo $values['photo_ID'];?>','feedback','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=150'); return false;">Upload Image to gallery!</a></td>
<td width="73"> <form name="delete_form" id="delete_form" method="post" action="">
<input name="delete_me" type="checkbox" id="delete_me" value="checkbox" />
<input type="submit" name="Submit" value="Delete" />
<input name="photo_ID" type="hidden" id="photo_ID2" value="<?php echo $row_rst_results['photo_ID']; ?>" />
</form></td>
</tr>
</table>
<?php } while ($row_rst_results = mysql_fetch_assoc($rst_results)); ?>
<br />
<p class="title">&nbsp;</p>
<p class="title">Total Records:
<?php echo $totalRows_rst_results ?>
</p>
</div>
</body>
</html>
<?php
mysql_free_result($rst_results);
?>
begeiste
New php-forum User
New php-forum User
 
Posts: 83
Joined: Thu Jun 03, 2004 11:27 am


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.