PHP - Help With Sessionid And Download Limits
I don't know if this is the right sub forum, but here's the question anyway:
When you run a PHP board that's based on a PHP session ID for each user, is it possible to edit the php.ini or any other file to restrict the amount of simultaneous downloads for each user/session? I can see in PHP.ini that there are restrictions for uploads, but NOT downloads. I'm running a board with lots of attachments on it, and the users are taking too much bandwidth these days. And my PHP board doesn't support any download restrictions either. There's no plugins for this, so I was hoping for some guidance here. I thank you all in advance for any help! Similar TutorialsCan Anyone look at the String above and direct me to hwo would I go about gathering and collection only the AblumId and passing it for Hidden fields or url etc.. This is the code I am trying to use to get the information I need.Please help me. Code: [Select] function check_album_on($album_id){ if(!$album_id) return true; // everybody can add an album if is a registered /author user $db =& JFactory::getDBO(); $user =& JFactory::getUser(); $query = 'SELECT user_id, id, format_id, date FROM #__muscol_albums WHERE id = ' . $album_id ; $db->setQuery($query); $album_creator = $db->loadResult(); if($album_creator == $user->id) return true; else return false; echo ".$album_id" or echo } I'm having a problem with removing duplicates values in an array. seems like array_unique wont accept arrays bigger then 5084 also i tried $stargate_address_array= array_keys(array_flip($stargate_address_array)); $stargate_address_array= array_keys(array_count_values($stargate_address_array)); if i count the array before array_unique i get an array account of 600,000 but soon as it hits unique array its count is only 5084. anyone know how to get around this? function stargate_address_check() { $map_x = 200; $map_y = 200; $stars_per_sector = 15; $star_amount = $map_x * $map_y * $stars_per_sector; $stargate_address_array = ''; $create_address_array = 0; while ($create_address_array < $star_amount) { // creates a huge array of address's $new_address = stargate_address_generator(); $stargate_address_array[] = $new_address; ++$create_address_array; } // removes any duplicate address $stargate_address_arrays = array_unique($stargate_address_array); $count = count($stargate_address_arrays); return $count; } echo stargate_address_check(); the function im using to generate the values inside the array // creates a stargate address function stargate_address_generator() { $chevron1 = rand(1,38); $chevron2 = rand(1,38); while ($chevron1 == $chevron2) { $chevron2 = rand(1,38); } $chevron3 = rand(1,38); while ($chevron3 == $chevron1 || $chevron3 == $chevron2) { $chevron3 = rand(1,38); } $chevron4 = rand(1,38); while ($chevron4 == $chevron1 || $chevron4 == $chevron2 || $chevron4 == $chevron3) {$chevron4 = rand(1,38);} $chevron5 = rand(1,38); while ($chevron5 == $chevron1 || $chevron5 == $chevron2 || $chevron5 == $chevron3 || $chevron5 == $chevron4) {$chevron5 = rand(1,38); } $chevron6 = rand(1,38); while ($chevron6 == $chevron1 || $chevron6 == $chevron2 || $chevron6 == $chevron3 || $chevron6 == $chevron4 || $chevron6 == $chevron5) { $chevron6 = rand(1,38); } $stargate_address = "$chevron1-$chevron2-$chevron3-$chevron4-$chevron5-$chevron6"; return $stargate_address; } I have a D-Link DNS-323 running some sort of Linux (probably) with the EXT2 filesystem -- connected to Windows XP SP3 via ethernet.
Wikipedia says I can put a lot of files on the drive. But is there an actual limit?
On the (root?) top-level folder, I have a sum total of 997 files and folders. I am trying to put a few more files onto the volume, but an error is being reported that says there is insufficient space. The DNS Status panel says I have about 700GB of free space.
I am running the DNS's Scan Disk utility on on the volume now.
I moved a few hundred individual files into a folder, thus reducing the number of 'objects' to 790 on the (root?) top folder.
Still, the DNS reports I have insufficient space.
I moved the file to another drive letter on the Windows system just to make sure the source wasn't corrupted somehow, and that transferred fine. Then I tried to move it onto the DNS and it still said insufficient space.
I cannot give any info about how the EXT2 filesystem drive was formatted. Which is to say, if there is a configuration (such as block size) that would limit the total number of objects on the volume as a whole, I do not have that data.
Is it actually possible to have 700GB free on a 1.5TB drive formatted EXT2, and have 'insufficient space'?
Edited by bsmither, 06 November 2014 - 12:17 AM. Hi,
Im using Mysqli and im trying to limit the results by 10 and order them from last to first from the database.
$sqlhorses = "SELECT Place FROM `*` WHERE `Horse` ='".$db->real_escape_string($row['horse']). "'";the above works but when i added the limit 6 to the end it shows errors. Can anyone help? Hi. Right I'm trying to write a little script that selects one random image from a group and displays it on the page. Here is my code... $TheCat = $data['album_name']; $GetAPicy = "SELECT photo_name, album FROM photos WHERE album = '$TheCat' ORDER BY rand LIMIT 1"; $rGetAPicy = mysql_query($GetAPicy) or die(mysql_error()); $Picy = mysql_fetch_array($rGetAPicy); With this code I get the following error Unknown column 'rand' in 'order clause' Obviously I can see the error but I dont understand where they are supposed to be placed. Can anyone help? what I've done and since undone, because it wasn't working and cant show you because i use notepad. im trying to add values in arrays together it happens the wrong way tho instayed of adding the 2 arrays togeather it adds each value of the one array togeather like this =>27 [1] =>9 [2] =>9 [0] =>3 [1] =>1 [2] =>1 when what i really want is =>10 [1] =>10 [2] =>10 [0] =>1 [1] =>1 [2] =>1 (the ones are added to the nines) thank you for your time $i=1; $g=1; foreach($Mdarray as $MD1) { foreach($MD1 as $MD2) { $MD3[$g][$i] = explode("|" , $MD2); $i++; } $i=1; $g++; } print_r($MD3); print_r($MD3) returns (just alot of numbers nothing of real significant) Quote ( [1] => Array ( [1] => Array ( => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 ) [2] => Array ( => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 ) ) [2] => Array ( [1] => Array ( => 1 [1] => 1 [2] => 1 [3] => 1 [4] => 1 [5] => 1 [6] => 1 [7] => 1 [8] => 1 [9] => 1 [10] => 1 [11] => 1 [12] => 1 [13] => 1 ) [2] => Array ( => 1 [1] => 1 [2] => 1 [3] => 1 [4] => 1 [5] => 1 [6] => 1 [7] => 1 [8] => 1 [9] => 1 [10] => 1 [11] => 1 [12] => 1 [13] => 1 ) ) [3] => Array ( [1] => Array ( => 100 [1] => 100 [2] => 100 [3] => 100 [4] => 100 [5] => 100 [6] => 100 [7] => 100 [8] => 100 [9] => 100 [10] => 100 [11] => 100 [12] => 100 [13] => 100 ) [2] => Array ( => 100 [1] => 100 [2] => 100 [3] => 100 [4] => 100 [5] => 100 [6] => 100 [7] => 100 [8] => 100 [9] => 100 [10] => 100 [11] => 100 [12] => 100 [13] => 100 ) ) [4] => Array ( [1] => Array ( => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 ) [2] => Array ( => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 ) ) [5] => Array ( [1] => Array ( => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 ) [2] => Array ( => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 ) ) [6] => Array ( [1] => Array ( => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 ) [2] => Array ( => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 ) ) [7] => Array ( [1] => Array ( => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 ) [2] => Array ( => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 ) ) [8] => Array ( [1] => Array ( => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 ) [2] => Array ( => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 ) ) [9] => Array ( [1] => Array ( => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 ) [2] => Array ( => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 ) ) [10] => Array ( [1] => Array ( => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 ) [2] => Array ( => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 ) ) [11] => Array ( [1] => Array ( => 1 [1] => 1 [2] => 1 [3] => 1 [4] => 1 [5] => 1 [6] => 1 [7] => 1 [8] => 1 [9] => 1 [10] => 1 [11] => 1 [12] => 1 [13] => 1 ) [2] => Array ( => 9 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 ) ) ) My specific situation is SEOMoz, but this is a general question. I have a pretty extensive series of tools that rely on the SEOMoz api. They recently implemented 1 request per 10 seconds throttle limit. Is there a way I can run one request, stop for 10 seconds, and run the next, and so on? Anyway to get around something like this, without breaking their TOS? im trying to create withdraw page Code: [Select] <?php $query=mysql_query("SELECT * FROM users WHERE login='$data->login'")or die(mysql_error()); $row = mysql_fetch_array($query); $moneycount="5000"; $count=$row['coins']; if(isset($_POST['send'])) { if($_POST['name'] == ""){ $mesaj = "<div class=\"msg\"><div class=\"error\">". $lang['PLEASE_ENTER'] ."</div></div>"; }else if($_POST['email'] == ""){ $mesaj = "<div class=\"msg\"><div class=\"error\">". $lang['PLEASE_ENTER_YOUR_MAIL']."</div></div>"; }else if($_POST['message'] == ""){ $mesaj = "<div class=\"msg\"><div class=\"error\"> ".$lang['PLEASE_ENTER_YOUR_MESSAGE'] . "</div></div>"; }else if ($moneycount => $count ){ $mesaj = " not engout money"; }else{ $subject ="Withdraw"; $message="{$_POST['message']} BANK{$_POST['bank']} Likes{$_POST['likes']} "; $header="From: {$_POST['name']} <{$_POST['email']}>"; $to = $site->site_email; $send_contact=mail($to,$subject,$message,$header); if($send_contact);{ echo $sent = "<div class=\"msg\"><div class=\"success\">". $lang['WITHDRAW_REQUEST']."</div></div>"; }}} ?> evrithink is working fine the only promblem is i whant to add limit 5000 coins can sombady tell me what is wrong here and not working? $moneycount="5000"; $count=$row['coins']; else if ($moneycount => $count ){ $mesaj = " not engout money" I've think I actually pushed javascript to the limits where what I'm trying to do isn't even actually feasible. I'm using interactJS for drag and drop. Upon the drag event, I simply call a function to make 1x2 div's inside the inventory. (For places for the sword to be placed). The limitation is: Watch the last 2 seconds of this gif. It's impossible to have it be placed at position X1, Y1. Edit: This is the code to loop through all the boxes and show the green placeholder. itest = qsa('.iBoxes2'); itemtype = event.target.getAttribute('slot-size'); console.log(' Width: '+itemtype[0]+' | Height: '+itemtype[2]+' '); iwidth=(itemtype[0]*25.5); iheight=(itemtype[2]*24.5); console.log(iwidth); counter=0; for(i=0; i < itest.length; i++){ cslot = itest[i].getAttribute('data-slot'); if ( counter % 2 ==0 && cslot != 9 && cslot != 18 && cslot != 27 && cslot != 36 && cslot != 45 && cslot != 54 && cslot != 63) { itest[i].style.position='relative'; itest[i].style.display="inline-block"; itest[i].style.width=""+iwidth+"px"; itest[i].style.background='#D8FFDA'; itest[i].style.height=""+iheight+"px" } counter++; }qsa is function qsa(e){return document.querySelectorAll(e)} Edited by Monkuar, 25 January 2015 - 07:37 PM. My sql limits are not working. In "select * from state order by state limit 18,36", state is not limiting till 36 but goes till 54 and prints it completely.My sql statement seems to be right. Is there any problem with my php ? When i debug my $check = 36 but it should be 18 ($check is just the variable to show how many values it is printing). Can someone please point me my mistake ? Code: [Select] <table> <tr> <td> <?php $sql = "select * from state order by state limit 0,18"; $dat = mysql_query($sql); while($row = mysql_fetch_array($dat)) { $state=$row['state']; ?> <p><span> • </span> <a href="<?php echo $state; ?>-1.html"><strong><?php echo $state; ?></strong></a> <?php } ?> </p> </td> <td> <?php $sql = "select * from state order by state limit 18,36"; $check = 0; // used this to check $dat = mysql_query($sql); while($row = mysql_fetch_array($dat)) { $check++; // incrementing this value after each display $state=$row['state']; ?> <p><span> • </span> <a href="<?php echo $state; ?>-1.html"><strong><?php echo $state; ?></strong></a> <?php } ?> </td> </tr> </table> PHP 7.4.2 is given 256M as memory_limit. I am giving a 370MB file to md5_file(). I get a hash with no errors. Is PHP loading the entire file into memory, all at once, to process it? If so, is there then a practical limit to the size of the file without eventually causing an out-of-memory situation?
Basically I would like to place a link on my website and have the user download a file, but rather than just right clicking and choosing save target as, the link must be clicked, on the next page the file is fetched and then the client can download the file. How would I go about setting this up please? I have made a Php program that downloads an Inno setup installation file for installing a program. However, if I for one or another reason want to make a new download of the same Inno setup installation file, the previous file will still be found in the Download folder. Each of the downloads get a number in parenthesis, setup(1), setup(2), setup(3) etc. However, I wondered if it is posible to erase the previous file in the same process as I download a new one, so that however many downloads I do, there will all the time only be one occurence of this file in the Download folder. The download code is as follows: $exe = "Inno script/Test_setup.exe"; header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"Test_setup.exe\""); header("Content-Length: " . filesize($exe)); readfile($exe); Thanks in advance. Sincerely
Hello all. I am very new to PHP, and I am not sure where to look or what I'm looking for in my current assignment. My task is to take in two numbers between 0-100. Once I take in that number, it should state beside it "The __ was accepted." The program should not accept any numbers greater than 100 or any characters. Once I do this, I must take a second number and do a similar thing. Finally, I must have a statement show up at the bottom stating which number is greater. Essentially, I need help in determining what I should use to place parameters, and how I can keep the program from echo ing any statement until input has been taken and tested for parameters. Any help you can provide will be greatly appreciated! Hi,i will like to know how to put a file on my website for people to download..please how should i go about it? thanks merry christmass I have a small program that is to be used to export data from some MYSQL tables into an Excel spreadsheet. It does the export successfully, the first pass, but each subsequent download selection causes the browser to display the html code as text to the browser. If I disable the excel output, the page redraws successfully un subsequent requests. The header definition I have is ias follows: Code: [Select] $FileInfo = pathinfo(filename); // fix for IE catching or PHP bug issue header("Pragma: public"); header("Expires: 0"); // set expiration time header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); // browser must download file from server instead of cache // force download dialog header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-type: application/x-msexcel"); header("Content-Type: application/download"); // use the Content-Disposition header to supply a recommended filename and // force the browser to display the save dialog. if ($download_filename == "") $download_filename = "download.xlm"; header("Content-Disposition: attachment; filename=".$download_filename.";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($filename)); @readfile($filename); I did not setup this header, because to be honest, these things confuse the heck out of me. Can anyone see what may be wrong with this? Can you give me some suggestions? I can post more of the code if needed, but i believe that this is the area of interest for this issue. Thanks in advance. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=316412.0 I have the following code, but wish to allow admin members to download the short WMV video without having the page reload. My page can have anything to to 20 videos on the page. I can place a button there but how to I get the video files to download and not play when clicked. Code: [Select] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Admin</title> <link href="style2010.css" rel="stylesheet" type="text/css"> </head> <body style="width:1000px; width: 50%; margin-left: auto; margin-right: auto;"> <div style="width:1000px; padding-right: 3px; padding-left: 3px; height:100%; min-height: 500px;"> <div align="center"><h2>Admin</h2><br /></div> <div style="float: left; padding-left: 5px;"> <form name="delete" method="post" action=""> <div align="center" style="float: left; padding: 0 10px 50px 10px;"> <object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" id="MediaPlayer1" standby="Loading Windows Media Player components..." width="300" height="300"> <PARAM NAME="url" value="67.wmv" /> <param name="src" value="67.wmv" /> <param name="showcontrols" value="true" /> <param name="autostart" value="false" /> <!--[if !IE]>--> <object type="video/x-ms-wmv" data="67.wmv" width="300" height="300"> <param name="src" value="67.wmv" /> <param name="autostart" value="false" /> <param name="controller" value="true" /> </object> <!--<![endif]--> </object> <br />67.wmv<br />Delete above file? <input name="67---wmv" type="checkbox" value="delete"> </div> <br clear="all"/><input type="submit" name="Delete Selected" value="Delete Selected"> </form> <br /><br /> </div> </div> <br style="clear:both" /> </body> </html> I created this php class which recieves an sql query from flash and then produces a csv file for download. The code in its current form produces a csv file on the server. However, I want it to save on the client computer with a 'Save As' dialog box. I am testing on localhost. Here is the class: <?php class CSVExport { public function __construct() { require_once 'Zend/Date.php'; require_once 'DatabaseConnection.php'; } public function exportCSV($query) { $result = mysql_query($query); $fname = 'CSVFile.csv'; $headers = array(); $rowArray = array(); $numFields = mysql_num_fields($result); for ($i = 0; $i < $numFields; $i++) { $headers[] = mysql_field_name($result , $i); } $fp = fopen($fname, 'w'); if ($fp && $result) { header('Content-Type: application/csv'); header('Content-Disposition: inline; filename='.$fname); fputcsv($fp, $headers); while ($thisrow = mysql_fetch_row($result)) { fputcsv($fp, $thisrow); } readfile($fname); fclose($fp); } die; } } Thanks I've written the following code: Code: [Select] <?php echo '<img src="Sheph.png" />'; function Wad(){ if (file_exists("Sheph.png")) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename("Sheph.png")); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize("Sheph.png")); ob_clean(); flush(); readfile("Sheph.png"); exit; } } Wad(); ?> What I want to do is show the image AND show a file download window. The problem is that it shows the download window but the image doesn't appear. and if I comment the function and keep the echo part only,the image appears normally. What's wrong ? |