Using waaay too much memory, on a very small script
Posted: Mon Jul 17, 2006 4:33 pm
I am working on an authorization script for use with one of my programs (In short, product keys). The page that verifies the code is erroring saying that it has exhausted all of the memory. It makes no sense because the amount of memory it's trying to use is smaller than the maxium.
3840 < 20971520, so why is the memory exhausted?
The entire functions.php script is:
Line 18 is:
It doesn't matter what value is passed to the $seed variable (Even if no value is passed), it still does it.
feyd | Please use
Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 3840 bytes) in /home/elitenet/public_html/echo/admin/functions.php on line 18
3840 < 20971520, so why is the memory exhausted?
The entire functions.php script is:
Code: Select all
<?php
session_start();
ini_set("memory_limit", "20M");
include('variables.php');
function logged_in() { //Check to see if the person is logged in
if (($session['user'] == ('' || null)) || ($session['pass'] == ('' || null))) {
$temp_var=false;
}
else {
$temp_var=true;
}
return $temp_var;
};
function generate_code($seed) {
$temp_var=ord($seed) * 1337;
$temp_var=$temp_var + strlen($seed);
$temp_var=$temp_var / (1337 / strlen($seed));
}
?>Code: Select all
$temp_var=$temp_var + strlen($seed);feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]