PHP: Connect Mysql Database Using PDO

<!– <?php $user=’root’; $pass=’www.cheapglasses123.com’; $dbh = new PDO(‘mysql:host=localhost;dbname=yzmedu’, $user, $pass); ?> –> <?php try { $dbh = new PDO(‘mysql:host=localhost;dbname=yzmedu’, $user, $pass); // var_dump($dbh); foreach($dbh->query(‘SELECT * from message’) as $row) { echo “<pre>”; print_r($row); echo “</pre>”; } $dbh = null; } catch (PDOException $e) { print “Error!: ” . $e->getMessage() . “<br/>”; die(); } $dbh = […]

Add Different Resource for EmpireCMS

Sometimes it is very difficut for us to publish an article if all the articles have 2 or more different articles resources from other sites. In this cases, we can not copy directly. We can use PHP code:

How to generate all strings with 3 lowercases

In order to let you understand my php code easily on how to generate all strings with 3 lowercases, I will share the code with you on how to generate all 26 single letter from a to z; next generate all strings with 2 lowercases, ie, aa, aj, gz; finally i will tell you the […]

How to get visiters real IP via PHP code?

<? function getIP() { static $realip; if (isset($_SERVER)){ if (isset($_SERVER[“HTTP_X_FORWARDED_FOR”])){ $realip = $_SERVER[“HTTP_X_FORWARDED_FOR”]; } else if (isset($_SERVER[“HTTP_CLIENT_IP”])) { $realip = $_SERVER[“HTTP_CLIENT_IP”]; } else { $realip = $_SERVER[“REMOTE_ADDR”]; } } else { if (getenv(“HTTP_X_FORWARDED_FOR”)){ $realip = getenv(“HTTP_X_FORWARDED_FOR”); } else if (getenv(“HTTP_CLIENT_IP”)) { $realip = getenv(“HTTP_CLIENT_IP”); } else { $realip = getenv(“REMOTE_ADDR”); } } return $realip; } […]

Post Comments Automatically

<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″> </head> <script language=javascript> setTimeout(“document.form1.submit()”,10000) </script> <body bgcolor=”#FFFFFF” text=”#000000″> <form name=”form1″ method=”post” action=”pp.asp”> <p> <input type=”text” name=”textfield”> </p> <p> <input type=”text” name=”textfield2″> </p> </form> </body> </html> We can post comments after 10 seconds.

How can I change wordpress 404 page with Hostgator?

First, creat a page called 404.php, and put the file under your theme root. For example, you are using the wordpress theme called twentyten, then please put 404.php under wp-content/themes/twentyten. Add the following code at 404.php: