Alex
Staff Alumni-
Posts
2,467 -
Joined
-
Last visited
Everything posted by Alex
-
You can use file_get_contents() or cURL. Since you're not posting data file_get_contents() will work fine. ex: $var = file_get_contents('http://submissions.ask.com/ping?sitemap=http://www.mysite.com/sitemap_index.xml');
-
When you're outputting apply nl2br() to it as well.
-
'INVALID_HEX_STRING' isn't defined anywhere. You'd have to define it like.. define("INVALID_HEX_STRING", "Invalid hex string... etc..", true);
-
I prefer working on the back-end. I'm decent with graphics, but I just don't enjoy working with them that much. And I'm terrible with colors and making things it together on the larger scale.
-
Click the 'top solved' button in the bottom left of the page please.
-
Well, first off in the form it says 'Submit-pool' and in the code you're using $_POST['submit-pool']. It is case-sensitive.
-
$ganja=date("D dS M h:i A", time() + (60 * 10));
-
You'll have to use CRON jobs.
-
$fh = fopen($file,'w+');
-
You're looking for mod_rewrite edit: I'm late.
-
// create an array of permitted MIME types $permitted = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/png','application/msword');
-
[SOLVED] Parse string from the middle of a string
Alex replied to refiking's topic in PHP Coding Help
You mean delete everything before or after (like you said) Or delete everything within those 2 variables, like you demonstrated? $string = "12345" $section1 = 12; $section2 = 4; $newstring = str_replace(Array($section1, $section2), NULL, $string); echo $newstring; // 35 -
Because you want to echo the count, you'd do this: <?php include "db.php"; $sql = mysql_query("SELECT COUNT(id) FROM users"); $row = mysql_fetch_assoc($sql); echo "MythScape has {$row['COUNT(id)']} members!"; ?>
-
Make the topic as solved. There's a button on the topic page, bottom left.
-
} else ( echo "I'm sorry, there's a problem with your form. Please try again."; ) should be } else { echo "I'm sorry, there's a problem with your form. Please try again."; } The { and } were ( )
-
Have a drop down menu for them to select their time zone, store it, then use date_default_timezone_set()
-
Whoops, my fault. I read that wrong.. I'm tired it's after 4am Use Eval() Here's an example: <?php $function = 'foobar'; function foobar() { echo 'foobar'; } eval($function . '();'); ?>
-
$uploaded_size and $uploaded_type have no value. So of course it won't work. Also, for your $ok, why don't you use a boolean, and just use "true/false"? Would be easier. Additionally, you could just change your structure because the whole $ok, thing isn't even needed. The errors should be enough to notify the uploader that their file wasn't uploaded. You might want to look into filesize() and getimagesize()
-
You can use a while() loop, a for() loop, or just add an incremented number into your foreach() like.. $i = 0; foreach($r->getItems() as $entry) { if($i >= 5) break; echo '<div class="infoblock">'; echo "<p>"; echo '<a style="font-size: 130%;" href="'; echo $entry['link']; echo '">'; echo $entry['title']; echo "</a></p>"; $line=$entry['content:encoded']; $line=str_replace('/>','>',$line); $line=str_replace('</p>','</p><p> </p>',$line); echo $line; echo "<p style='text-align: center;'><a href='".$entry['comments']."'>Click here for comments or to leave a reply</a></p><p> </p>"; echo "</div>\n"; $i++; }
-
The literal for single quotes is "read as string". So everything inside of single quotes will read as a string.
-
if ($logged['username'] && $logged['level'] == 'mod' || $logged['level'] == 'admin' || $logged['level'] == 'owner')
-
$this_order = $row[$which]; Anything inside of single quotes will be evaluated as a string. So technically what you had was saying $row['$which'] Actually the string '$which' and not the value of $which.
-
Why would you use a hidden field? First off that's insecure, those can be edited. All you need to do is use $_SERVER['REMOTE_ADDR'] where ever you're inserting it into the database. Because the file is still being requested by the user it'll still contain their ip.
-
[SOLVED] get file contents and splitting problem :(
Alex replied to jamesxg1's topic in PHP Coding Help
If it's already in the text file then it sounds like you want to output the exact contents of the file? <?php $textfile = 'datafiles.txt'; $handle = fopen("$textfile", "r"); $contents = fread($handle, filesize($textfile)); fclose($handle); echo nl2br($contents); Or am I wrong?