Jump to content

nuxy

Members
  • Posts

    97
  • Joined

  • Last visited

    Never

Everything posted by nuxy

  1. I have a problem with the function set_exception_handler. I can't seem to get it to work with it calling a function within a class. set_exception_handler($en->handle_error); When I try it that way, it reads the "error_handler" as a variable. Notice: Undefined property: engine::$handle_error in index.php on line 19 set_exception_handler($en->handle_error()); When I try it that way, it reads as a function, but doesn't pass any variables to the function. Warning: Missing argument 1 for engine::handle_error(), called in index.php on line 19 and defined in classes\engine.php on line 279 Warning: Missing argument 2 for engine::handle_error(), called in index.php on line 19 and defined in classes\engine.php on line 279 Warning: Missing argument 3 for engine::handle_error(), called in index.php on line 19 and defined in classes\engine.php on line 279 Warning: Missing argument 4 for engine::handle_error(), called in index.php on line 19 and defined in classes\engine.php on line 279 I have tried with just making a function in the "index.php" script, but it doesn't display anything then. function handle_error($a, $b, $c, $d) { global $en; $en->handle_error($a, $b, $c, $d); return; } set_exception_handler('handle_error'); Does anyone have an idea how I could fix this problem?
  2. I got my script working, it is actaully very precise now. Thanks everyone..
  3. That is my problem, i'm already checking the hashes against a database. But anyways, I've been working on it, founda partial solution. function auto() { global $mysql; $chars = '1234567890abcdefghijklmnopqrstuvwxyz'; echo 'Loading Config: '; $datafeed = file_get_contents('stats.ini'); $datafile['new'] = split("\n", $datafeed); foreach($datafile['new'] as $varline) { $vars = split(' = ', $varline); $var[$vars[0]] = $vars[1]; } $pre[0] = $var['next[0]']; $pre[1] = $var['next[1]']; $pre[2] = $var['next[2]']; $pre[3] = $var['next[3]']; $pre[4] = $var['next[4]']; $pre[5] = $var['next[5]']; $pre[6] = $var['next[6]']; echo 'Loaded<br><pre>'; print_r($pre); echo '</pre><br><br>'; for($next[0]=$pre[0];$next[0]<=(strlen($chars)-1);$next[0]++) { for($next[1]=$pre[1];$next[1]<=(strlen($chars)-1);$next[1]++) { for($next[2]=$pre[2];$next[2]<=(strlen($chars)-1);$next[2]++) { for($next[3]=$pre[3];$next[3]<=(strlen($chars)-1);$next[3]++) { for($next[4]=$pre[4];$next[4]<=(strlen($chars)-1);$next[4]++) { for($next[5]=$pre[5];$next[5]<=(strlen($chars)-1);$next[5]++) { $fp = fopen('stats.ini', 'w'); $datafeed = file_get_contents('stats.ini'); $datafile['new'] = split("\n", $datafeed); foreach($datafile['new'] as $varline) { $vars = split(' = ', $varline); $var[$vars[0]] = $vars[1]; } $var['next[0]'] = (empty($var['next[0]'])) ? 0 : $var['next[0]']; $var['next[1]'] = (empty($var['next[1]'])) ? 0 : $var['next[1]']; $var['next[2]'] = (empty($var['next[2]'])) ? 0 : $var['next[2]']; $var['next[3]'] = (empty($var['next[3]'])) ? 0 : $var['next[3]']; $var['next[4]'] = (empty($var['next[4]'])) ? 0 : $var['next[4]']; $var['next[5]'] = (empty($var['next[5]'])) ? 0 : $var['next[5]']; $var['next[6]'] = (empty($var['next[6]'])) ? 0 : $var['next[6]']; foreach($var as $key => $vl) fputs($fp, $key . " = " . $vl . "\n"); fclose($fp); for($next[6]=$pre[6];$next[6]<=(strlen($chars)-1);$next[6]++) { $string = ''; if ($next[0]) $string .= $chars[$next[0]]; if ($next[1]) $string .= $chars[$next[1]]; if ($next[2]) $string .= $chars[$next[2]]; if ($next[3]) $string .= $chars[$next[3]]; if ($next[4]) $string .= $chars[$next[4]]; if ($next[5]) $string .= $chars[$next[5]]; if ($next[6]) $string .= $chars[$next[6]]; // not relevant to the topic } } } } } } } } Still debugging, so I'm still open to ideas..
  4. Well, I've made a script that makes random words(letter sequences), but my here is my problem. It's not really a problem, just a feature I want to enhance. The script will make millions/billions of letter sequences, but that takes a long time. What I want to do is to be able to stop the script, and then continue it at a later point, from that original point I stopped it. Say it came to the letter sequence "as1s" and then I stop it, the next time it should go on from "as1s" and make "as1t" and so forth. Here is my current script, a bit messy, but should be doable. function auto() { global $mysql; echo 'Beginning to add hashes..<br><form method="post" action="?auto"> <input type="submit" value="Show No Output" name="blah"></form><br><br>'; $chars = '1234567890abcdefghijklmnopqrstuvwxyz'; for($next[0]=0;$next[0]<=(strlen($chars)-1);$next[0]++) { for($next[1]=0;$next[1]<=(strlen($chars)-1);$next[1]++) { for($next[2]=0;$next[2]<=(strlen($chars)-1);$next[2]++) { for($next[3]=0;$next[3]<=(strlen($chars)-1);$next[3]++) { for($next[4]=0;$next[4]<=(strlen($chars)-1);$next[4]++) { for($next[5]=0;$next[5]<=(strlen($chars)-1);$next[5]++) { for($next[6]=0;$next[6]<=(strlen($chars)-1);$next[6]++) { $string = ''; if ($next[0]) $string .= $chars[$next[0]]; if ($next[1]) $string .= $chars[$next[1]]; if ($next[2]) $string .= $chars[$next[2]]; if ($next[3]) $string .= $chars[$next[3]]; if ($next[4]) $string .= $chars[$next[4]]; if ($next[5]) $string .= $chars[$next[5]]; if ($next[6]) $string .= $chars[$next[6]]; // otehr processing stuff not rellative here.. } } } } } } } } Also, if anyone knows how to optimize, well, not really optimize, but another way to do this aswell, I would appreciate it. Anyone have an idea how I can make this feature? Thank you in advance...
  5. Hello there, I'm currently creating a page, that is using mainly CSS2. I'll explain what I want to do, The desigh has two pictures at either sides of it, left and right. The main table, that is in the middle is has the width of 70 percent, and then the other two sides has 15 percent each. My current layout uses a table, as this example. table -> tr -> td <> td <- td <> td -> td <> td <- tr <- table I'm usingthe background property to lay an image, that is bassically transparent with an shaddow effect for the main table. So far everything has gone well, but now, the background images seems to be under the actual image. This really kind of cufuzes me. There is also the matter of the one background image(left) does not want to align prroperly(0% 100%/top right). here is an image of it. Here is the code, it is in php, for certain purposes. <?php function header_a1() { ?> <style type="text/css"> body { background-color: #FFFFFF; color: #333333; margin: 0px 0px 0px 0px; } td.main_bdy { background-color: #e6e6e6; vertical-align: top; text-align: left; padding: 10px; font-family: tahoma; font-size: 11px; font-color: #333; } table { border-spacing: 0px; } td { padding: 0px; } td.sld_l { background-image: url('images/sld_l.png'); bacground-position: 0% 100%; background-repeat: repeat-y; width: 15%; text-align: right; vertical-align: top; } td.sld_r { background-image: url('images/sld_r.png'); bacground-position: 0% 0%; background-repeat: repeat-y; width: 15%; text-align: left; vertical-align: top; } </style> <table style="width: 100%;height: 100%"> <tr> <td class="sld_l"> <img src=""> </td> <td style="width: 70%" class="main_bdy"> <?php return 0; } function ending_a1() { echo '</td> <td class="sld_r"> <img src=""> </td> </tr> </table>'; return 0; } What can I do to correct this? Thanks.
  6. The element "this" is predefined. It refers to the current element.
  7. The disapearing act: <script> function hide(id) { obj = document.getElementById(id); obj.style.display = "none"; } </script> <a onclick="javascript:hide('content')">-</a> <div id="content"><input type="text"></div> If you actually want do do somethign with the text that the user inputs, eg. send to a php to get a result, then it is ajax. But I think I missed your point completeley.
  8. Does the file "database.sql" exist in the directory? IF not, make test file with that name, or change the name of the current file.
  9. This is HTML, but use the onChange Event. <table border =0 bgcolor=orange width=100%> <tr> <td> <select name="language" onChange="document.location = this.value + '.php'"> <option value="english">English</option> <option value="chinese">Chinese</option> </select> </td> </tr> </table>
  10. The mysql_query() functin returns false if the query is not executed, or there occured an error. Use an if statement. <?php if (false == ($var = @mysql_query("COMMIT"))) { // error.. echo 'There was an error: ' . mysql_error() . '.'; } else { //success echo 'Success: ' . $var . '.'; }
  11. Lazy way: Add ob_start(). You are most probably including this script somewhere, you need to remove "all" data echo/prinited becausea header is sent.
  12. Try removing the quotes.. <?php $connection = mysql_connect('localhost','MYUSERNAME','MYPASSWORD'); if (!empty($connection)) { mysql_query("CREATE DATABASE `database`"); mysql_query("USE `database`"); $file = file_get_contents('database.sql'); $array = split(';', $file); foreach($array as $line) { if (!empty(mysql_query($line)) echo 'Executed: ' . $line . '<br>'; else echo '<b>Failed: ' . $line . '</b><br>'; } } else echo 'Could not connect to database'; ?>
  13. Try to see if it isn't disabled. <?php echo 'Function is ' . ((function_exists('exec')) ? 'enabled' : 'disabled') . '.'; ?>
  14. PHP has some nifty functions for mysql. One of them is mysql_createdb, this should come in handly. I would however, suggest you use the mysql_query to make a database, it will give you much more controll over the process. Executing a SQL file to the database should be relativley easy, you just need to make an array of the file and loop trough it. <?php $connection = mysql_connect('host','user','passwd'); if (!empty($connection)) { mysql_query("CREATE DATABASE `db`"); mysql_query("USE `db`"); $file = file_get_contents('db.sql'); $array = split(';', $file); foreach($array as $line) { if (!empty(mysql_query("$line")) echo 'Executed: ' . $line . '<br>'; else echo '<b>Failed: ' . $line . '</b><br>'; } } else echo 'Could not connect to database'; ?> Edit: just make sure you set the right mysql delimiter.. just to give you an idea.
  15. It depends on what your intentions are. If it is to get a high click rate, and fast money: Placing an advertisement at the top of the page, will give maximum exposure, thus resulting in more profit. The cons if this would most properbly that advertisements at the top of the page is sort of anoying, depending on the colour scheme of the advertisement. If you want to provide a service, and still make some amount of profit: If advertisements are at the bottom of the page, it will most likley not be noticed as much. It would not receive any good amount of click rate, and profit won't be good, unless; If you are with a advertising service that pays for say 10000 impressions, then this could also make a good deal of money. This technique is used by major website such as Youtube, myspace and similar websites. The only cons of this is that if you are with an advertising service that works on CPC, you will not be making very much money. You could also, to get maximum exposure, place advertisements on the top and bottom of the page. This might be very anoying, but it will get you a great amount of money.
  16. Programming has been here for a very long time. It's a way we talk to computers, and the way we make mistakes, leading the mindless things we call computers to execute something totally different than what we want. A little bracket here, in a 700+ line script.. A little typo there.. All these small things leeds to us hating certain things of programming. Like in C++, pointers, round-off of integers. Also the amount of money you spend to learn new technologies.. Most things are the same in any programming language. What would you think is the most .. annoying things cross-programming languages. I personally think it is operators, pointing to the one way in a script can lead to something that is very, very hard to debug.
  17. I forgot to give my current script. $chars = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','0','-'); $num = 0; while(strlen($string) != count($chars)) { $string .= $chars[$num]; $num++; echo $string . '<br>'; } It works, but only for one sequence of "a", and also not with numbers within the words. Example: a ab abc abcd abcde abcdef abcdefg abcdefgh abcdefghi abcdefghij abcdefghijk abcdefghijkl abcdefghijklm abcdefghijklmn abcdefghijklmno abcdefghijklmnop abcdefghijklmnopq abcdefghijklmnopqr abcdefghijklmnopqrs abcdefghijklmnopqrst abcdefghijklmnopqrstu abcdefghijklmnopqrstuv abcdefghijklmnopqrstuvw abcdefghijklmnopqrstuvwx abcdefghijklmnopqrstuvwxy abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz0 abcdefghijklmnopqrstuvwxyz01 abcdefghijklmnopqrstuvwxyz012 abcdefghijklmnopqrstuvwxyz0123 abcdefghijklmnopqrstuvwxyz01234 abcdefghijklmnopqrstuvwxyz012345 abcdefghijklmnopqrstuvwxyz0123456 abcdefghijklmnopqrstuvwxyz01234567 abcdefghijklmnopqrstuvwxyz012345678 abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz01234567890 abcdefghijklmnopqrstuvwxyz01234567890-
  18. Hello, I'm trying to generate a listing of just random letters. I don't quite know how to explain this but, the output should be like this. a b .. z ab .. az ba .. bz .. zzzzzzzzzzzz Now here comes the second part. I would like to include numbers within the random letters, and a hypon. I'm trying to make this for a script that will list domain names. Examples: d0main 3xample google .. Because the internet won't allow me to simply list all the domain names there is(only com, net, org), I'll have to do this. So var I can only make weird unidentified figures. Can anyone assist me with this?
  19. Try enclosing the variables with single quotes. $query = "SELECT * FROM table WHERE column1 = '$var1' AND column2 = '$var2'"; $result = mysql_query($query) or die ("Couldn't execute query"); Edit: Yes it will, it's just as easy to see the post data as it is to see the get data.
  20. nuxy

    GD Graph

    I figured that, that is why I pass the values trough the tra function. function tra($num) { $result = 200 - $num; if ($result < 0) $result = 0; return $result; } Thanks!
  21. nuxy

    GD Graph

    I'm creating an graph, rather simple to display cpu usage of the server the script runs on. It is all going well, except for the fact that the graph appears to be more random that what I made it to be. What I want to accomplish is simply showing a graph that would display the last 50 known percentages that was logged to a text file, but for some reason it is reading either a null or just making percentages up. It will draw a line upwards when the percentage goes lower, and at random times. I already found a script that reads the cpu usage, and I know for a fact it work, just because the percentage isn't random on the text I made in the upper left corner of the graph. The script has been cut down to the part where the graph gets generated. <?php $load = round(get_server_load(true), 0); $fp = fopen('cpustats.txt', 'a'); fputs($fp, ':' . $load); fclose($fp); $data = explode(':', strrev(file_get_contents('cpustats.txt')), 50); $data[50] = explode(':', 2); $data[50] = $data[50][0]; $im = imagecreate(500, 200); $white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF); $gray = imagecolorallocate($im, 0xDD, 0x00, 0x00); $black = imagecolorallocate($im, 0x00, 0x00, 0x00); $whay = imagecolorallocate($im, 0xEE, 0xEE, 0xEE); $dark = imagecolorallocate($im, 0xBB, 0x00, 0x00); imagefill($im, 0, 0, $white); imageline($im, 50, 0, 50, 200, $whay); imageline($im, 100, 0, 100, 200, $whay); imageline($im, 150, 0, 150, 200, $whay); imageline($im, 200, 0, 200, 200, $whay); imageline($im, 250, 0, 250, 200, $whay); imageline($im, 300, 0, 300, 200, $whay); imageline($im, 350, 0, 350, 200, $whay); imageline($im, 400, 0, 400, 200, $whay); imageline($im, 450, 0, 450, 200, $whay); imageline($im, 0, 50, 500, 50, $whay); imageline($im, 0, 100, 500, 100, $whay); imageline($im, 0, 150, 500, 150, $whay); $c = 0; $t = 0; for ($i = 0; $i <= 50; $i++) { $c += 10; $point = $data[$i] * 2; $l = tra($point); imageline($im, $c - 10, tra($t), $c, $l, $dark); $t = $point; } imagealphablending($im, $true); $trans = imagecolorallocatealpha($im, 0x33, 0x33, 0x33, 90); imagestring($im, 3, 5, 3, $load . '%', $trans); imagepng($im); exit; ?> Thanks.
  22. Try putting brackets over the other statements. SELECT * FROM table WHERE (action=1 AND scope=4) OR (type=4 AND action=2 AND scope=4) OR (type=6 AND action=3) GROUP BY ...";
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.