EragonJ – A humble navigator

About EragonJ | About this blog

Archive for the ‘PHP’ Category

[Mac] How to enable GD lib ?

leave a comment

意外找到這個開發者寫的pkg檔,真的是一裝就Happy Ending了,省下不少時間,

以下是該pkg檔的特色,記下來給以後有需要的人!!

連結

  • the MySQL and PostgreSQL databases
  • the cURL library for various communications protocols
  • the GD image creation library (with PNG, JPEG, PostScript Type 1 and TrueType font options).
  • the expat XML parser and WDDX support
  • XSLT transformations
  • LDAP access
  • the IMAP client library
  • mcrypt encryption functions
  • GNU gettext

Written by EragonJ

January 19th, 2010 at 12:31 am

Posted in PHP

Tagged with , , ,

[PHP] phpMyAdmin #2002 error

leave a comment

Environment :

Mac OSX 10.5.8
PHP 5.2.10
Mysql 5.0.82
phpMyAdmin 3.1.3

Error:

#2002 – The server is not responding (or local MySQL server’s socket is not correctly configured)

Solution



Written by EragonJ

September 17th, 2009 at 5:08 am

Posted in PHP

Tagged with , , , ,

[PHP] Wxetch bot 三連發

leave a comment

昨天意外的看到一個討論串 , 就在那邊寫了一個新的 Wxetch Tricker 寫到三點…原因是因為有些地方一直卡住才卡這麼晚 , 囧…

A – Wxetch Tricker

是能夠用中花電信的 proxy server 來做到 cheating 的作用


<?php
if(isset($_POST['url'])){

$cookie = 'cookie.txt';
$url = trim($_POST['url']);
$pattern = "/www.wretch.cc/blog/(.*)/i";

if((preg_match($pattern,$url,$last))==TRUE){
$url = $last[1];
}
for($i=0;$i<25;$i++){
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,"www.wretch.cc/blog/$url");
curl_setopt($ch,CURLOPT_PROXY,"proxy.hinet.net");
curl_setopt($ch,CURLOPT_PROXYPORT,80);
curl_setopt($ch,CURLOPT_TIMEOUT,5);
curl_setopt($ch,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch,CURLOPT_COOKIEJAR,$cookie);
curl_setopt($ch,CURLOPT_COOKIEFILE,$cookie);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_exec($ch);
curl_close($ch);
}
}else{
echo '
<html>
<head>
<title>Wxetch Tricker</title>
</head>
<body>
<form method="post" action="tricker.php">
請輸入Wxetch帳號:<input type="text" name="url" value="">
<input type="submit" name="click" value="click">
....default: 50 times
</form>
<div align="right">Author: EragonJ</div>
</body>
</html>
';
}
?>

因為這個要是中花電信的用戶才能使用他們的proxy server , 不過台灣還蠻多用戶的ISP都是他 , 所以應該都可以做到就是了!

我一直在想 , proxy server 不過就是個中繼站嗎? 那這樣子的話是怎麼可能做到cheating的功效 , 如果我推論沒錯的話 proxy.hinet.net:80 這是主要的server , 其下還有很多子server可以供主server 發佈命令去做中繼的動作 , 所以就可以做到cheating的功用 ,因為是由各個子proxy server去和Wxetch做接觸的!!

就算是小量cheating的動作就是了..

B – Wxetch Observer

有兩個版本 , 一個是Full size version
而另一個是Short cut version

這兩個都是可以直接去抓取相簿圖片的小程式 , 但是該死的IE6用右鍵會抓不到圖 , 但FF就沒有這個問題 , 可以來用用看FF3呀XD~ 真的是現在都用這個了~ 超好用 , 又有很多add-ons

大概就是這三個啦 , 下次還有什麼有趣的東西再放出來~

Written by EragonJ

February 10th, 2009 at 4:36 am

Posted in PHP

Tagged with , ,

[PHP] PHPmailer

leave a comment

今天第一次用PHPmailer,為了學著用線上寄信的功能。

而這在經過多次設定後,發現了很多問題= =” ,因為不太會玩嘛~

由於本機沒有裝SMTP Server ,所以就借用Google的SMTP Server來實現。

1.剛開始要先include class.phpmailer.php (自行去官網下載最新版的)

2.還要再inlcude class.smtp.php(都在同一個壓縮檔內)

3.setting


$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true; //啟用SMTP認証
$mail->SMTPSecure = "ssl"; //以SSL加密連線
$mail->Host = "smtp.gmail.com"; // Gmail的SMTP Server address
$mail->Port = 465; // Gmail的SMTP port

$mail->Username = "xxxx@gmail.com"; // GMAIL 帳號
$mail->Password = "xxxxxx"; // GMAIL 密碼

$mail->From = "xxxx"; //從誰寄來
$mail->FromName = "First Last"; //從誰寄來(名字)
$mail->Body = "Hey buddy, heres an email!"; //信件內容
$mail->Subject = "PHPMailer Test Subject via gmail"; //信件主旨

$mail->WordWrap = 50; // 設定斷字的長度

$mail->AddAddress("recept@mail.com", "John Doe"); //設定收件人的Email和Name

$mail->setLanguage('zh'); //我自己翻譯的中文錯誤訊息(可不加)

if(!$mail->Send()) { //寄信成功與否
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

基本上這樣設定就沒有問題了,下次再打我研究出來的結果。

可以留言討論呀:D~

Written by EragonJ

September 10th, 2008 at 5:20 pm

Posted in PHP

Tagged with ,