Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. Hi, How can I modify: RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L] So that it both supports: http://domain/dashboard (currently only supports this one) http://localhost/path/to/project/dashboard The .htaccess with the rewrite rules is located in: http://localhost/path/to/project Thanks in advance, Ignace
  2. No, you are not. You can never be 100% sure, 99.9% at the most. If it isn't the code, then it's the server and if it isn't both it's a PHP bug or a MySQL bug. To many variables to be ever truly sure.
  3. while ($row = mysql_fetch_assoc($query)) { $dbusername = $row['username']; $dbpassword = $row['password']; } modify to: list($dbusername, $dbpassword) = mysql_fetch_array($query, MYSQL_NUM);
  4. session_register("myusername"); session_register("mypassword"); is deprecated use: $_SESSION['myusername'] = $myusername; $_SESSION['mypassword'] = $mypassword; echo header("location:login2.php"); should be: header("location:login2.php");
  5. $strtotime = strtotime($row['date']); $now = time(); $diff = $now - $strtotime; if ($diff > 2419200/*28 days in time*/) { echo 'no test'; } else { echo 'test'; }
  6. WYSIWY(G|M) What You See Is What You Get What You See Is What You Mean http://tinymce.moxiecode.com/
  7. I have no problem with that if it's true
  8. There are a few ways: 1. Create a fallback try/catch. try { //application code } catch (Exception $e) { //catches any uncaught exception's } 2. Use set_error_handler() & set_exception_handler() set_error_handler('error_handler'); set_exception_handler('exception_handler'); function error_handler($errno, $errstr, $errfile = '', $errline = 0, array $errcontext = array()) {} function exception_handler($exception) {}
  9. There are many tutorials and scripts already available on the internet. Googl'ing will turn up quite a few of both. I'm sure you can find a few good tutorials on the homepage of phpfreaks (http://www.phpfreaks.com).
  10. SELECT substr(column, 0, length) as alias ..
  11. <?php $result = mysql_query($query); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo 'Name: ' . $row['last_name'] . ', ' . $row['first_name'] . '<br />'; echo 'Company: ' . $row['company'] . '<br />'; echo 'Amount: ' . number_format($row['amount'], 2, ',', '.') . '<br />'; } ?> No you are not. Rome wasn't build in 1 day, all it takes is effort and some common sense.
  12. $tpl -> AssignArray(array('recent.posts' => $recentPosts)); $tpl -> AssignArray(array('recent.comments' => $recentComments));
  13. Create a database table countries and create an entry for each and every country and it's currency conversion from - if you use - USD to the country currency and update this daily or weekly.
  14. This is covered in the manual (http://www.php.net/manual/en/control-structures.switch.php)
  15. if (!empty($_GET['name'])) { $globQuery = implode(DIRECTORY_SEPARATOR, array(realpath('maps'), '*/*')); $files = glob($globQuery); $words = str_word_count($_GET['name'], 1); $matches = array();//array_flip($words); foreach ($files as $file) { $file = basename($file); foreach ($words as $word) { if (stripos($file, $word)) { $matches[$file][] = $word; // the more words a file has the higher it's relevancy } } } //executes in count($files)^count($words) I think //do something with $matches }
  16. You'll need something like simplexml (http://us2.php.net/manual/en/book.simplexml.php) to create the .RSS feeds. These RSS files need to be created according to the RSS Spec (http://cyber.law.harvard.edu/rss/rss.html). To merge multiple feeds just read them all in an individual simplexml, create a new simplexml object and add each and every other simplexml object. You can also use DOM (http://be2.php.net/book.dom) however some (new programmers) have problems by understanding the analogy.
  17. http://be2.php.net/number_format
  18. Yes a cronjob (linux) or a scheduled task (windows). Your server will then call a certain script at a certain interval and execute it.
  19. Ok, I think I know what you mean. So you want the $netcashgross (=55.00) to modify depending on the country locale? So for example if your system uses dollars and I'm from belgium it would display: 38.90 EUR. It's discussed here: http://discuss.joelonsoftware.com/default.asp?biz.5.650513.7 Eventual winner: http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml (free) Other viable options: http://www.xe.com/ (my personal recommendation, however for one single computer it's $540/year) http://dynamicconverter.com/ (free to some extend) http://www.webservicex.net/ws/WSDetails.aspx?CATID=2&WSID=10 (free)
  20. No, I don't think so. I have only one advice though before you start the resize process (which in itself is intense and may cause your script to timeout). You may want to bump up your memory limit or set the time limit for the execution of the script to 0. This way if the resizing takes longer then required or requires more resources then normal, it can otherwise the user will get an error on-screen telling him maximum execution has been reached. You can however also put a restriction of the maximum width and height. If the image is to large, remove it from the server and tell him he needs to resize it first to width x height before uploading it again. This saves you resources and you don't need to resize the image before you need to resize it again to create a thumbnail. Your visitors will thank you to as you save them bandwidth and they won't have to scroll 5 times because the image posted was in 1600x1200.
  21. $sessionid = $_GET[$userid]; run_query("select * from users_details where userid IN (select session_id from users_online where session_id = $sessionid)");
  22. Have you read the re-captcha manual? http://recaptcha.net/plugins/php/
  23. preg_replace('/\[user:([\s-a-z]+)\]/', '<a href="profile.php?user=$1">$1</a>', $text);
  24. cronjob that runs every day retrieving all users who which to be contacted daily (although I'm sure that no-one want to be contacted daily) and then send e-mails to each and every recipient.
  25. Have you checked if the server can send e-mail? Where to, do you get redirected ok.html or error.html after filling out the form? Have you checked error.log (Apache)?
×
×
  • 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.