Jump to content

WebStyles

Members
  • Posts

    1,216
  • Joined

  • Last visited

Everything posted by WebStyles

  1. you need to compare the value you're putting into the <option> with the one they inputted. instead of: $options.="<OPTION VALUE=\"$id\">".$name.'</option>'; try $options.='<option value="$id"'; if($_POST['workOrderClients'] == $id) echo ' selected'; $option .= '>'.$name.'</option>';
  2. <html> <head> <script> function delayer(){ alert("it works"); } </script> </head> <body onLoad="setTimeout('delayer()', 5000)"> <h2> hello</h2> <h3> Hello world</h3> </body> </body> </html>
  3. if you're sure that is the exact output, you can do something like this: (although regex is a better way to go) $var = '<p><a href="link"><img src="image" /></a></p>'; $var = str_replace('<p><a href="','',$var); $var = str_replace('"><img src="',':',$var); $var = str_replace('" /></a></p>','',$var); $parts = explode(":",$var); $url = $parts[0]; $image = $parts[1];
  4. there are many ways you can go from here, what is the exact situation ?
  5. we do help with problems, but not ones we have to guess. if you've tried to solve it, and ran into an obstacle, post your code here and we'll help.
  6. php is server side, so whater php is doing, will be executed on the server and then sent to your browser... you can use sleep($secs) at the start of one of your scripts, to delay the execution, but it won't be the same thing. Some browsers will jump to a blank page while your script is waiting. Firefox will actually wait before the script is over until it jumps, so in firefox you can (sort of) simulate the effect with php. Javascript will do a much better job.
  7. you can include javascript in your code to achieve that result.
  8. nope, that's not going to work either.
  9. 1. copy code 2. paste in you file 3. place file on server 4. execute through browser 5. post results here
  10. $model = isset($_POST['model']) && trim($_POST['model']) != '' ? $_POST['model'] : ''; $query = "SELECT * FROM cars WHERE Model='$model'"; if($model) == "") $query = "SELECT * FROM cars"; $result = mysql_query($query);
  11. I can see several things with your code. 1. Not checking to see if $_GET['code'] exists and not planing for when it doesn't 2. creating an unnecessary mysql_query before if (isset($_POST['submit'])) { ... 3. this: $sql2 = "UPDATE users WHERE pilotID='$pilotid'"; is supposed to update what? 4. You have most of the code in a while loop but at the end of the first loop you do this: header("Location: login.php");
  12. You want the full code? Here you go: <?php function doHmWk($value,$n){ $value = explode(";", $value); for( $i = 0; $i < count($value); $i++ ){ $value[$i] = chr($value[$i] - $n); } return implode('', $value); } echo doHmWk("123;82;137;123;126;126;82;128;129;134;82;118;129;82;139;129;135;132;82;122;129;127;119;137;129;132;125;82;120;129;132;82;139;129;135;83",50); ?>
  13. @darkfreaks the ternary operator takes 3 operands: a condition, a result for true and a result for false: $something = $i > 1 ? 'True' : 'False'; you have 4 operators in yours.
  14. $model = $model is still redundant. you don't need the 'else' if ( trim($model) == "" ) $model='ALL models';
  15. Are you sure about this? if ( $model == "" ) { $model=''; }else{ $model=$model; } it's basically saying: If $model is empty, then set $model to empty, otherwise, (if $model is not empty) make $model = $model... it's kind of redundant no?
  16. Not sure about tools being available, but in those situations, what I do is: 1. Use gmail for testing (emails arrive within 1 second so there's not much waiting time) 2. start with a base that works, and add my stuff gradually, testing after adding every line. instead of writing all the code and then trying to find the problem, I find it easier to add a line at a time, and keep testing, so I always know where the problem is. I know this is not what you asked, but hey, just thought I would shout it out, in case you don't find any cool tools. Hope it helps
  17. you reference them when you declare the function, not when you're passing them in.
  18. what happens when a user goes to a new page? that page's PHP code executes and return something to the user, right? Just put the code in that page, or script, whatever you're calling.
  19. with the code I gave you above.
  20. Something in the lines of: // set time of last activity $userTime = time(); mysql_query("update `table` set where `activityTime` = '$userTime'",$conn); // force logout to those inactive for over 2 minutes $inactivityTime = time() - 120; // 2 minutes mysql_query("update `table` set `loginStatus` = '0' where `activityTime` < '$inactivityTime' ",$conn);
  21. if you use time() it will give you a timestamp in seconds. (number of seconds since 1st Jan 1970 to be more exact) Store that in you database whenever a user interacts, then all you need to do is search through the database and set the field to 0 on all timestamps that are greater than 2 minutes (whatever you want). since it's all done in seconds, 2 minutes = 120 seconds.
  22. store the timestamp with every action they perform (whenever they click on something or send a message).
  23. popup? like in javascript popups? echo '<script>alert("Invalid Username or Password");</script>'; ? ? ?
×
×
  • 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.