Jump to content

nonexistentera

Members
  • Posts

    45
  • Joined

  • Last visited

    Never

Everything posted by nonexistentera

  1. Alright this is kinda an odd thing, so I need some help. I have a table "quote" with the three columns `id`, `quote`, and `author`. Now I am wondering if there is anyway that I can output all the different values in the column `author`, and if a repeat is found, not to display it again. I know I can do this in a for loop, but I know there is a better way to do it. Always is. Any help or suggestions are always greatly appreciated. Thanks in advanced. --nonexistentera
  2. Perfect. Love it. Exactly what I needed. Thank you, --nonexistentera
  3. Hello, I am wondering if there is a service/script out there that can validate my entire website. I am wondering this because the entire site needs to be valid at all times. If not, is there anyway to create a script that can crawl the entire site and test each page. Thanks in advance for any advice. --nonexistentera
  4. While I was searching through one of my favorite sites, I came across something interesting. You can replace the ID with just about anything. http://www.ultimate-guitar.com/tabs.php?id=20238 There is a little thing that says [DB LOG] which shows the time, status, rows, and other things for each query. I am wondering if there is any actual script out there that does this, or is this just something I am going to need to make myself. --nonexistentera
  5. Well thank you for your suggestion. I did exactly as you said, and it still didn't work. After a few cups of coffee, and some holes in the wall, I finally found the issue. I have a function that deletes users that have not been confirmed after 24 hours, and this is added into my database connection function. I had the function in my global call file setting clean as true, which deleted the user once the file was called. This was my bad XD Thank you for your help, I have always liked this community Thanks -nonexistentera
  6. I have no idea how this happens. I have tried the SQL straight through phpMyAdmin and it works perfectly, but yet when I try it through the script, it deletes the row instead of just updating it. It is set into a function below function Confirm(){ global $HTTP_SERVER_VARS, $user_info; $id = $_GET["id"]; $md5 = $_GET["secret"]; if (!$id) httperr(); $res = mysql_query("SELECT passhash, editsecret, status FROM users WHERE id = $id"); $row = mysql_fetch_array($res); if (!$row) httperr(); if ($row["status"] != "pending") { header("Refresh: 0; url=/ok?type=confirmed"); exit(); } $sec = hash_pad($row["editsecret"]); if ($md5 != md5($sec)) httperr(); $updateSQL = "UPDATE `users` SET `status` = 'confirmed' WHERE `id` =".$id." LIMIT 1 "; mysql_query($updateSQL) or die(mysql_error()); logincookie($id, $row["passhash"]); header("Location: /ok?type=confirm"); } I have tried the $updateSQL and it returns no errors, but the mysql_query is deleting it. Any thoughts on why this would be doing this ???
  7. Is there a way to do this. Like if the original string was Great job. Amazing and went through nl2br to become Great job. <br /> Amazing is there anyway to revert back to the original formatting. I guess what Im asking is if there is a way to go from <br /> to \n and showing the string in it's original form of Great job. Amazing I was thinking of preg_match or something along the lines of that.
  8. Alright I have right now RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?action=$1 [L,QSA] so any call to /resource will result in index.php?action=resource I am wondering how I can do this in reverse to do a redirect from index.php?action=resource to /resource. It seems like the code below would work, but I haven't gotten anything RewriteRule ^index.php?action=(.+)$ ./$1 [R=302,NC] Any help would be much appreciated. Thanks -nonexistentera
  9. For some reason that slipped my mind. It's brilliant. After some time of working with mod_rewrite I finally have it running smoothly. Now for the php side. Thank you for giving me some extra common sense. oh BTW, Nice sig
  10. Well I mean like it will be ?action=browse let's say and there are categories, and sub categories, so ?action=browse&cat=3&subcat=2 So lets say 3 is Software, and the sub category is PHP. There would be Home>Browse>Software>PHP Then the user can go to the category software, or the browse section. I think I just saw what I needed, so I will see what I can think up.
  11. Hello. I have been searching around for something that could meet my needs, but as of which have not found anything. I have all my url's layed out as so index.php?action=requestedAction Which apache rewrites to /requestedAction I am not sure how I could create a breadcrumb trail for this, or where to really begin. Anyone knowledgeable on this :/ Thanks for anything in advance -nonexistentera
  12. Finally got it. You can close this topic I decided to use the requested URI, then this doesn't create an endless lood, as once it gets to the 'pretty' page, it stops $text = $_SERVER['REQUEST_URI']; if (preg_match("/\baction=\b/i", $text)) { header('Location: http://www.x00n.com/' . $_GET['action']); } else { }
  13. Well im guessing it is still being passed since the rewrite calls the same url, just in 'pretty' terms.
  14. Well the main problem that I am getting with that is a never-ending loop. index.php?action=resource is equal so it will redirect to /resource. But action is still equal to resource so it will redirect again, just continuing. Im not sure what to do but I am going to go over some modules that have worked and see what makes them tick. XD
  15. Alright Im not to sure if this is more of a rewrite issue or a PHP issue. I have seen this with different rewrite addons for SMF and other projects. I have RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?action=$1 [L,QSA] Now it works when I goto /resource as it shows index.php?action=resource. But I am wondering how to force anyone that goes to index.php?action=resource to be redirected to /resource. Im not sure if this can be accomplished with rewrite, but if so that would be awesome. Thanks in advance, -nonexistentera
  16. I have thought out how I can layout the database, but have no idea on how I can get it to work with php. The database is layed out using id's, the top of the levels are the 100's (100, 200, 300) and the sub level's are based throughout the ten's section (100, 110, 120). Then another level is added using the one's(101,102,103) corresponding to Good, bad, and alright for each of the sub-levels. ex Tree1(100) -Root1(110) --Good Root(111) --Bad Root(112) --Alright Root(113) -Root2(120) --Good Root(121) --Bad Root(122) --Alright Root(123) This is the best way I have been able to think of a good way to layout the categories. If there is a better way, I would be very grateful, as I have gone tooth and nail trying to find a way to get this to work. All comments happily accepted -nonexistentera
  17. Do you know what the slash2 is suppose to be. It looks like a function, which if so, could you post it. If it's a variable though you are missing the $ which could be causing you to have no rows, giving you your error.
  18. Whatever the $sql = "Your Statement"; is equal to.
  19. This is strange. What is your SQL for the comments mysql_result->$query->$sql
  20. the mysql_result() looking in row 0 which is giving you this error. Try changing it to $allowcomments = mysql_result($query, 1); And tell me what you get.
  21. @PFMaBiSmAd Good job you guessed it pretty well. And yeah I would be massive. I think I did pretty well though. I was at 20 million and only took up around 800mb's. And I do understand that it would be huge. Thats why I was wondering if I could just put it in a file. It could be in an Array or some nice and simple form. BTW I have unlimited space and bandwidth(within reason)
  22. Hey there. Im not sure, but I have used this before. http://forums.mysql.com/read.php?52,142673,200941#msg-200941 In your script, wherever you run the mysql_result(); try doing mysql_num_rows() before using mysql_result() and see if you get anything back. $sql = "Whatever"; $query = mysql_query($sql); $numRows = mysql_num_rows($query); echo $numRows; Try that and tell us whet you get. If it's 0, you have no records.
  23. Hello. I have the script listed below, which will insert all possible combinations of the listed symbols. <? ini_set("memory_limit","300M"); ini_set("max_execution_time","360"); function permutations($letters,$num){ $last = str_repeat($letters{0},$num); $result = array(); while($last != str_repeat(lastchar($letters),$num)){ $result[] = $last; $last = char_add($letters,$last,$num-1); } $result[] = $last; return $result; } function char_add($digits,$string,$char){ if($string{$char} <> lastchar($digits)){ $string{$char} = $digits{strpos($digits,$string{$char})+1}; return $string; }else{ $string = changeall($string,$digits{0},$char); return char_add($digits,$string,$char-1); } } function lastchar($string){ return $string{strlen($string)-1}; } function changeall($string,$char,$start = 0,$end = 0){ if($end == 0) $end = strlen($string)-1; for($i=$start;$i<=$end;$i++){ $string{$i} = $char; } return $string; } ?> All that will show below is the time it took for the script to execute. If the script never finishes(based on memory or execution time) then it will display an error <br /> <? $time = microtime(); $time = explode(" ", $time); $time = $time[1] + $time[0]; $start = $time; mysql_connect(TheUsual); mysql_select_db("DB"); $ts = 3; $tt = 4; $a = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*?"; while($ts < $tt){ $Array=permutations($a,$ts); for($i=0 ; $i < count($Array) ; $i++) { /* echo "$i." . $Array[$i] . "<BR>"; */ mysql_query("INSERT INTO `permutations` ( `id` , `anValue` ) VALUES ( NULL , '$Array[$i]') LIMIT 500 ") or die(mysql_error()); } $ts++; } $time = microtime(); $time = explode(" ", $time); $time = $time[1] + $time[0]; $finish = $time; $totaltim[code] e = ($finish - $start); printf ("Database Inserted in %f seconds.", $totaltime); ?> [/code] I have a problem once the length exceeds 5 characters in length. The output is so large, and takes so long, that it overdoes the CPU. I tried doing something like $a $b $c $d with each equaling 6-10 characters. Then I connect them together like $a.$b $a.$c $a.$d $b.$c $b.$d $c.$d But this would have multiple values for each length. such as AA for the first length, and AA for the next length. Is there any way to get all the possible values, without repeating, and without exceeding CPU. I completly stumped on this, even after thinking it over many times. Anyone have any ideas?? If so Im glad to hear as I don't know what else I could do.
×
×
  • 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.