Jump to content

Winstons

Members
  • Posts

    52
  • Joined

  • Last visited

    Never

Everything posted by Winstons

  1. Why empty firs body of 'if' ??? if (isset($_POST['escape']) || (isset($_POST['suicide']))) { // Why here is nothing wrote ??? } else { if(empty($_POST['agree'])){ echo "You need to check the box"; }else{ mysql_query("DELETE FROM `users` WHERE `id`= ".(int)($_SESSION['user_id']); } }
  2. asurfaceinbetween Show all code from your php file.
  3. You must write as if(isset($_POST['escape']) || isset($_POST['suicide'])){ // Do something } else { // Else do something }
  4. Try write it outside of the 'input' element <?php echo '<pre>' . print_r($qty, true) . '</pre>'; ?> What will on screen ?
  5. Yes. The code was for example
  6. melloorr Your code is incorrect. Below, my code, it is correct error_reporting(E_ALL); if(isset($_COOKIE)) { if (isset($_COOKIE['Key_my_site']) && $_COOKIE['Key_my_site'] == $cookiedbid) echo "Your cookie is okay."; elseif (isset($_COOKIE['Key_my_site']) && $_COOKIE['Key_my_site'] !== $cookiedbid) { header("refresh:5;url=index.php" ); echo "You have been logged out because your cookie has been compromised"; setcookie(Key_my_site, 0, $past); } else echo "Your cookie is no longer there."; }
  7. For this, you must do this if(!isset($_COOKIE['name'])) set_cookie('name', 'value'); else // Do something with existing COOKIE
  8. But you must understand, that hiding errors, also untreated variables is very very bad !
  9. At the beginning of php file, write error_reporting(0); Or just write '@' before a variable For example @$var; // Or @$_COOKIE['name'];
  10. Hmm... Try replace it <input type="text" name="qty<?php echo $id; ?>" value="<?php echo print_r($qty); ?>" size="3" maxlength="3" class="view_basket_qty" /> To this <input type="text" name="qty<?php echo $id; ?>" value="<?php echo '<pre>' . print_r($qty, true) . '</pre>'; ?>" size="3" maxlength="3" class="view_basket_qty" /> What you see on the screen ?
  11. This is wrong <?php echo print_r($qty) ?> You must write just <?php print_r($qty); ?> Or this <?php echo print_r($qty, true); ?> Last two examples is same.
  12. Tell me, what shows to You print_r($qtv); // Or print_r($rows); And where or what, outputs to screen the 'array' ?
  13. Write in body of 'foreach' print_r($qtv); And if You wrote You must replace extract($row); to extract($rows);
  14. Try replace it $contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1; To that $contents[] = (isset($contents[$item])) ? $contents[$item] + 1 : 1;
  15. Do you mean it ? $basket = $_SESSION['basket']; if ($basket) { $data = preg_split("#[s,]#", $basket); $data = array_chunk($data, 2); foreach($data as $key => $val) echo 'ID ' . $val[0] . '; Size: ' . $val[1] . '<br/>'; }
  16. $str = '1s1,12s2,16s3,28s1'; $data = preg_split("#[s,]#", $str); $data = array_chunk($data, 2); foreach($data as $key => $val) echo 'ID ' . $val[0] . '; Size: ' . $val[1] . '<br/>';
  17. Try it $str = '1s1,12s2,16s3,28s1'; $data = preg_split("#[s,]#", $str); $data = array_chunk($data, 2); echo '<pre>'.(print_r($data, 1)).'</pre>'; After, you'll get multi-array, with elements id and size
  18. son.of.the.morning Show your code. SergeiSS Hello from phpforum.ru by Winston
  19. www - is correct domain name goog - goog, too, fits the pattern. therefore believes it is right RegExp. If you you want correct url get, you must to enumerate a list of domains Try it $str = ' www.google.com http://google.com https://google.com http://www.google.com https://www.google.com google.co.uk www.google.co.uk http://google.co.uk https://google.co.uk http://www.google.co.uk https://www.google.co.uk www.goo go.ru google.lol '; preg_match_all("#(?:https?://)?(?:www\.)?[-a-z\d]{2,9}\.(?(1)[-a-z\d]{2,5}|(?:co|com|uk|us|ru|org|net))(\.[-a-z\d]{2,4})?#is", $str, $match); echo '<pre>'.(print_r($match, 1)).'</pre>';
  20. The ternary operator ? Do you mean it ? $num = '07654'; $check = substr($num, 0, 2); echo $check == '07' ? 'OK' : 'BAD';
  21. Try that $num = '07654'; $check = substr($num, 0, 2); if($check == '07') echo 'OK'; else echo 'BAD';
  22. Use the test by 'if'. If all is OK, do redirect
  23. Try set date_default_timezone_set('Europe/London'); At beginning your php file.
×
×
  • 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.