คู่มือการพัฒนาซอฟต์แวร์บนเว็บบราวซ์เซอร์ให้รองรับ UA ด้วยภาษา PHP/en
<languages/> This manual is a guideline for UA web application development using PHP. The application will be able to accept, validate and process Thai IDN and Thai EAI correctly.
User/Pass for accessing server in the workshop [User]
# HOST: https://ws.kon.in.th # DB: https://ws.kon.in.th/phpmyadmin/ # user: userX # pass: eaiuserX
Preparing to Support UA in PHP
Related systems
- Database system
- MySQL
- PHPMyAdmin
- Web application
- Registration system
- Login system
- User profile system
- Email system
- PHPMailer
To be used software
- Filezilla [Win] [Mac]
- Web Browser e.g. Firefox, Chrome, Safari
- Text Editor (Code Editor) e.g. Notepad, Atom
Application Architecture
Developing Applications to Support UA in PHP
# CREATE TABLE IF NOT EXISTS accounts ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(50) NOT NULL, `password` varchar(255) NOT NULL, `email` varchar(100) NOT NULL, `activation_code` varchar(50) DEFAULT '', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
modify register.html fronm
# <input type="email" name="email" placeholder="Email" id="email" required>
to
# <input type="text" name="email" placeholder="Email" id="email" required>
modify register.php from
# if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
exit('Email is not valid!');
}
to
# if (preg_match('/^[ก-๙a-zA-Z0-9_+&*-]+(?:\.[ก-๙a-zA-Z0-9_+&*-]+)*@(?:[ก-๙a-zA-Z0-9-]+\.)+[ก-๙a-zA-Z]{2,16}$/u', $_POST['email']) == 0) {
exit('Email is not valid!');
}
modify PHPMailer/src/PHPMailer.php from
# case 'php': default: return filter_var($address, FILTER_VALIDATE_EMAIL) !== false;
to
# case 'php':
default:
return (bool) preg_match("/^[ก-๙a-zA-Z0-9_+&*-]+(?:\.[ก-๙a-zA-Z0-9_+&*-]+)*@(?:[ก-๙a-zA-Z0-9-]+\.)+[ก-๙a-zA-Z]{2,16}$/u", $address);


