


The project integrates Discuz UCenter and discuzcenter
Although I personally dislike discuz very much, there is no way, the market is power, especially for friends who integrate the discuz forum, if you don’t want to use it If there are two systems, integrating UCenter is inevitable. Although it is boring, it has to be done.
1. Preparation
1. Read the full text of uc api manual. Refer to http://faq.comsenz.com/library/UCenter/introduction/introduction_list.htm
2. Add application instructions in the uc background. Refer to http://faq.comsenz.com/viewnews-506 (official) http://wenku.baidu.com/view/3790fdd7195f312b3169a588.html (grassroots)
3. uc client necessary code, Download here
2. Example
Although it seems that the above preparations are enough, experience tells us, no, it is not enough. Disuzuz is not something that is just plain water, such as zend frame, dedecms, and ci. Without a bit of research spirit and a tossing temperament, it is impossible to understand its profound connotation, let alone control it. To achieve success, we need detailed explanatory text and necessary pictures, although you may not be successful with these.
Let’s take a look at my project structure first
tanahk is the real project address, x3.2 is my discuz forum file, open it
You can see that discuz x3.2 has been integrated with ucenter, where uc_server is the server, uc_client is the client, and the uc_client folder is in discuz x, discuz home, discuz xspace All other products are already bundled. But it has not been added to my tanahk project. According to the previous reference information, it must exist in every project. Therefore, we copy the client in developguide.zip under the preparation point 3 to below tanahk. And named it api
Because the UCenter application defaults to finding the api/uc.php file, the client folder must be renamed api. Go back to the developguide.zip compressed package, open the api/uc.php below, and copy it to tanahk/api.
tanahk’s directory structure changes to
Okay, now we can add our project application in the UCenter background . The background of uc is generally http://www.xxx.com/x3.2/uc_server/admin.php
Select "Application Management"--"Add New Application ”
Refer to 2 in the preparation above.
Application type: Other
Communication key: Find the key in discuz root/config/confgi_ucenter.php, define('UC_KEY', '...124sdf45s4d5fsd4f5s4...');discuz root is your uc directory.
Physical path of the application: can be empty, as long as the application main url is filled in correctly
Application interface file name: keep uc.php, no need to fill in api/uc.php
Whether to enable synchronous login: Yes, this is The key point is that in the future, multiple projects can share one uc, and there is no need to create a new user system by yourself.
Submit.
ecshop discuz ucenter integration
1. Install ucenter
2. Install discuz. It is integrated with ucenter during the installation process and does not require me to do anything
3. Install ecshop and uc_client Copy to the root directory (uc_client in the ucenter installation file). Then copy the configuration to data /config.php
define('UC_CONNECT', 'mysql');
define('UC_DBHOST', 'localhost ');
define('UC_DBUSER', 'root');
define('UC_DBPW', 'root');
define('UC_DBNAME', 'ucenter');
define( 'UC_DBCHARSET', 'utf8');
define('UC_DBTABLEPRE', '`ucenter`.uc_');
define('UC_DBCONNECT', '0');
define('UC_KEY', '1234567890');
define('UC_API', 'localhost/ucenter/upload');
define('UC_CHARSET', 'utf-8');
define('UC_IP', '127.0 .0.1');
define('UC_APPID', '3');
define('UC_PPP', '20');
The communication was found to be successful in the ucenter background. Then install ucenter in ecshop. After installation, check whether the settings are consistent with those in ucenter. It should be fine. Now my discuz and ecshop can log in simultaneously.
168 is installed. Install ucenter and go to ucenter to add applications
(1). Enter the UC management background, click 'Application Management', then click 'Add New Application', and then select 'Customize' Install'
Application name: Enter PHP168 whole site system
Application URL: Enter http://website domain name/do (no / is required at the end, and note that it ends with do)
Application IP: Leave it blank Just
Communication key: write any one, such as 123abcdkjhh
Application type: select 'Other
Physical path of application: leave it blank
View profile page address: leave it blank
Application interface file name: uc.php
Tag single display template: Leave it blank
Tag template mark description: Leave it blank
Whether to enable synchronous login: select 'Yes'
No Accept the notification: Select 'Yes'
Finally submit. After submission, return to the application list. Then select the application you just submitted and click Edit.
Copy the code in 'Application UCenter Configuration Information:' , just put it in the second line of the entire site/do/config.php.
Then integrate discuz and home through ucenter

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

PHP uses MySQLi and PDO extensions to interact in database operations and server-side logic processing, and processes server-side logic through functions such as session management. 1) Use MySQLi or PDO to connect to the database and execute SQL queries. 2) Handle HTTP requests and user status through session management and other functions. 3) Use transactions to ensure the atomicity of database operations. 4) Prevent SQL injection, use exception handling and closing connections for debugging. 5) Optimize performance through indexing and cache, write highly readable code and perform error handling.

Using preprocessing statements and PDO in PHP can effectively prevent SQL injection attacks. 1) Use PDO to connect to the database and set the error mode. 2) Create preprocessing statements through the prepare method and pass data using placeholders and execute methods. 3) Process query results and ensure the security and performance of the code.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP makes it easy to create interactive web content. 1) Dynamically generate content by embedding HTML and display it in real time based on user input or database data. 2) Process form submission and generate dynamic output to ensure that htmlspecialchars is used to prevent XSS. 3) Use MySQL to create a user registration system, and use password_hash and preprocessing statements to enhance security. Mastering these techniques will improve the efficiency of web development.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment