Jump to content

Jragon

Members
  • Posts

    148
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Jragon

  1. I have updated the code It sort of works, but on the seccond try it breaks errror: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1 and then in the database it say the id is 38 and the number of visits is allready 2???? code: <?php //finds out ip $ip = $_SERVER['REMOTE_ADDR']; //conects to the mysql server $connection = mysql_connect('localhost', 'root', ''); //sellects the database mysql_select_db('iplog', $connection); //looks for duplacute ips $dup = mysql_query("SELECT COUNT(ip_address) FROM logged_ips WHERE ip_address = '$ip'",$connection) or die(mysql_error()); $count = mysql_result($dup, 0); //checks to see if there is a duplecate name if ($count == 0){ //inserts the ip in to the database $string = "INSERT INTO `logged_ips` (`aid`, `ip_address`, `ip_visits`) VALUES ('', '$ip', '2')"; mysql_query($string, $connection) or die(mysql_error()); }else{ //adds a visit to the database $string2 = "UPDATE `logged_ips` SET `ip_visits` = '++1' WHERE `ip_address` = '$ip' LIMIT 0,1"; mysql_query($string2, $connection) or die(mysql_error()); } //outputs the ip echo $ip; ?>
  2. Good point, but still with the edit it just shows the ip and doent do anything
  3. Here is the dumps: -- phpMyAdmin SQL Dump -- version 3.2.4 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Nov 15, 2010 at 03:53 PM -- Server version: 5.1.41 -- PHP Version: 5.3.1 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `iplog` -- -- -------------------------------------------------------- -- -- Table structure for table `logged_ips` -- CREATE TABLE IF NOT EXISTS `logged_ips` ( `aid` int(11) NOT NULL AUTO_INCREMENT, `ip_address` varchar(68) NOT NULL, `ip_visits` int(11) NOT NULL, PRIMARY KEY (`aid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=38 ; -- -- Dumping data for table `logged_ips` -- /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  4. Thanks, i should of put some error checking stuff my new error: Unknown column 'number' in 'field list'
  5. hey guys, i need some help with my php/mysql iplogger. My code: <?php //finds out ip $ip = $_SERVER['REMOTE_ADDR']; //conects to the mysql server $connection = mysql_connect('localhost', 'root', ''); //sellects the database mysql_select_db('iplog', $connection); //looks for duplacute ips $dup = mysql_query("SELECT COUNT(number) FROM logged_ips WHERE ip_address = '$ip'",$connection); $count = mysql_result($dup, 0); //checks to see if there is a duplecate name if ($count == 0){ //inserts the ip in to the database $string = 'INSERT INTO `logged_ips` (`aid`, `ip_address`, `ip_visits`) VALUES (\'' . null . '\', \'' . $ip . '\', \'0\')'; mysql_query($string, $connection); }else{ //adds a visit to the database $string2 = "UPDATE `logged_ips` SET `ip_visits` = '++1' WHERE `ip_address` = $ip LIMIT 0,1"; mysql_query($string2, $connection); } //outputs the ip echo $ip; ?> error: Warning: mysql_result() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\randoms\logger\test.php on line 11 127.0.0.1 It also doesnt put anything in to the mysql database. Please help. Thanks jragon
  6. Hey guys, I am making a quotes siggy, code: <?php /** * @author Jragon * @copyright 2010 */ $textfile = "quotes.txt"; $quotes = array(); if (file_exists($textfile)) { $quotes = explode("\n", file_get_contents($textfile)); srand((float)microtime() * 10000000); $string = $quotes[array_rand($quotes)]; $string = wordwrap($string, 100, "\n", true); text_to_image($string, 800); } else { $string = "Sig file non-existant..."; } function text_to_image($text, $image_width, $colour = array(0, 244, 34), $background = array(0, 0, 0)) { $font = 5; $line_height = 15; $padding = 2; $text = wordwrap($text, ($image_width/10)); $lines = explode("\n", $text); $image = imagecreate($image_width, ((count($lines) * $line_height)) + ($padding * 2)); $background = imagecolorallocate($image, $background[48], $background[44], $background[44]); $colour = imagecolorallocate($image, $colour[0], $colour[1], $colour[2]); imagefill($image, 0, 0, $background); $i = $padding; foreach ($lines as $line) { imagestring($image, $font, $padding, $i, trim($line), $colour); $i += $line_height; } header("Content-type: image/jpeg"); imagejpeg($image); imagedestroy($image); exit; } ?> What i want it to do is have the lines the same legnth, and when a quote is smaller the image to shrink. Thanks jragon
  7. Hey guys, I have a problem with my quote thing, i have a few long quotes that i want to word wrap My code: <?php /** * @author Jragon * @copyright 2010 */ Header ("Content-type: image/gif"); $textfile = "quotes.txt"; $quotes = array(); if(file_exists($textfile)){ $quotes = explode("\n",file_get_contents($textfile)); srand ((float) microtime() * 10000000); $string = $quotes[array_rand($quotes)]; $string= wordwrap($string, 50, "\n", true); } else { $string = "Sig file non-existant..."; } $font = 3; $width = ImageFontWidth($font)* strlen($string); $height = ImageFontHeight($font); $im = ImageCreate($width,$height); $x=imagesx($im)-$width ; $y=imagesy($im)-$height; $background_color = imagecolorallocate ($im, 242, 242, 242); //white background $text_color = imagecolorallocate ($im, 0, 0,0);//black text $trans_color = $background_color;//transparent colour imagecolortransparent($im, $trans_color); imagestring ($im, $font, $x, $y, $string, $text_color); imagegif($im); ImageDestroy($im); ?> The where the line breake should be there is a strange symbol, also there is a symbol at the end of eatch line. Thanks Jragon
  8. I all ready did it gets to step one but no ferthere
  9. Thanks It still isnt working, i think its because of the swich statement.
  10. Thanks but it still dosent work my new code <form enctype="multipart/form-data" action="upload.php" method="POST"> Please choose a file: <input name="file" type="file" /><br /> <input type="hidden" name="sent" value="true"/> <input type="submit" value="Upload" /> <?php /** * @author Jragon * @copyright 2010 */ function stringrand() { for ($i = 0; $i < 6; $i++) { switch (rand(1, 3)) { case 1: $rand .= chr(rand(48, 57)); break; //0-9 case 2: $rand .= chr(rand(65, 90)); break; //A-Z case 3: $rand .= chr(rand(97, 122)); break; //a-z } } return $rand; } if (isset($_POST['sent'])) { echo "step1 <br />"; switch ($_FILES['file']['type']) { case 'image/jpeg': $type = 'image'; $ext = 'jpg'; break; case 'image/gif': $type = 'image'; $ext = 'gif'; break; case 'image/png': $type = 'image'; $ext = 'png'; break; case 'video/mp4': $type = 'video'; $type = 'mp4'; break; case 'application/x-shockwave-flash': $type = 'video'; $ext = 'flv'; break; case 'audio/mp3': $type = 'audio'; $ext = 'mp3'; break; default: $type = ''; break; } if ($type == 'video') { echo "step2 video <br />"; $name = basename($_FILES['uploaded']['name']); $target = $_SERVER['DOCUMENT_ROOT'] . "/projects/uploader/upload/$type/"; $target = $target . stringradnd() . ".$ext"; $worked = false; if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file " . $name . " has been uploaded"; $worked = true; } else { echo "Sorry, there was a problem uploading your file."; } } elseif ($type == 'audio') { echo "step2 audio <br />"; $name = basename($_FILES['uploaded']['name']); $target = $_SERVER['DOCUMENT_ROOT'] . "/projects/uploader/upload/$type/"; $target = $target . stringradnd() . ".$ext"; $worked = false; if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file " . $name . " has been uploaded"; $worked = true; $target = $target . "&plugins=revolt-1"; } else { echo "Sorry, there was a problem uploading your file."; } } elseif ($type == 'image') { echo "step2 images <br />"; $name = basename($_FILES['uploaded']['name']); $target = $_SERVER['DOCUMENT_ROOT'] . "/projects/uploader/upload/$type/"; $target = $target . stringradnd() . ".$ext"; $worked = false; if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file " . $name . " has been uploaded"; $worked = true; } else { echo "Sorry, there was a problem uploading your file."; } } elseif ($type == '') { $worked = false; echo "Sorry the only extensions you can use are: jpeg jpg gif png mp3 mp4 flv"; } if ($worked == true) { $target = $_SERVER['DOCUMENT_ROOT'] . "/projects/uploader"; echo <<< ENDHTML Well done it worked <script type='text/javascript' src='$target/flvplayer/swfobject.js'></script> <div id='mediaspace'>This text will be replaced</div> <script type='text/javascript'> var so = new SWFObject('/flvplayer/player.swf','mpl','470','320','9'); so.addParam('allowfullscreen','true'); so.addParam('allowscriptaccess','always'); so.addParam('wmode','opaque'); so.addVariable('file','/upload/{$name}'); so.write('mediaspace'); </script> ENDHTML; } } ?>
  11. Hey guys I've made a php uploader, <form enctype="multipart/form-data" action="upload.php" method="POST"> Please choose a file: <input name="uploaded" type="file" /><br /> <input type="hidden" name="sent"/> <input type="submit" value="Upload" /> <?php /** * @author Jragon * @copyright 2010 */ function stringrand() { for ($i = 0; $i < 6; $i++) { switch (rand(1, 3)) { case 1: $rand .= chr(rand(48, 57)); break; //0-9 case 2: $rand .= chr(rand(65, 90)); break; //A-Z case 3: $rand .= chr(rand(97, 122)); break; //a-z } } return $rand; } if (isset($_POST['sent'])) { switch ($_FILES['uploaded']['name']) { case 'image/jpeg': $type = 'image'; $ext = 'jpg'; break; case 'image/gif': $type = 'image'; $ext = 'gif'; break; case 'image/png': $type = 'image'; $ext = 'png'; break; case 'video/mp4': $type = 'video'; $type = 'mp4'; break; case 'application/x-shockwave-flash': $type = 'video'; $ext = 'flv'; break; case 'audio/mp3': $type = 'audio'; $ext = 'mp3'; break; default: $type = ''; break; } if ($type == 'video') { $name = basename($_FILES['uploaded']['name']); $target = "/upload/$type/"; $target = $target . stringradnd() . ".$ext"; $worked = false; if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file " . $name . " has been uploaded"; $worked = true; } else { echo "Sorry, there was a problem uploading your file."; } } elseif ($type == 'audio') { $name = basename($_FILES['uploaded']['name']); $target = "/upload/$type/"; $target = $target . stringradnd() . ".$ext"; $worked = false; if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file " . $name . " has been uploaded"; $worked = true; $target = $target . "&plugins=revolt-1"; } else { echo "Sorry, there was a problem uploading your file."; } } elseif ($type == 'image') { $name = basename($_FILES['uploaded']['name']); $target = "/upload/$type/"; $target = $target . stringradnd() . ".$ext"; $worked = false; if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file " . $name . " has been uploaded"; $worked = true; } else { echo "Sorry, there was a problem uploading your file."; } } elseif ($type == '') { $worked = false; echo "Sorry the only extensions you can use are: jpeg jpg gif png mp3 mp4 flv"; } if ($worked == true) { echo <<< ENDHTML <script type='text/javascript' src='/flvplayer/swfobject.js'></script> <div id='mediaspace'>This text will be replaced</div> <script type='text/javascript'> var so = new SWFObject('/flvplayer/player.swf','mpl','470','320','9'); so.addParam('allowfullscreen','true'); so.addParam('allowscriptaccess','always'); so.addParam('wmode','opaque'); so.addVariable('file','/upload/{$name}'); so.write('mediaspace'); </script> ENDHTML; } } ?> But its not working, it dosent upload the files Please help Jragon
  12. Hey guys. I was hoping that someone could tell me how i could make an auto update sort of thing. my php: for($i = $num; $i <= 100; $i++){ //lots more code here echo $i } But what i want it to do is echo $i once the code has finished then when it dose it agien it replaces $i with the new $i Thanks JRagon
  13. Hiya guys, I've never used 'Hiya' =] Well, I need a little help. I've got a permutation function that Mchl gave me: function permute($array,$positions,&$perms,$previous = null) { if($positions > 0) { if(!isset($previous)) { $previous = array(); } foreach($array as $element) { $tempPrevious = $previous; $tempPrevious[] = $element; permute($array,$positions-1,$perms,$tempPrevious); } } else { $perms[] = $previous; } } It works fine, but I need to take it to the next level (you might not call it permutation). What I need it to do: Use's all characters in ASCII thing start from 1 characters and goto 50 characters When it gets to Maximum execution time it remembers where it was and can be restarted and will start form there MD5 the output Add the md5 hash to a database with the origanal output Work So that is what I need it to do. If it is possible Please tell me how it can be done, if not then tell me how much of it is possible. Thanks Jragon
  14. Its now working =] but still the same error: Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\md5\mkdbw.php on line 7 Is there anyway to stop this? Thanks Rory
  15. MySQL sintax error: Problem with the query: INSERT INTO md5 VALUES ('3590cb8af0bbb9e78c343b52b93773c9', ''') You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''')' at line 1 I cant see anything worng with it.
  16. With the new one i get the error: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 24 bytes) in C:\xampp\htdocs\md5\mkdbw.php on line 4 But with the old one i manage to get 29,000 results If you want to download all my word lists go here: http://www.mediafire.com/?3i0y2e85o2thuk9 Thanks Jragon
  17. Hey, I'm getting an error: Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\test.php on line 11 My code: <?php $file = fopen ('C:\xampp\htdocs\GDict.txt', 'r'); $i = 0; while(!feof ($file)) { $load[$i] = fgets($file, 1024); mysql_connect("localhost","root",""); mysql_select_db("md5"); $word = $load[$i]; $md5 = md5($word); mysql_query("INSERT INTO md5 VALUES ('$md5', '$word');"); $i++; $limit = count($load); $width2 = $limit; } fclose($file); echo '[o] Loaded' . $limit . 'word. <br />'; echo '<br />Done.'; ?> I have tried changing the php.ini file. max_execution_time = 60 To max_execution_time = 30000000000000 But that still dosent work. Any help would be loved Thanks Jragon
  18. Is it possable to make a graph with php so that its sort of a line graph. saying how many times it has occerd like this graph: http://img840.imageshack.us/i/rest.png/ done the bottom there is the numbers and along the side is the ammount of times the number has occerd
  19. Hello, I was wondering how i could count how many times the number 1 appers in the document and 2, 3, 4, 5, 6, 7, 8, 9, 10. The text will have over 1000000 results set out like this: 2 10 1 4 2 7 5 3 8 10 1 7 7 2 1 9 3 3 7 3 1 5 2 1 4 7 7 9 10 2 5 8 10 9 8 3 2 2 9 6 8 8 8 2 5 1 9 3 5 9 3 4 6 7 5 6 9 2 3 6 2 once it has counted the charicters i want it to put it in to a table I have all redey made the table: <table border="1"> <tr> <th>1</th> <th>2</th> <th>3</th> <th>4</th> <th>5</th> <th>6</th> <th>7</th> <th>8</th> <th>9</th> <th>10</th> </tr> <tr> <td>number of numbers</td> <td>number of numbers</td> <td>number of numbers</td> <td>number of numbers</td> <td>number of numbers</td> <td>number of numbers</td> <td>number of numbers</td> <td>number of numbers</td> <td>number of numbers</td> <td>number of numbers</td> </tr> </table> I have looked at the count_chars function but the manule is ver confuzerling if anyone could explane how i could do this it would be great Thanks Jragon
  20. Its now giving me a new error with this function: function cryptc($code, $string, $type){ if($type == 'decrypt'){ if(getmd5($code) != false){ $string = $string; $code = $code; $replace = strget('abc', 'decrypt', $code); $find = strget(getmd5($code), ' ', $code); $result = strtr($string, $find, $replace); return $result; }else{ return 'Sorry your code dose not exist.'; } }else{ include("connect.php"); $find = strget('abc', 'encrypt', ' '); $replace = randstr(79); $md5 = md5($replace); $query = sprintf("INSERT INTO codes (code_id, md5_code, decipher_code, abc_code) VALUES('%s', '%s', '%s', '%s')", mysql_real_escape_string(''), mysql_real_escape_string($md5), mysql_real_escape_string($replace), mysql_real_escape_string($find)); mysql_query($query); $result = strtr($string, $find, $replace); return 'Here is your result:<br />' . $result . '<br />Here is you code to decrypt it:<br />' . $md5; } } Heres my error: Warning: strtr() expects parameter 3 to be string, array given in C:\xampp\htdocs\makecode\includes\inlude.php on line 36 also heres my strget function: function strget($option, $option2, $code){ if($option == 'abc'){ if($option2 == 'encrypt'){ $string = str_shuffle('q1w2e3r4t5y6u7i8o9p0a-s=d!f"g£h\$j/k<lzxc\>vb`n¬m¦QWERTYUIOPASDFGHJKLZXCVBNM ,.'); return $string; }else{ $query = sprintf("SELECT abc_code FROM codes WHERE md5_code = '%s'", mysql_real_escape_string($code)); $numrows = mysql_num_rows(mysql_query($query)); $result = mysql_query($query); if($numrows == 1){ return mysql_fetch_assoc($result); }else{ return die('Sorry that code dose not exist'); } } }else{ $string = $option; return $string; } }
  21. Hey guys, my function is not working: function getmd5($code){ include("connect.php"); $code = $code; $query = sprintf("SELECT decipher_code FROM codes WHERE md5_code = '%s'", mysql_real_escape_string($code)); $numrows = mysql_num_rows(mysql_query($query)); $result = mysql_query($query); if($numrows = 1){ while(mysql_fetch_assoc($result)){ return $row['decipher_code']; } }else{ return false; } } For some reason its not returning anything here are the mysql dumps: -- phpMyAdmin SQL Dump -- version 3.2.4 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jul 25, 2010 at 08:02 AM -- Server version: 5.1.41 -- PHP Version: 5.3.1 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `decipher` -- -- -------------------------------------------------------- -- -- Table structure for table `codes` -- CREATE TABLE IF NOT EXISTS `codes` ( `code_id` int(11) NOT NULL AUTO_INCREMENT, `md5_code` varchar(32) NOT NULL, `decipher_code` varchar(200) NOT NULL, PRIMARY KEY (`code_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=15 ; -- -- Dumping data for table `codes` -- INSERT INTO `codes` (`code_id`, `md5_code`, `decipher_code`) VALUES (1, 'dc639d6429d2b9bf1eb47fb241c2dbe5', '²y;#"Rz«–é*¿-þdÕ§…8îo°àͦvæÏòÄýCWÅP)·ÇGh?»+$ÜÛT¡^6Øô2AV'), (2, '146af588a5ef0bc04a53870b474fa85a', 'VgéÄ,êR@–Óe¢D¤¿×¥jBã Yá¼füÒ\\àq¹3™€¨°èZAùô<ÃS~*¦¦kä|+ÏEñ'), (3, 'b197cfa5068c629bcc9e39abb8802a29', '«~$÷\\QÌ°·¨¬ó½ýµßÍãy³®¶r±{©Éçü)§\\xìñk\\¥`ò,w=iSÆP*h©DoÞ…F'), (4, '384bb45c3cce0a8256b62c88476db549', '%RÑ-)¦¤ðÐ#×ãLçlNèý7Iµ¿UÌFÕà÷å&£ó?߯ÿ¶0,3XÇÚíDÎkQ2˜[þ ȸ'), (5, '532e3fe9997a27ca8917a7240bb2dfa7', '¨Ø±¦1IÿM£¶,í÷v͸ü#Q¤N¥€hfå(´B[rÌ ñlWA2µ?\\Üdû@óÄi=Ãéß'), (6, 'dd180ec755d4f07bedd2e3d6558e122d', 'k¤Ò>ù$ÔÌÇV´Ö¢°2`óØG«{]ë®lO݈"ÐÁu—R–Í|QYÜSÿÓ©¹7øN…ª(xúdi'), (7, '61f4618bf4af0b1b00e7c091c22060bc', 'Ömü©èO¼Úìô:©øÑ«ÏçBíd*öy¬é?;T¥JûÅ2ÍSÝX=–5na0vÔ.R¸È@ªKÞ˜Ü'), (8, 'cf178ef5c5dbfe85e6ac078b206e1c28', 'öpu>DÊîlØG9e–íñ)tÙªMÚF3 $y#\\ˆ×ç «n®[*`ü¾Ü8³Âd}Em€úƶ¼ð´'), (9, '39afd367b1603a8c46e84af25b64216d', '¼Ì¤5ÜÇÉQBO|\\¾æÂðH¦1ìßµn)¦iRù}—׿ÃJ3&%°è€^ø÷ä»ö6î2[4ësFÙ'), (10, 'e59807215ca555a0078c6242d7c0a216', '<V¸¼ì|?å˜b,@íÎ~¾¦û)Eã½fÃ+ó¹KiÔ¦ä¥ù§µïð={_1w¨jz°N#±%Læ2Ì'), (11, '231d3ad7add92ebe4ac9231b72d47dbc', ';åÁöHªwâa®Î ÚóÖñ]£Õä¯Ã2}k^PëõÏsØF4ûÆé3bGz+|xìÈð©¤{=n¼¢u'), (12, '156077e5e43012400da2fbccdca6ce00', 'd,1Kêg8¼EíÁ÷u¬l¡}ÌÒa`î=WQA2RsµG˜àÖ*£ýqP-Ç9ÉTÄc´CnjYìÚëØ'), (13, '46d468c2af0af93a979938f7d0f04af9', '&¿<ª7²4ÐèĵËJìSåÚLeUÝÒoÃdá´çúÊ:N_Ìm·lø>VÇÜnfíô€ü+#ëW}û¦'), (14, 'e7a10f40712dc3f9c96c9143aaa45b19', ' 4;ß*îK¯¸ÎhÝ·"7~À]Uü.Ñf嬡´¿ÐÈÆd¢a˜3ÔíÕ±ñú™Á&^w¦v÷G6àÙp'); Thanks Jragon
  22. I see that it would be usefull. but i'm want to do it my way so i was wondering if anyone knew how i could fix my errors
×
×
  • 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.