|
I'm trying to graph Hard Drive utilization by partitions for a project I am working on. My goal is to allow user input of partitions of a server. From that point forward they can track changes in partition free space by entering the amount of free space on each partition at any given point of time. It can the be plotted out on a line graph. Here is some sample data: code:
All I want is a good recommendation on a PHP graphing Class or package and maybe a push in the right direction.
|
# ¿ Jul 15, 2009 15:55 |
|
|
# ¿ May 15, 2024 15:26 |
|
chips posted:Have a look at jpgraph if you just want to generate images, but have you considered using either flash or javascript to do the plotting? Obviously it depends on what the client is and what it might support/be reasonable. I was looking at JPGraph and it looks like it might work. I also looked at PHP/SWF Charts which definitely looks much nicer but also more involved. I like the idea of displaying an image or a swf, and not having the browser draw the plots with javascript. This will all be web based obviously so IE / FF / Safari support is required.
|
# ¿ Jul 15, 2009 16:25 |
|
Munkeymon posted:There's also the Google Chart API: http://code.google.com/apis/chart/ Very cool. I forgot Google had this available. I will have to look into that as well. I think I will need something different that can be included in a commercial application since this web app I am developing will probably be sold or subscription based.
|
# ¿ Jul 15, 2009 19:32 |
|
standard posted:Does anyone know of a nice image serving type script? You could make one fairly easily if you are good with PHP. The problem isn't just serving images, you have to somehow tell the script where the image is stored on the server. What exactly are you trying to accomplish by not hard coding image paths?
|
# ¿ Jul 20, 2009 20:04 |
|
standard posted:I'm competent but just can't be bothered to think through the security implications to be be honest. Most of the code I have was built for a purpose and not just for general image serving so it probably won't help you much. As for security, if you are trying to secure the images from prying eyes and only want to serve up images that the user is authorized to view that gets tricky but isn't too difficult. If a directory called images and just want to serve up images/hello.jpg but would prefer <img src="image.php?i=1" /> as opposed to <img src="images/hello.jpg" /> then that is easy.
|
# ¿ Jul 20, 2009 20:19 |
|
standard posted:I meant 'don't give users access to my whole filesystem' type security, rather than authorization type security. Example: <img src="image.php?img=123456" /> php:<?php $imagePath = '/home/user/public_html/images/'; if ($_GET['img'] == '123456') { $imagefile = "sample"; // this value can be pulled from a database or whatever! } else { $imagefile = "blank"; } $newimage = $imagePath.$imagefile.'.png'; header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header('Content-Type: image/png'); // header('Content-Disposition: attachment; filename="' . $_GET['img'] . '.png"'); // FORCE DOWNLOAD header('Content-Disposition: filename="' . $_GET['img'] . '.png"'); $img = LoadPNG($newimage); imagepng($img); imagedestroy($img); ?> Lithium Hosting - Reliable, Affordable, Feature Packed Web Hosting DarkLotus fucked around with this message at 20:37 on Jul 20, 2009 |
# ¿ Jul 20, 2009 20:30 |
|
supster posted:Why are you creating an image object? All you need to do is something like this: supster posted:You are also allowing the user access to directly modify the response header. DarkLotus fucked around with this message at 23:38 on Jul 20, 2009 |
# ¿ Jul 20, 2009 23:34 |
|
Lets assume that we are in control of the size of files we are serving up with an image script. If that is true, is it still an issue or has it turned into a best practice scenario now?
|
# ¿ Jul 21, 2009 01:35 |
|
waffle iron posted:That goes double for serving images out of a database with PHP. Yeah, storing images in a db is retarded.
|
# ¿ Jul 21, 2009 02:53 |
|
scrabbleship posted:It might but it is probably a bit overkill for what my client wants. This would probably overwhelm him. He just wants something he can see the entries in the table with and modify/delete faulty ones with; nothing to fancy. Thanks for the suggestion nonetheless. http://stefangabos.blogspot.com/search/label/Data%20Grid%20PHP%20Class%20Description/
|
# ¿ Aug 29, 2009 04:39 |
|
crabrock posted:So does nobody know why my sessions aren't keeping? is it something i should bring up to my host? I wanted to see if there was anything wrong with my code, but nobody has said anything either way. http://phpuserclass.com
|
# ¿ Oct 10, 2009 04:26 |
|
Begby posted:Is your host erasing the contents of /tmp on the server every couple of days? Or is there a cron job that goes in there and deletes everyting that is x days old? Zebra Framework has a good Sessions class. http://stefangabos.blogspot.com/search/label/Sessions%20Management%20PHP%20Class%20Download
|
# ¿ Oct 12, 2009 23:13 |
|
fletcher posted:After I read this post I sang "P-H-P" aloud to the tune of AC/DC's T.N.T. AWESOME! Now its stuck in my head thanks!
|
# ¿ Oct 28, 2009 03:39 |
|
Aturaten posted:I honestly forget if cpanel has the capability to edit the php.ini file, but you need to find it. After you do, look for: Don't do this!!! Instead use Easy Apache in WHM to add the Zip Extension under Exhaustive Options. If you don't use Easy Apache currently, then do whatever. If you modify things manually and then want to use Easy Apache later, things may not work as intended. I find it is best to either manually build and configure Apache and PHP or use Easy Apache, not both! http://twiki.cpanel.net/twiki/bin/view/EasyApache3/WebHome
|
# ¿ Oct 29, 2009 00:28 |
|
apekillape posted:Holy poo poo, I can't believe I missed that. I've been mucking around in Putty and google all day trying to manipulate PECL and a bunch of other nonense, when it's been right there in EasyApache all this time. My pleasure. I'm not sure what you use your server for, but I have 3 cPanel / WHM servers for Lithium Hosting and I don't mind sharing my knowledge and experience!
|
# ¿ Oct 29, 2009 01:01 |
|
apekillape posted:Crap, something else I forgot about. login as root and type chown user.user /home/user/public_html/folder -R
|
# ¿ Oct 29, 2009 02:03 |
|
Aturaten posted:Well aren't we Mr. "I own a loving web hosting company". At first I wasn't too pleased with the direction your post was going until I saw that you love Lithium Hosting. Then I smiled
|
# ¿ Oct 29, 2009 02:04 |
|
apekillape posted:I got this: sorry, not literally user.user, but whatever the user name is that wordpress is installed for.
|
# ¿ Oct 29, 2009 02:28 |
|
fletcher posted:Never even heard of this. I currently use Notepad++ as well (and sftp-drive) to write all my code. All I want is an editor that can do key based authentication to edit remotely hosted code, sftp-drive is the biggest piece of poo poo. I personally use UltraEdit. It allows me to remotely edit code using SFTP and the syntax highlighting works well for my needs. I've never used Notepad++, NetBeans, or any Framework or IDE though.
|
# ¿ Oct 30, 2009 19:30 |
|
KracKiwi posted:Could anyone point me towards the best method for posting a facebook status from a remote website using php? http://developers.facebook.com/ You'll need to register your site with them before you can do anything.
|
# ¿ Nov 6, 2009 01:52 |
|
LastCaress posted:Is there a way to upload a picture from a remote url to my server using curl? Basically I had a firefox extension that allowed me to right click on a picture and upload it to my server, but now they turned "allow_url_fopen" off and doesn't work. Here is a very basic example: Please read the curl documentation php:<? $url = "http://www.domain.com/image.jpg"; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 0); $fileContents = curl_exec($ch); curl_close($ch); $newImg = imagecreatefromstring($fileContents); ?>
|
# ¿ Dec 10, 2009 23:02 |
|
For a good sessions management class, take a look at this: Database Sessions Management Class
|
# ¿ Dec 22, 2009 14:18 |
|
Little Brittle posted:I need to download a text file every 10 minutes from a remote server. What is the best way to grab the file, while ensuring that the file is not being currently written? Right now, I'm grabbing the file via PHP FTP commands and processing it. you can use curl, it is probably the best option for using PHP to grab anything from a remote server. You could run something on the remote server to send you the file. This would allow you to lock it while sending.
|
# ¿ Jan 5, 2010 00:11 |
|
rotaryfun posted:I'm currently trying to get my webserver setup to handle php. I'm having a bit of trouble getting everything setup correctly though. Do you need to use IIS or have you considered installing XAMPP? If you're stuck with IIS, I'm pretty sure there is an installer for PHP that will integrate with IIS or at least give you detailed instructions if it can't/
|
# ¿ Jan 12, 2010 00:29 |
|
rotaryfun posted:I am unfortunately stuck with IIS. Did you run the installer? PHP 5.2.12 installer Last time I tried on a windows box, it attempted to integrate with IIS. If it fails it will tell you what to do to make it work. http://www.php.net/manual/en/install.windows.iis6.php should help too
|
# ¿ Jan 12, 2010 00:46 |
|
rotaryfun posted:From the link that I posted, I downloaded and installed the 5.3.1 VC9 non thread safe installer. I'll give previous version installers a try too. With IIS you want the non thread safe installer. Try following these instructions: http://www.peterguy.com/php/install_IIS6.html Seem to have good information.
|
# ¿ Jan 12, 2010 01:32 |
|
rotaryfun posted:Followed this and was able to get the server up and running with 5.2.5 You're welcome. Enjoy your IIS + PHP setup!
|
# ¿ Jan 12, 2010 21:32 |
|
apekillape posted:You're both beautiful people and have completely saved my bacon. This will get A through Z php:<?php foreach(range('a','z') as $i) { $url = "http://www.songmeanings.net/artist/directory/$i/"; $artistHTML = artistcURL($url); $artists_to_insert = artistList($artistHTML); $insert_sql = join(", ", $artists_to_insert); // Simple Database insert mysql_query("INSERT INTO table (name, url) VALUES $insert_sql"); } function artistList($html) { $doc = new DOMDocument(); $doc->loadHTML($html); $mainDiv = $doc->getElementById("listing_artists"); $anchors = $mainDiv->getElementsByTagName("a"); foreach ($anchors as $anchor) { $artist = mysql_real_escape_string($anchor->textContent); $artistUrl = mysql_real_escape_string("http://www.songmeanings.net".$anchor->getAttribute("href")); $artist_to_insert[] = "('$artist', '$artistUrl')"; } return $artist_to_insert; } function artistcURL($url) { $curl = curl_init(); curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); curl_setopt($curl, CURLOPT_URL, $url); $result = curl_exec($curl); curl_close($curl); return $result; } ?>
|
# ¿ Jan 22, 2010 05:11 |
|
fletcher posted:Why are you telling somebody new to PHP to use mysql_real_escape_string prepared statements! PDO! He already had the database side down. Quote: "Looping and getting it into the DB and all was never a problem" You might as well ask why I would tell somebody to use mysql_real_escape_string or mysql_insert without first opening the database connection
|
# ¿ Jan 22, 2010 06:32 |
|
apekillape posted:This will never end. Curl is timing out. Set the curl timeout to a higher value.
|
# ¿ Jan 26, 2010 05:00 |
|
apekillape posted:It wasn't set at all before, I added the line and set it to 30, then 60. It still stops after 519 records. I won't pretend to be an expert. Look into CURLOPT_BUFFERSIZE and CURLOPT_CONNECTTIMEOUT.
|
# ¿ Jan 26, 2010 05:48 |
|
Yeehaw McKickass posted:Would someone be able to direct me to some simple contact form resources? Tutorials, or straight up code, what-have-you. What do you mean "Confirms the mail was sent"? Just making sure the mail sending function completed without errors?
|
# ¿ Mar 19, 2010 14:44 |
|
Yeehaw McKickass posted:I mean within the form box, without having to refresh the page. This isn't difficult, you'll have an HTML form, then you'll use jQuery to validate the input and submit via AJAX to form.php. If successful, the jQuery can hide the form and display a success notification without reloading the page. The example below does ZERO input validation. You will at bare minimum want to validate user input via jQuery and then again via PHP. formtest.html code:
php:<?php if (!empty($_POST['field'])) { echo "Form Submitted!"; echo "<pre>"; print_r($_POST); echo "</pre>"; } exit; ?> DarkLotus fucked around with this message at 21:01 on Mar 19, 2010 |
# ¿ Mar 19, 2010 18:36 |
|
Thirteenth Step posted:I have a combo box which populates from the DB, code is: new form: php:<?php $query="SELECT id,forename,surname,dept FROM staff"; $result = mysql_query ($query); echo "<form type=\"post\" action=\"\">"; //This will post to itself echo "<select name=\"staff\">Staff Name</option>"; while($nt=mysql_fetch_array($result)){ echo "<option value=\"{$nt['id']}\">{$nt['forename']} {$nt['surname']} - {$nt['dept']} Staff</option>"; } echo "</select>"; echo "<input type=\"submit\" name=\"submit\" value=\"submit\" />"; echo "</form>"; ?> php:<?php // put this code at the top of your PHP file so when the form posts, it will run before your select list is created. if ($_POST['submit']) { $deleteID = mysql_real_escape_string($_POST['id']); $deleteQuery = "DELETE FROM staff WHERE id = '$deleteID' LIMIT 1"; $deleteResult = mysql_query($deleteQuery) or die(mysql_error()); } ?> DarkLotus fucked around with this message at 19:09 on Mar 25, 2010 |
# ¿ Mar 25, 2010 18:40 |
|
revmoo posted:What's the easiest way to match if statements containing a bunch of possibilities. For example, if $variable contains any one of 30 different possible strings return true otherwise return false? put those strings in an array, then use php:<? if (in_array($value, $array)) { //do stuff } ?> php:<? switch ($i) { case 0: echo "i equals 0"; break; case 1: echo "i equals 1"; break; case 2: echo "i equals 2"; break; } ?> php:<? if ($i == 0) { echo "i equals 0"; } elseif ($i == 1) { echo "i equals 1"; } elseif ($i == 2) { echo "i equals 2"; } ?> DarkLotus fucked around with this message at 21:06 on Mar 25, 2010 |
# ¿ Mar 25, 2010 21:04 |
|
revmoo posted:Just did 1100 lines of case statements to translate zip codes into geographical price zones. My hands are tired. I bet if you post your code, minus all 1100 lines of zip codes, someone could help you optimize it better.
|
# ¿ Mar 26, 2010 19:43 |
|
I am pretty sure it is acceptable to have a structure like this:code:
|
# ¿ Apr 1, 2010 23:16 |
|
I am experiencing a strange issue while developing an addon module for a product I use. The software developer has given me the usual "There isn't anything that would cause this" type of run-around.php:<? $value = "test"; function test_function($someothershit) { global $value; var_dump($value); } ?>
|
# ¿ Apr 9, 2010 17:53 |
|
gwar3k1 posted:Change the name of the variable. There may be another global $value in the product? Very good suggestion. I forgot to mention I tried that and the result is the same.
|
# ¿ Apr 9, 2010 19:13 |
|
|
# ¿ May 15, 2024 15:26 |
|
gwar3k1 posted:Perhaps try $value .= "test"; which would further suggest existance of a constant $value somewhere. I set a value on one page: php:<? $DEBUG = true; ?> php:<? $debug = defined('C_DEBUG') ? ((strcasecmp(C_DEBUG, 'true') == 0) ? true : false) : $DEBUG; function debugfunction($serviceObj) { global $debug; if($debug) { print "<b>Debug Mode is True:</b></br></br>"; print "<b>XML Sent:</b><br><br>"; print "<xmp>" . $serviceObj->request . "</xmp>"; print "<br><b>XML Received:</b><br><br>"; print "<xmp>" . $serviceObj->response . "</xmp>"; print "<br>"; } else { print "<b>Debug Mode is False:</b></br></br>"; } } ?> $GLOBALS['debug'] is empty. I did try this before to see what it said. I did not write this code, I am simply trying to build a module using an API which I have done without issue but anytime the code executes as part of a different application, all kinds of strangeness happens.
|
# ¿ Apr 9, 2010 20:40 |