How To Create AJAX Commenting System for Static HTML Pages ajax의 코멘트 시스템을 만드는 방법을 정적인 페이지에
I wanted to create ajax based commenting system for some html pages. 나는 기반의 코멘트 시스템을 만들고 싶었 ajax 일부 페이지합니다. The design goals were: 의 디자인의 목표는 :
1. Simple to use and install 간단하게 사용 및 설치
2. 두합니다. Database (MySQL) backed 데이터베이스 (mysql) 지원
3. 3합니다. Minimal changes to HTML template / files 최소한의 변경 내용을 html 템플릿 / 파일
4. 사. Support effective (no frequent cache refreshes) html page compression / caching strategy for heavily commented sites. 지원 효과 (캐시를 수시로 업데이트) 페이지 압축 / 캐싱 전략을 크게 논평 사이트를합니다.
An AJAX based system fits the bill. an ajax 기반 시스템에 맞는 법안합니다. The new comments are displayed instantaneously. 순간적의 새 코멘트가 표시됩니다. The html pages can be cached and / or compressed without requiring to refresh after each comment. the 페이지 수있습니다 캐싱 및 / 또는 압축된 후 각 코멘트를 업데이 트를 필요로하지 않고있습니다.
Spam is an issue with any commenting system. 스팸은 어떤 코멘트 시스템에 연결하는 데 문제가있습니다. I have decided to strip html tags in the first iteration to deter spammers. 나는 스트립 태그하기로했다 스패머의 첫번째 반복을 억제합니다. As a personal decision I have decided not to capture email address. 개인적인 판단으로 캡처 나는 이메일 주소를하지 않기로 결정합니다. However it can be trivially added along with url if so desired. 그러나 그것과 함께 url 수있습니다 원할 경우 추가 자명합니다.
I used Sajax as my Ajax framework. 나는 내 ajax 프레임 워크를 사용 sajax합니다. It presented 그것 발표 few 소수의 problems as Sajax is more suited for PHP / Ruby pages and not HTML. 문제를 sajax가 더 적합합니다 php / 루비 페이지와 html없습니다. Here is 다음은 my solution 내 솔루션을 . 합니다.
Schema: 스키마 :
CREATE TABLE `comments` ( 테이블을 만들기`의견`(
`id` INT NOT NULL AUTO_INCREMENT , 널 없다``int auto_increment,
`url` VARCHAR( 255 ) NOT NULL , `url`varchar (255) 없다 0,
`ip` VARCHAR( 30 ) NOT NULL , `ip`varchar (30) 안 0,
`author` VARCHAR( 255 ) DEFAULT ‘Anonymous Coward’ NOT NULL , `저자`varchar (255) 기본값으로 '익명의 겁쟁이'않 0,
`location` VARCHAR( 255 ) DEFAULT ‘Cyberspace’ NOT NULL , `위치`varchar (255) 기본값으로 '사이버 스페이스'않 0,
`comment` TEXT NOT NULL , `의견`텍스트가 0,
`when` TIMESTAMP NOT NULL, 타임 스탬프 없다``0,
PRIMARY KEY ( `id` ) ) 기본 키 (`번호`))
);
Design notes: 디자인 참고 사항 :
The code for adding comment passed the url of the page. 코드를 추가하기위한 페이지의 코멘트를 전달합니다. When the page is loaded a sajax call is made to fetch all the comment for the url of the page. 이 페이지가 로드될 때 만들어를 가져올 a sajax 호출이 페이지의 모든 코멘트를합니다. New comments are displayed instantaneously as new comments are fetched after a comment has been submitted. 새 코멘트가 표시됩니다 반입 후 즉시 새로운 의견은 의견이 제출되었습니다. This can additionally fetch comments from other users. 이것은 또한 다른 사용자의 의견을 가져오는합니다. However I have decided not to implement timed refresh as that may unnecessarily increase server load without adding much value to users. 그러나 나는 시간이 업데이 트를 구현하지 않기로 결정을 불필요하게 증가로 서버의 부하가 많은 값을 사용자를 추가하지 않고있습니다. Validation checks are made to detect and not add duplicate comments. 유효성 확인은 중복 의견은 추가하지를 감지하고있습니다. Comment throttling by same user can be added to prevent abuse. 코멘트를 조절하여 악용을 방지하기 위해 동일한 사용자 추가할 수있습니다.
Hope that helps in designing your commenting system. 귀하의 코멘트 시스템을 디자인하는 데 도움 기대합니다.
Filed under 밑에 CMS Software cms 소프트웨어를 , Headline News 헤드 라인 뉴스 , How To 하는 방법을 , Open Source Software 오픈 소스 소프트웨어 , PHP php , Pro Blogging 직업적인 블로깅 , Spam Watch 스팸 메일 시계 , Tech Note 기술 참고 사항 , Web 웹 , Web Services 웹 서비스 | |
| |
RSS 2.0 rss 2.0 | |
Trackback 트랙백 this Article | 이 문서 |
Email this Article 전자 우편이 문서
You may also like to read 같은를 읽을 수있습니다 |





June 10th, 2006 at 4:27 pm 2006년 6월 10일에서 오후 4시 27분
I think that works as long as search engine indexing of the comments is not important (as you outlined in “When *NOT* to use AJAX.” 나는 한 검색 엔진의 색인 생성을 생각하는 작품의 의견은 중요하지 않습니다 (당신에 명시된 "언제 * 비 * ajax를 사용합니다."
I don’t understand how stripping markup deters spammers. 이해가 안가 벗겨진 마크업하는 방법 스패머는 deters합니다. A spambot has no way of knowing whether you are stripping HTML/links or not. a spambot은 당신이 삭제 여부를 알 방법이없습니다 html / 링크 여부합니다. It is just going to submit the spam and hope you leave the HTML intact. 그것은 그 자식에게 제출하여 html 스팸 메일과 희망을 그대로 둡니다.
August 21st, 2006 at 12:15 pm 2006년 8월 21일에서 오후 12시 15분
For antibots the best solution is generating a code automatically in an image. antibots위한 최고의 솔루션은 이미지를 생성하는 코드를 자동으로합니다.
August 21st, 2006 at 12:33 pm 2006년 8월 21일에서 오후 12시 33분
@Brian @ 브라이언
> I think that works as long as search engine indexing of the comments is not important > 내 생각만큼 검색 엔진의 색인을 생성하는 작품의 의견은 중요하지 않습니다
Definitely. 확실합니다. That is also a deterrent for spammers. 스패머가에 대한 억지력도합니다.
> A spambot has no way of knowing whether you are stripping HTML/links or not. > a spambot은 당신이 삭제 여부를 알 방법이없습니다 html / 링크 여부합니다. It is just going to submit the spam and hope you leave the HTML intact. 그것은 그 자식에게 제출하여 html 스팸 메일과 희망을 그대로 둡니다.
In my experience I have seen most spambots target sites with specific signature like those of WordPress or Movable Type. 내 경험에 사이트를 본 적이있어이 문서가 적용되는 대부분의 spambots wordpress 또는 이동 유형을 같은 구체적인 서명합니다. They spam based on site signature. 그들은 스팸 메일 사이트를 기반으로 서명을합니다. So normally home-grown commenting system are unlikely to be invaded. 그래서 일반적으로 홈 - 성장의 코멘트 시스템은 침략 않을 수있습니다. When they find a popular commenting system is stripping html then they will not have any incentive to develop code for that system. 인기 논평을 그들이 찾을 때 시스템이없는 그들은 인센티브가 벗겨진 html 다음 코드를이 시스템을 개발합니다.
@Gunther @ 군터
Do you mean spambots & CAPTCHA? 무슨 뜻 spambots & captcha?
November 11th, 2007 at 6:56 pm 2007년 11월 11일에서 오후 6시 56분
Thanks 감사합니다