Jump to content

discomatt

Members
  • Posts

    1,943
  • Joined

  • Last visited

    Never

Everything posted by discomatt

  1. Use different session names!! http://php.net/session_name
  2. It's really situation dependent. May I see the code you used to benchmark?
  3. Alternately: <?php $var = "sometext"; class getvar { protected $var; public function __construct( $var ) { $this->var = $var; } public function test() { echo "Var: {$this->var}"; } } $obj = new getvar( $var ); $obj->test(); ?>
  4. Random salt >> Static salt.
  5. Eclipse w/ Zend for a paid solution.. PDT (Eclipse) for a free solution.
  6. Convince the telcos to format your message that way? Keep in mind you're not email their cellphones... you're emailing the telco, who then converts the email to an SMS message and sends it to the phone number. The format received probably varies from provider to provider... If you want it to look a certain way, why not pay for it? For the most part, the end user has to pay when they receive a text message via e-mail... wouldn't it be better practise to take care of that cost for them?
  7. Doubtful. That change is probably done at a telco level. Ideally, you want to use a paid SMS gateway
  8. Good luck doing it with VARCHAR. Shoudla done with a date type column.
  9. There's no legitimate way of using this. Ask this 'friend' to allow your hostname as an unfiltered referrer.
  10. SELECT * FROM `table` ORDER BY (`field1`+`field2`+`field3`) DESC
  11. Is the data stored as a varchar/text ('3.2/10') or as a decimal/float? (3.2)
  12. Code using standards http://www.w3schools.com/HTML/
  13. Convert to decimal, and make a minimum difference. This will only work for light/dark though... as #FF0000 text and #0000FF background technically have a '0' difference. To get by this you may want to have a minimum difference per channel and combine that with an overall difference... though personally i think solid red text on a solid blue background is just ugly. <?php $text = '#FFFF00'; $bg = '#000000'; $minDeviation = 400; $textRGB = hex2rgb( $text ); $bgRGB = hex2rgb( $bg ); if( abs(array_sum($textRGB)-array_sum($bgRGB)) < $minDeviation ) echo 'Colors are too similar'; else echo 'Colors are different enough'; function hex2rgb ( $hex ) { if ( substr($hex,0,1) === '#' ) $hex = substr($hex,1); if ( strlen($hex) !== 6 ) return FALSE; return array( 'r' => hexdec( substr($hex,0,2) ), 'g' => hexdec( substr($hex,2,2) ), 'b' => hexdec( substr($hex,4,2) ) ); } ?>
  14. Say what? The idea is the page POSTs to itself. You want to view the same page every time, but you want to prevent refresh. You want to force the user to repost new information every time. Check out my example, and you'll see why your method won't work. You're always resubmitting to the same page.
  15. Here's a basic rundown... <?php session_start(); if( isset($_SESSION['noRefresh']) && $_POST['noRefresh'] !== $_SESSION['noRefresh'] ) echo 'Refresh attempt detected<br />'; else echo 'No refresh/first visit<br />'; $_SESSION['noRefresh'] = substr( md5(uniqid(mt_rand(),true)), 0, 5 ); echo <<<OUTPUT <form action="" method="post"> <input type="hidden" name="noRefresh" value="{$_SESSION['noRefresh']}" /> <input type="submit" name="Submit the Query" /> </form> OUTPUT; ?>
  16. It's probably storing the random value in a session - when you refresh, you're reposting the OLD 'traincode' value, when it expects the new one. This can still easily be bypassed by creating an AutoIt script that hits the submit button every x seconds
  17. You could also try echo (string)$profile switch ( (string)$profile ) :
  18. Get a 64bit system.... Unsigned integers aren't supported in PHP, sadly. http://php.net/int
  19. <?php $data = array(); while( $row = mysql_fetch_assoc($result) ) $data[] = $row; ?>
  20. You want <pre><?php $theDate = '12-25-2008'; var_dump( strtotime( str_replace('-','/',$theDate) ) ); ?></pre>
  21. http://www.gnu.org/software/tar/manual/html_node/Calendar-date-items.html#SEC116 Read up <pre><?php var_dump( strtotime('12-25-2008') ); var_dump( strtotime('12/25/2008') ); var_dump( strtotime('2008-12-25') ); ?></pre> bool(false) int(1230192000) int(1230192000)
  22. I'm not too familiar with the methods Apache uses for htaccess-based authentication, but this might help http://php.net/manual/en/features.http-auth.php
×
×
  • 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.