Jump to content

neylitalo

Staff Alumni
  • Posts

    1,853
  • Joined

  • Last visited

    Never

Everything posted by neylitalo

  1. You need to have PHP running as an Apache module for HTTP authentication to work - I'm guessing you've got it running as CGI.
  2. something like this should do what you're asking for, unless I'm misunderstanding you. [code]<?php $var = array(); while($x < 10) {     $var[$x] = $result_select;     $x++; //to prevent an infinite loop! } print_r($var); ?>[/code]
  3. [!--quoteo(post=351941:date=Mar 5 2006, 07:54 PM:name=ToonMariner)--][div class=\'quotetop\']QUOTE(ToonMariner @ Mar 5 2006, 07:54 PM) [snapback]351941[/snapback][/div][div class=\'quotemain\'][!--quotec--] Variable variables (as they are called) can be very useful. neylitalo has the basics correct.... $var = 'name'; creates a container so you can vary the varibale used so echoing $$var would echo out the contents of $name. It becomes really useful looping through similar variables like so.. say you have lots of variables called: foo1, foo2, foo3....foo4 now you don't have any array to loop through as they are all independant vars as far as php is concerned BUT if you do this $i = 1; do { $var = 'foo$i'; echo $$var; $i++; } while ($$var); that would echo out each and every variable fooNUMBER. [/quote] That's the only thing I can see it coming in handy for. However, there is an easier way. Now, I'm not saying your method is wrong, but I want to point out one little thing. Why not just create an array? ;) Call it $foo, and have the keys be numbers. And you can do so much more stuff with arrays. foreach loops, sorting, the whole nine yards. And quite honestly, I don't see ANY situation where it would be easier to have a bunch of variables than a single array with several keys.
  4. I think this is how it would work. Say you have a variable called $name. [code]$name = "john";[/code] And say you want to assign the NAME of another variable based on $name. I honestly don't know why you'd want to, but you do. :) You can then do this: [code]$$name = "male";[/code] It puts the contents of $name ("john") in place of "$name", so you effectively have: [code]$john = "male";[/code] So now you can work with the variable $john.
  5. ah... you won't need classes to do this. All you need to do this is access the $_GET array. Check this out. If you're accessing this URL [code]http://www.domain.com/index.php?a=1&b=2[/code] then put this code into index.php to get the data from that URL: [code]<?php $a = $_GET['a']; $b = $_GET['b']; echo $a; //will echo 1 echo $b; //will echo 2 ?>[/code]
  6. This is used in the following syntax: $object->method(); (where method is the name of a function, and object is an instance of a class) $object->property; (where property is a variable in a class - the OOP term is property) ie: [code]<?php class person {     public function __construct()     {         $firstName = "John";         $lastName = "Smith";     }     public function getFirstName()     {         return $this->firstName;     }     public function getLastName()     {         return $this->lastName;     } } ?>[/code] That's an example of a [i]class[/i]. $firstName and $lastName are [i]properties[/i] of the class, and getFirstName() and getLastName() are [i]methods[/i] of the class. When referencing methods or properties [i]inside[/i] their containing class (look at getFirstName and getLastName), you use $this to reference the class. It's always an object on the left and a method or property on the right of the ->. Hope I didn't confuse you. :)
  7. This is probably because of the different types of line breaks on the different OSes. Here's how the line breaks work in Unix: \n Mac: \r Windows: \n\r Use \n\r to be safe :) [b]edit: [/b]Barand's too quick ;)
  8. You may want to develop with MySQL 4 for a few months until 5 becomes popular - it's going to be a slooow transition. I have not seen one web host that has MySQL 5. The Apache 2 thing should be easy to find, but that's not as crucial as the PHP or MySQL. Sure you'll be able to find a host that does Apache 2 and PHP 5, but you may as well give up looking for a good, relatively cheap host with MySQL 5. One (sorta) easy way to do it would be to get a VPS, as steelmanronald06 said. Granted, you have to know a bit (ok, a lot :D ) of Unix/Linux and be willing to do everything yourself, but then... you get to do everything yourself. And then you can have whatever versions of whatever software you want. And to answer your other question, you'll most likely be making changes on your home computer and uploading them to your web server via FTP. Unless you get a VPS (or dedicated server), in which case you could SSH into it and use Vim or nano or your favorite command line text editor to edit the files directly. I personally [a href=\"http://www.ace-host.net\" target=\"_blank\"]http://www.ace-host.net[/a] for hosting - excellent deals, and when I had a problem (only once) they were very prompt and helpful in solving it. It's not one of the usual names that pops up, but I'm hosted on their servers and it's excellent.
  9. I'm guessing it's one of the following: a) The file that's throwing this error is not in the same directory as the vpopmail, domains, or domain directories. b) The user that's running the script does not have permission to vpopmail/domains/domain. I'm guessing it's [b]a[/b] - it's very easy for a particular directory to not contain another particular directory ;) If it's a), you may be missing a package that will create the appropriate directories. Google vpopmail and see what it belongs to. You may want to check at some other Linux-specific forums. Some of my favorites: linuxforum.com and linuxquestions.org. You may be able to get some CentOS specific help from a CentOS forum, but I'm not sure what kind of support the Red Hat family has, these days.
  10. Risk. An excellent game - but you may want to save it for a really crappy day. A game can take hours.
  11. I don't think you would use more than one database for one application - I'm guessing they include multiple DBs in the case of somebody hosting more than one system/application on their web server.
  12. Assign your database connection string to a variable, echo it, and let us know what the result is. And I'm assuming that the DB library is installed by the way it generated the error.
  13. I'm just guessing here, but wouldn't you be able to put some kind of timer going, and when it hits a certain time, have it do something? I don't really see the advantage of being able to do something with no interaction from the user, unless it's time-based.
  14. I highly doubt it - you could make a system call on the server you want to restart it on, but I don't know how Apache would react to being shutdown by one of it's processes :x <?php exec("/usr/local/apache2/bin/apachectl restart"); ?> would do it for most custom compilations of Apache, if it would work. That would be the command to use. Assuming your server is running Linux.
  15. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]whats the last bit, the .md5("salt") bit do? It just makes it harder to brute force. Anything that makes it different than md5($password) will help.
  16. My httpd-std.conf in /usr/local/apache2/conf - but that's a custom build of Apache. I don't know where Fedora would have put it. According to a Google search, the Fedora RPMs put httpd.conf in /etc/httpd/conf, but I don't know where the default would be.
  17. databases are designed to handle large amounts of data - 16,000 rows would be child's play. If you really want power, though, use PostgreSQL - I'm just starting to use it, and I'm already seeing how much more powerful it is than MySQL. [a href=\"http://www.postgresql.org\" target=\"_blank\"]http://www.postgresql.org[/a]
  18. Sure, that would work, so long as you do the same when you are going to compare the string provided by the user. Let me clear something up really quick: no one method of salting works better than another. When somebody runs a brute-force attack, they usually just md5() the string they're trying JUST ONCE. They don't md5() it and md5() it again, they don't md5() it and reverse it, they don't do anything special. There are just too many combinations of possibilities to even come close to hitting the correct one. The point of salting is so they DO have to guess. And if they guess, they probably aren't going to be right. So, any of the following would work beautifully, as long as you keep it consistent. And feel free to make your own "algorithm". [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--][span style=\"color:#0000BB\"]<? md5[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]md5[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$string[/span][span style=\"color:#007700\"])); [/span][span style=\"color:#0000BB\"]md5[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]strrev[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$string[/span][span style=\"color:#007700\"])); [/span][span style=\"color:#0000BB\"]strrev[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]md5[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$string[/span][span style=\"color:#007700\"])); [/span][span style=\"color:#0000BB\"]str_rot13[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]md5[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$string[/span][span style=\"color:#007700\"])); [/span][span style=\"color:#0000BB\"]md5[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]md5[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$string[/span][span style=\"color:#007700\"]).[/span][span style=\"color:#0000BB\"]md5[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"salt\"[/span][span style=\"color:#007700\"])); [/span][span style=\"color:#FF8000\"]//Just DON\'T do this: [/span][span style=\"color:#0000BB\"]md5[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$string[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#FF8000\"]//because that\'s what the hackers are expecting. [/span][span style=\"color:#0000BB\"]?>[/span] [/span][!--PHP-Foot--][/div][!--PHP-EFoot--]
  19. I can give you a start - but not much else :X http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
  20. 317307[/snapback] ah... didn't see that bit in there. I must have missed it.
  21. but you can't. And anything that's going to throw a hacker off is good - just do something other than straight MD5ing it. As long as you throw something else in the mix, they'll never be able to guess it to brute force it.
  22. neylitalo

    QMail

    qmail binaries are only available for Unix based systems.
  23. huh. I would have guessed it would work beautifully. Is there a setting in php.ini that says "You can't override this using ini_set"? I've been looking but can't find one... just an idea.
  24. use ini_set at the start of your scripts [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--][span style=\"color:#0000BB\"]<? ini_set[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"session.use_cookies\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#DD0000\"]\"1\"[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]ini_set[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"session.use_only_cookies\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#DD0000\"]\"1\"[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]?>[/span] [/span][!--PHP-Foot--][/div][!--PHP-EFoot--]
  25. you wouldn't be able to unencrypt it - MD5 is a one-way hash. You cannot "unencrypt" an MD5 hash. The standard method for MD5 authentication is to store the password as a MD5 hash (salted, unsalted, whatever) and then, when a user tries to authenticate, take the password they provide, run the same algorithm on it, and compare the hashes. If the hashes match, then the password is valid.
×
×
  • 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.