Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. ob_start(); on the top of your index.php page afterwards right before the ob_end_clean(); you put: $BUFFER = ob_get_contents(); and at the very bottom of your index.php page echo $BUFFER;
  2. <table style="border-collapse: collapse;" table border="0" img { margin: 0; padding: 0; } bordercolor="#111111" cellpadding="0" cellspacing="0" width="760"> that is a wrong implementation of what i suggested, it should be (if you want it to be inline with your element): <table border='0' style='border-collapse: collapse;' bordercolor=... and for every image of you: <img style='margin: 0; padding: 0;' />
  3. how i would code this? using smarty: login.tpl {include file = 'header.tpl'} <form action='{$action}' method='post'> <table border="0"> <tr> <td><label for='{$lblUsername}'>{$txtUsername}</label></td> <td><input type='text' id='{$lblUsername}' name='{$lblUsername}' maxlength='25' /></td> </tr> <tr> <td><label for='{$lblPassword}'>{$txtPassword}</label></td> <td><input ... </tr> </table> </form> {include file='footer.tpl'} login.php $oSmarty = new Smarty; $oSmarty->assign('action', ''); $oSmarty->assign('lblUsername', 'username'); // If you are using PEAR packages like Auth, this would be something like: // $oSmarty->assign('lblUsername', $oAuth->getPostUsernameField()); $oSmarty->assign('txtUsername', 'Username:'); ... $oSmarty->display('login.tpl');
  4. // leave out the single quotes around variables if ($answer == $input) // using strcmp() and strcasecmp(); // these functions return 0 when equal, < 0 when one is shorter then the other, > 0 when one is longer then the other // case sensitive if (!strcmp($answer, $input)) // case insensitive if (!strcasecmp($answer, $input)) // check: http://be.php.net/manual/en/function.strcmp.php http://be.php.net/manual/en/function.strcasecmp.php
  5. well, as i mentioned before, GeoIP is the most accurate, they have an open-source version, check it out: http://www.maxmind.com/ @taith not exactly, that is only possible when they have been using a static ip address, if it is dynamic, it will be pointing you to a wrong location!
  6. So, a snooper visits a link, you gather it, you get his location, and then what? You ban the ip address? And what if they are working on a dynamic ip address (what they probably are)? Or do you wanna ban a complete pool (e.g.: texas)?
  7. normally your PEAR.php file should be in C:\php5\pear, if it is not in that directory, then you can obtain a copy from http://pear.php.net, if you would like to set the pear directory somewhere else, use: $my_path = 'your/path/to/pear/folder'; // no trailing slash $incl_path = ini_get('include_path'); ini_set('include_path', $incl_path . PATH_SEPERATOR . $my_path);
  8. Using an ip is never very accurate when it comes to determing the users exact location. The mechanism works as follows (in case you wish to implement it): a new ip address is found and a user is requested, to type in his location, this can easily be done through registration (or whenever a user logs in, and his current ip does not match his previous), however most ISP's provide a dynamic ip address to their clients, so you see that the accuracy of the mechanism decreases GeoIP for example contains about a few million addresses, and is more accurate then most systems, however you need to obtain a site license to use their software.
  9. There are never better ways, there are only "easier-to-maintain" ways, for example, you could seperate your presentation from your business logic using templates, i am not a real fan of having html running around in my php code!
  10. Your posting this in the wrong section, it has to come under HTML Help! Just so you know! But hey therefor they invented admins right? between your head tags: <style type="text/css"> <!-- -- more on css can be found at: -- http://www.blooberry.com/indexdot/css/index.html //--> table { border-collapse: collapse; } img { margin: 0; padding: 0; } </style> then if that does not work, try, IE already has this set to 0, dunno about FF: <table border="0">
  11. // The below code gives you the possibility to colour more then 3 rows // for example if you would like also to colour the fourth and fifth, you // only have to add 2 more colors to the $colors array! // $colors = array('#FFBB00', '#9CB400', '#9C9C9C'); do { if (isset($colors)) { $color = array_shift($colors); if (is_null($color)) { unset($colors); } } else { $color = '#ffffff'; } // color row // <tr bgcolor= $color; }
  12. just use backward slash followed by an n (newline) between double quotes <?php echo "$id \n $title"; ?>
  13. change your div into the following: <div style="position:relative;">
  14. i use <select name='comics'> so when i submit the form my chosen option will be in the $_POST['comics'] atleast when my form looks like <form method="post" ..
  15. why don't u just use: SELECT * FROM `news` ORDER BY `news_publish_date` DESC LIMIT 5
  16. if ($result = [b]mysql_query[/b]($sql)) // You can not execute a query result as a query try this edited version of sasa's code: <?php <?php require('get_connected.php'); $title = $_POST['comics']; $sql = sprintf("SELECT title, issue_number, cover_date, comic_id FROM comics WHERE title ='%s'", $title); $result = mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($result)) { echo "<select name='comics'>"; while ($row = mysql_fetch_assoc($result)) { vprintf("<option value='%s'>%s</option>", array_fill(0, 2, $row['title'])); } echo "</select>"; } echo $title; ?> ?>
  17. <?PHP $a = array('10', '20', '30', '40'); $b = $a[rand(0, count($a) - 1)]; // use mt_rand() to use the Mersenne Twister echo $b; ?>
  18. <?PHP // $hello5 ${$topic}{$_GET['ID']}; // or the eval() way eval("\$" . $topic . $_GET['id'] . ";"); ?>
  19. I always use the joomla solution <?PHP // main page define('_CONSTANT', 0x0001); // fancy way for setting something to true // page which should not be accessed directly but is included on the main page defined('_CONSTANT') or exit('FATAL ERROR: You are not authorized to access this file directly.'); ?>
  20. // For example // config.php $aConfig['app_debug'] = true; // index.php include 'config.php'; // When not using any template engine (i.e.: Smarty) // inside the <head> tags if ($aConfig['app_debug']) { echo "<link href='devOnly.css' rel='stylesheet' type='text/css'>"; } assigning default values is the same as assigning values ($var = value;), you just put it in a file and change it value or use its value at runtime.
  21. <?PHP $aFile = file('yourfile.flat'); for ($i = 0; $i < count($aFile); $i++) { list($user, $pass, $name) = explode('|', $aFile[$i]); // ... } ?>
  22. while(($mem[curlf] > 0) || ($defender[curlf] > 0)) the problem about this loop is that it only stops when both variables hit zero or less, and because the winner always have more then 0 hp will this result in an neverending loop, therefor i suggest changing the "or" (||) into an "and" (&&) which will close the loop because the loops checks for both variables being greater then 0 Also 10 minutes execution time is not really recommended, you could run out of memory and be looking at a blue screen! Ask google how to set your execution time to something more "recommended", i should use 30 seconds for development, and remove it, when going live
×
×
  • 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.