Jump to content

phpfreak

Members
  • Posts

    507
  • Joined

  • Last visited

Everything posted by phpfreak

  1. There's probably more overhead when you don't define the string and PHP has to go through the error reporting and tell you about it. This could of course be eliminated by suppressing the error with an @ cymbal or turning error reporting off.
  2. it looks like you're seeing the content on the page twice because you're outputting it twice. The first time - echo $file Is your first output, then if you're logged in, the second one will output as well... Perhaps remove the first echo $file from your code after you read the file. Also, fread as someone mentioned earlier is a way to do it, but I think you're on track with file_get_contents as it returns the contents into a string without the need to use all the extra functionality as described with fread. Good luck!
  3. I believe the answer was given above. You may want to look into jquery = http://jquery.com and use Javascript / Ajax to capture the state of the select menu - then pull the results from an Ajax script and populate your form fields using Javascript. PHP handles the processing as a pre-processor before your output is sent to the browser and there is nothing to do on the browser side once it's sent to your browser - therefore Javascript and AJAX will allow your application to be more interactive without loading up a new page each time a value changes.
  4. you more than likely want to use $yourfile = '/path/to/something.jpg'; Use the full system path to the file to prevent issues with the file_exists function results.
  5. I think the problem with the original code is that you're quoting the ".$sel" value... Perhaps this mod could work out.. It looks like the output would be: <option value="foo" "selected="selected"">Foo</option> That could be causing your html to break? Try this: echo '<option '.$sel.' value="'.$row['manufacturer'].'">'.$row['manufacturer'].'</option>'."\n"; There's many debates on single quotes and double quotes and I use single quotes to avoid confusion in HTML such as your initial example above. Hope that helps, if not let us know.
  6. I would personally try not to use $_GET and file names to include files. You can open yourself up to a whole mess of security issues and this has been the main way that people can get inside information about your machine - provided that you aren't using PHP's security features like open_basedir() or PHP Safe Mode. The best thing to do would be to write a map of files to an ID or something and pass that ID into the $_GET and match it to a hard set of values in your database or an array or some sort. Don't get me wrong, your method will work, but may cause security issues.
  7. The question to me is... Do you want to reinvent the wheel or try something tried and true? If this class was for a unique purpose then it makes sense to invest time into it, but always remember that we are only offering advice on how to paint your canvas.. It's your artwork not ours... Paint it how you see fit!
  8. Zend has some to use, also adodb use to be a pretty good one, not sure how well it's maintained these days.
  9. It only inserts because mysql_query($sql) or die (mysql_error()); Is only in the condition that $id is empty... I think maybe this: if (!empty($id)) { // $sql is set here, but never sent to mysql_query() $sql = ("UPDATE news SET news_title = '$news_title', news_category = '$news_category', news_short_text = '$news_short_text', news_text = '$news_text' WHERE id = '$id' "); mysql_query($sql) or die (mysql_error()); } else { // $sql is set here, and then... $sql = "INSERT INTO news (news_title,news_category,news_short_text,news_text,news_author,news_date) VALUES ('".$news_title."','".$news_category."','".$news_short_text."','".$news_text."','".$_SESSION[u_nick]."','".$last_time_seen."')"; // $sql is sent to mysql_query() mysql_query($sql) or die (mysql_error()); }
  10. It looks like you're on the right track to me... be sure to look up those functions in the PHP Manual to get a better understanding of what they do.
  11. IE is always the pain... can you post your style sheet?
  12. Just out of curiosity why not use a pre-existing database abstraction layer? There's tons of them out there already that do the same things you're wanting to do here, but already written and optimized.
  13. I would strongly advise you against putting e-mail addresses in your forms. Spam Bots and spiders are going to find this, and also someone can override these e-mail addresses via an external form and post to your processing page and end up spamming as many people as they want. I recommend you create an option and in your processing code - not visible to the public - based on which option you choose which e-mail (hard coded, or through a database of e-mails) etc.
  14. Also try using $_POST instead of $_REQUEST
  15. You can check your php.ini file and make sure the timeout isn't too low there. Perhaps you don't have access to setting the set_time_limit() function. I recommend you pull a <? phpinfo() ?> and see what the timelimit settings are. You may also be having an Apache timeout as well, so you'll want to check out your apache config settings.
  16. Do you have any code that handles the URL mapping or are you wanting to do this strictly via .htaccess / config file
  17. Nice function Crayon Violent... I'll snag that for something I'm working on now!
  18. Has anyone else noticed any further issues?
  19. I have removed the right column banner as it was causing issues with the code blocks. Very strange that is happening... it shouldn't have had any affect on the topics.
  20. time has been updated as well...
  21. sphinx has been restarted, I'll check on the IRC with Daniel tomorrow.
  22. I just wanted to pop in and apologize for the downtime today. We've been having hardware issues lately and our raid failed, followed by bad sectors on the 2nd drive. It took some time and some patience, but we finally got the site back up on the new server. We hope that you'll notice speed improvements on the site. The ads have to stay to help cover our costs in hardware and hosting. Thanks for your understanding.
  23. I've updated the css. Please refresh the style sheets and let me know if that's any better. Thanks!
  24. The point of drupal is that you wouldn't have to touch code if you didn't want to. However, you may be better off using Wordpress if you really need a tunrkey CMS.. In drupal - you would go to http://yoursite.com/node/add and then create a page. Edit that page, paste your PayPal code in there and save it and get the link. If you need to do more than that, you can get into Drupal's template system and setup a page with views, or hack your template.php or perhaps even get into drupal module development - but that all requires learning quite about how drupal functions.
×
×
  • 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.