scootstah
Staff Alumni-
Posts
3,858 -
Joined
-
Last visited
-
Days Won
29
Everything posted by scootstah
-
Is their email part of your salt or hash algorithm? If not, I can't possibly see why you would want to do that.
-
Had you bothered to read the code I posted earlier, it should be pretty obvious. You simply replace the BBCode with HTML. You don't need anything installed on your server, it is not an addon. It is replacing one piece of text with another piece of text. $bbcode = '[b]'; $html = str_replace('[b]', '<b>', $bbcode); I don't know of a simpler way to explain it.
-
It has nothing to do with your host, or with PHP. It is simply text that you convert into HTML. [ b] becomes <b>, [ i] becomes <i>, etc.
-
In Wordpress everything is stored in the same table "wp_posts", so it can simply search for slugs in that table. If one is found, it displays whatever type of content is associated with that result (whether it be a post, or a page or whatever). Somehow it also figures out if the slug is a category or not. Like I've said before, I hate Wordpress but I really love how they handle permalinks.
-
You would have to pass all of the variables up to $overlayMsg first. If that's not what you want, then pass a single array or object instead. function __construct($file, $data) { $cls = new Cls('file.txt', array( 'outFile' => 'newpdf.pdf', 'fontSize' => 70, 'alpha' => 0.6, 'overlayMsg' => 'N O T F O R S H O P', 'degrees' => 45 ));
-
That is a band-aid at best. It doesn't fix the error, it just masks it.
-
Hmm, I guess I read his post wrong. It seems a little vague to me. I read it as he was making an installer for an application which stores the credentials in a file. EDIT: But once again, if you are storing them in a file then it doesn't matter if you encrypt them or not, unless you keep the encryption key off-site. If they have access to the file system to download the file where they are, they also have access to the encryption algorithm and the key.
-
http://en.wikipedia.org/wiki/BBCode First Google result. There is a PECL package for BBCode. http://www.php.net/manual/en/book.bbcode.php
-
I haven't worked with CakePHP, but you can insert data in batches like this: INSERT INTO table (col1, col2, col3) VALUES (1,2,3), (4,5,6), (7,8,9); This would insert 3 new rows.
-
Maybe I'm wrong, but I think he is talking about the database credentials. You don't really need to encrypt those, because if they have access to the file in the first place they also have the means to decrypt it.
-
The cookie has no value, it simply exists. Basically if it exists, don't add a view, if it doesn't exist create it and add a view.
-
Yeah, I guess that makes more sense. Also makes sense. Sometimes I forget that PHP pretty much has a function for everything. I made a function that parses BBCode and turns it into HTML. You write quotes just like you do on these forums, and then the function will turn it into HTML. At this point it only handles quotes, but you could easily add any other BBCode syntax for things like bold, italics, underline, etc.
-
Right, that's the issue. Forums would crash instantly if we had to uniquely identify "please help" as a thread title. Also, articles aren't good for this either because of the likelihood of adding things like [update] and [Fixed] to the title. Unique IDs all the way. The slug doesn't have to be identical to the title. For example if your article was titled "Some uber leet article" the slug might be "some-uber-leet-article". If you added [update] to the title, the slug can stay the same. If you ever title something the same, you'd append a number to the slug. So it would become "some-uber-leet-article-2". It really depends what you are doing as to how you want your URL's. Something like a forum, or something where you run a high chance of a duplicate title, you might want to go with something else. Maybe prefix the slug with the post ID or something, so it would become "19284-some-uber-leet-article". Still looks pretty, yet will always be unique.
-
You can indeed have just the post title in your URL. Wordpress seems to handle it without problems. The logic seems pretty straight forward. if (physical page exists) { .... } else if (article exists) { .... } EDIT: You would just have to make sure your slugs were unique or you might have conflicts.
-
You would use file_put_contents for that.
-
I think you are looking for URI routing. Generally the htaccess will be something like, <IfModule mod_rewrite.c> RewriteEngine on Options +FollowSymLinks -Indexes RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?uri=$1 [PT,L] </IfModule> And thus all requests will tunnel through index.php. From there, $_GET['uri'] will contain the requested segments. So if you went to example.com/article/category/1, $_GET['uri'] would contain "article/category/1". You can explode this string to get an array of each segment. From there, take a look at some URI routing classes. The one for CodeIgniter is really simple but will still do what you need.
-
This could probably be refined, but it will get you on the right track. function parse_bbcode($data) { // make sure open quote tags match closed quote tags $open_quote = substr_count($data, '[quote]'); $closed_quote = substr_count($data, '[/quote]'); if ($open_quote > $closed_quote) { $diff = $open_quote - $closed_quote; // add closed tags for($i = 0; $i < $diff; $i++) { $data .= '[/quote]'; } } else if ($closed_quote > $open_quote) { $diff = $closed_quote - $open_quote; // add open tags for($i = 0; $i < $diff; $i++) { $data .= '[quote]'; } } $search = array( '/\[quote\]/i', '/\[\/quote\]/i' ); $replace = array( '<blockquote>', '</blockquote>' ); return preg_replace($search, $replace, $data); }
-
Currently, your cookie is only considered a "session cookie". That is, it will expire as soon as you close the browser. Since 24 hours probably won't have passed before the user next opens their browser, this is not acceptable. You'll need to tell the cookie to expire in 24 hours. You have the right idea, but you put it in the wrong parameter. The expire time is the third parameter. So just change it to: setcookie("user", "", time()+84600); To update the views, this should do: $k=mysql_query("UPDATE `images` SET views = views+1 WHERE id = '$userid'"); I don't know where/how $userid is defined, but make sure it can't contain SQL injection. If it is numerical you can simply cast it to an int to make sure. $userid = (int) $userid;
-
That does nothing to clarify your question. The only way to assign anything to the key "c" is to explicitly assign something to the key "c". $array['a]['c'] = 'something';
-
You can also use entities for the < > <textarea rows="10" cols="60" id="code" name="code"><?php ?></textarea>
-
Post all of the code.
-
Whoa. I came on and checked new replies to my messages, and I had green under my name. *rubs eyes* Yep, that is green. Woohoo, thanks guys.
-
The first replace will essentially be ignored in your first code, because you aren't actually modifying the $_POST value. You can use arrays in str_replace to replace multiple values. $myPageContent = mysql_real_escape_string(str_replace(array('\'', '"'), array(''', '"'), $_POST['myPageContent']));