Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. I see that you do this: $listtags = "$listtags,$tags"; Which would work, but I don't see that $tags has any value, did you mean $row['tags']? If so, you might want to try something like this: $listtags .= ',' . $tags;
  2. This might be useful: http://www.underwaterdesign.com/2006/06/php_create_a_cron_job_with_php.php
  3. Setting the contents of an elseif to a function would just increase the time it takes it to process (though, not noticeably) because it's calling an additional function. The same would hold true for the include.
  4. I've been working on ImageBoard project with a friend of mine. The only preview of it is http://random-anime.com The purpose of the project is to build a user-friendly, nice-looking ImageBoard, because none of them exist. Futuba (websites like 4chan), and other popular ImageBoard systems are very un-user-friendly and look horrible. I'm looking for advise, opinions etc.. We've only been working on this for about 4-5 days, but we've got a lot done. The Admin Panel is almost done, and looks really great. Preview of Admin Panel: http://random-anime.com/images/random/226.png Website: http://random-anime.com
  5. Use isset() to check if the form has been submitted. eg. if(isset($_POST['submit'])) { //Do whatever.. }
  6. Because $p doesn't include the .php extension.
  7. $split = explode("\n", $input); Then the first line would be $split[0], second would be $split[1], etc..
  8. Are you sure the file is being included correctly? Make sure the path is right, you're also missing a ; try: include 'scripts/testing.php';
  9. It's not possible with AJAX because there's no live connection, no socket opened.
  10. while($file = $dir->dir()) { if($file != '.' && $file != '..') echo '<a href="' . $file . '">' . $file . '</a><BR>'; }
  11. Oh, oops. That's because I didn't account for the fact that the last segment won't be 90 characters in length, try this: $string = 'Advanced Training Institute for Mental Health Professional Evidence-based Mental Health Treatment of Traumatized A Seinfeldian Model of Ethical Reasoning: Jerry, George, Elaine, and Kramer Teach Aspirational Ethics Psychiatric Emergencies: Best Practices in the Assessment and Management of the Patient in Crisis'; $split = str_split($string); for($i = 90;$i < count($split);$i+=90) { $temp = $i; while($split[$temp] != ' ') { $temp--; } $parts[] = $temp; } for($i = 0;$i < count($parts);$i++) { $str_parts[] = substr($string, $parts[$i - 1], $parts[$i] - $parts[$i - 1]); } $str_parts[] = substr($string, $parts[count($parts)-1]); print_r($str_parts);
  12. Something like this should work: $string = 'Advanced Training Institute for Mental Health Professional Evidence-based Mental Health Treatment of Traumatized A Seinfeldian Model of Ethical Reasoning: Jerry, George, Elaine, and Kramer Teach Aspirational Ethics Psychiatric Emergencies: Best Practices in the Assessment and Management of the Patient in Crisis'; $split = str_split($string); for($i = 90;$i < count($split);$i+=90) { $temp = $i; while($split[$temp] != ' ') { $temp--; } $parts[] = $temp; } for($i = 0;$i < count($parts);$i++) { $str_parts[] = substr($string, $parts[$i - 1], $parts[$i] - $parts[$i - 1]); } print_r($str_parts); Output: Array ( [0] => Advanced Training Institute for Mental Health Professional Evidence-based Mental Health [1] => Treatment of Traumatized A Seinfeldian Model of Ethical Reasoning: Jerry, George, Elaine, [2] => and Kramer Teach Aspirational Ethics Psychiatric Emergencies: Best Practices in the )
  13. You should probably rethink your whole template system. I could give you an alternative option, but it's really not worth the trouble that it'll cost you.
  14. Without sessions you'd have to redo the way you're currently doing it. Because the way to do it without sessions is having form verification on the same page.
  15. It looks fine at first glance. What do you mean it's inserting and updating?
  16. To make things easier you should make a simple function, to check if it's already in the database, if not add the person, otherwise just update. Something like this: function ip_exists($ip) { $result = mysql_query("SELECT `datetime` FROM `log` WHERE ipaddress='$ip'"); return (!mysql_num_rows($result)) ? false : true; } if(ip_exists($_SERVER['REMOTE_ADDR'])) { //Update } else { //Insert new record }
  17. Well, for the most part, JavaScript is dependant on the site, so it's not like you can just copy some JavaScript, slap it on your site and it'll work. For those people who don't know how to code, it wouldn't matter. I could apply the proper indentation and those people will still not understand it. But for those who know JavaScript, they would just write their own. The only real benefit of removing the white space is to make it run faster? Is the speed increase even worth it?
  18. To get a value from a function you use return: function secure_var($var){ return mysql_real_escape_string(htmlentities($var)); } $var = 'something...'; $var = secure_var($var);
  19. I was kinda wondering something about this recently. Doesn't that kind of prevent people from using your source as well? I mean if you have like 500+ lines of JavaScript and you remove all the unnecessary whitespace and make it practically unreadable who is really going to uncompress it?
  20. You can use a .htaccess file to prevent caching of dynamic pages: <FilesMatch "\.(php|cgi|pl|htm)$"> ExpiresActive Off Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform" Header set Pragma "no-cache" </FilesMatch>
  21. Besides missing a break; that looks fine. But the other way would be advised.
  22. You'll have to use the PHP GD library. There are many tutorials are online. What you want to accomplish is pretty simple. Some functions you might want to look into: Php GD image*() (png, gif, jpeg) imagecreatefrom*() '' imagecopymerge() imagecolortransparent() imagecolorallocate()
  23. 30 seconds is a pretty good standard. So that's a good thing for your php.ini value. Sometimes you'll have a script that takes more than 30 seconds to run; if you know something is going to pass that limit you can just use set_time_limit() within that specific file.
  24. Oh, I wasn't aware. Good call.
×
×
  • 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.