Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. Why would you do that? What's the purpose of storing timestamps like that? As you can see that's only causing you problems. You really shouldn't be storing them like that. You can try something like this to do what you ask, but I really suggest you don't do it this way.. $ctime = date("ymdHis"); list($year, $month, $day, $hour, $minutes, $seconds) = str_split($ctime, 2); echo "$day/$month/$year $hour:$minutes:$seconds";
  2. $query is undefined. You're executing the query on the previous line: $sql = mysql_query("INSERT INTO `users` (`userid`, `members`, `rank`, `xfire`) VALUES ('$userid', '$firstname', '$lastname', '$username')") or die(mysql_error());
  3. You have too many semicolons. You only place a semicolon at the end of a statement. Since you're concatenating a string, you don't put them there. You also need to escape th double quotes in the string. echo "<h2>Logged In</h2>" ."<a href=\"http://www.virtualamerican.org/filepirep.html\">File a PIREP</a>" ."<a href=\"http://www.virtualamerican.org/logbooks/select.html\">Logbook</a>";
  4. You can use fsockopen. $fp = fsockopen('www.google.com', 80, $errno, $errstr, 5); echo $fp ? "Online!" : "Offline!";
  5. Make a function like this: function strpos_array($haystack, $search){ foreach($search as $term){ if(strpos($haystack, $term) !== false){ return true; } } return false; } Then use it like this: $arr = array("Bad Dog", "Bad Cat", "Bad Bear", "Nice Bear", "Nice Dog"); $angry_animals = array('bad', 'ugly', 'mad'); foreach($arr as $key => $val){ if(strpos_array($val, $angry_animals)){ unset($arr[$key]); } } print_r($arr);
  6. You mean something like this?: $arr = array("Bad Dog", "Bad Cat", "Bad Bear", "Nice Bear", "Nice Dog"); foreach($arr as $key => $val){ if(strpos(strtolower($val), 'bad') !== false){ unset($arr[$key]); } } print_r($arr);
  7. That's just a string, it's not doing anything. All that line of code does is print out of the variable $user then * then the variable $id Ex: $user = 'foo'; $id = 1; print $user."*".$id; // Output: foo*1
  8. != means not equal. !== means not identical. See the manual on comparison operators. Here's an example demonstrating the difference: $var1 = false; $var2 = 0; if($var1 != $var2){ // Won't get here because 0 == false (evaluates to) } if($var1 !== $var2){ // Will get here because $var1 isn't identical to $var2 }
  9. For future reference, if your question is answered it's appreciated if you mark it as solved so people don't waste their time looking at it. There's a button at the bottom of the page to do so.
  10. Please post your exact code. That should work, but you could be making another mistake; for example, echoing out $_POST['data'] instead of $data.
  11. ini_set('display_errors', 0);
  12. What are you talking about? There's no PHP there at all. The browser client doesn't care what the server side language being used is, it never has to deal with it period (hence server-side). The browser just sends the request to the server, the server does whatever it's instructed to do and returns the response in the form of HTML.
  13. As suspected, your problem is a scope problem. You're trying to use $this inside of the gradient function, it is not defined there. Read about variable scopes here. Why are you even using OOP in the first place? You're not using it in any way shape or form that would give you an advantage. It's a horrible implementation, all you're doing is packing everything inside the constructor of the object.
  14. My mistake, I forgot that pathinfo doesn't return an array when you specify a specific option to return. $arr = array('jpg', 'bmp', 'gif', 'png' /* ... */); if(in_array(pathinfo($variable, PATHINFO_EXTENSION), $arr)){ // ... }
  15. pathinfo $arr = array('jpg', 'bmp', 'gif', 'png' /* ... */); $info = pathinfo($variable, PATHINFO_EXTENSION); if(in_array($info['extension'], $arr)){ // ... }
  16. You could use an ini file along with parse_ini_file.
  17. No, you either need to use a file with a .php extension or use that method to allow .html to be parsed as a PHP document, AFAIK there is no other way.
  18. Oh then yes, that needs to be executed by PHP to work, obviously. There are ways to make the server parse .html files as PHP files though.
  19. @5kyy8lu3, the function is file_get_contents, and because you're including a remote file in this case it doesn't matter whether you use include or file_get_contents, you'll only get the output of the file regardless. @receiver, any file can be included.
  20. The JavaScript could look something like this: <script type="text/javascript"> var time = 10; function startCountdown(){ var t = setTimeout("countdown()", 1000); } function countdown(){ --time; if(time == 0){ document.getElementById("countdown").innerHTML = "<a href='...'>...</a>"; }else{ document.getElementById("countdown").innerHTML = time; var t = setTimeout("countdown()", 1000); } } </script> <div id="countdown">10</div> <button onclick="startCountdown();">Start</button> All you need to do is style it.
  21. Yea of course, you could probably style it to get it to look the same way you had it in flash and just put a background on it.
×
×
  • 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.