j9sjam3
Members-
Posts
47 -
Joined
-
Last visited
Never
Everything posted by j9sjam3
-
Hello. I am trying to override a library class. I am developing with Zend Server CE. If I put the class into /library/Zend/{class}.php, would it automatically override the one "installed" with Zend Server CE? Thanks.
-
Hello. I am implementing a CMS with constantly changing pages and constant updates. I am wondering if it is better to make it all MySQL based or static pages (new pages are created by PHP when they are created). Thanks.
-
Wrong forum. What are you trying to achieve? Why would anyone go to the books.php?class=sales page anyway?
-
adding folders that are empty to disallowed array
j9sjam3 replied to nickharambee's topic in PHP Coding Help
I mean, have an allowed folder array? So whoever only has access to certain folders. This is also better for security. -
If you just store the IP address in the database then you can check if the user is on the same IP address?
-
adding folders that are empty to disallowed array
j9sjam3 replied to nickharambee's topic in PHP Coding Help
Why couldn't you just make an allowed array instead? Would save a lot of trouble... -
If you handle sessions via the database, you can add an expiry date. Check this out: http://stefangabos.ro/php-libraries/zebra-session/
-
I will attempt to explain the differences between file_get_content and include. File get content does what it says on the tin. It liturally GETS the content and does nothing with it. It makes it act like an HTML file. So if the files content was this: <?php echo "something cool here; ?> And your page was: <?php echo file_get_content("pathToFile.php"); The page would display: On the other hand, if you were to have an include statement: <?php include("pathToFile.php"); The page would display: Hope this helps a little.
-
Read this It will really help with what your doing.
-
Try: <?php if(!isset($_SESSION['anObject'])) { // Is NOT logged in } else { if($_SESSION['anObject'] != "some_string_or_whatever_here_to_stop_spoofing") { // Is NOT Logged in } else { // is Logged in }
-
Using a HTML template with includes can't read from $_GET
j9sjam3 replied to rpmorrow's topic in PHP Coding Help
Can't you use .htaccess to rewrite the URL's? e.g. File: search.php?q=searchterm Will be seen in URL as: search/searchterm/ -
Couldn't you just use a function to connect (function conn($hosst, $user, $pass etc)) and log from that?
-
unknown time remaining (force download) (Read 6 times)
j9sjam3 replied to ykach's topic in PHP Coding Help
Has the $filename got the file extension? -
Can anyone help? Would be much appreciated...
-
Search for image upload on Google. http://www.w3schools.com/php/php_file_upload.asp Should handle it.
-
The .htaccess file should never (or very rarely) change. As long as your are rewriting your URL's to: shop_details.php?url=$1 Then then in the case of: www.mydomain.com/shops/shop_name/product_name The $url var would be : shops/shop_name/product_name Use PHP's explode function to separate the parts. Example: $default_place = "shops"; $default_name = "name"; $default_product = "product"; $default_id = "001002"; if(isset($_GET['url'])) { $url = explode("/", $_GET['url']; $default_place = isset($url[0]) ? $url[0] : $default_place; // etc etc } [/code]
-
Please use code brackets [code]code here[//code] (without the double slash) Is this Dreamweaver code? Its usually a lot easier to write your own and you learn a lot more from doing it yourself...
-
mysql_query("SELECT * FROM pages WHERE subject_id = '".$row['id']."', $connection) or die(mysql_error($connection));
-
Issue with saving uploaded image twice
j9sjam3 replied to wwfc_barmy_army's topic in PHP Coding Help
Resize_image.php <?php class resizeImage { protected $image, $toWidth, $toHeight; public function __construct($original_image, $toWidth = 200, $toHeight = 200, $autoresize = true) { if(is_null($original_image)) { die("Missing first argument"); } $this->image = $original_image; $this->toHeight = $toHeight; $this->toWidth = $toWidth; $autoresize == true ? $this->resize() : false; } public function resize() { list($width, $height) = getimagesize($this->image); $xscale = $width / $this->toWidth; $yscale = $height / $this->toHeight; if($yscale > $xscale){ $new_width = round($width * (1 / $yscale)); $new_height = round($height * (1 / $yscale)); } else { $new_width = round($width * (1 / $xscale)); $new_height = round($height * (1 / $xscale)); } $imageResized = imagecreatetruecolor($new_width, $new_height); $imageTmp = imagecreatefromjpeg ($originalImage); imagecopyresampled($imageResized, $imageTmp, 0, 0, 0, 0, $new_width, $new_height, $width, $height); return $imageResized; } public function __destruct() { } } <?php // stuff before include("resize_image.php"); $image = new resizeImage($file, 100); if ($s3->putObjectFile($thumbnail, "containerhere", "thumbs/" . $fileName3, S3::ACL_PUBLIC_READ)) { echo "<strong>Uploaded Image</strong>"; }else{ echo "<strong>Something went wrong while uploading your file... sorry.</strong>"; } -
Issue with saving uploaded image twice
j9sjam3 replied to wwfc_barmy_army's topic in PHP Coding Help
Instead of: include('simpleImage.php'); $image = new SimpleImage(); $image->load($_FILES['theFile2']['tmp_name']); $image->resizeToWidth(100); $image->save($_FILES['theFile2']['tmp_name']); Use: include("resize_image.php"); $image = new resizeImage;' $thumbnail = $image->resize($file, 100); if ($s3->putObjectFile($thumbnail, "containerhere", "thumbs/" . $fileName3, S3::ACL_PUBLIC_READ)) { echo "<strong>Uploaded Image</strong>"; }else{ echo "<strong>Something went wrong while uploading your file... sorry.</strong>"; } resize_image.php <?php class resizeImage { protected $image, $toWidth, $toHeight; public function __construct($original_image, $toWidth = 200, $toHeight = 200) { $this->image = $original_image; $this->toHeight = $toHeight; $this->toWidth = $toWidth; } public function resize() { list($width, $height) = getimagesize($this->image); $xscale = $width / $this->toWidth; $yscale = $height / $this->toHeight; if($yscale > $xscale){ $new_width = round($width * (1 / $yscale)); $new_height = round($height * (1 / $yscale)); } else { $new_width = round($width * (1 / $xscale)); $new_height = round($height * (1 / $xscale)); } $imageResized = imagecreatetruecolor($new_width, $new_height); $imageTmp = imagecreatefromjpeg ($originalImage); imagecopyresampled($imageResized, $imageTmp, 0, 0, 0, 0, $new_width, $new_height, $width, $height); return $imageResized; } public function __destruct() { } } -
Is one SUBMIT into multiple tables possible?
j9sjam3 replied to nomadsoul's topic in PHP Coding Help
If that doesn't work, then have hidden fields. onSubmit update the hidden fields to the values you want them. -
Issue with saving uploaded image twice
j9sjam3 replied to wwfc_barmy_army's topic in PHP Coding Help
What file is "pathtofile.php"? Are you accidentally trying to save to that file? -
Issue with saving uploaded image twice
j9sjam3 replied to wwfc_barmy_army's topic in PHP Coding Help
Did you get any error messages? Could you also include -
Just out of curiosity, why would you want to do that? Aren't you defining the host, user etc anyway?
-
Issue with saving uploaded image twice
j9sjam3 replied to wwfc_barmy_army's topic in PHP Coding Help
Wouldn't it be easier, more user friendly and faster to upload the full size image, and resize it in PHP?