Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. Are you completely positive the request is getting to the file? If you really do have error_reporting(E_ALL); at the top of your file you should be receiving errors right now because unlike the ereg functions the PCRE functions require delimiters. Ex: preg_replace("[^A-Za-z0-9 ]", "", $name); should be: preg_replace("~[^A-Za-z0-9 ]~", "", $name);. You should change all of the other patterns accordingly.
  2. By the way, there's a feature to mark a topic as solved. To do so there's a button at the bottom left.
  3. Judging by the print_r of the $list array you should be using $list[0]['Type'] not $list['Type'][0].
  4. m is for the month. We're currently in November, the 11th month so that's why it's displaying that. Instead change m to i
  5. Notepad++ actually supports Regular Expressions. If you press Ctrl + F then goto the replace tab you can check the box that says "Regular Expressions". Then search for: $[^"]* and replace it with nothing you'll be left with what you want.
  6. It seems this has evolved into more of an ActionScript problem, unless you can confirm that the values are being sent to the PHP file. It appears that you're using AS2.0, the majority of my ActionScript knowledge lies with AS3.0, but if you post your entire ActionScript source I can try to help you.
  7. Perhaps that why it's you "all the time" then. ALEXWD has been being a rude person to me lately but i cant report him? Cause he's mod... I hope you're joking :-\
  8. I should stop trying to do 23940748 things at once, sorry. function grab_files($start_dir, $ext) { $dir = new RecursiveDirectoryIterator($start_dir); $files = Array(); foreach($dir->getChildren() as $file) if(is_dir($file)) $files = array_merge($files, grab_files($file, $ext)); else if(pathinfo($file, PATHINFO_EXTENSION) == $ext) $files[] = (string) $file; return $files; } $files = grab_files('../gallery', 'jpg'); shuffle($files); array_splice($files, 20); foreach($files as $file) { echo $file . '<br />'; } Silly mistake.
  9. I actually edited my post before you said that because I noticed that design flaw myself (if the first file found is a directory that will happen). Copy the code that's there now and it should work.
  10. I'm not sure if this class implements an easier way to do this, there isn't documentation about it in the manual, but I don't think so. Something like this will work: function grab_files($start_dir, $ext) { $dir = new RecursiveDirectoryIterator($start_dir); foreach($dir->getChildren() as $file) if(is_dir($file)) $files = array_merge((array) $files, grab_files($file, $ext)); else if(pathinfo($file, PATHINFO_EXTENSION) == $ext) $files[] = (string) $file; return $files; } $files = grab_files('../gallery', 'jpg'); array_splice(shuffle($files), 20); foreach($files as $file) { echo $file . '<br />'; } Edit: Added the 20 file limit and randomization, forgot you wanted that as well.
  11. Why not use glob. $files = glob('*.jpg'); array_splice(shuffle($files), 20); foreach($files as $file) { echo "$file<br />\n"; }
  12. Variables aren't parsed in single quotes. Use double quotes: header("Location: index.php?id=$id");
  13. You're misspelling some of the variables in the array, but yea that's the general idea.
  14. I suggest you put error_reporting(E_ALL); at the top of your file. You should be getting a mysql error like 'column count doesn't match value count', because you're specifying 8 columns to insert into, but only providing 7 values. If `ID` is an auto_increment field it's not even necessary to include it in your query, so just remove it. [ot]You shouldn't be using ereg functions anymore as they're depreciated, instead use the PCRE functions. In your case preg_replace.[/ot]
  15. That won't work. It'll give output like: first iteration: name1, name1; second iteration name2, name2; third name1, name1, etc.. I think you mean something like this: $x = 1; for($i= 0;$i < 4;$i++) { $x = ($x < 4) ? $x : ($x = 1); someFunction(${'var'.$x}, ${'var'.++$x}); $x++; } If you're going to do it that way might as well put $x inside the for()'s parameters to make it cleaner (like below). But I was under the impression that the OP wanted it to be random. for($i= 0, $x = 1;$i < sizeof($somevar);$i++, $x = (++$x < 4) ? $x : 1) someFunction(${'var'.$x}, ${'var'.++$x});
  16. Implementations? Do you mean tutorials? There are examples of implementations all over the place, just look at Google or whatever. Here is a good tutorial, http://www.phpfreaks.com/tutorial/basic-pagination
  17. You want to loop through the entire $links array and randomly choose the user/pass combination? Then do something like this: $arr = Array( Array( $_POST['note1'], $_POST['com1'] ), Array( $_POST['note2'], $_POST['com2'] ) ); for($i = 0, $c = count($links);$i < $c;$i++) { $curl = $turl[0].$links[$i]["href"]; $lcontent = getcontent($curl); $content = getthreadcontent($lcontent); $rand = array_rand($arr); something($content, $arr[$rand][0], $arr[$rand][1]); }
  18. You can get values from the query string using the $_GET superglobal. somepage.php?var=something would be accessed like so: echo $_GET['var']; // Something
  19. What about something like this? $arr = Array( Array( $_POST['note1'], $_POST['com1'] ), Array( $_POST['note2'], $_POST['com2'] ) ); for($i = 0, $c = count($arr);$i < $c;$i++) { $curl = $turl[0].$links[$i]["href"]; $lcontent = getcontent($curl); $content = getthreadcontent($lcontent); something($content, $arr[$i][0], $arr[$i][1]); } As long as you're excluding content it's hard for me to understand exactly what you're trying to do.
  20. I'm not sure why you have that second for statement, or what you're trying to do at all. Can you post your entire code and explain what you're trying to do a little better?
  21. You could do something like this: $arr = Array( $_POST['note1'], $_POST['com1'], $_POST['note2'], $_POST['com2'] ); for($i = 0, $c = count($arr);$i < $c;$i+=2) { something($arr[$i], $arr[$i+1]); }
  22. You mean something like this? <script type="text/javascript"> var customMessages = new Array('Message 1', 'Message 2', 'Message 3', 'Message 4', 'Message 5'); var secondsPassed = 0; function myFunc() { var t = setTimeout("load()", 1000); } function load() { document.getElementById("ss2").innerHTML = 'Loading..' + customMessages[secondsPassed]; if(++secondsPassed < 6) var t = setTimeout("load()", 1000); else document.getElementById("ss2").innerHTML = 'Loaded!'; } </script> <body onload="myFunc()"> <div id="ss2">Loading..</div> </body>
  23. No, like this: date_default_timezone_set('America/Los_Angeles'); $time = date(F." ".d.", ".Y." ".g.":".i.":");
×
×
  • 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.