runnerjp
-
Posts
2,214 -
Joined
-
Last visited
Posts posted by runnerjp
-
-
i store the date like this
$attended_from = "$from_year-$from_month-$from_day";
$attended_to = "$to_year-$to_month-$to_day";
if ($to_present=='yes') $attended_to = '0000-00-00';
$sql = "INSERT INTO education (user_id,created,updated,title,attended_from,attended_to,location) VALUE ('$user_id',NOW(),NOW(),'$title','$attended_from','$attended_to','$location')";
-
i get the error
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /var/www/vhosts/reference-bank.com/profile.php on line 350 Call Stack: 0.0000 630584 1. {main}() /var/www/vhosts/reference-bank.com/index.php:0 0.0002 631104 2. require_once('/var/www/vhosts/reference-bank.com/inc/config.php') /var/www/vhosts/reference-bank.com/index.php:1 0.0034 694496 3. include('/var/www/vhosts/reference-bank.com/profile.php') /var/www/vhosts/reference-bank.com/inc/config.php:64
-
Hello in my sql database i store a present date as 0000-00-00
how can i orderby the date so it startes with 0000-00-00 then works its way down form todays date
$sql = 'SELECT * FROM user_references WHERE employment_id=\''.$rowe['id'].'\' AND user_id=\''.$user_id.'\' AND status=\'active\'';
e.g
0000-00-00
2012-06-04
2012-03-02
-
the following give me an error
i need to keep <option value="<?php echo $_SESSION['type_of_work_id1'] ;?>" selected="selected">- Please Select -</option> other wise it will chose an option.
<select name="type_of_work_id" id="type_of_work_id"> <option value="<?php echo $_SESSION['type_of_work_id1'] ;?>" selected="selected">- Please Select -</option> <?php if (mysql_num_rows($rst)>0): while($rowt = mysql_fetch_assoc($rst)){ $sel = ($_SESSION['type_of_work_id1'] == $rowt['type_of_work_id']) ? " SELECTED" : "";?> <option <?php if ($rowt['id'] == $_SESSION['type_of_work_id1']){ ?>selected="selected" <? } ?> value="<?=$rowt['id']?>"><?=stripslashes($rowt['title'])?></option> <?php }endwhile; endif; ?> </select>
-
ah yes i have no idea why i added year as its a number.
so when faced with my selected boxes getting results from the database
<select name="type_of_work_id" id="type_of_work_id"> <option value="<?php echo $_SESSION['type_of_work_id1'] ;?>" selected="selected">- Please Select -</option> <?php if (mysql_num_rows($rst)>0): while ($rowt = mysql_fetch_assoc($rst)):?> <option value="<?=$rowt['id']?>"><?=stripslashes($rowt['title'])?></option> <?php endwhile; endif; ?> </select>
how would i use the selected statement?
this is my last one i promis as then i would have them all
-
i have tried the following suggestion but the field is blank for some reason
<select name="from_year" id="from_year"> <?php for($i = 1900; $i <= 2012; $i++){ $sel = ($i == $_SESSION['fromyear']) ? " SELECTED" : ""; echo '<option value="'.$i.'"'.$sel.'>'.$year[$i].'</option>'; }?> </select>
-
actually to add to that how would i do it also for code such as
<select name="type_of_work_id" id="type_of_work_id"> <option value="<?php echo $_SESSION['type_of_work_id1'] ;?>" selected="selected">- Please Select -</option> <?php if (mysql_num_rows($rst)>0): while ($rowt = mysql_fetch_assoc($rst)):?> <option value="<?=$rowt['id']?>"><?=stripslashes($rowt['title'])?></option> <?php endwhile; endif; ?> </select>
-
yes that worked.... last question
how would i do it for a year?
<select name="from_year" id="from_year">
<?php for($i=0;$i<=100;$i++){
$sel = ($i == $_SESSION['fromyear']) ? " SELECTED" : "";
echo '<option value="'.$i.'"'.$sel.'>'.$year[$i].'</option>';
}?>
<option value="<?php echo $_SESSION['fromyear'];?>" selected="selected">yyyy</dd>
<?for ($i=0;$i<=100;$i++):?>
<option value="<?=$start_year-$i?>"><?=$start_year-$i?></dd>
<?endfor;?>
</select>
i hav tried
<?php for($i=0;$i<=100;$i++){ $sel = ($i == $_SESSION['fromyear']) ? " SELECTED" : ""; echo '<option value="'.$i.'"'.$sel.'>'.$year[$i].'</option>'; }?>
-
i gave it ago and it didnt select the month
<select name="from_month" id="from_month">
<option value="" selected="selected">mm</dd>
<?php for($i = 1; $i <= 12; $i++){
$sel = ($i == $_SESSION['frommonth']) ? " SELECTED" : "";
echo '<option value="'.$i.'"'.$sel.'>'.$months[$i].'</option>';
}?>
</select>
-
if the session is true $_SESSION['frommonth'] i want it to show the selected session
<select name="from_month" id="from_month"> <option value="<?php echo $_SESSION['frommonth'];?>" selected="selected">mm</dd> <?for ($i=1;$i<=12;$i++):?> <option value="<?=$i?>"><?=$months[$i]?></dd> <?endfor;?> </select>
how could i do this?
-
No its been moved from anouther server thats all
i have also added
<?php // Turn off all error reporting error_reporting(0); // Report simple running errors error_reporting(E_ERROR | E_WARNING | E_PARSE); // Reporting E_NOTICE can be good too (to report uninitialized // variables or catch variable name misspellings ...) error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); // Report all errors except E_NOTICE // This is the default value set in php.ini error_reporting(E_ALL ^ E_NOTICE); // Report all PHP errors (see changelog) error_reporting(E_ALL); // Report all PHP errors error_reporting(-1); // Same as error_reporting(E_ALL); ini_set('error_reporting', E_ALL); ?>
to each page with no errors
-
// file upload function function SendResults( $errorNumber, $customMsg = '' ) { echo '<script type="text/javascript">' ; echo 'window.parent.OnUploadCompleted(' . $errorNumber . ',"' . $customMsg . '") ;' ; echo '</script>' ; exit ; } function GetRootPath() // from admin { $sRealRootPath = realpath( '../' ) ; return $sRealRootPath; } function GetRootPathCMS() { $sRealRootPath = realpath( './' ) ; return $sRealRootPath; } function GetURLPathFromAdmin() // from admin { $sRealPath = realpath( './' ) ; $sRootRealPath = realpath( '../' ) ; $sRealPathFromRoot = substr( $sRealPath, strlen( $sRootRealPath ), strlen( $sRealPath ) ); $sSelfPath = $_SERVER['PHP_SELF'] ; $sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) ) ; $sURLPath = substr( $sSelfPath, 0, strlen( $sSelfPath ) - strlen( $sRealPathFromRoot ) ); return $sURLPath; } function GetURLPath() // from root app { $sRealPath = realpath( './' ) ; $sRootRealPath = realpath( './' ) ; $sRealPathFromRoot = substr( $sRealPath, strlen( $sRootRealPath ), strlen( $sRealPath ) ); $sSelfPath = $_SERVER['PHP_SELF'] ; $sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) ) ; $sURLPath = substr( $sSelfPath, 0, strlen( $sSelfPath ) - strlen( $sRealPathFromRoot ) ); return $sURLPath; } function RemoveExtension( $fileName ) { return substr( $fileName, 0, strrpos( $fileName, '.' ) ) ; } function RemoveFromStart( $sourceString, $charToRemove ) { $sPattern = '|^' . $charToRemove . '+|' ; return preg_replace( $sPattern, '', $sourceString ) ; } function RemoveFromEnd( $sourceString, $charToRemove ) { $sPattern = '|' . $charToRemove . '+$|' ; return preg_replace( $sPattern, '', $sourceString ) ; } function remove_directory($dir) { if ($handle = opendir("$dir")) { while (false !== ($item = readdir($handle))) { if ($item != "." && $item != "..") { if (is_dir("$dir/$item")) { remove_directory("$dir/$item"); } else { unlink("$dir/$item"); } } } closedir($handle); rmdir($dir); } } function upload_file($uploadFileName, $uploadDirectory, $admin_area = true) { //upload new img title if ($admin_area) $sServerDir = GetRootPath() . $uploadDirectory; else $sServerDir = GetRootPathCMS() . $uploadDirectory; // Get the posted file. $oFile = $_FILES[$uploadFileName] ; // Get the uploaded file name $sFileName = $oFile['name'] ; $sOriginalFileName = $sFileName ; $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ; $sExtension = strtolower( $sExtension ) ; // Initializes the counter used to rename the file, if another one with the same name already exists. $iCounter = 0 ; while ( true ) { // Compose the file path. $sFilePath = $sServerDir . '/' . $sFileName ; // If a file with that name already exists. if ( is_file( $sFilePath ) ) { $iCounter++ ; $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ; } else { move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ; if ( is_file( $sFilePath ) ) { $oldumask = umask(0) ; chmod( $sFilePath, 0777 ) ; umask( $oldumask ) ; } break ; } } return $sFileName; } function upload_file_cms($uploadFileName, $uploadDirectory) { //upload new img title $sServerDir = ROOT_PATH . $uploadDirectory; // Get the posted file. $oFile = $_FILES[$uploadFileName] ; // Get the uploaded file name $sFileName = $oFile['name'] ; $sOriginalFileName = $sFileName ; $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ; $sExtension = strtolower( $sExtension ) ; // Initializes the counter used to rename the file, if another one with the same name already exists. $iCounter = 0 ; while ( true ) { // Compose the file path. $sFilePath = $sServerDir . '/' . $sFileName ; // If a file with that name already exists. if ( is_file( $sFilePath ) ) { $iCounter++ ; $sFileName = RemoveExtension( $sOriginalFileName ) . '_' . $iCounter . '_.' . $sExtension ; } else { move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ; if ( is_file( $sFilePath ) ) { $oldumask = umask(0) ; chmod( $sFilePath, 0777 ) ; umask( $oldumask ) ; } break ; } } return $sFileName; }
-
I have inherited some code and i cant seem to find where it uploads the image to a folder anywhere.
It adds it to the database but not to any folder.
Can any one see where it does this atall??
File attached as code to long to paste.
-
I fixed the error by removing the spaces!
but thankyou for this information Also, session_unregister() was depreciated 10 years ago, throws a depreciated error message in php5.3, and has been completely removed in php5.4 that was just released. You would instead unset() the MemberArea $_SESSION variable.
-
Hey guys im getting the error Warning: Cannot modify header information - headers already sent by (output started at /home/kylegray/public_html/include/authenticate.php:12) in /home/kylegray/public_html/home.php on line 7
Any idea why this is coming up. I think its something to to with me setting the cookie setcookie("un", $id); but im not sure.
home.php
<? include("include/config.php"); //$_SESSION["backpage"]=$_SERVER['PHP_SELF']; if($_SESSION["client_log"]!="true"){ session_unregister("MemberArea"); header("Location: index.php?redirect=".basename($_SERVER['PHP_SELF'])); exit(); } ?>
authenticate.php
<?php include("include/required.php"); include("include/pagedetails.php"); include_once("include/authenticate.php"); $tblName = $tbluser; $id=$_SESSION["id"]; setcookie("un", $id); $ImgPath="$CatImage/"; $ImgPathsing="$SingUPImage/"; ?>
-
got it in the end
-
i tired the blow with function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) {
if( $image_type == IMAGETYPE_JPEG ) {
imagejpeg($this->image,$filename,$compression);
} elseif( $image_type == IMAGETYPE_GIF ) {
imagegif($this->image,$filename);
} elseif( $image_type == IMAGETYPE_PNG ) {
imagepng($this->image,$filename);
}
if( $permissions != null) {
$filename = "images/". $_FILES['file']['name'];
imagejpeg($tmp,$filename,100);
chmod($filename,$permissions);
}
but it does not work :S
<?php class imageupload { var $image; var $image_type; function load($filename) { $image_info = getimagesize($filename); $this->image_type = $image_info[2]; if( $this->image_type == IMAGETYPE_JPEG ) { $this->image = imagecreatefromjpeg($filename); } elseif( $this->image_type == IMAGETYPE_GIF ) { $this->image = imagecreatefromgif($filename); } elseif( $this->image_type == IMAGETYPE_PNG ) { $this->image = imagecreatefrompng($filename); } } function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) { if( $image_type == IMAGETYPE_JPEG ) { imagejpeg($this->image,$filename,$compression); } elseif( $image_type == IMAGETYPE_GIF ) { imagegif($this->image,$filename); } elseif( $image_type == IMAGETYPE_PNG ) { imagepng($this->image,$filename); } if( $permissions != null) { $filename = "images/". $_FILES['file']['name']; imagejpeg($tmp,$filename,100); chmod($filename,$permissions); } } function output($image_type=IMAGETYPE_JPEG) { if( $image_type == IMAGETYPE_JPEG ) { imagejpeg($this->image); } elseif( $image_type == IMAGETYPE_GIF ) { imagegif($this->image); } elseif( $image_type == IMAGETYPE_PNG ) { imagepng($this->image); } } function getWidth() { return imagesx($this->image); } function getHeight() { return imagesy($this->image); } function resizeToHeight($height) { $ratio = $height / $this->getHeight(); $width = $this->getWidth() * $ratio; $this->resize($width,$height); } function resizeToWidth($width) { $ratio = $width / $this->getWidth(); $height = $this->getheight() * $ratio; $this->resize($width,$height); } function scale($scale) { $width = $this->getWidth() * $scale/100; $height = $this->getheight() * $scale/100; $this->resize($width,$height); } function resize($width,$height) { $new_image = imagecreatetruecolor($width, $height); imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight()); $this->image = $new_image; } } ?>
-
how do i set the destination folder for the image?
-
i chnage it to its correct one
if( isset($_POST['submit']) ) {
if( $_FILES['topical_img']['error'] === UPLOAD_ERR_OK ) {
include('imageupload.php');
$image = new imageupload();
$image->load($_FILES['topical_img']['tmp_name']);
$image->resizeToWidth(250);
$image->save('picture2.jpg');
} else {
echo 'Error uploading file. Please try again later.';
}
}
and i get the errors again
Warning: imagesx(): supplied argument is not a valid Image resource in /home/lgray3/public_html/DVGP/admin/imageupload.php on line 49
Warning: Division by zero in /home/lgray3/public_html/DVGP/admin/imageupload.php on line 63
Warning: imagesy(): supplied argument is not a valid Image resource in /home/lgray3/public_html/DVGP/admin/imageupload.php on line 53
Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /home/lgray3/public_html/DVGP/admin/imageupload.php on line 75
Warning: imagesx(): supplied argument is not a valid Image resource in /home/lgray3/public_html/DVGP/admin/imageupload.php on line 49
Warning: imagesy(): supplied argument is not a valid Image resource in /home/lgray3/public_html/DVGP/admin/imageupload.php on line 53
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/lgray3/public_html/DVGP/admin/imageupload.php on line 76
Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/lgray3/public_html/DVGP/admin/imageupload.php on line 22
-
Hello,
As you can see from the below code i use enctype="multipart/form-data"
also i took your advice PFMaBiSmAd and added
if( isset($_POST['submit']) ) {
if( $_FILES['uploaded_image']['error'] === UPLOAD_ERR_OK ) {
include('imageupload.php');
$image = new imageupload();
$image->load($_FILES['uploaded_image']['tmp_name']);
$image->resizeToWidth(250);
$image->save('picture2.jpg');
} else {
echo 'Error uploading file.';
}
}
it seems i get an error... how can i go about finding this error?
<?php require_once('../../Connections/dbadmin.php'); ?> <?php //initialize the session if (!isset($_SESSION)) { session_start(); } // ** Logout the current user. ** $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 = "login.php"; if ($logoutGoTo) { header("Location: $logoutGoTo"); exit; } } ?> <?php if (!isset($_SESSION)) { session_start(); } $MM_authorizedUsers = ""; $MM_donotCheckaccess = "true"; // *** Restrict Access To Page: Grant or deny access to this page function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { // For security, start by assuming the visitor is NOT authorized. $isValid = False; // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. // Therefore, we know that a user is NOT logged in if that Session variable is blank. if (!empty($UserName)) { // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. // Parse the strings into arrays. $arrUsers = Explode(",", $strUsers); $arrGroups = Explode(",", $strGroups); if (in_array($UserName, $arrUsers)) { $isValid = true; } // Or, you may restrict access to only certain users based on their username. if (in_array($UserGroup, $arrGroups)) { $isValid = true; } if (($strUsers == "") && true) { $isValid = true; } } return $isValid; } $MM_restrictGoTo = "login.php"; if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { $MM_qsChar = "?"; $MM_referrer = $_SERVER['PHP_SELF']; if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&"; if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) $MM_referrer .= "?" . $_SERVER['QUERY_STRING']; $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer); header("Location: ". $MM_restrictGoTo); exit; } ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $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']); } // Validation $error = array(); $MM_flag="MM_insert"; if (isset($_POST[$MM_flag])) { // Check headline if (empty($_POST['topical_headline'])) { array_push($error, 'topical_headline');} // Check topical content if (empty($_POST['topical_detail'])) { array_push($error, 'topical_detail');} // Check display order if (empty($_POST['topical_order'])) { array_push($error, 'topical_order');} //add Image if( isset($_POST['submit']) ) { if( $_FILES['uploaded_image']['error'] === UPLOAD_ERR_OK ) { include('imageupload.php'); $image = new imageupload(); $image->load($_FILES['uploaded_image']['tmp_name']); $image->resizeToWidth(250); $image->save('picture2.jpg'); } else { echo 'Error uploading file. Please try again later.'; } } } if (!$error) { if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "addtopicalform")) { $insertSQL = sprintf("INSERT INTO topical (topical_headline, topical_detail, topical_readmore, topical_img, topical_order, topical_published) VALUES (%s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['topical_headline'], "text"), GetSQLValueString($_POST['topical_detail'], "text"), GetSQLValueString($_POST['topical_readmore'], "text"), GetSQLValueString($_POST['topical_img'], "text"), GetSQLValueString($_POST['topical_order'], "int"), GetSQLValueString($_POST['topical_published'], "text")); mysql_select_db($database_dbadmin, $dbadmin); $Result1 = mysql_query($insertSQL, $dbadmin) or die(mysql_error()); $insertGoTo = "topical_list.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } } ?> <!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"><!-- InstanceBegin template="/Templates/admin.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- InstanceBeginEditable name="doctitle" --> <title>Dearne Valley Group Practice | Admin Home</title> <script type="text/javascript" src="../tinymce/jscripts/tiny_mce/tiny_mce.js"></script> <script type="text/javascript"> tinyMCE.init({ theme : "advanced", mode: "textareas", plugins : "", theme_advanced_buttons1 : "", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", theme_advanced_toolbar_location : "top", theme_advanced_buttons1 : "forecolor, fontsizeselect,bold,italic,underline,separator,bullist,numlist,separator,link,unlink", height:"200px", width:"620px" }); </script> <!-- InstanceEndEditable --> <link href="../css/admin.css" rel="stylesheet" type="text/css" /> <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> </head> <body> <div id="container"> <div id="header"> <div id="dvgplogo"> <h1 id="DVGP"><span>Dearne Valley Group Practice</span></h1> </div> <div id="hdrtext"><h2>ADMINISTRATION AREA</h2></div> <div class="clear"></div> </div> <div id="navigation"> <ul> <li><a href="adminhome.php">Home</a></li> <li><a href="news_list.php">News Items</a></li> <li><a href="topical_list.php">Topical Items</a></li> <li><a href="practice_team_update.php">Practice Team</a></li> <li><a href="changepwd.php">Change Password</a></li> <li><a href="<?php echo $logoutAction ?>">Log Out</a></li> </ul> </div> <div id="contentwrapper"><!-- InstanceBeginEditable name="admincontent" --> <h1>Add Topical Item</h1> <p>Please complete the following fields to add a topical item.</p> <form action="<?php echo $editFormAction; ?>" name="addtopicalform" id="addtopicalform" enctype="multipart/form-data" method="POST"> <fieldset> <div id="rightform"> <div class="formfield"> <?php if (isset($error) && in_array('topical_order', $error)) { ?><div class="warning">Please enter a display order</div><?php } ?> <label for="topical_order" class="formlabel2">Display Order:</label><br /> <input name="topical_order" type="text" maxlength="2" class="textfieldvshort" <?php if (isset($error)) {echo 'value="'.htmlentities($_POST['topical_order']).'"' ;} ?>/> </div> <div class="formfield"> <label for="topical_headline" class="formlabel2">Publication Status:</label> <div id="whenpublish"> <label><input name="topical_published" type="radio" id="topical_published_0" value="y" checked="checked" <?php if ($_POST['topical_published'] == 'y') {echo 'checked="checked"';} ?>/>Published </label> <br /> <label><input type="radio" name="topical_published" value="n" id="topical_published_1" <?php if ($_POST['topical_published'] == 'n') {echo 'checked="checked"';} ?>/>Pending / Archived</label> </div> </div> <div class="formfield"> <label for="topical_img" class="formlabel">Select associated image (optional):</label><br /> <input name="topical_img" type="file" id="topical_img" /> </div> <div id="submitform"> <input name="submit" type="submit" value="Save" class="submitbutton" /> </div> </div> <div id="leftform"> <div class="formfield"> <?php if (isset($error) && in_array('topical_headline', $error)) { ?><div class="warning">Please enter a headline</div><?php } ?> <label for="topical_headline" class="formlabel1">Headline: </label><br /> <input name="topical_headline" type="text" maxlength="250" class="textfieldlong" <?php if (isset($error)) {echo 'value="'.htmlentities($_POST['topical_headline']).'"' ;} ?>/> </div> <div class="formfield"> <?php if (isset($error) && in_array('topical_detail', $error)) { ?><div class="warning">Please enter the details</div><?php } ?> <label for="topical_detail" class="formlabel1">Details to show on the home page: </label><br /> <textarea name="topical_detail" id="topical_detail"><?php if (isset($error)) {echo htmlentities($_POST['topical_detail']);} ?></textarea> </div> <div class="formfield"> <label for="topical_readmore" class="formlabel1">Addtional details to show on an extra page (optional): </label><br /> <textarea name="topical_readmore" id="topical_readmore"><?php if (isset($error)) {echo htmlentities($_POST['topical_readmore']);} ?></textarea> </div> </div> <div class="clear"></div> </fieldset> <input type="hidden" name="MM_insert" value="addtopicalform" /> </form> <!-- InstanceEndEditable --> </div> </div> </body> <!-- InstanceEnd --></html>
-
I get the following errors
Warning: getimagesize() [function.getimagesize]: Filename cannot be empty in /home/lgray3/public_html/DVGP/admin/imageupload.php on line 6
Warning: imagesx(): supplied argument is not a valid Image resource in /home/lgray3/public_html/DVGP/admin/imageupload.php on line 49
Warning: Division by zero in /home/lgray3/public_html/DVGP/admin/imageupload.php on line 63
Warning: imagesy(): supplied argument is not a valid Image resource in /home/lgray3/public_html/DVGP/admin/imageupload.php on line 53
Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /home/lgray3/public_html/DVGP/admin/imageupload.php on line 75
Warning: imagesx(): supplied argument is not a valid Image resource in /home/lgray3/public_html/DVGP/admin/imageupload.php on line 49
Warning: imagesy(): supplied argument is not a valid Image resource in /home/lgray3/public_html/DVGP/admin/imageupload.php on line 53
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/lgray3/public_html/DVGP/admin/imageupload.php on line 76
Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/lgray3/public_html/DVGP/admin/imageupload.php on line 22
but as far as i am awear the code should work :S
<?php class imageupload { var $image; var $image_type; function load($filename) { $image_info = getimagesize($filename); $this->image_type = $image_info[2]; if( $this->image_type == IMAGETYPE_JPEG ) { $this->image = imagecreatefromjpeg($filename); } elseif( $this->image_type == IMAGETYPE_GIF ) { $this->image = imagecreatefromgif($filename); } elseif( $this->image_type == IMAGETYPE_PNG ) { $this->image = imagecreatefrompng($filename); } } function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) { if( $image_type == IMAGETYPE_JPEG ) { imagejpeg($this->image,$filename,$compression); } elseif( $image_type == IMAGETYPE_GIF ) { imagegif($this->image,$filename); } elseif( $image_type == IMAGETYPE_PNG ) { imagepng($this->image,$filename); } if( $permissions != null) { chmod($filename,$permissions); } } function output($image_type=IMAGETYPE_JPEG) { if( $image_type == IMAGETYPE_JPEG ) { imagejpeg($this->image); } elseif( $image_type == IMAGETYPE_GIF ) { imagegif($this->image); } elseif( $image_type == IMAGETYPE_PNG ) { imagepng($this->image); } } function getWidth() { return imagesx($this->image); } function getHeight() { return imagesy($this->image); } function resizeToHeight($height) { $ratio = $height / $this->getHeight(); $width = $this->getWidth() * $ratio; $this->resize($width,$height); } function resizeToWidth($width) { $ratio = $width / $this->getWidth(); $height = $this->getheight() * $ratio; $this->resize($width,$height); } function scale($scale) { $width = $this->getWidth() * $scale/100; $height = $this->getheight() * $scale/100; $this->resize($width,$height); } function resize($width,$height) { $new_image = imagecreatetruecolor($width, $height); imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight()); $this->image = $new_image; } } ?>
with the following in my upload page
if( isset($_POST['submit']) ) { include('imageupload.php'); $image = new imageupload(); $image->load($_FILES['uploaded_image']['tmp_name']); $image->resizeToWidth(250); $image->save('picture2.jpg'); }
-
I get the error:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET4.0C; .NET4.0E)
Timestamp: Fri, 22 Jul 2011 14:57:58 UTC
Message: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
Line: 0
Char: 0
Code: 0
URI: http://www.keystonepersonals.com/
-
I get the following error Warning: Invalid argument supplied for foreach() in /home/celbre/public_html/search.php on line 37
http://www.celbre.com/search.php?s=ryan
can we have a demo account to use?
-
Could you just store the db value before you update in a session then display the session value?
sql order by date starting with 000-00-00
in MySQL Help
Posted
any idea why im getting the error Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean