Yealink Forums

Full Version: Simple PHP Phonebook
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
(03-02-2015 01:08 AM)jaykay Wrote: [ -> ]
(02-28-2015 05:14 PM)WelshPaul Wrote: [ -> ]
(02-28-2015 04:57 AM)jaykay Wrote: [ -> ]
(02-28-2015 04:07 AM)WelshPaul Wrote: [ -> ]I'm confused... Are you talking about updating the XMl file in phonebook script posted above? or your own XML file that your hosting on your web server?

If your on about the phonebook script I posted above you simply login and add, edit or delete the contact or contacts and click on Generate Remote Phonebook and the XML file is created or updated (if it exists already) automatically.


Thanks for the prompt reply. Maybe I just jumped in here without reading your post properly..... I've had a long day!
So can I bulk import contacts from a csv file to your script?
Will xampp do or do you recommend another program for the sql part.

Ah right I got you, no. I know, I know... All that hassle for a no lol

If you already have an XML or CSV file with a list there is no way to import that into the script above. It's a manual process but once listed in the phone book it's easy to export a CSV based on that phone book list for use on any device or a XML for use with an online phone book.

I should point out that this isn't really *my* script, I just added the ability to login/logout and made a few changes to the way it generates the files. It still needs some work so if anyone wants to build on it then go for it. Smile

Ah well, I might just create a new list anyway because the ability to automatically update the phonebook across all phones is worth the effort
OK. I am trying to set up the phonebook but am missing something. My knowledge of MySql wouldn't be too good.
I downloaded your files to my htdocs folder on webserver.
I have created a new database on sql and named it "yealink". I have then imported phonebook_sql.sql. I then create a new user with a password for that newly created db.
When I then browse to localhost/phonebook I get a login page but an error when entering any username or password.
Any ideas?
(03-02-2015 06:25 PM)jaykay Wrote: [ -> ]Any ideas?

Did you change the server, username, password and database names in the following line of file data\datalogin.php:
PHP Code:
$con=mysqli_connect("localhost","root","password","phonebook"); 

If these are correct, please verify that you can logon with the commandline, using the parameters:
Code:
mysql -h <server> -u <username> -D <database> -p
(03-03-2015 03:37 AM)cptjack Wrote: [ -> ]
(03-02-2015 06:25 PM)jaykay Wrote: [ -> ]Any ideas?

Did you change the server, username, password and database names in the following line of file data\datalogin.php:
PHP Code:
$con=mysqli_connect("localhost","root","password","phonebook"); 

If these are correct, please verify that you can logon with the commandline, using the parameters:
Code:
mysql -h <server> -u <username> -D <database> -p
Hi cptjack
I made the change and that has pushed me on a little bit. It looks like I need to alter the login.php file also. I see there are a lot of entries in this file with regard to username and password. Do you know which line I have to enter my username/password details?
I now have this error:

Notice: Undefined variable: error in C:\xampp\htdocs\phonebook\phonebook\login.php on line 75

Many Thanks
JK
That's a non critical error, you should be able to login with a user now. The username and password in login.php are checked against the user table in the 'yealink' database.

To avoid the error message, the $error variable needs to be declared at the top of the script are non-critical errors should be suppressed.
(03-03-2015 05:04 AM)cptjack Wrote: [ -> ]That's a non critical error, you should be able to login with a user now. The username and password in login.php are checked against the user table in the 'yealink' database.

To avoid the error message, the $error variable needs to be declared at the top of the script are non-critical errors should be suppressed.

I have 2 users in the db. One is the default user/user. The other is custom test/test. When I use either username I get "incorrect password". When I use something random or root as username I get "incorrect username". So it looks like it is recognising the username user or test from the db but accepting the password.
Make sure to md5() your passwords with:
Code:
update users set password=md5('user') where username='user';
update users set password=md5('test') where username='test';

This should give you the passwords 'ee11cbb19052e40b07aac0ca060c23ee' and '098f6bcd4621d373cade4e832627b4f6' respectively.
(03-04-2015 06:17 AM)cptjack Wrote: [ -> ]Make sure to md5() your passwords with:
Code:
update users set password=md5('user') where username='user';
update users set password=md5('test') where username='test';

This should give you the passwords 'ee11cbb19052e40b07aac0ca060c23ee' and '098f6bcd4621d373cade4e832627b4f6' respectively.

Meant to post yesterday. I created a new db and imported the .sql file. I made changes as per afore mentioned and I can now browse to the db with user/user. Thanks for your help.
Pages: 1 2 3 4
Reference URL's