Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. Those earlier rules may be interfering with the later rule. Anything which doesn't exist as a file or directory is getting rewritten to ./index.php by the WordPress rules. You can try putting your rules first: RewriteEngine On RewriteRule ^\/(.*)\/(.*)\/.*$ user/index.php?p=$1 # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress RewriteCond %{HTTP_HOST} ^ryanweekly.ryanweekly.com$ [OR] RewriteCond %{HTTP_HOST} ^www.ryanweekly.ryanweekly.com$ I have no idea if that will work as rewrite rules can be quite arcane, but it's worth a try.
  2. Did it work? You might also need to switch on the rewrite engine with this line, before the rewrite rule: RewriteEngine On
  3. That sounds pretty good to me gizmola. Who would want the store to run out of pokeballs? There's nothing worse than encountering a rare pokemon and finding you've got no pokeballs left
  4. This query may be failing: $doUserquery = mysql_query("UPDATE `users` SET gold=".$newGold." , ".implode(' , ',$queryUser)." WHERE id = $user->id LIMIT 1"); Try changing it to this: $doUserquery = mysql_query("UPDATE `users` SET gold=".$newGold." , ".implode(' , ',$queryUser)." WHERE id = $user->id LIMIT 1") or die("Query to update user's gold failed:" . mysql_error());
  5. You're welcome Good luck with your coding! BTW I just noticed I used $password_correct > 0 and $password_correct == 1 in the code I posted. I should have used the same condition both times, that was a mistake. I don't want you to think there's any special reason for that, it's just me not being careful
  6. That code is a bit of a mess. Try this: <?php //Database Information $dbhost = "localhost"; $dbname = "islewar"; $dbuser = "islewar"; $dbpass = "***"; //Connect to database mysql_connect ($dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); session_start(); $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string(md5($_POST['password'])); # Is the user's password correct? $query = "select * from users where username='$username' and password='$password'"; $result = mysql_query($query); $password_correct = mysql_num_rows($result); # Is this user banned? $banquery = mysql_query("select * from bans where username='$username'"); $ban_exist = mysql_num_rows($banquery); if ($ban_exist > 0 && $password_correct > 0){ include 'userban.html'; } elseif ($ban_exist == 0 && $password_correct == 1) { $_SESSION['username'] = "$username"; include "members.php"; } else { include 'loginfail.php'; } ?> I've re-ordered the if/then/else because I don't feel comfortable about having "log the user in" as the default case. With mysql queries you need to have a clear idea of where the data goes. First there is a query, then a query result (from mysql_query()), and then data derived from the query result like the number of rows and the values in the rows. In your original code the query result from the "ban" query was not being stored in a variable.
  7. PHP is telling you that $customer_id was used already in the same script, and was set to a string. You should be fine if you use another name for the array. I like names such as $customer_id_arr, which tells me it's an array.
  8. It sounds to me like you need to store that data in $_SESSION. You may be able to store the class instance in $_SESSION, but make sure the class is defined when session data is read in (ie session_start() must occur after classes are defined, unless you are autoloading class definitions). Just to confirm, you are storing the data from a script called from jQuery, then you want to access the data in a php script called from elsewhere?
  9. By "Run the query" do you mean you can run it in PHP and display the results, or you can run it in an administration program like phpmyadmin?
  10. Try "while($i < 11)" instead of "if($i < 11)"
  11. That's very unusual. move_uploaded_file() works even on images and zip files, so it normally doesn't do any processing. Have you tried a script which does move_uploaded_file() only and nothing else, and checked if that alone is removing the quotes?
  12. Try selecting count(distinct product_id). Alternatively you can put your original query in a subquery and wrap "SELECT COUNT(*) FROM ( ... )" around it.
  13. Can you please post the code you have now?
  14. Please tell me that the name field can't have numbers in it.. otherwise it's tricky. You might want to make a second post in the regexp sub-forum asking specifically about a regexp to parse this. I would not consider that to be double posting as you're asking a different question. Also the name for #4 appears to be missing altogether, further complicating things. Does that data go through any earlier processing phases which might have a more structured format? This code works for all except #4 (and assumes specific characters allowed in the name - this would need to be altered for other names. It also won't work if numbers are allowed in names): <?php $str = 'Players on server: [#] [iP Address]:[Port] [Ping] [GUID] [Name] -------------------------------------------------- 0 149.223.37.234:2304 171 as1wd5sjg095fc5xdv9u2x4mmigxi6fe Billyo 1 52.157.123.12:2304 156 jmmga2qza05vg0j84xhglrzdbuqe37wp {A}Gamer 2 248.237.161.275:204 63 0l0d2lxuiwejafp8b8aag1psqmbtgwos Kokonuts 3 35.195.183.151:2304 46 iuww8nvzh5a22rcesjj9jdlkrt2laj99 XSD-T. Marshall 4 44.101.11.241:2304 62 msclrtyaoc2go6cqfxzxbnuo6mtx42l5 5 199.285.163.153:2404 46 n9juys2as7jbkeqgx2913t543evp5w7m Muy 6 54.174.123.135:2304 46 bf713bf4bef6f6a4055416d96b9459ff lotto (6 players in total)'; $str = preg_replace('|.*-------------------------------------------------- |', '', $str); $str = preg_replace('|\(\d+ players in total\)|', '', $str); print "$str\n"; $foo = preg_match_all('|(\d+) ([\d.:]+) (\d+) ([[:alnum:]]+) ([[:alpha:]. {}-]+) |', $str, &$matches); var_dump($matches); ?>
  15. Mikesta's approach sounds good, though you should remove the header and footer first (or just remove the header and ignore the footer when you reach it). And it looks like there's 5 data points per user, so you would go through 5 at a time.
  16. Here's a LiveHTTPHeaders dump of a valid request (with a few sensitive headers removed): GET /search?q=http%3A%2F%2Fmailtrackpro.com%2Findex.php%2Fbottom-menu%2Fnuestros-clientes%2F&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a HTTP/1.1 Host: www.google.com User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip, deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Connection: keep-alive Now most of that is unimportant, but what I do notice is your search term contains some characters that should be url encoded. Firefox (which I made this request) has done that encoding, which is why you see %3A and %2F in the search request. So I would try modifying your code like this: $busqueda = "/search?q=".urlencode($search); If you look at the wireshark log from your connection: 0030 40 3d a7 58 00 00 47 45 54 20 2f 73 65 61 72 63 @=.X..GET /searc 0040 68 3f 71 3d 68 74 74 70 3a 2f 2f 6d 61 69 6c 74 h?q=http://mailt 0050 72 61 63 6b 70 72 6f 2e 63 6f 6d 2f 69 6e 64 65 rackpro.com/inde 0060 78 2e 70 68 70 2f 62 6f 74 74 6f 6d 2d 6d 65 6e x.php/bottom-men 0070 75 2f 6e 75 65 73 74 72 6f 73 2d 63 6c 69 65 6e u/nuestros-clien 0080 74 65 73 2f 26 73 61 66 65 3d 61 63 74 69 76 65 tes/&safe=active 0090 26 66 69 6c 74 65 72 3d 30 20 48 54 54 50 2f 31 &filter=0 HTTP/1 00a0 2e 31 0d 0a 48 6f 73 74 3a 20 77 77 77 2e 67 6f .1..Host: www.go 00b0 6f 67 6c 65 2e 63 6f 6d 2f 0d 0a 55 73 65 72 2d ogle.com/..User- That is raw - the url encoding wasn't applied.
  17. Thanks for that dump. I doubt the TCP checksums are an issue, those are calculated by your OS and will not be wrong. Those will only be an issue if you are sending data at the "raw socket" level, but what you're using here is a "cooked socket", where the OS takes care of TCP and IP checksums. So the issue will be with the HTTP protocol - Google is saying your request doesn't make sense. I can see one issue here: $request .= "Accept-Language: es-ar,es;q=0.8,en-us;q=0.5,en;q=0.3"; There is no \r\n on this line. So google will be interpreting the following header line as a continuation of this one. I don't know if that's enough to cause a "400 Bad Request" response though. What I would try next if I was doing this is to remove all the headers except the "Host:" header and see what happens. Ie just this: $request = "GET $busqueda HTTP/1.1\r\n"; $request .= "Host: www.google.com/\r\n"; $request .= "\r\n"; # Put this on a seperate line so it doesn't get lost when re-ordering and adding/removing headers Now that is valid HTTP/1.0 for sure, I don't know if it's valid HTTP/1.1, but I think it would be. Also regarding your capture, it didn't show the full text that you sent. If need to make another capture, see if you can "zoom" into the packet where your pc sends the HTTP request to google, and get the full contents of it.
  18. That wireshark log from an SSL session isn't telling me much. Can you log an unencrypted connection instead? An exact dump of what's being sent would be very helpful (there's an option somewhere to "follow" a tcp session and it'll show you exactly what went back and forth).
  19. I would try requesting "/search ..." instead of "search ...". IE, add a slash at the start. Even better, use an extension such as Firefox LiveHTTPHeaders to see the exact headers sent on a successful request and copy those. I doubt that line feeds are the problem. What exactly is the response you get from the server?
  20. I'm not sure we're talking about the same thing here. I'm talking about a tree with unlimited depth, such as DMOZ.
  21. What is in $comp->pvc ? If it is not an array, then that is probably the cause of the error. The error is often caused like this: $foo = 'bar'; print $foo[0]; # OK, treating a string as a 1 level array gives you a string offset instead print $foo[0][0]; # Error! Can't treat a string as a 2 level array
  22. Can you post the code that gave you that error?
  23. It needs a bit more than what's in that thread to support unlimited subcategories. The code there has no recursion, which is the key idea needed to make this work.
  24. FYI the code posted by whisperer19 only allows one level of subcategories
  25. The way to use prepare is demonstrated on the manual page here: http://www.php.net/manual/en/pdo.prepare.php $sth = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY)); $sth->execute(array(':calories' => 150, ':colour' => 'red')); But your code should work with just the query, even though the prepare is not doing anything. Does your code return an empty array? If so, try without the "where" condition.
×
×
  • 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.