PHP - Moved: Monitor Size???
This topic has been moved to CSS Help.
http://www.phpfreaks.com/forums/index.php?topic=347531.0 Similar TutorialsThis topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=320263.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=314962.0 This topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=351144.0 This topic has been moved to Editor Help (Dreamweaver, Zend, etc). http://www.phpfreaks.com/forums/index.php?topic=307438.0 This topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=351153.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=353875.0 This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=358122.0 Hi, Is it possible to make some kind of network/web traffic sniffer than can give you stats on how much p2p, mail etc etc traffic is going out your router? If so, does anyone know of any tutorials on the subject? My provider says that my display_errors is set to off ( in an email, also I have a new provider and I can't see how to get to php.ini yet) I always thought that if display_errors is set to off that when a php error would occur that the screen would go blank from that spot and beyound. However when I put in the wrong connect info by mistake I got Warning: require( PATH TO connect.php (I changed this)) [function.require]: failed to open stream: No such file or directory in /this directory (I changed this) on line 10 Should this stuff be showing with display_errors set to off ? Hi all, I have a tool currently in place that pulls information from one server and displays it. Currently in the setup, whenever the status of a chat has "Waiting". It's grouped with all other's as $num_waiting. The problem I am having is do to the server it pulls the information from, 1 session would equal 11 if there are 11 reps answering chats. The issue with divising by the number of active agents is on occasion the server reports more or less than the number of agents which in turn generates responses like 3.3333 and so on. And no the number with that status has never actually equaled to a single instance. As such you can see my dilemma here, I need to find a way of taking all sessions with that status and most likely cross-referencing another attribute such as $customername to prevent the doubles and finally provide only a single instance for each of these sessions. I am including the bulk of the current code below. Any help is much appreciated. Code: [Select] <?php $num_waiting = 0; foreach($loginParams as $login){ $soapclient = new soapclient("https://secure.logmeinrescue.com/API/API.asmx?WSDL"); $loginResult = $soapclient->login($login); if($login[sEmail] == "lmitnifron@telenetwork.com"){ } $hierparams = array(""=>""); $hierarchyResult = $soapclient->getHierarchy($hierparams); $hierarchy = $hierarchyResult->aHierarchy; $nodes = $hierarchy->HIERARCHY; $numberofnodes = count($nodes); $eNodeRef = "NODE"; echo "<table border =\"5\" cellspacing = \"5\">"; $totalsessioncount = 0; $numberoftechs = 0; for ($iNodes = 0; $iNodes < $numberofnodes; $iNodes += 1) { if($nodes[$iNodes]->eStatus == "Online" && $nodes[$iNodes]->eType == "Technician"){ if($nodes[$iNodes]->iParentID == 000000 || $nodes[$iNodes]->iParentID == 00000000){ print_r("<tr>"); $techname = $nodes[$iNodes]->sName; $emailaddress = findaddress($techname); echo '<td><a href="xmpp:' . $emailaddress . '?message&subject=chat">' . $techname .'</a><br /></td>'; $iNodeID = $nodes[$iNodes]->iNodeID; $sessionparams = array( 'iNodeID' => $iNodeID, 'eNodeRef' => $eNodeRef ); $sessionresult = $soapclient->getSession($sessionparams); $session = $sessionresult->aSessions; $sessionnodes = $session->SESSION; $numberofsessionnodes = count($sessionnodes); $totalsessioncount = $totalsessioncount + $numberofsessionnodes; $numberoftechs = $numberoftechs + 1; if($numberofsessionnodes >= 2) { for ($isessionNodes = 0; $isessionNodes < $numberofsessionnodes; $isessionNodes += 1) { $session_status = $sessionnodes[$isessionNodes]->sStatus; $session_customername = $sessionnodes[$isessionNodes]->sCustomField0; $isdouble = check_doubles($session_customername); if(!$isdouble && ($session_status != "Waiting")) { if(isset($session_status)){postsessioninfo($session_status, $session_customername);} }else{ $num_waiting++; } } } unset($session_customername); unset($session_starttime); print_r("</td>"); } } } print_r("</table>"); $soapclient->logout(); clear_table(); } $session_que = $num_waiting; echo "Sessions Waiting -- " . $session_que . "<br><br>"; ?> MOD EDIT: [code] . . . [/code] BBCode tags added. I am currently working on an application to schedule conferences. I have everything completed to create a conference including start time and duration. The problem I have now though is how do I monitor MySQL for the conferences that are created and perform actions when the duration of the conference is up? I was looking into MySQL events but those seem to be only internal events and are not able to execute anything outside of that. I was thinking about a infinite loop that queries MySQL and sleeps for one second but thought that this might be a lot of load on the server. Any thoughts I really appreciate it. could someone help in how to resize a uploaded image size, say if someone is uploading a 1mb photo to my server, i wish for it to become 100kb and also resize its width and height? here is my code Code: [Select] //////////////////////////////////////uploader else if($action=="uploader") { echo "Upload your picture and copy the link <br/>after uploading to user it at gallery.<br/><br/>"; echo "<form method=\"post\" enctype=\"multipart/form-data\" action=\"index.php?action=uploaded&sid=$sid\">"; echo "Choose Pictu <br />"; echo "<input name=\"uploaded\" type=\"file\" /><br /><br />"; echo "<input type=\"submit\" value=\"Upload\" />"; echo "</form><br/>"; echo "<p align=\"center\">"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; } //////////////////////////////////////uploader else if($action=="uploaded") { $blacklist = array(".php", ".php.jpg", ".php.jpeg", ".php.gif", ".php.png", ".phtml", ".php3", ".php4"); foreach ($blacklist as $item) { if(preg_match("/$item\$/i", $_FILES['uploaded']['name'])) { echo "<p align=\"center\">"; echo "Oops sorry we do not allow those files.<br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; exit; } } $target = "../images/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; if (file_exists("../images/" . $_FILES["uploaded"]["name"])) { echo "<p align=\"center\">"; echo $_FILES["file"]["name"] . "Oops file name already exists<br/> kindly rename your picture and upload again. <br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; }else{ //This is our size condition if ($uploaded_size > 25600){ echo "Your file is too large. We have a 25kb limit.<br/>"; $ok=0; } $types = array('image/jpeg', 'image/gif', 'image/png'); if (in_array($_FILES['uploaded']['type'], $types)) { // file is okay continue } else { $ok=0; } //Here we check that $ok was not set to 0 by an error if ($ok==0){ echo "<p align=\"center\">"; Echo "Sorry your file was not uploaded.<br/> It may be the wrong filetype. <br/>We only allow JPG, GIF, and PNG filetypes.<br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; } //If everything is ok we try to upload it else{ if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)){ echo "<p align=\"center\">"; echo "The file ". basename( $_FILES['uploadedfile']['name']). " Picture uploaded successfully.<br/><br/><b>$target <br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; } else{ echo "<p align=\"center\">"; echo "Sorry, there was a problem uploading your file.<br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; } } } } Hi there, In a string for a shopping cart I am storing both the item id and the item size selected in a number like this 12s1 where 12 is the id and 1 is the size. How can I separate these from one another again? I'm guessing it's to do with expand() ? Thanks, Jack I am able to get directory size of folder inside folders owned by me but I need to get folder size of a root owned folder. Is it possible to do this? Thanks in advance! i need help gettig the size of a directory Hello: Hoping someone can help me figure this out... I am resizing a photo/thumbnails with GD (I think that's the correct term) upon uploading. Works fine but the one thing I can't figure out is how to scale the height proportionate with the width. Meaning, I have the width set to 690px, and the height set to 500px. It is making the images look squished. What I would like to do is have a set width (like 690px), but have the height scale down proportionalety. Or, can I just remove the height (although I tried that and it did not work). This is the code: Code: [Select] // Let's get the Thumbnail size $size = GetImageSize( $images_dir."/".$filename ); if($size[0] > $size[1]) //{ //$thumbnail_width = 100; //$thumbnail_height = (int)(100 * $size[1] / $size[0]); //} //else //{ //$thumbnail_width = (int)(100 * $size[0] / $size[1]); //$thumbnail_height = 100; //} { //$thumbnail_width = 690; //$thumbnail_height = (int)(500 * $size[1] / $size[0]); $old_width = $size[0]; $old_height = $size[1]; $thumbnail_width = 690; $thumbnail_height = ($old_height * $thumbnail_width / $old_width); } else { $thumbnail_width = (int)(690 * $size[0] / $size[1]); $thumbnail_height = 500; } // Build Thumbnail with GD 1.x.x, you can use the other described methods too $function_suffix = $gd_function_suffix[$filetype]; $function_to_read = "ImageCreateFrom".$function_suffix; $function_to_write = "Image".$function_suffix; // Read the source file $source_handle = $function_to_read ( $images_dir."/".$filename ); if($source_handle) { // Let's create an blank image for the thumbnail //$destination_handle = ImageCreate ( $thumbnail_width, $thumbnail_height ); $destination_handle = imagecreatetruecolor( $thumbnail_width, $thumbnail_height ); // Now we resize it ImageCopyResized( $destination_handle, $source_handle, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $size[0], $size[1] ); } // Let's save the thumbnail $function_to_write( $destination_handle, $images_dir."/tb_".$filename ); ImageDestroy($destination_handle ); // $result_final .= "<img src='".$images_dir. "/tb_".$filename."' style='margin-right: 20px; width: 100px;' />"; Anyone have any ideas on this? Thanks much. Hello again How to convert size from taken from sql as the numbers and converted to MB in php? When you try and upload files using a size limiting feature, when you consider $_FILES['form_element']['size'] what actually is this measured in again? I seem to have forgotten what it's actually measured in, if I was to say a limit on $_FILES['myform_file_upload']['size'] < 20000, what does the 20000 actually mean? Any help is appreciated, Jeremy. Is there a way I can get the .jpg file in kilobytes from a remote url and check it to make sure it does not exceed 40 kilobytes before it saves the remote url into my database? |