Re: [PHP-DB] Creating all key combinations passwords
I wanted to do the same some time ago and considered doing it in php but i realized that php is not the appropriate language for doing that... i wanted to insert the data into a mysql-database, too i thought about doing it in C++ but my coding skills were too poor, i didn't know how to implement mysql-access -.- i had another idea some time ago, something that should also work in php (i won't do this in php, i'd use C++ or python or something like that) the idea is the following: create all possible combinations in a C++ program and write it into a file where there is something like INSERT INTO passwords (password, hash) VALUES [and here all the data] and then import it using the command line into mysql i have this code to generate the combinations, i wrote it some time ago and unfortunately there is a segfault, i don't know why and didn't work on this for some time #include #include using namespace std; unsigned int lastcharindex(string input, string charset) { int position = charset.find(input[(input.length())-1],0); return position; } void generatewords(string start, unsigned int maxlength, string charset) { if(start.size() <= maxlength && lastcharindex(start, charset) != 0 && lastcharindex(start, charset) != charset.size() -1) { start[start.size()-1] = charset[lastcharindex(start, charset)+1]; cout << start << endl; generatewords(start, maxlength, charset); } else if(start.size() <= maxlength && lastcharindex(start, charset) == charset.size()-1) { while(lastcharindex(start, charset) == charset.size()-1) { start.erase(start.size()-1,1); if(start=="") {break;} } start[start.size()-1] = charset[lastcharindex(start, charset)+1]; cout << start << endl; start += charset[0]; cout << start << endl; generatewords(start, maxlength, charset); } else if(start.size() < maxlength && lastcharindex(start, charset) == 0) { start += charset[0]; cout << start << endl; generatewords(start, maxlength, charset); } else if(start.size() <= maxlength && lastcharindex(start, charset) == 0) { start[start.size()-1] = charset[lastcharindex(start, charset)+1]; cout << start << endl; generatewords(start, maxlength, charset); } } @Stut: the idea is NOT to be a cracker kid, the intent is only to realize that project to train and develop my coding skills and to run some tests how secure passwords are -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Search witin text.
you can use explode from php.net: >> array *explode* ( string $delimiter, string $string [, int $limit] ) Returns an array of strings, each of which is a substring of /string/ formed by splitting it on boundaries formed by the string /delimiter/. If /limit/ is set, the returned array will contain a maximum of /limit/ elements with the last element containing the rest of /string/. << as delimiter you would use a space character in this case. for example: the user input is $input = "Chris Carter"; now you can $split = explode(" ", $input); so $split would be an array that contains ["Chris", "Carter"] now you can persorm your search using $split[0] and/or $split[1] ;) I hope that's what you're looking for Chris Carter wrote: Thanks much ... this has been achieved now. However, there is another issue. Say for example, the user wants to search 'Chriscarter' but puts into the search field 'Chris Carter' how is it that I can take only the 'Chris' out of the search string and present the matching searches from the database? Any clue or link would be of great assistance. Thanks again. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Trying to add primary key to existing database.
hehe, ok i would write a script that reads the existing data from the table and inserts it into a new one that has the same structure PLUS a primary key something like: original_table:name, description, whatever new_table:id, name, description, whatever where id is primary key and auto_increment then mysql_query("INSERT INTO new_table (name,description,whatever) VALUES ($name,$description,$whatever)"); //that should add the id automatically } mysql_close($link) ?> then you can drop the original_table and rename the new_table to original_table i don't know if there's a better, more simple solution and i hope i did not forget anything important and it works this way Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Ways to display remaining data columns.
my first idea is the following: since i'm sure there must be any kind of primary key you could add a simple link that opens in a new window and passes your primary key. a script (the one in the new window) now gets the details from the database the link might be something like the following: href='details.php?unique_id=123' target='_blank'>Details but please make shure you check the submitted data before using it in a query.(think of sql injections..) you might consider using a POST form instead of GET in order to make it more secure i think it should also work with something like target='_blank' but i'm not sure at the moment i hope it helps and i hope i did not forget security issues ;) Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] retain form information -.-
sorry i fogot something... in the fill-in-form.php you would now have to modify the form to something like echo " [...] ...> to retain the information "; i think thats it -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] retaining form information when someone presses back
Flint Million: This might not be relavent for this forum, so if not please direct me to the proper one; although I do like to keep my email list subscriptions down. I have a custom application in PHP in which a user fills out a form of information. When the user submits, I perform sanity checking on the user's submitted data and refuse to actually process/insert it if those checks fail. However, my users are complaining that when they press back to correct, all the data is gone from the form and they have to re-enter it all. I know many websites that can retain the form data when someone presses back; how is this done? Flint M ok, an input field might be something like name='username' size='8' maxlegth='32'> --> the submitted variable would be stored in $_POST["username"] (or $_GET["username"] depending on what method you use to submit it) your back-button should now contain a link like href='fill-in-form.php?username=$_POST["username"]'>back to keep the information an other possibility might be using cookies but this would be impossible if the user refuses to accept cookies, so this method might not be wanted Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php