Jump to content

Jabop

Members
  • Posts

    452
  • Joined

  • Last visited

    Never

Everything posted by Jabop

  1. Oni-kun, if allow_url_fopen was not set to true, it would have thrown another error message explicitly stating such. I found out why it wasn't working. Some sites are finicky when it comes to user agents, so I set this at the beginning of my script: <?php ini_set('user_agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.16) Gecko/2009121601 Ubuntu/9.04 (jaunty) Firefox/3.0.16'); ?>
  2. Code: <?php // www.digg.com print_r(get_headers('http://www.digg.com', 1)); // digg.com print_r(get_headers('http://digg.com', 1)); ?> Response: Warning: get_headers(http://www.digg.com) [function.get-headers]: failed to open stream: HTTP request failed! in /home/jacob/workspace/tester.php on line 3 Warning: get_headers(http://www.digg.com) [function.get-headers]: failed to open stream: HTTP request failed! in /home/jacob/workspace/tester.php on line 6 Any idea why this isn't working?
  3. <?php $link=mysqli_connect(SERVER, USERNAME, PASSWORD, DB, '3306'); $res=mysqli_query($link, "SELECT name FROM products_wrappers WHERE name LIKE 'ProductName% Pro Complete"); while($result=mysqli_fetch_array($res)) { echo $result[0]; } echo '<br />'; $res=mysql_query("SELECT name FROM products_wrappers WHERE name LIKE 'ProductName% Pro Complete'"); while($result=mysql_fetch_array($res)) { echo $result[0]; } ?> This code returns: ProductName� Pro Complete ProductName™ Pro Complete Why does mysqli return an invalid character, while mysql returns the valid ™ (trademark) character?
  4. <?php $string='asdfasdfasdfasdfadfasdfasdfadfadfadfasdfadfadfasdfadfadfsdfsdfsdfafasdsdfsdfsdfsdfdf'; if (strlen($string)>130) { echo substr($string, 0, 130) . ' read more omg click here'; } else { echo $string; } ?>
  5. u culd do $_SESSION['temporary_variable'] = $_SESSION['take']; $_SESSION['take'] = $_SESSION['temporary_variable'] + 2; $_SESSION['take'] = $_SESSION['take'] - 1; pretty easy noob
  6. eMonk <?php $array=shuffle($array); foreach($array as $key=>$value) { echo $value; } ?>
  7. That wouldn't work for what you need - hold on.
  8. You'd start like this. <?php $Username=mysqli_real_escape_string($_GET['user']); $Query=mysqli_query("SELECT * FROM users WHERE Username='$Username' LIMIT 1"); // blah ?>
  9. Check my code again, I edited it. Make sure you're passing the right file.
  10. Right click the page, click 'View Source,' and copy the text. Paste that into your document and there you go.
  11. <?php $image_list = file_get_contents('file.txt'); $image_list = explode("\n", $image_list); echo $image_list[mt_rand(0, count($image_list))]; ?>
  12. Read: http://www.phpfreaks.com/forums/index.php/topic,37442.0.html
  13. It's not about headers being 'called.' the problem is that they're 'sent.' that means any data, even whitespace, sent to the client, also sends the headers which means you can't set any more.
  14. something is already being output before you get to your header. restructure your code or isntead of the second header, echo some javascript redirection (fail).
  15. Or you can just use intervals. DELETE FROM table WHERE date < DATE_SUB(NOW(), 1 DAY);
  16. Why do people just post code and say there's an error fix it... What is "the mysql_num_rows error?"
  17. Also, if you want to reassign the indexes to their new values, perform this afterwards: <?php $array=array_keys($array); ?> EDIT: Just did some googling and found a more simple function. http://us2.php.net/array_filter
  18. <?php foreach($array as $key=>$value) { if ($value=='') { unset($array[$key]); } } ?>
  19. I would make a permissions table or even serialize an array of available permissions in a column the users table, to make it easier. your concept is very similar but they way you're checking (less than, less than or equal to, etc) doesn't seem to be the best way to do it. what's wrong with what you have, though? edit: revraz beat me to 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.