[PHP-DB] Password generator
Hi people, I have to make a password generator, but i have a little problem. - It needs to generate password 8 characters long, and including 1 or 2 special characters(like #$%&*@). - Those special characters can never appear as the first or last character in the string... anywhere between is fine. I have a password generator script now that does the first thing... but the special character can be in front or back of the string wich it shouldnt.. i have been looking on the web for this but i havent found the answer. Below is my scripts so far.. Any help is appreciated, thanks for your time, Best regards, Davy Obdam // This variable contains the list of allowable characters // for the password. Note that the number 0 and the letter // 'O' have been removed to avoid confusion between the two. // The same is true of 'I' and 1 $allowable_characters = "abcdefghefghijklmnopqrstuvwxyz0123456789%#*&"; // We see how many characters are in the allowable list $ps_len = strlen($allowable_characters); // Seed the random number generator with the microtime stamp // (current UNIX timestamp, but in microseconds) mt_srand((double)microtime()*100); // Declare the password as a blank string. $pass = ""; // Loop the number of times specified by $length for($i = 0; $i < $length; $i++) { // Each iteration, pick a random character from the // allowable string and append it to the password. $pass .= $allowable_characters[mt_rand(0,$ps_len-1)]; } // Retun the password we've selected return $pass; } $password = generate_password(); echo $password; ?> -- --- Davy Obdam Web application developer Networking4all email: [EMAIL PROTECTED] email: [EMAIL PROTECTED] internet: http://www.networking4all.com --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] date() and mktime() functions: weeknumbers and months.
Hi people, I would like to select news from my database bases on week/year and month/year. How can i do this.. I would like to pass two arguments in the query string, like news.php?week=14&year=2003 or news.php?month=3&year=2003. Can anybody help me.. Thanks in advance. I have been looking at the date() and mktime() functions, but is there anyway to determine the date from a weeknumber? I have been using this: $yr="2003"; $mnth="03"; $dy="31"; echo "base date: ".$yr."-".$mnth."-".$dy.""; echo "last sunday: ".date("Y-m-d", mktime(0,0,0,$mnth,$dy-date("w",mktime(0,0,0,$mnth,$dy,$yr)),$yr)).""; echo "next saturday: ".date("Y-m-d", mktime(0,0,0,$mnth,$dy+6-date("w",mktime(0,0,0,$mnth,$dy,$yr)),$yr)).""; $sql = "SELECT * FROM news WHERE date>='$last_sunday' AND date<='$next_saturday'). But i would find it better to use a weeknumber instead Best regards, Davy Obdam - Networking4all Webapplication developer E-mail: [EMAIL PROTECTED] Web: http://www.networking4all.com Kijk ook eens op: http://www.verzamelgids.nl -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: WG: [PHP-DB] Confirmation e-mail
Hi Andreas, Thanks for you responce. I am also wondering how you would do that in the database, i have a table users in my MySQL database containing the users information that submitted when they registerd. Now i want to activate thier account only after they have clicked on the confirmation link... if possible without any additional tables in my db. I users do not confirm thier account i wanna remove thier data from the database after 48hours. Thanks for your time.. Best regards, Davy Obdam info@phpken wrote: hi, too please don't send password over the internet. better you ask the user if they click the link below your email. then the user get a formular and there you can ask him for his password. then you can make sure the emails wasn't read by other user. this is a secure method. andreas van loock -Ursprüngliche Nachricht- Von: info@phpken [mailto:[EMAIL PROTECTED]] Gesendet: Sonntag, 9. Februar 2003 20:34 An: Php-Db Betreff: WG: [PHP-DB] Confirmation e-mail hi, the best way for this is optin and optout method. so you can referrer if the users email exist. if the users email exists you can to assume the user is the user who would like the registration for your website. in the email you can set a link to a modul of your website. in this link you can take an accesskey, wich you generated by a new account. this key is the users unique id. now not all users given there right email and the email will send back to you. first choice you select the incoming returns or you can write a script who will checked a emailaccount for returned emails. in this programm you can select the "to"-field and check it in your database. is any user in the email true then you can delete them and you database will be clean. you can lookup this: http://www.smtphost.de/smtp.auth please insert your emailaddress, it will be generat an email for you. then you click the link in this email. this way is optin. if you want to unregister you can delete your account from the same formular what you are registered. okthis is my way.any other ideas? andreas van loock -Ursprüngliche Nachricht- Von: Davy Obdam [mailto:[EMAIL PROTECTED]] Gesendet: Sonntag, 9. Februar 2003 20:04 An: PHP; PHP-WIN; PHP-DB Betreff: [PHP-DB] Confirmation e-mail Hello people., I am developing a website with a user login system, i would like to send an confirmation e-mail to the user when he/she registers for the site, asking for confirmation...for instance click on a link to activate thier account. My question is what would be the best approach to achieve this? How is this usualy done? Any thoughts and help is appreciated. Best regards, Davy Obdam -- ---- Davy Obdam - Obdam webdesign© mailto:[EMAIL PROTECTED] web: www.davyobdam.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- ---- Davy Obdam - Obdam webdesign© mailto:[EMAIL PROTECTED] web: www.davyobdam.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Confirmation e-mail
Hello people., I am developing a website with a user login system, i would like to send an confirmation e-mail to the user when he/she registers for the site, asking for confirmation...for instance click on a link to activate thier account. My question is what would be the best approach to achieve this? How is this usualy done? Any thoughts and help is appreciated. Best regards, Davy Obdam -- Davy Obdam - Obdam webdesign© mailto:[EMAIL PROTECTED] web: www.davyobdam.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL : InnoDB tables
Helloo people, I have a question about MySQL, i use MySQL 3.23.55 together with PHP 4.3.0 on my windows XP system. Does the version of MySQL supports InnoDB tables? And how do i do it i have noticed that in PhpMyAdmin i cannot choose this table format..., but i gues that has more to do with the PhpMyAdmin then with my database i gues. Best regards, Davy Obdam -- Davy Obdam - Obdam webdesign© mailto:[EMAIL PROTECTED] web: www.davyobdam.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Retrieving field name of Database
Helloo people, I have to build a database abstraction class with support for XML output. My XML output has to look like this: value value ... value value ... Well i almost got it, but how do i get all the field names of my MySQL tables? This is my code, a part of my database class. : /** * getXMLDocument * * Get the result of your query back in XML document * @authorDavy Obdam */ function getXMLDocument() { //Create XML document if(!$this->xmlDoc = domxml_new_doc("1.0")) { die("[ERROR] Cant create XML document"); } // Create root element $this->root_element = $this->xmlDoc->create_element("result"); $this->root_element->set_attribute("query", $this->sqlQuery); //Get database fields and values $count = 0; while($this->fetchRow()) { $row_element = $this->xmlDoc->create_element("row"); $n_row = $this->root_element->append_child($row_element); $row_number = $row_element->set_attribute("number" ,$count); $count++; // Get fieldnames and values for($i=0; $isqlQuery); $i++) { $field_element = $this->xmlDoc->create_element("field"); $n_field = $row_element->append_child($field_element); $field_name = $field_element->set_attribute("name", "name"); $field_content = $field_element->append_child($this->xmlDoc->create_text_node(utf8_encode("text"))); } $this->moveNext(); } // Put everything together and show it $append_root = $this->xmlDoc->append_child($this->root_element); header("content-type:text/xml"); echo $this->xmlDoc->dump_mem(); } Now all i get is one field whatever in my XML output, but i should get 10 with this particular query.. Any help is appreciated, thanks for you time. Best regards, Davy Obdam mailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] substituting for $id with globals off (newbie)
> -Oorspronkelijk bericht- > Van: Davy Obdam [mailto:[EMAIL PROTECTED]] > Verzonden: woensdag 20 november 2002 17:39 > Aan: 'mike karthauser' > Onderwerp: RE: [PHP-DB] substituting for $id with globals off (newbie) > > > Hi Mike, > > $result = mysql_query("SELECT * FROM address WHERE > id=".$_GET['id']."",$db); > > This should work. > > Best regards, > > Davy Obdam > > Obdam w e b d e s i g nC > Webdesign, application and database development > tel : +31(0)641 222 385 > mailto:[EMAIL PROTECTED] > > > > -Oorspronkelijk bericht- > > Van: mike karthauser [mailto:[EMAIL PROTECTED]] > > Verzonden: woensdag 20 november 2002 17:18 > > Aan: [EMAIL PROTECTED] > > Onderwerp: [PHP-DB] substituting for $id with globals off (newbie) > > > > > > Hi, thanks for earlier replies regarding php resources. I am > > currently hitting a brick wall on the script below due to my > > lack of understanding of php coupled with my lack of > > knowledge about globals. > > > > I replaced $id with $_GET['id'] in line 5 which now allows > > the user to reach the script to evaluate when presented with > > testpage.php?id=n. It now falls over when it tries to run the > > query part : > > > > WHERE id=$id > > > > I tried to submit this instance with $_GET['id'] in the query > > which also fails. In the $_GET['id'] where is the value for > > id now stored? Can anyone see where i have gone wrong? > > > > thanks > > --- > > my source: > > > > > $db = mysql_connect("localhost", "root"); > > mysql_select_db("bsdb1",$db); // display individual record if > > ($_GET['id']) { > > $result = mysql_query("SELECT * FROM address WHERE > > id=$id",$db); $myrow = mysql_fetch_array($result); > > printf("Name: %s\n", $myrow["name"]); > > printf("Address: %s\n", $myrow["address"]); > > printf("Home Number: %s\n", $myrow["hnum"]); > > printf("Work Number: %s\n", $myrow["wnum"]); > > > > } else { > > // show employee list > > $result = mysql_query("SELECT * FROM address",$db); > > if ($myrow = mysql_fetch_array($result)) { > > // display list if there are records to display > > do { > > printf("%s\n", > > $_SERVER['PHP_SELF'], $myrow["id"], $myrow["name"]); } while > > ($myrow = mysql_fetch_array($result)); } else { > > // no records to display > > echo "Sorry, no records were found!"; > > } > > } > > ?> > > -- > > Mike Karthauser > > Managing Director - Brightstorm Ltd > > > > Email >> [EMAIL PROTECTED] > > Web >> http://www.brightstorm.co.uk > > Tel >> 0117 9426653 (office) > >07939 252144 (mobile) > > > > Snailmail >> Unit 8, 14 King Square, > >Bristol BS2 8JJ > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > Deze e-mail is door E-mail VirusScanner van Planet Internet > > gecontroleerd op virussen. Op http://www.planet.nl/evs staat > > een verwijzing naar de actuele lijst waar op wordt gecontroleerd. > > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Mccrypt installation?
Hi people I have a problem installing some extensions on a windows XP machine (Apache 2.0.40 and PHP 4.2.3/MySql 3.23.52). I now have most of the extensions i need installed, although there are a few ones wich i dont get to work? Any idea`s? ;extension=php_mcrypt.dll doesnt work and stil produces a error message.. Thanks Best regards, Davy Obdam mailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Find out a pic size?
Hi There, You could also use the getimagesize(); function for this "; ?> This will give Hope this helps Best regards, Davy Obdam mailto:info@;davyobdam.com > -Oorspronkelijk bericht- > Van: milisphp [mailto:milis@;indoinformatika.com] > Verzonden: maandag 11 november 2002 7:38 > Aan: [EMAIL PROTECTED] > Onderwerp: [PHP-DB] Find out a pic size? > > > Hi, > > I'm working with a lot of picture in a website and the size > is not always the same. > > I need some help on how to find out the size (width and > height) of a picture. Is there any way to do this (especially > with PHP)? > > I need it so I can calculate the width and height to be > specified on the HTML tag. > > Thanks, > > Hansen > IndoInformatika > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: [PHP] Re: Need help with HTTP-Authentication
Hi David,. > Http authentication is probly not what you would want to > use. Especially if you want to program in timeouts, you > would be better off using session based login variables. > Cookies are even better with an encrypted pasword that has a > windows of time that you have to goto other pages to renew. > > Why HTTP auth? > > Is it mandatory? Well its not mandatory i gues. I just thought that using HTTP-Authentication was one of the more secure ways of a login system? But i have heared not thats not the case, so i might go for a login system with sessions instead, or cookies. What would u use and why? What excactly do u mean with timeouts? > I know this hasnt been any help, sorry! Thats okay;-) Keeps the discusion alive;-) Best regards, Davy Obdam, mailto:info@;davyobdam.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Need help with HTTP-Authentication
Hi There, > Hi, > > a simple question.. :) > how do you do ? I am doing fine, thanks ;-). How are u? > You can use 2 methods : > with a .htaccess file on your webserver, updated with your > table fields or a direct authentification with http headers > and a little bit of php... Tell me more? may be I could help you. I would like to use PHP.. Well this is the code i have sofar: I cannot get it to work correctly.. I have two users in my 'gebruikers'(means users) table, but i can only login with the first user. When i try the 2nd user nothing happends. Do u know a solution or maybe some better http-authenticate script? Thanks alot:-) Best regards, Davy Obdam, mailto:[EMAIL PROTECTED] > > Regards, > P.E. Baroiller > > "Davy Obdam" <[EMAIL PROTECTED]> a écrit dans le message de > news: 001901c2747e$fa0184a0$[EMAIL PROTECTED] > > Hi People,. > > > > I have a problem with HTTP-Authentication, i have 2 users in my > > database, and i want both to be able to login. However it > works, but > > only the first user is able to login. I Use a MySQL 3.23.xx > database, > > PHP 4.2.3 and Apache 2.0.40. Can anyone help me with this, any help > > would be greatly apreciated. Thanks already;-)Maybe some examples?? > > ;-) > > > > Best regards, > > > > Davy Obdam, > > mailto:[EMAIL PROTECTED] > > > > > > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Need help with HTTP-Authentication
Hi People,. I have a problem with HTTP-Authentication, i have 2 users in my database, and i want both to be able to login. However it works, but only the first user is able to login. I Use a MySQL 3.23.xx database, PHP 4.2.3 and Apache 2.0.40. Can anyone help me with this, any help would be greatly apreciated. Thanks already;-)Maybe some examples?? ;-) Best regards, Davy Obdam, mailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php