Jump to content

RussellReal

Members
  • Posts

    1,773
  • Joined

  • Last visited

Everything posted by RussellReal

  1. <?php $today=date('m/d/y'); $time="6 MONTHS"; $expires = strtotime("$today + $time"); print "$today and $expires"; ?>
  2. honestly looks good to me >.>
  3. I know, thats what I was originally going to formulate for him, however, using the while loop, then array reverse, will ofcourse do the same operations double, instead my way, you get the data, and put it in the right place, at the same time
  4. daniel, actually, I'm decreasing the $i variable in each loop of the for, whether it is 7 or 8 when I go to set it to 6, it will still get set to 6
  5. To be honest you'd be better with something like: function BBCode($post){ $post = htmlentities($post); $bbcodes = array(); $bbcodes[] = "/@(\d+?)/"; $bbnext[] = "<a href=\"#post_$1\">@$1</a>"; $bbcodes[] = "#\[b\](.*?)\[/b\]#is"; $bbnext[] = "<b>$1</b>"; $bbcodes[] = "#\[i\](.*?)\[/i\]#is"; $bbnext[] = "<i>$1</i>"; $bbcodes[] = "#\[url=(.*?)\](.*?)\[/url\]#i"; $bbnext[] = "<a href=\"$1\" target=\"_blank\">$2</a>"; $bbcodes[] = "#\[url\](.*?)\[/url\]#i"; $bbnext[] = "<a href=\"$1\" target=\"_blank\">$1</a>"; $bbcodes[] = "#\:as\:#i"; $bbnext[] = "<img src=\"http://i204.photobucket.com/albums/bb303/img0t/as.png\">"; $bbcodes[] = "#\:a-boo\:#i"; $bbnext[] = "<img src=\"http://i204.photobucket.com/albums/bb303/img0t/boo_as.png\">"; $bbcodes[] = "#\:a-link\:#i"; $bbnext[] = "<img src=\"http://i204.photobucket.com/albums/bb303/img0t/link_as.png\">"; $bbcodes[] = "#\:a-snake\:#i"; $bbnext[] = "<img src=\"http://i204.photobucket.com/albums/bb303/img0t/snake_as.png\">"; preg_replace($bbcodes,$bbnext,$post); return $post; }
  6. try that <?php $result = mysql_query("SELECT * FROM fixtures WHERE result != '' ORDER BY date DESC LIMIT 6", $connection); $results = array(); for ($i = (mysql_num_rows($result) - 1); $i > 0; $i--) { mysql_data_seek($result,$i); $results[] = mysql_fetch_assoc($result); } ?> note: its untested.. as I just wrote it, but if it doesn't work just tweak it a bit, thats along the lines of what you need
  7. that does nothing to the css
  8. I just rewrote it, I wouldn't see an error in this... other than 1 too many closing brackets <?php if ($news_content2 != "") { echo <<<A <ul class="news_item"> <li><h2>$news_title2</h2></li> <li><span class='news_date'>$news_date2</span></li> <li>$news_content2...</li> <li><a href="$news_article_url" title='$news_title2' class='readmore' target='_blank'>Read More</a></li> </ul> A; } elseif ($news_content2 == "") { echo "<p class='error'>Sorry, News For This Artist is Currently Unavailable.</p>"; echo "<img src='images/error.gif' alt='Error' title='Error' class='center' /> "; echo "<p class='error'>Please try again Later</p>"; } ?>
  9. because this is not a PHP question, this is an HTML question... but, since you're here.. Just do something like this: <style type="text/css"> div.pice { display: block; width: 100px; float: left; } div.pice img { display: block; width: 100px; height: 80px; } div.pice div { clear: both; display: block; font-size: 11px; font-family: Tahoma; } </style> <div class="pice"> <img src="img_url" /> <div>description</div> </div><div class="pice"> <img src="img_url" /> <div>description</div> </div><div class="pice"> <img src="img_url" /> <div>description</div> </div>
  10. array_reverse <3
  11. <?php class SpamFilter { private $words; public function __construct($wordlist) { $this->words = $wordlist; } private function prep($input) { return trim(preg_replace(array('/[^a-z0-9 \n\.\,-]/i','/\n/','/[\,\.]/'),array('',' ',"\n"),$input)); } public function spam_rating($input) { $input = $this->prep($input); $exp = explode("\n",$input); $length = 0; $count = 0; foreach ($exp as $line) { $length += substr_count(trim($line),' ') + 1; foreach ($this->words as $word) { if (stripos($line,$word) !== false) $count += substr_count(trim(str_replace(array('-','_'),' ',$word)),' ') + 1; } } return min(100,floor((($count * 3.5) / $length) * 100)); } } $s = new SpamFilter(array('free','sign-up','sign up','amazing','unbelievable')); echo $s->spam_rating('This unbelievable free offer is all yours, all you need to do is go to my website, sign up, and set up your mailing address to receive your AMAZING offer!').'%'; // the above echo returns 58%, each 'flag' word is worth 350% an average word.. enjoy ?> I put this class together for you, just to help you out
  12. session_start just gives you access to the session with the user.. its nothing special.. if you used the superglobal $_SESSION without initiating the session via session_start it will do absolutely nothing.. ofcourse it will still function as a variable, but will not do what it was designed to do, save the data inside at the garbage collection stage of the php process, to a session file, for use in another php execution, if you initiate a session with the same user, using the same php session id.. so if you're going to use your session in 'page1.php' yes, you need to initiate the session..
  13. sweet, didn't know that (didn't test it either)
  14. as soon as you add it to the session, it should be accessible in every page, but instead of using $_POST you'd use $_SESSION to access it (AFTER you initiate the session using session_start ofcourse )
  15. oh.. coz the first language I learned RegEx in was mIRC, and in mIRC or (mSL) the RegEx had modifyers, much like /i or /s but one of them was /g for 'greedy' or 'global' search so I just got used to calling it a greedy search, my bad
  16. session.. at the start of the page you direct your form to.. do this: <?php session_start(); $_SESSION[] = $_REQUEST; ?>
  17. <?php $content = substr($info,$a = (strpos($info,$b = 'Location') + strlen($b)),strpos($info,'Contact',$a) - $a); ?>
  18. '/(<\?(?:php)?.*?\?>)/i' but ofcourse.. that would result in errors if for whatever reason you're trying to like echo '?>'; in your php but thats rare I suppose, but you could use some sort of look ahead to be sure you get the very last one, or at the very least an atomic group.. good luck oh and you're using php? use preg_match_all instead of preg_match for greedy searches
  19. uhm.. you're forgetting to start the session... session_start
  20. how advanced are you in php? If you're more advanced, you could try a socket, and after x amount of loops if you receive 0 bytes of data, then you could break; the loop.. or uhm.. set_time_limit but that is for the ENTIRE php script's processing.. not just for 1 specific thing.. or just use file fuctions, and do the same thing as the socket would.. but that would probably give you the same problem as file_get_contents considering fopen and file_get_contents go thru the same initial processes anyway goodluck
  21. assuming $groups actually gets filled.. <?php // do whatever to get $groups filled... $formatted = ''; foreach ($groups as $type => $members) { foreach ($members as $member) { list($name,$color,$level) = $member; $formatted .= "<span style='color: {$color};'>{$name}</span>"; } } ?>
  22. ok, based on this, just because 2 items are the same specsdoesn't mean they are the same item.. don't group them at all is my opinion.. if they order 12 of the same serial number, then group them, otherwise, thats veryweird to see you buying qty 3 of 3 different items.. and could get confusing on ur end also..
  23. you probably don't need to keep tabs you could just use current for example: <?php foreach($range_i as $key => $increment) { $pips[] = $range_s[$key]; //add the start of the range to the pip array $total_range_pips = ($range_f[$key] - $range_s[$key]) / $increment; //how many increments are there within the range for($i = 1; $i <= $total_range_pips; $i++) { $pips[] = current($pips) + $increment; //add an increment onto the last entered value } } ?> also other thoughts, if finish is lower than start, you could encounter other errors..
  24. arr[$desc_lenght_max you spelled length wrong lol
×
×
  • 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.