Huớng dẫn cơ bản cho các bạn cài Phpmyadmin trên LAMPP củaUbuntu

Dùng Terminal để cài Phpmyadmin
“sudo apt-get install phpmyadmin"

Sửa lại file “apache2.conf”
gksudo gedit /etc/apache2/apache2.conf"

Ta add thêm dòng lênh này vào cuối của file phía trên
“Include /etc/phpmyadmin/apache.conf”

Restart lại Apache bằng dòng lệnh
sudo /etc/init.d/apache2 restart"

Liên kết để bạn tải xuống máy:
Chú ý: Nếu có vấn đề trong quá trình tải xuống máy bạn có thể:
  1. Thử tải lại bằng liên kết thay thế:
  2. Hoặc cấu hình lại máy tính của bạn (Với một số phiên bản Windows, có thể đã được cấu hình để chặn lại quá trình download của bạn.)
Giới thiệu

Hướng dẫn kỹ thuật

Setting up LAMPP in UBUNTU 9.10

Tháng Một 5, 2009 — cuongvttt

Here goes my first Linux Tutorial for LAMPP using XAMPP. Actually i was searching for a way to install LAMP on my debian system when i came across this wonderful tutorial. Thought would be nice to share it.
Step 1: Download

http://www.apachefriends.org/en/xampp-linux.html

Step 2: Installation

After downloading simply type in the following commands:
1.Go to a Linux shell and login as the system administrator root:
su
2.Extract the downloaded archive file to /opt:

Code:

tar xvfz xampp-linux-1.6.2.tar.gz -C /opt

Warning: Please use only this command to install XAMPP. DON’T use any Microsoft Windows tools to extract the archive, it won’t work.
Warning 2: already installed XAMPP versions get overwritten by this command.
That’s all. XAMPP is now installed below the /opt/lampp directory.

Step 3: Start
To start XAMPP simply call this command:

Code:

/opt/lampp/lampp start

You should now see something like this on your screen:
Starting XAMPP 1.6.2…

Code:

LAMPP: Starting Apache…
LAMPP: Starting MySQL…
LAMPP started.
Ready. Apache and MySQL are running.

Step 4: Test
OK, that was easy but how can you check that everything really works? Just type in the following URL at your favourite web browser:

http://localhost

Now you should see the start page of XAMPP containing some links to check the status of the installed software and some small programming examples.

A matter of security (A MUST READ!)
As mentioned before, XAMPP is not meant for production use but only for developers in a development environment. The way XAMPP is configured is to be open as possible and allowing the developer anything he/she wants. For development environments this is great but in a production environment it could be fatal.
Here a list of missing security in XAMPP:
1.The MySQL administrator (root) has no password.
2.The MySQL daemon is accessible via network.
3.ProFTPD uses the password “lampp” for user “nobody”.
4.PhpMyAdmin is accessible via network.
5.Examples are accessible via network.
6.MySQL and Apache running under the same user (nobody).
To fix most of the security weaknesses simply call the following command:

Code:

/opt/lampp/lampp security

It starts a small security check and makes your XAMPP installation more secure.

PHP 4 or PHP 5?
Because such very new versions like PHP 5 always should be handled with care we decided to include both current versions of PHP into XAMPP since version 1.4.7: PHP 5.x and PHP 4.x. If you find out your PHP application doesn’t work with PHP 5 you will be able to switch back easily to PHP 4.
By the following command you can switch “back” to PHP 4.x:

Code:

/opt/lampp/lampp php4

And with the following command you can switch back to PHP 5.x:

Code:

/opt/lampp/lampp php5

If you forgot which version of PHP is in use simply use phpinfo() or call this command:

Code:

/opt/lampp/lampp phpstatus

Advanced start and stop parameters

* start – Starts XAMPP.
* stop – Stops XAMPP.
* restart – Stops and starts XAMPP.
* startapache – Starts only the Apache.
* startssl – Starts the Apache SSL support. This command activates the SSL support permanently, e.g. if you restarts XAMPP in the future SSL will stay activated.
* startmysql – Starts only the MySQL database.
* startftp – Starts the ProFTPD server. Via FTP you can upload files for your web server (user “nobody”, password “lampp”). This command activates the
* ProFTPD permanently, e.g. if you restarts XAMPP in the future FTP will stay activated.
* stopapache – Stops the Apache.
* stopssl – Stops the Apache SSL support. This command deactivates the SSL support permanently, e.g. if you restarts XAMPP in the future SSL will stay deactivated.
* stopmysql – Stops the MySQL database.
* stopftp – Stops the ProFTPD server. This command deactivates the ProFTPD permanently, e.g. if you restarts XAMPP in the future FTP will stay deactivated.
* security – Starts a small security check programm.

What is where?

* /opt/lampp/bin/ – The XAMPP commands home.
* /opt/lampp/bin/mysql – calls for example the MySQL monitor.
* /opt/lampp/htdocs/ – The Apache DocumentRoot directory.
* /opt/lampp/etc/httpd.conf – The Apache configuration file.
* /opt/lampp/etc/my.cnf – The MySQL configuration file.
* /opt/lampp/etc/php.ini – The PHP configuration file.
* /opt/lampp/etc/proftpd.conf – The ProFTPD configuration file. (since 0.9.5)
* /opt/lampp/phpmyadmin/config.inc.php – The phpMyAdmin configuration file.

Stopping XAMPP
To stop XAMPP simply call this command:

Code:

/opt/lampp/lampp stop

You should now see:

Code:

Stopping LAMPP 1.6.2…
LAMPP: Stopping Apache…
LAMPP: Stopping MySQL…
LAMPP stopped.

And XAMPP for Linux is stopped.

Uninstall
To uninstall XAMPP just type in this command:

Code:

rm -rf /opt/lampp

The end.

Source – http://www.apachefriends.org/en/xampp-linux.html

Thao tác nhanh với UBUNTU 9.10

Hầu hết để thao tác nhanh với Ubuntu ta dùng “Terminal”  (tưong tự DOS trên windows) để thao tác

1.Cài đặt các chuơng trình mới trong Ubuntu

“sudo apt-get update” : Update các phần mềm mới cho Ubuntu

“sudo apt-get install ten_chuong_trinh” : Cài đặt 1 phần mềm mới
ex: sudo apt-get install skype

2. Dùng Nautilus để thao tác với các trình quản lý file ( tuơng tự window explorer)

“sudo nautilus” : thao tác copy và xóa 1 cách dễ dàng

3. Phân quyền trong các folfer và file trong Ubuntu

Khi truy cập 1 file, đôi khi bạn không có quyền sửa và xóa 1 folder hoac muc nào đó
“sudo chmod -R  777 /var/opt/” : phân quyền 777 cho toàn bộ thư mục “opt”

4.Tắt 1 chưong trình đang chay

“sudo killall vlc” : tắt chuơng trình vlc media player

“sudo xkill” : tắt 1 chuơng trình theo con trỏ chuột(di chuột vào chưong trình muốn tắt)

5. Phím tắt:

Alt + F2: chạy 1 ứng dụng bất kỳ

Ctrl+Alt+D : thu nhỏ tất cả các cửa sổ

Setup localhost chạy PHP trong Ubuntu 9.10

Trong bài này, chúng tôi sẽ hướng dẫn cho bạn cách cài đặt một hệ thống LAMP. LAMP bao gồm Linux, Apache, MySQL, PHP. Hướng dẫn này chủ yếu dành cho những người chỉ có một chút kiến thức trong việc sử dụng Linux.

Cài đặt Apache

Để bắt đầu chúng tôi sẽ hướng dẫn cài đặt Apache.

1. Mở phần Terminal (Applications > Accessories > Terminal)

2. Copy/Paste dòng mã sau vào Terminal và nhấn phím enter:

sudo apt-get install apache2

3. Terminal sẽ hỏi mật khẩu của bạn, nhập nó vào và nhấn enter.

Kiểm tra Apache

Để chắc chắn mọi thứ đã được cài đặt chính xác, chúng ta sẽ tiến hành kiểm tra Apache để đảm bảo nó hoạt động đúng cách.

1. Mở trình duyệt và sau đó nhập địa chỉ web sau đây vào ô địa chỉ:

http://localhost/

2. Bạn sẽ thấy một thư mục có tên là apache2-default/. Mở thư mục đó ra, bạn sẽ nhận được thông báo là “It works!” và bạn đã thành công.

Cài đặt PHP

Tiếp theo chúng ta sẽ tiến hành cài đặt PHP 5.

Bước 1: Mở lại phần Terminal (Applications > Accessories > Terminal)

Bước 2: Copy/Paste dòng lệnh sau vào Terminal và nhấn enter:

sudo apt-get install php5 libapache2-mod-php5

Bước 3: Hợp lệ để PHP làm việc và tương thích với Apache và chúng ta phải khởi động lại nó. Nhập vào câu lệnh sau trong Terminal để thực hiện điều này:

sudo /etc/init.d/apache2 restart

Kiểm tra lại PHP

Để đảm bảo không có vấn đề gì phát sinh đối với PHP, hãy kiểm tra lại nó bằng các bước sau:

Bước 1: Trong Terminal, copy và paste dòng lệnh sau rồi nhấn enter:

sudo gedit /var/www/testphp.php

Câu lệnh này sẽ mở một file có tên là phptest.php.

Bước 2: Copy/Paste dòng lệnh sau vào file phptest:

<?php phpinfo(); ?>

Bước 3: Lưu và đóng file lại

Bước 4: Mở trình duyệt web của bạn và nhập vào địa chỉ sau:

http://localhost/testphp.php

Bạn sẽ thấy giao diện sau:

Việc cài đặt cả Apache và PHP đã thành công!

Cài đặt MySQL

Cuối cùng là việc cài đặt MySQL

Bước 1: Lại tiếp tục mở lại Terminal và đưa vào dòng lệnh sau:

sudo apt-get install mysql-server

Bước 2 (không bắt buộc): Để các máy tính khác trong mạng xem được server mà bạn đã tạo, đầu tiên là bạn phải chỉnh sửa “Bind Address”. Bắt đầu bằng việc mởTerminal để sửa file my.cnf.

gksudo gedit /etc/mysql/my.cnf

Tại dòng

bind-address = 127.0.0.1

đổi địa chỉ 127.0.0.1 thành địa chỉ IP của bạn
Bước 3: Đây là bước quan trọng, nhập dòng lệnh sau vào Terminal:

mysql -u root

Và copy/paste dòng lệnh sau:

mysql> SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(‘yourpassword’);

(Hãy thay đổi yourpassword bằng mật khẩu mà bạn chọn)

Bước 4: Giờ chúng ta sẽ tiến hành cài đặt chương trình phpMyAdmin, đây là một công cụ đơn giản để chỉnh sửa cơ sở dữ liệu của bạn. Copy/paste dòng lệnh sau vàoTerminal:

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

Sau khi đã cài đặt mọi thứ, bước tiếp theo cần thực hiện là làm cho PHP có thể làm việc cùng với MySQL. Để thực hiện điều này, chúng ta cần mở file php.ini bằng cách nhập vào dòng lệnh sau:

gksudo gedit /etc/php5/apache2/php.ini

Trong file này, chúng ta cần bỏ dấu chú thích ở dòng lệnh sau bằng cách bỏ đi dấu chấm phẩy đầu dòng (;):

;extension=mysql.so

Thay đổi nó thành như sau:

extension=mysql.so

Giờ thì bạn có thể khởi động lại Apache và hoàn thiện toàn bộ quá trình cài đặt!

sudo /etc/init.d/apache2 restart

(Theo How To Forge)

This function use to check enter on form with jquery

function check_key(e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
if(keycode == 13){
return false;
}

}

Tạo 1 table từ  1 table khác:

Create Table new_table Select * From old_table

Export MySQL data records to an Excel file in one PHP file, simple and easily!

This tutorial require 1 PHP file and 1 table of mySQL database.

  1. export_excel.php
  2. Database “tutorial” and table “name_list” with 2 fields: id(auto_increment), name(varchar, 50) and put some records about 20 – 30 records into this table. (directly by phpMyAdmin
Source Code

<?
// Connect database.
mysql_connect(“localhost”,”",”");
mysql_select_db(“tutorial”);

// Get data records from table.
$result=mysql_query(“select * from name_list order by id asc”);

// Functions for export to excel.
function xlsBOF() {
echo pack(“ssssss”, 0×809, 0×8, 0×0, 0×10, 0×0, 0×0);
return;
}
function xlsEOF() {
echo pack(“ss”, 0×0A, 0×00);
return;
}
function xlsWriteNumber($Row, $Col, $Value) {
echo pack(“sssss”, 0×203, 14, $Row, $Col, 0×0);
echo pack(“d”, $Value);
return;
}
function xlsWriteLabel($Row, $Col, $Value ) {
$L = strlen($Value);
echo pack(“ssssss”, 0×204, 8 + $L, $Row, $Col, 0×0, $L);
echo $Value;
return;
}
header(“Pragma: public”);
header(“Expires: 0″);
header(“Cache-Control: must-revalidate, post-check=0, pre-check=0″);
header(“Content-Type: application/force-download”);
header(“Content-Type: application/octet-stream”);
header(“Content-Type: application/download”);;
header(“Content-Disposition: attachment;filename=orderlist.xls “);
header(“Content-Transfer-Encoding: binary “);

xlsBOF();

/*
Make a top line on your excel sheet at line 1 (starting at 0).
The first number is the row number and the second number is the column, both are start at ‘0′
*/

xlsWriteLabel(0,0,”List of car company.”);

// Make column labels. (at line 3)
xlsWriteLabel(2,0,”No.”);
xlsWriteLabel(2,1,”Company”);

$xlsRow = 3;

// Put data records from mysql by while loop.
while($row=mysql_fetch_array($result)){

xlsWriteNumber($xlsRow,0,$row['id']);
xlsWriteLabel($xlsRow,1,$row['name']);

$xlsRow++;
}
xlsEOF();
exit();
?>

++++++++++++++
+ Website_cv
++++++++++++++
+ cv_id
+ status
++++++++++++++

+++++++++++++++
+ Website_apply_job
+++++++++++++++
+ cv_id
+ status
+++++++++++++++
=> copy Status From website_cv to website_apply_job

UPDATE website_apply_job
JOIN website_cv
ON website_cv.cv_id = website_apply_job.cv_id
SET website_apply_job.STATUS = website_cv.STATUS;

    /*Make position:fixed work in IE6!*/
 
 
    .fixed-top /* position fixed Top */{position:fixed;bottom:auto;top:0px;}
 
    .fixed-bottom /* position fixed Bottom */{position:fixed;bottom:0px;top:auto;}
 
    .fixed-left /* position fixed Left */{position:fixed;right:auto;left:0px;}
 
    .fixed-right /* position fixed right */{position:fixed;right:0px;left:auto;}
 
 
    * html,* html body /* IE6 Fixed Position Jitter Fix */{background-image:url(about:blank);background-attachment:fixed;}
 
    * html .fixed-top /* IE6 position fixed Top */{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop));}
 
    * html .fixed-right /* IE6 position fixed right */{position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10)||0)-(parseInt(this.currentStyle.marginRight,10)||0));}
 
    * html .fixed-bottom /* IE6 position fixed Bottom */{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));}
 
    * html .fixed-left /* IE6 position fixed Left */{position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft));}

10 Thủ thuật CSS mà bạn cần biết – Phần I

Trong quá trình thực hành và làm việc với CSSCascading Style Sheets chúng ta sẽ gặp những vấn đề xảy ra rất thường xuyên, để giải quyết chúng một cách nhanh chóng thì chúng ta cần phải biến những cách xử lý của các vấn đề đó trở thành những phản xạ của riêng mình. Do đó trong bài viết này tôi xin tổng hợp ra mười thủ thuật về CSSCascading Style Sheets mà bạn cần phải biết và biến chúng thành những kỹ năng của mình. Tôi hy vọng rằng sau khi đọc xong bài viết này các bạn sẽ tự tin hơn trong việc giải quyết các vấn đề tương tự.
1. Dùng kỹ thuật Sorthand để thực hiện viết mã CSS.

Như tôi đã trình bày trong bài viết “Cách viết giản lược trong CSS” thì việc sử dụng kỹ thuật này rất tiện ích cho quá trình bạn viết mã CSSCascading Style Sheets.

Ví dụ: Khi style cho font chữ trong CSS thông thường bạn sẽ viết như sau:

font-weight: bold;
font-style: italic;
font-variant: small-caps;
font-size: 1em;
line-height: 1.5em;
font-family: Verdana, sans-serif;

Nếu áp dụng kỹ thuật Sorthand thì chúng ta chỉ cần phải viết.

font: bold italic small-caps 1em/1.5em verdana, sans-serif;

2. Đặt hai class cho cùng một đối tượng

Thông thường khi bạn viết mã HTML bạn chỉ đặt một class cho một đối tượng. Tuy nhiên điều đó không có nghĩa rằng bạn chỉ được phép đặt duy nhất một class cho một đối tượng. Định dạng HTML cho phép bạn đặt 2 class cho cùng một đối tượng.

Như các bạn đã thấy ở trên nếu bạn muốn đặt 2 class cho cùng một đối tượng thì tên của class thứ nhất phải cách tên của class thứ hai bằng khoảng trống. Trong trường hợp hai class này đều được đặt cùng một thuộc tính thì đối tượng này sẽ được định dạng theo thuộc tính nào được viết sau.

Ví dụ cả hai class đều định nghĩa màu nền cho đối tượng

div.class1 {
background: #CC0000;
}

div.class2 {
background: #00000FF;
}

Trong trường hợp như trên thì đối tượng sẽ nhận thuộc tính background của class2. Vì class2 được định nghĩa sau và trình duyệt sẽ nhận giá trị của thuộc tính này.
3. Các giá trị mặc định của đường viền

Trong quá trình bạn style một đối tượng nào đó có thuộc tính border bạn sẽ liệt kê ra các giá trị của thuộc tính border đó. Vd:

border: 2px solid #000;

Vậy cái gì sẽ hiện thị giá trị mặc định?

1. Border-style: Trong quá trình bạn định nghĩa đường viền (border) cho các đối tượng HTML, nếu như đối tượng phía trước được định nghĩa kiểu border như thế nào thì các đối tượng sau cũng được định nghĩa kiểu border đó ( trong trường hợp bạn không nêu ra kiểu của các đối tượng định nghĩa sau )
2. Border-width: Khi bạn không định nghĩa rõ độ dày của đường viền cho đối tượng bạn định style thì trình duyệt sẽ lấy mặc định độ dày của đường viền đó là 1 pixel.
3. Border-color: Màu của đường bao ngoài sẽ có màu mặc định là màu của đối tượng được bao ( trong trường hợp bạn bỏ qua thông số màu của đối tượng )

4. Định dạng CSS cho tài liệu ở dạng in ấn.

Hầu hết những Web Designer ở Việt Nam rất ít quan tâm tới vấn đề này, nhưng thực chất nó lại là một trong những vấn đề khá quan trọng trong quá trình thiết kế Web. Khi bạn bắt tay vào thiết kế thông thường bạn chỉ quan tâm tới nó hiện thị trên thiết bị đầu cuối là màn hình như thế nào, mà bạn ít khi quan tâm tới khi Website của bạn sẽ được in ra như thế nào? Trong trường hợp người duyệt Web muốn lưu lại những thông tin trên Website của bạn bằng những bản in thì bắt buộc người duyệt cần phải mất thời gian cho việc lựa chọn và xóa bỏ những đối tượng không cần thiết.

Để khắc phục điều đó bạn chỉ cần thêm một file CSS phục vụ riêng cho việc in ấn vào trong Website của bạn. Cách thức cho như sau, trên phần header của bạn ngay sau dòng lệnh chèn file CSSCascading Style Sheets bạn sẽ thêm một dòng tương tự dòng trên những có một số chỗ khác biệt.

Hai chỗ khác biệt đó là tên file CSS (printstyle.css) được sử dụng cho chế độ in và thứ hai là thuộc tính media của link phải đặt là “print” (media=”print”)

Trong file CSS này bạn sẽ tự động tắt các thành phần không cần thiết (vd: hình quảng cáo, phần tỉ giá, thời tiết,..mà thay vào đó là bạn cho hiển thị những phần nội dung mà người xem quan tâm.

(Theo cssyeah.com)