Jump to content

Philip

Staff Alumni
  • Posts

    4,665
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by Philip

  1. Your javascript is not submitting the form but simply opening a new window.
  2. //get data $state = $runrows['state']; $url = $runrows['url']; $username = ucwords($runrows['username']); echo " <b>$username</b><br> $state<br> <a href='$url'>View Profile</a><br> ";
  3. SMF (the board used at PHP Freaks) will let you know when you need to update, but it won't automatically update. However - their update script is pretty awesome (when visiting their download page check out the large upgrade)
  4. ucfirst for the first letter in the string, or ucwords for the first letter in each word.
  5. The main thing I forgot on mine was deletion - but keeping the message itself & parent ID. Which would be something like.... This one is the one with the sender info & the message itself: CREATE TABLE IF NOT EXISTS `pm_message` ( `id` int(10) unsigned NOT NULL auto_increment, `id_parent` int(10) unsigned default NULL, `id_sender` mediumint( unsigned NOT NULL, `title` varchar(100) NOT NULL, `content` text NOT NULL, `date_sent` timestamp NULL default NULL, `delete_sender` tinyint(1) NOT NULL, PRIMARY KEY (`id`) ) This is the related table, an entry for each message for each recipient: CREATE TABLE IF NOT EXISTS `pm_info` ( `id_message` int(10) unsigned NOT NULL, `id_receiver` mediumint( unsigned NOT NULL, `read_receiver` tinyint(1) NOT NULL default '0', `date_read` timestamp NULL default NULL, `delete_receiver` tinyint(1) NOT NULL default '0', KEY `message_id` (`id_message`)
  6. http://www.phpfreaks.com/forums/index.php/topic,260841.0.html
  7. back to the original question - you can store the value in mysql/flat file and have it check every page load to see if the site is in maintenance mode... or I prefer using .htaccess if applicable
  8. The error message says it all....
  9. And you're the type to come back in a few years and beg to have your profile & posts deleted for looking like an idiot.
  10. I like the last set the best - some of those are trippy
  11. $hex = substr($hex, 1); That will remove the first character from the string, which is placed at the end of your while loop. So, 1e5a would become e5a after the first pass of the loop. Whenever you run the loop 4 times, you are left with an empty variable, not a variable with the value of a space character. When you had it while ($hex != ' ') it would run that loop until hex was just a ' ' which would never happen. And because it was empty, and your while loop looked for a space, when it came to the if statements, the empty $hex wasn't a character between 'a' and 'f' if (ord($char) >= ord('a') and ord($char) <= ord('f')) , and it wasn't a integer between '0' and '9'.... else if (ord($char) >= ord('0') and ord($char) <= ord('9')) so it fell back to the last else statement - return an invalid hex string. else return INVALID_HEX_STRING;
  12. I find it easier to do the following, especially when you have a lot of entries: <select name="skinstyle"> <?php $options = array( 'Default' => 0, 'Light Blue' => 1, 'Sunset' => 2, 'Beautiful Blue' => 3, ); foreach($options as $text => $value) { echo '<option value="'.$value.'"'; if($Profile['skinstyle'] == $value) echo ' selected="selected"'; echo '>'.$text.'</option>'; } ?> </select> Edit: quite similar to CV's, just with keys/values for the options.
  13. You used a double quote instead of a single quote on the first echo... <?php echo '<div id="copyright" style="position:absolute;left:55px;width:150px;height:44px;z-index:32'; if(isset($_SESSION['myusername'])) { echo 'top:628px;'; } else { echo 'top:588px;'; } echo '" align="left"> <font style="font-size:13px" color="#000000" face="Arial">Squiblo &#169; 2009</font></div>'; ?> <div id="copyright" style="position:absolute;left:55px;top:588px;width:150px;height:44px;z-index:32" align="left"> <?php if(isset($_SESSION['myusername'])) echo '<font style="font-size:13px" color="#000000" face="Arial">Squiblo &#169; 2009>'; ?> </font></div>
  14. Which, technically could be shortened even more.. it just comes down to how readable you really want it. foreach(array('age', 'gender', 'rate', 'last_login') as $k) $data[$k] = (!empty($_GET[$k])) ? $_GET[$k] : ((isset($_POST[$k])) ? $_POST[$k] : ''); // or, with variable variables. foreach(array('age', 'gender', 'rate', 'last_login') as $k) $$k = (!empty($_GET[$k])) ? $_GET[$k] : ((isset($_POST[$k])) ? $_POST[$k] : '');
  15. You're going to want to put single quotes around the values ... VALUES ('$name', '$pass', '$email', '$ip')
  16. $sql = "INSERT INTO user (username,password,email,ip) VALUES ($name, $pass, $email, $ip"); Should be $sql = "INSERT INTO user (username,password,email,ip) VALUES ($name, $pass, $email, $ip)";
  17. You cannot use like $per = 5.35% because the per cent sign is a modulus operator. $creditcardpercent = .275 *100; $balance = $order * $creditcardpercent; // or $creditcardpercent = .275; $balance = $order * ($creditcardpercent * 100);
  18. I like the Head First series - well, at least I did when I was learning ajax methods a while back. That whole series draws things out, isn't as boring as a normal programming book, which for me led to learning the material faster
  19. ccleaner has done the job for me in the past on cleaning family's/friend's computers.... you know how some people always click the banner ads because they really think they can win a free ipod with no hitches.
  20. The following works: <?php define("INVALID_HEX_STRING", " Invalid hex string", true); echo hex_to_decimal('0xff').' :: '.hexdec('0xff'); echo "<br>\n"; echo hex_to_decimal('1e5a').' :: '.hexdec('1e5a'); function hex_to_decimal ($hex) { $hex = strtolower($hex); $hex = trim($hex); if (substr($hex, 0, 2) == '0x') $hex = substr($hex, 2); $result = 0; while ($hex != '') { $char = substr($hex, 0, 1); if (ord($char) >= ord('a') and ord($char) <= ord('f')) $val = 10 + (ord($char) - ord('a')); else if (ord($char) >= ord('0') and ord($char) <= ord('9')) $val = ord($char) - ord('0'); else return INVALID_HEX_STRING; $result = ($result * 16) + $val; $hex = substr($hex, 1); } return $result; } ?> while ($hex != ' ') should have been while($hex != '') otherwise after it checks the last digit there is nothing left of the string but the loop will run until it finds a space.... which it won't thus returning INVALID HEX STRING
  21. Ummm.... that screenie doesn't have anything to do with php's config file. Just your setup on your server. Create a page with just: <?php phpinfo(); ?> and see if anything might be blocking you
  22. Ohh thanks, looks interesting
  23. Are you sure you're running the right query? This is what I am pulling from phpMyAdmin: SQL query: SELECT DISTINCT(`ball3`) FROM `cash3` ORDER BY `date` DESC LIMIT 0, 30 ; Rows: 10 ball3 7 8 2 5 0 6 3 1 4 9 ---- SQL query: SELECT DISTINCT(`ball2`) FROM `cash3` ORDER BY `date` DESC LIMIT 0, 30 ; Rows: 10 ball2 7 1 3 6 0 9 5 4 8 2 --- SQL query: SELECT DISTINCT(`ball1`) FROM `cash3` ORDER BY `date` DESC LIMIT 0, 30 ; Rows: 10 ball1 0 8 3 7 4 1 5 6 2 9
×
×
  • 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.