-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
my guess is that you are trying to use a font that is not available on your server. But again, seeing as how you have yet to actually provide real details, it's only a guess.
-
Ah yes, I see your problem. It's on line 5.
-
ctype_alnum by itself only checks that it is an alphanumeric string. It does not determine whether it has at least one number in it. if (preg_match('~^[a-z0-9]*[0-9][a-z0-9]*$~i',$subject)) { // $subject is alphanumeric and contains at least 1 number } else { // failed } OP: This code will do what you want with one caveat: Technically a string consisting of a single digit like "9" will pass. If you want to do other things like enforce a minimum/maximum length, be more specific.
-
The average joe probably will think it is a waste of money. But when you have a handful of professionals going against each other, sometimes it really does boil down to those really small things. Athletes with different shoes...which one offers that little bit of extra spring. Or like wine...average joe can't even tell the difference between a $10 bottle of wine and $100 bottle of wine, let alone a $1000 bottle of wine. But when you have a connoisseur doing the test...if he's worth a damn he would know.
-
One caveat I noticed is that it will add the "..." to text shorter than 30 chars... also this is slightly better (meant to do < in stead of > in the 2nd and 3rd char classes) $content = $link; // content here $content = preg_replace("~(<a[^>]+>)([^<]{1,30})[^<]*(</a>)~i",'$1$2...$3',$content);
-
$content = "..."; // content here $content = preg_replace("~(<a[^>]+>)([^>]{1,30})[^>]*(</a>)~i",'$1$2...$3',$content); edit: fixed variable names..
-
are you even using the right path/to/file? do this: echo $data; do you see your stuff outputting on the screen? If so... do this: $data = file("Matthew.txt"); echo "<pre>"; print_r($data); And post here what it outputs.
-
try $pattern = "~character-username = (.+?)$~s";
-
I guess you are talking about the quotes? No, like I said, with php, the modifiers are also put within the string, so php needs to know the boundary between your pattern and your modifiers. Even though modifiers are optional, the delimiters are not. Otherwise there would be no way to tell php that hey these are delims and i have modifiers, vs. no I don't have delims and modifiers, or hey these sure look like delims and modifiers but they aren't, they are normal text to match! IOW in order to prevent ambiguity, the delimiters have to be present no matter what.
-
okay well what does file_get_html() look like?
-
not really enough info...my best guess is maybe your test page's html is so mal-formed the parser fails to parse it correctly.
-
^ post the code surrounding it, as well as the actual parse error. You are missing or have too many quotes, brackets, semicolons etc.. somewhere. The actual error message helps tell you what it is (not) expecting.
-
Okay fair enough...sure, without requiring registration, cookies would be one of your only options. Create a new table called "hiddenGuides" with 2 columns: unique cookie id and guide id. On page load, check if the cookie exists. If it doesn't, generate a unique ID and store it in the cookie and select all rows from database. If cookie does exist, take that cookie value and only select the guides from your guide table that don't match the cookie id and guide id in hiddenGuides. When user clicks on a new row to hide, insert new row into hiddenGuides with the cookie value and guide id.
-
Yes, you can use it on your own site. Only stipulation is that in no way can you ever hold myself or anybody else at phpfreaks responsible for any mishaps, damage, etc.. resulting from the use of it. Just keep in mind that with tutorials, there are oftentimes better ways to actually implement the principle. Tutorials are meant to strip things down to the basics, often disregarding things like security, scope, elegance, etc... because the point is to teach you the principle in general. There is minimal validation included in that code but a lot more can/should be considered, depending on what else you've got setup. Also, many people like to abstract that stuff into a class to make the page code cleaner. Etc.... Point is, although it technically works "out-of-the-box", it's a tutorial with sandboxed code to help you learn something - a starting point.
-
okay well in the example you provided, it is just being able to manually filter out some paginated results...you don't really need to mess with cookies for that...simply use some javascript to change a css attribute of the td to hidden or remove it altogether... but if you are wanting to do more than that...well that's where the "we need more info" statement kicks in...
-
all users or specific users? If you are wanting to prevent all users from viewing them, store the pages and directories in a directory outside of your publicly accessible directory. If you only want to restrict some users, then it really depends on what your overall system/site looks like, what it's for etc.. but in general, that's where a login/membership system comes into play.
-
A delimiter is just a character you choose to specify the start and end of your pattern. It can be most any non-alphanumeric character, though most people use / ~ or # (I personally like ~). So basically you would have "~your actual pattern here~". The reason why you need delimiters in php is because pattern modifiers are also contained within the argument. For example, if I wanted to make my pattern case-insenstive, I would do this: "~pattern~i" so php needs to know the boundaries of your actual pattern so it can know if you are using any modifiers. NOTE: whatever delimiter you choose to use in your pattern...if you need to match that character in your pattern you will need to escape it (prefix it with a backslash) so that php knows you are searching for that character instead of ending your pattern. As a programmer, you already use delimiters in other ways, though you probably just don't realize it. For instance, quotes around strings are delimiters, specifying the start and end of the string
-
you need to send headers in your email specifying that it is html content. Otherwise most email clients will not render it as html edit: nvm didn't see that last line of code. hmm did you check your email settings in yahoo?
-
make sure the table name is spelled right (case-sensitive), also your script could have failed to select a db in the first place...
-
if you are looking to store variables and values...there's really no reason why you need to store them as valid php syntax...if you're gonna do that, why not just include the file so the variables are simple made...(though i guess this doesn't account for writing values..) Alternatively, just do the var:value with a simple delimiter so you don't need to mess around with having to strip out all that extra php syntax... Alternatively, you could look into serialize and unserialize
-
ideally you would have a column with just the actual thread title, a separate column for an id and another separate column or even whole separate table for that "new", depending on what exactly that is supposed to signify. Then you could just order by id. IOW I sure hope that you don't have 1 column with that whole string as values...
-
Okay maybe you should explain more about what you mean by "hiding" stuff? Are you wanting to be able to make the rows completely inaccessible by the user if the cookie exists? Then you don't need javascript at all. The better thing would be to not output the rows to begin with, which you'd be doing with php. Ideally you would only select the rows you need based on whether the cookie exists or not. Alternatively you would select the rows and then only actually echo out the rows you want to echo out if the cookie exists.
-
check for cookie. If it exists, only select and echo out relevant rows. If not, select and echo out rows as normal and create cookie.
-
I see an $imageid in there that just gets assigned an unsanitized/unvalidated $_GET['src'] and then used in both select and update queries... I also see $name and $comment vars being assigned posted values and the only validation I see done on it is checking if they are empty and for a couple of spam type strings..... I don't even see mysql_real_escape_string being used... And for the file uploads...I see nothing that prevents someone from overwriting existing files PFM pretty much summed it up: You need to validate all your user input.
-
Declaring a variable that an Include PHP file can insert into a query
.josh replied to bluewaves's topic in PHP Coding Help
$variable = "value";