ManiacDan
Staff Alumni-
Posts
2,604 -
Joined
-
Last visited
-
Days Won
10
Everything posted by ManiacDan
-
OP already marked this solution as solved, so he's in for a surprise when he tries this code in a real environment. Good eye.
-
Using output buffering because your redirects are designed wrong will only slow down the perceived performance of your website. Redirects and any other header() calls must be the first thing your script does. You cannot echo anything, even HTML tags, before a header redirect.
-
There's a fatal syntax error in this code, perhaps that's causing it. Also, you'll need to debug this on your own. You can't just write an entire program and hit "go" and then give us "when I hit go nothing goes." Does the referrer come in properly? Does the explode produce the data you'd expect? Are you sure you know what foreach does? What happens when you remove that (completely unnecessary) break statement?
-
adding rows and colums to a two dimentional array
ManiacDan replied to stijn0713's topic in PHP Coding Help
So then...explain better. There are dozens of ways to add things to an array. The three most common: $arr[] = $something; array_push($arr, $something); array_unshift($arr, $something); If those don't fit your requirements, refine the requirements. -
You need to use the ternary operator echo 'one' . ($x=$y ? 'add 2' : '') . ($a=$b ? 'add 4' : '');
-
usually this is handled by checking on the "my account" page. If they're not logged in, kick them to the login page.
-
Need help with a simple Regular Expression and preg_match
ManiacDan replied to vestaxpdx's topic in Regex Help
Regular expressions are an entirely different language. It's as confusing as learning python. -
They do work off a database, but it's not any database you would recognize. Google's data store is massively complex. But when you get right down to it, they need a copy of every page. They have a copy of this page. They have to if they're going to see that I said "they need a copy of every page." In an hour, if you search for: maniacdan "they need a copy of every page" This page will come up. Data fetched through ajax probably will not be read by google, no. I'm not sure how sites like Gawker do it, but I assume they have special code that detects if they're being crawled by the googlebot and serves up the article in plaintext rather than through ajax. I would do something similar to that: If the user-agent supports javascript (like all modern browsers), send the page "normal" with the ajax call. if they're the googlebot, a "mini" browser like opera or a cell phone, or a text-only browser like lynx, serve them the article in a more plaintext format. Or you could just print the content when you load the page and keep the ajax call for subsequent clicks. Warning: Serving googlebot different content than normal users is against their rules and could get you blacklisted from google. Read up on their rules. I think something like what I suggested is ok, it's a rule about the content itself.
-
The purpose of google cache is so google can return search results. The cache is what they search against. You have to keep a copy of every website on the internet if you're going to search them, that's how it works. Sites which are updated far more frequently than yours are cached with no issue. What's the actual problem you're seeing?
-
This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=360896.0
-
1200+ posts and you still thought it was ok to dump 200+ lines on us without anything but "this broked"?
-
Need help with a simple Regular Expression and preg_match
ManiacDan replied to vestaxpdx's topic in Regex Help
$my_string = "AND country='United Kingdom' OR country='France' OR country='Spain'"; preg_match_all("/country\s*=\s*'([^']+)'/", $my_string, $foo); $countries = $foo[1]; print_r($countries); -Dan -
Well...in my second line I said you'll have to use the domdocument or parse the strings by hand using substr.
-
Do you encode these or anything when you put them into the database? Have you looked at the data directly in the database to see if it's encoded weirdly in there? Where is the failure in this system?
-
The preg_match is working perfectly. You want the opening div tag, and then everything until the first closing div tag. That's what you got. If you really want to parse MATCHING tags, then regex is not the solution. You'll have to use the domdocument, or parse them by hand using substr. Both are annoying.
-
Ugh, why? You could just as easily include a mysqldump file. You probably want to simply use empty(), strtolower() and in_array().
-
I don't know of a built-in implementation of bcrypt.
-
You've tried this? mysql_query("INSERT INTO users (UserName, Password, Access) VALUES ('{$InsertUserName}', '{$InsertPassword}', '{$InsertAccess}')"); Also, you need to use mysql_real_escape_string around all these variables. It's also a good idea to actually check and handle error messages for queries (which you're not doing). And finally, you must die() directly after a header() call.
-
If you're using MySQL's MATCH...AGAINST syntax (which was designed exactly for this kind of search) you can put words into MySQL's stopword list and have the database exclude them automatically. Barand and I are suggesting the same thing. MATCH...AGAINST is applied against columns with a FULLTEXT index. Google for either.
-
Topic moved to PHP. liomon41, please don't create four copies of a thread. We'll move it to where it belongs.
-
This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=360850.0
-
PHP's built in crypt function is perfect for hashing passwords, with very little danger of this type of attack. I believe this quote was talking about (a) encryption and not hashing, and (b) rolling it yourself instead of using a built-in library like crypt.
-
Here's a suggestion then: Write a question that can be answered and someone will answer it. What you see is what you get. You won't even define the words you're using, so this thread is closed.
-
Try actually answering some of the questions.
-
Please clarify this a little bit. You're looking for an OCR software? Like a real "Scanner"? Or are you looking for something to simply read plaintext documents? What do you mean by "similar words"? How is the user submitting this data? How should it be compared to stored data?