Jabop
Members-
Posts
452 -
Joined
-
Last visited
Never
Everything posted by Jabop
-
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'); ?>
-
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?
-
Fixed. UTF-8 != utf8
-
<?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?
-
& or ; and why?
-
<?php $string='asdfasdfasdfasdfadfasdfasdfadfadfadfasdfadfadfasdfadfadfsdfsdfsdfafasdsdfsdfsdfsdfdf'; if (strlen($string)>130) { echo substr($string, 0, 130) . ' read more omg click here'; } else { echo $string; } ?>
-
Looking for an online trading community script
Jabop replied to SevereSoldier's topic in PHP Coding Help
Outsource that hahahah -
u culd do $_SESSION['temporary_variable'] = $_SESSION['take']; $_SESSION['take'] = $_SESSION['temporary_variable'] + 2; $_SESSION['take'] = $_SESSION['take'] - 1; pretty easy noob
-
eMonk <?php $array=shuffle($array); foreach($array as $key=>$value) { echo $value; } ?>
-
That wouldn't work for what you need - hold on.
-
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 ?>
-
Check my code again, I edited it. Make sure you're passing the right file.
-
Right click the page, click 'View Source,' and copy the text. Paste that into your document and there you go.
-
<?php $image_list = file_get_contents('file.txt'); $image_list = explode("\n", $image_list); echo $image_list[mt_rand(0, count($image_list))]; ?>
-
Read: http://www.phpfreaks.com/forums/index.php/topic,37442.0.html
-
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.
-
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).
-
Or you can just use intervals. DELETE FROM table WHERE date < DATE_SUB(NOW(), 1 DAY);
-
Why do people just post code and say there's an error fix it... What is "the mysql_num_rows error?"
-
[SOLVED] array_slice : removing element in array
Jabop replied to sohrab_ark's topic in PHP Coding Help
foreach $input... -
[SOLVED] array_slice : removing element in array
Jabop replied to sohrab_ark's topic in PHP Coding Help
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 -
[SOLVED] array_slice : removing element in array
Jabop replied to sohrab_ark's topic in PHP Coding Help
<?php foreach($array as $key=>$value) { if ($value=='') { unset($array[$key]); } } ?> -
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
-
Wow