Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. You should still preform mysql_real_escape_string() on the text. But when displaying it back preform stripslashes().
  2. You didn't make it too clear what you need help with. Are you saying that the code you posted is the format of how the config.php file should be created with the information from the installation page inserted into it's designated area? If so it would probably be a good idea to create a file containing the template of that. It would look something like this: $dbhost = "{DB_HOST}"; //Database hostname $dbuser = "{DB_USER}"; //Database username $dbpassword = "{DB_PASSWORD}"; //Database password $db = "{DB}"; //The database your selecting ... Using file_get_contents() you can then get the contents of that file, then replace the replacements ({DB_HOST}, {DB_USER}, etc..) with the correct information. Example: $tpl = file_get_contents('config.txt'); // Template file as stated above $replace = Array('{DB_HOST}', '{DB_USER}', '{DB_PASSWORD}', '{DB}'); // Template replacements $values = Array($_POST['db-host'], $_POST['db-user'], $_POST['db-password'], $_POST['db']); // information from the installation page $tpl = str_replace($replace, $values, $tpl); // write $tpl to config.php
  3. If I'm understanding your correctly this can all, and should all be done within the query itself. eg. $result = mysql_query("SELECT user_name, location_message FROM users_tbl WHERE location='$userlocation' AND wanted_lvl='1' AND stealth < '$uservision'"); Where $uservision contains the vision value for the current user.
  4. An example would be like: mysql_query("UPDATE users SET post_count = post_count + 1 WHERE user_id='$id'");
  5. \n doesn't change the view that you see in the browser; the same way returns in html doesn't cause text to goto the next line. You'll see it on the next line if you goto view page source. Otherwise use <br />.
  6. You should also be preforming mysql_real_escape_string() on all strings before passing them into the mysql query.
  7. To calculate the number of bounces would be very simple. ex: $height = 100; //initial hight in centimeters $restitution = .7; $bounces = 0; while($height > 10) { $height = pow($height, $restitution); $bounces++; } echo $bounces; As for the distance traveled you'd need to factor another force into the system.
  8. For the inserting example, this would be better, only 1 query no loop. mysql_query("INSERT INTO table (ID) VALUES (" . implode('),(', range(1, 100) . ");");
  9. You'll need to CMOD to file to give it permissions, try 777.
  10. Sorry, tired. Use: move_uploaded_file($_FILES["File1"]["tmp_name"], 'D:\Hosting\123456\html\upload\\' . $_FILES['File1']['name']);
  11. You need to remove that additional \. Say you uploaded a file named "hello.jpg", the string created would be: D:\Hosting\123456\html\upload\\hello.jpg You want: D:\Hosting\123456\html\upload\hello.jpg so: move_uploaded_file($_FILES["File1"]["tmp_name"], "D:\Hosting\123456\html\upload\{$_FILES["File1"]["name"]}");
  12. Alex

    Religion

    At no point do you have to accept it as truth, because it cannot be proven. Realistically, at the end of the day, even though it cannot be proven, you say fuck it and accept it as truth...which sounds suspiciously like faith. So if you believe anything that's faith? I have faith echo "Hello World"; will output Hello World Actually, yes. Can you honestly say you know every single thing at work and involved and working together to do something as simple as even that? Or do you, like everybody else, just take for granted and not even think about all those abstracted layers of software and then hardware are doing what they are 'supposed' to be doing, and then throwing into the mix some random other thing doesn't somehow interfere. I was just trying to make a point. But that wasn't the best example. The point I'm trying to make is that this logic can't really be used successfully in many aspects of daily life. Say you're taking a test.. You get a question as follows (Just an example to prove a point): "You throw a ball up; what will happen?" A) The ball will eventually fall B) The ball will hover C) The ball will disappear D) The ball will turn into a particle accelerator Are you going to say "It's impossible to know, any of those could happen", or you are going to assume (for at least that moment) that gravity exists and it will pull the ball down?
  13. Alex

    Religion

    At no point do you have to accept it as truth, because it cannot be proven. Realistically, at the end of the day, even though it cannot be proven, you say fuck it and accept it as truth...which sounds suspiciously like faith. So if you believe anything that's faith? I have faith echo "Hello World"; will output Hello World
  14. Alex

    Religion

    So you'd say that Science hasn't taught us anything besides what is not? Even though things might not be absolutely proven to be true (as you say is impossible..) there's a certain point where you have to accept it as truth. You can say that if you throw a ball up it might fly up into space, but how would you sound then? Though technically it could, it's well established that it won't, everyone knows this. Society can't function without truths, so in theory you may be correct, but it's not really practical.
  15. Alex

    Religion

    That's not 'only' what science does.. You're not exactly using the terminology correctly either. A theory is something that has already been proven and verified by different individuals and groups not directly related. Whereas an hypothesis or more or less an educated guess. Actually I think you're confused. A theory does not imply fact, it is merely and explanation or proposal based on principles and other known facts, the theory itself is not proven, rather accepted. Although I do agree that a hypothesis is the lesser of the two, but are commonly used synonymously. If they're used synonymously they're also being used incorrectly. A single individual can not create a theory, they can only come up with a hypothesis. As by definition a theory is something that has been proven multiple times by multiple unrelated individuals. @CV: There established laws that state why gravity exists, how it works, etc. That's like saying "THERES NO PROOF WE'RE NOT INSIDE OF A COMPUTER", so that means it must be seriously considered? No, there are truths that you must believe, but they make sense logically, and they can be proven from any angle. Whereas religion, not so much.
  16. Alex

    Religion

    That's not 'only' what science does.. You're not exactly using the terminology correctly either. A theory is something that has already been proven and verified by different individuals and groups not directly related. Whereas an hypothesis or more or less an educated guess. Are you saying that there is no proof of gravity?..
  17. Alex

    Religion

    I'm agnostic atheist. I feel like I should post at least some explanation, which would ultimately be pretty lengthy, of my beliefs otherwise the assumption is that I don't have any actual reasoning behind my beliefs (as holds true for way too many people). But I'm kinda busy and don't have the time to write something like that now. Perhaps if the topic gets into more of a debate.
  18. Alex

    css

    ../ moves up a directory. Just try images/background.jpg
  19. Yea, that's pretty much all that mine does as well. But it only makes things a little easier, not a big deal. The only other advantage that my MySQL wrapper gives is that it allows me to handle MySQL connections more effectively and easily; this is useful when using PHP as the scripting language on SHELL scripts for socket-servers.
  20. try: <?php $url = "http://www.thesun.co.uk/sol/homepage/sport/other_sports/racing/1142207/Templegates-racing-tips.html"; $page = file_get_contents($url); preg_match_all("~\<roottag\>(.+?)\<\/roottag\>~s", $page, $matches); print_r($matches); ?> edit: Late
  21. If it doesn't work you'll need to get browscap.ini which isn't packaged with PHP. You can download it here And you'll need to set browscap to the path of that file in php.ini.
  22. You're looking for mod_rewrite mod_write will 'redirect' certain urls to other paths without actually redirecting. eg. You can redirect site.com/login to site.com/login.php
×
×
  • 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.