Jump to content

Masna

Staff Alumni
  • Posts

    288
  • Joined

  • Last visited

About Masna

  • Birthday 10/12/1990

Profile Information

  • Gender
    Male
  • Location
    New York

Masna's Achievements

Member

Member (2/5)

0

Reputation

  1. $wanted_values = array(); foreach($colors as $towns){ $hello = explode(" ", $towns); $wanted_values[] = $hello[1]; } //now use $wanted_values however you want - [0] -> "hello", [1] -> "this", etc.
  2. Once anything is outputted by a php page, php flushes the buffered implied headers (auto-generated unless explicitly defined otherwise, things like Content-Type) and starts generating a response for the HTTP request. Because of echo "anything";, you are forcing this to happen. Thus, any headers you try to set thereafter (however you do it, including using the header() function) are rendered useless. It'd be like trying to set an accept encoding in your POST body - it just makes no sense.
  3. I tend to agree with this. Its ease-of-use is both a blessing and a curse for the Internet as a whole.
  4. Lol yeah that was my first though. Sometimes, just sometimes, I can't tell the difference between a troll and an extremely ignorant person. No offense OP, no offense.
  5. I come across lots and lots of criticism across the net towards PHP and many of its axioms as well as implementations. How do you all feel about this? Do we agree that PHP, overall, is not a solid, dependable language? Do we disagree and argue that, with the right set of tools and knowledge, PHP is as good a language as any? Some examples of the hate I often see are on phpwtf.org. Although essentially all of it is avoidable, there are some things worth discussing (I think).
  6. It's AJAX just the same. A function is repeatedly called in the background that utilizes AJAX to check for updates (stuff that wasn't there the last time the function was called). It's probably something like every 2 or 3 seconds it's called (or maybe every second - I don't know just how much Facebook servers can handle but it's probably a lot more than I imagine).
  7. What you did looks fine (and should work).
  8. Well, clearly, you're not. You're use of the "onClick" attribute of input "book" clearly indicates that you're trying very much so to incorporate JavaScript in this file.
  9. Try this: $Affcookie = 0; $Affcookie = $_COOKIE["track"]; if ($Affcookie == 0) { $Cookvar = 1; $Expire = time() + 60*60*24*60; setcookie("track", 1, $Expire, "/"); } if ($Cookvar == 1;) { echo 'blah'; }
  10. Lol. There's an extremely distinct difference between JavaScript and PHP (that which doesn't allow you to mix them). Try this: <script type="text/javascript"> function dataInsert() { alert('TEST'); } </script> <?php function timeCompare($tabletime) { global $result; global $q; $available = true; while ($row = mysql_fetch_array($result)) { $qtime = substr($row['date'], 11, 16); if ($tabletime == $qtime) { echo "<td>TAKEN</td>"; $available = false; break; } } if ($available) { echo "<td>"; echo "AVAILABLE - "; echo '<input type=button name="book" value=" BOOK NOW " onClick="javascript:dataInsert()"/>'; //This is supposed to call the function, and display the alert message echo "</td>"; } if (mysql_num_rows($result) != 0) { mysql_data_seek($result,0); } } ?>
  11. <?php //Populates $gang variable $query = $db->execute("select * from gangs where `id`= '".$player->gang_id."'"); if ($query->recordcount() == 0) { header("Location: ../your_gang/register.php"); } else { $gang = $query->fetchrow(); } ?>
  12. Don't do this: $result1 = $op->runsql("SELECT a.last_access FROM ".tbl_author." a WHERE a.id = '$userid'"); if(mysql_num_rows($result1) > 0){ while($row1 = $op->select($resul1t)){ $last =$row1['last_access']; if ($last < time() - (60*15)) { // 15 minutes cosideration $result = $op->runsql("UPDATE ".tbl_author." SET status = 1 WHERE id ='".$userid."'"); }else{ $result = $op->runsql("UPDATE ".tbl_author." SET status = 0 WHERE id ='".$userid."'"); } } } I know I suggested it to you, but I'm tired and I wasn't thinking clearly. The above script will put a very serious strain on your server and MySQL Database(s). Instead, simply check the time when a user views another user on profile.php (or anywhere that online status is shown for a particular user).
×
×
  • 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.