Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. Liam, that code would simply spend a fraction over 8 seconds loading, then display the text 'script here img here'. You can have output sent to the browser whilst the script is processing, if you use the flush function. For example: <?php for($x=1;$x<=5;$x++){ echo $x.'<br />'; flush(); sleep(1); } ?> With regards to the question, i agree with BlueSky. A delayed meta refresh would be better. Although, if you wanted to give the appearance of no reload, to enhance the 'illusion' of some loading time, then an AJAX approach would work more smoothly.
  2. You can store arrays in a field in mysql, with the serialize() function. You could then use unserialize() function on the data when you retrieve it. However, you are likey to be better off not storing an array, and storing each element separately. By storing an array in a database, you are removing most of the power of a database. You would no longer be able to perform searches,sorts or any other of the many database fuctions on the data.
  3. Well, it would be nice if you told us what does happen when you try this code. However, im going to assume that nothing happens - ie, you get no error messages, but there is no writing to the file. If you are having problems with a script, it's generally a good idea to remove the error suppresion(@). Try changing this line: if ($fp = @fopen('folder/file.php', "w")) To: if ($fp = fopen('folder/file.php', "w")) Post the error message if you get one.
  4. I only looked very quickly, however, i think you need to change this line: if (!$_POST['button1']) To: if (!$_POST['button1'] && !$_POST['button2']) Since you need to check if neither button have been pressed, which only occurs at the very start. The reason why it appears to 'start over' is that when you submit the form the second time, $_POST['button1'] is again false, as this hasn't been clicked. As an aside, using isset() is better practice than just testing if a variable is false. So you would do: if(!isset($_POST['button1']) && !isset($_POST['button2']))
  5. Sure, explode by the new line: <?php $str = 'Double Zero - Rythm Beater / Immaculate Conception Double Zero strike back (just like the Empire did) with some sleazy Jump Up funk, imagine immersing yourself in a tub full of pheromones before donning a proper pimp suit and going out on the pull. Well that’s precisely what ‘Rhythm Beater’ has done, and it’s got hyped up ladies literally dripping off it. ‘Immaculate Conception’ must be what they told the aforementioned women’s fathers… anyway, it’s jammed full of more sexual chemistry that’ll make any self respecting Lady Junglist get her knickers in a knot. Nice'; list($title,$blank_line,$content) = explode("\n",$str); echo $content; ?> $title would have the title in, $blankline is just a placeholder if you like, since there is a blank line.
  6. Well, you could look into using regular expressions to search for your swear words - this would remove issues of capitalization and use of spaces before/after words, however, people will ALWAYS be able to beat the filters. You can't possibly block all possible variations on spelling and use of symbols that could be read by humans. You have to decide how important it is to block the words. Im pretty sure there are existing language filters out there. Perhaps you could have a look for one.
  7. Well obviously it doesn't work, otherwise there would be something in the $Date variable! If you were to echo $Date: $Date=$_GET['Date']; echo 'Date: '.$date.'<br />'; You would have a blank. Do you think we could see the form?
  8. Well, evidently, there is no 'Date' variable being passed in the GET array. How is this supposed to being passed? Where is it comming from? Are you sure there is a capital D on date? You're sure you're not using the POST method to submit your form? We'll need somre more code.
  9. Forgot to add, you'll need an order by clause in your query. You could use the date field for that $sql = mysql_query("SELECT * FROM news ORDER BY date DESC LIMIT 1");
  10. Two options. 1.) Add a limit statement to your query: $sql = mysql_query("SELECT * FROM news LIMIT 1"); 2.) Dont use a while loop. Instead of: <?php while($result = mysql_fetch_array($sql)) { //code here } ?> Just do: <?php $result = mysql_fetch_array($sql); //code here ?>
  11. Looks like just a typo to me: This line: $split = preg_split("#\s+#", $post, -1, PREG_SPLIT_NO_EMPTY); Should be: $split = preg_split("#\s+#", $quote, -1, PREG_SPLIT_NO_EMPTY); Of course, this function isn't going to help much if someone doens't put a space between their swear words. darkfreaks : That wouldn't help. If you used that function, then it would only ever compare the first word in the string, because the function returns something after that first word.
  12. No need to sound so suprised Glad it worked.
  13. The easiest way would be pass all the parameters you need along with the url: <?php header("location:http://www.yoursite.com/file.php?foo=bar&var=something"); ?> You can then retrieve them using from the $_GET array.
  14. Ah ok, well you dont need the table name in the key of the array. Since you have more than one field with the same name(which are across differant tables) you'll need to use AS to rename the results. For example: $resourcearray = "SELECT mainlist.title AS maintitle..." You'd then use that by using $row['maintitle'];
  15. Im sorry, you're really going to have to help us help you here. Im guessing that was a typo, and 'the code below' doesn't work. However, what do you mean by doesn't work? What happens? What's supposed to happen? Do you get an error? What 'problem' are you having? Im not being rude, its just impossible to help without knowing what we're trying to help with!
  16. Whoops. Indeed your right. Not quite sure what i was thinking!
  17. Sure. Instead of adding everything in the $dirs array to the beginning of the $files array, it'll probably be easier to cycle through the two separately. You can then echo out differant css classes for directories and for files.
  18. Well, you would need to look into working with the filesystem with php - it's entirely possible to create directories and files with php which is what you would need to do. For instance, you'll need the mk_dir() function. If you google .htaccess tutorials you'll find the password protection you need. I believe there is a way to set up password protection for different folders without having a .htaccess file in each of the folders, though i am unsure of how this works.
  19. Well, you have an infinite loop there. If $i equals $lvlgain to start with, then the loop will never end because you make no change to the $lvlgain variable inside the loop. If they aren't equal, then the loop will never run anyway. I cant really suggest what to change as i've no idea what you are trying to do.
  20. Try: <?php $files = array(); $dirs = array(); $dir=opendir($f_user); while(($file = readdir($dir)) !== false) { if($file !== '.' && $file !== '..') { if(!is_dir($f_user.'\\'.$file)){ $files[] = $file; }else{ $dirs[] = $file; } } } closedir($dir); natcasesort($files); natcasesort($dirs); foreach($dirs as $v){ array_unshift($files,$v); } echo "<ul>\n"; for($i=0; $i<count($files); $i++) { if($files[$i] != "index.php") echo '<li><a href="'. $f_user .'/'. $files[$i] .'">'. $files[$i] .'</a> - <a href=\delete.php?del='. $files[$i] .'>Delete</a></li>'; } echo "</ul>\n"; ?> I changed what is passed to the is_dir() function to make it absolute, and added everything in the $dirs array to the beginning of your $files array to make things nice and easy
  21. I actually prefer timesplitters to halo. Shooting games are most fun with other people, and timesplitters multiplayer absolutely rocks. Maybe its just because i have a playstation & not an xbox, but i dont think so. I just prefer the rediculously fast paced timesplitters.
  22. Err, something along the lines of: <?php $files = array(); $dirs = array(); $dir=opendir($f_user); while(($file = readdir($dir)) !== false) { if($file !== '.' && $file !== '..') { if(!is_dir($file)){ $files[] = $file; }else{ $dirs[] = $file; } } You can then proceed to sort the directories as you do the files, and display those above.
  23. Firstly, it would probably help if you typed in comprehensible english if you want me to be able to understand you. Second, my argument still stands. Im sure you would agree that there isn't really anything wrong with lending a book to a friend. You are, however, likely to be breaking the copyright on the book, and hence be committing a crime. In this way, i think most people would agree that breaking the law actually is acceptable in some circumstances. The real issue here is where that 'line' (which is different for everyone, and depends entirely on their morality) is. Oh, and third, why exactly do you feel the need to be so aggressive? I, of course, dont take it personally - since it is obviously not personal, given some of your other posts.
  24. GingerRobot

    Geese

    As far as im aware, there isn't such a pattern. Perhaps im wrong and there may be something which will help you get most of them right. However, i dont believe you could make it get everything right without a list. Languages evolve, they dont stick to their rules all the time. Indeed, the most common phrases are usually those which are furthest from the rules and grammer of a given language. There will always be something which breaks the rule.
×
×
  • 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.