![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
The Little Guy
-
Posts
6,675 -
Joined
-
Last visited
Posts posted by The Little Guy
-
-
Reporter: What kind of hardware do you use to run Google?
Google: Lots of iPad 2's
-
yes there is. you may want to look at tinymce or ckeditor. it works great. as far as i have known, the editor is only for html and not php.
He is looking for a CMS not a WYSIWYG
-
I am not sure if this is what your trying to do...
<?php $file = "I went back home to see my family as I was studying in China. By the time I arrived home I was so hungry and the weather was cloudy."; $words = array("see", "reader", "stud", "China", "cloudy", "hungry", "answer", "el", "prefer"); $foundWords = array(); foreach($words as $word){ $word = preg_quote($word); if(preg_match("/$word/i", $file)) $foundWords[] = $word; } print_r($foundWords); ?>
-
echo datediff("2011-10-20 12:37:21", date("Y-m-d"));
-
http://us2.php.net/manual/en/reserved.variables.post.php
An associative array of variables passed to the current script via the HTTP POST method.
$HTTP_POST_VARS contains the same initial information, but is not a superglobal. (Note that $HTTP_POST_VARS and $_POST are different variables and that PHP handles them as such)
-
<form name="form1" method="post" action="<?=$_SERVER['PHP_SELF']?>" > <input name="myguess" type="text" value="<?php echo $_POST['myguess']; ?>"> <input type="hidden" name="allTheGuesses" value = "<?php echo $_POST['allTheGuesses']; ?>"> <input type="submit" value="GUESS"> </form>
-
I created this function in a class I will be releasing soon (which I am excited about). But this subtracts 2 dates and gives you the number of days.
function datediff($start_date, $end_date, $exact = false){ if(!is_int($start_date)){ if((bool)$exact) $start = strtotime($start_date); else $start = strtotime(date("Y-m-d", strtotime($start_date))); }else{ $start = $start_date; } if(!is_int($end_date)){ if((bool)$exact) $end = strtotime($end_date); else $end = strtotime(date("Y-m-d", strtotime($end_date))); }else{ $end = $end_date; } return ($start - $end) / 60 / 60 / 24; }
-
I already have that in my code:
if(mysql_affected_rows($sql) == 1){ // The code has just been inserted (no duplicates found) }else{ // The code already exists (its a duplicate) }
-
no, it only checks the unique ones. So if the column "code" is set to unique, it will only check that column on insert. If it finds a duplicate "code" it won't insert anything, otherwise it will insert.
Example:
insert ignore into members (first_name, code) values ('jim', '123'); -- inserts 1 row insert ignore into members (first_name, code) values ('joe', '123'); -- inserts 0 rows insert ignore into members (first_name, code) values ('jim', '1233'); -- inserts 1 row
-
Awesome video tutorial Playlist:
-
I like my host (See signature (get a discount)).
They are fast and reliable, and for $15 extra dollars you get a vps, and they don't monitor your bandwidth/space (Number Apache requests are monitored on shared servers).
I am currently using 12GB of space and 115GB of bandwidth (for this month). I have not noticed any downtime.
-
define "Not Functioning"
-
I see that you don't have a </select> tag
-
it all depends on the tables, such as:
- Size
- Structure
- and other factors
-
<a href="/somepage.php">Click me in 5 seconds</a>
-
You could do an "INSERT IGNORE" which would ignore duplicate rows.
So, you would need to make the column "code" as either a primary key or a unique key.
<?php $sql = null; if(isset($_POST['submit'])){ if(strlen($_POST['code']) == 19 && substr($_POST['code'],0,7) == '5541258') { $code = mysql_real_escape_string($_POST['code']); $secret = mysql_real_escape_string($_POST['secret']); $addr = mysql_real_escape_string($_SERVER['REMOTE_ADDR']); $sql = mysql_query("INSERT IGNORE INTO table(code,secret,ip,date) VALUES('$code','$secret','$addr',CURDATE())"); } } if(mysql_affected_rows($sql) == 1){ Print "<font color='green'>The code will be checked now</font>"; }else{ Print "<font color='red'>The code is invalid</font>"; } ?>
-
if( ctype_digit($number) && $number > 17 && $number < 100 ) {
if((int)$number > 17) {
$number = "00000000000000000000000000000000000000000000042";
They both worked...
-
If it's just a number and nothing else, you don't even really need a pattern. This should be faster too.
if( ctype_digit($number) && $number > 17 && $number < 100 ) {
personally I don't like that. I would have done this:
if((int)$number > 17) {
-
PHP GD:
http://phpsnips.com/snippet.php?id=5
ImageMagick:
$width = 500; $image = "/root/www/images/myImage.jpg"; $img = getimagesize($image); if($img[0] > $width) shell_exec("mogrify -resize $width $image");
-
in my opinion the easiest way is to use ImageMagick, so if your server has that use it...
-
you need to upload the full size image, then re-size it. You can not re-size it before it has been uploaded to the server.
-
This might work (might as in I don't know how your using the number).
<?php $values = array( "Joe is 18 years old", "Joe is 13 years old", "Joe is 11 years old", "Joe is 100 years old" ); foreach($values as $value){ preg_match("/\d+/", $value, $matches); if($matches[0] >= 18){ echo "Joe is 18 or older"; }else{ echo "Joe is under 18"; } echo "<br>"; } ?>
if you have as specific number, such as $age = 10, then you could just do something like this:
$age = 10; if($age >= 18){ echo "18 or older"; }else{ echo "under 18"; }
-
That seems to work! Result:
http://phpsnips.com/phplive/examples/misc/highlight.php
Thanks for the help!!!
-
Wonderful!
Any other suggestions on my regexp?
Oh, and another thing, in the first comment on the page, it highlights tags within comments. Any suggestions to stop that from happening?
Thanks for your help!
CMS for PHP or HTML integration Help
in Miscellaneous
Posted
Which is what a CMS is.... a Content Management System, such as one of these: http://www.phpkode.com/projects/category/php-cms/