Posted on 2009 under PHP |
14
Jan
Hello guys,the email() function in php could be very useful to send emails.If we could use php to create email address and then we can use email() function to send mails to others.
Okay,here I just write some code,if you needed,you can use them.
You can create a file let’s say email.php and save all the code within the file.
<?php header(”Content-Type:text/html;charset=utf-8″); ?>
<?php
$s = 1000;////////////////$s stand for how many emails you want to create,I set it as 1000.
for($i = 1;$i <= $s;$i++){
$qqemail9 = rand(1,9) . rand(0,9) . rand(0,9) . rand(0,9) . rand(0,9) . rand(0,9) . rand(0,9) . rand(0,9) . rand(0,9) . “@qq.com”;
$qqemail8 = rand(1,9) . rand(0,9) . rand(0,9) . rand(0,9) . rand(0,9) . rand(0,9) . rand(0,9) . rand(0,9) . “@qq.com”;
$num = rand(1,2);
if($num = 1){
$to = “{$qqemail9}”;
$subject = “this is the subject”; //////////////////sent “this is the subject” with your subject.
$message = “this is the content” . ” \r\n “; //////////////////sent “this is the content” with your content.
echo $i . ” ” . $to . “<br />”;
mail($to, $subject, $message, “FROM: sender@sender.com”);////////sender@sender.com is your own address,you can change it to your own email address.
}elseif($num =2){
$to = “{$qqemail8}”;
$subject = “this is the subject”; //////////////////sent “this is the subject” with your subject.
$message = “this is the content” . ” \r\n “;//////////////////sent “this is the content” with your content.
echo $i . $to . “<br />”;
mail($to, $subject, $message, “FROM: sender@sender.com”);////////sender@sender.com is your own address,you can change it to your own email address.
}
}
echo “You have sent” . $s . “emails”;
?>
Just upload the email file to your hosting and open the file you will have 1000 emails sent.
Posted on 2008 under PHP |
8
Oct
After connect php website and database,we will try to get the content from the database,we can create a page which is called content.php.
And we just need to put this code in the <body> </body> part.
<?php
$query_subjects = “SELECT * FROM subjects”;
$query = mysql_query($query_subjects);
if(!$query) {
die(”Database selection failed: ” . mysql_error() );
}
//so we just have get the content from the database subjects table,now we need to display the content on the website.
while($ subject_row = mysql_fetch_array($query)) {
echo $row[menu_name] ;
}
?>
It will get all the meun_name from the database and it will display on your website.
Posted on 2008 under PHP |
8
Oct
We just need to create a file config.php
and have the code
<?php
//Database Constants
define(”DB_SERVER”, “localhost”);
define(”DB_USER”, “english_wefri”);
define(”DB_PASS”, “winnerlabel”);
define(”DB_NAME”, “english_wefriend”);
?>
then create a file which is called connection.php
and put the code in the file.
<?php
require(”constants.php”);
// 1.Create a database connection
$connection = mysql_connect(DB_SERVER,DB_USER,DB_PASS);
if(!$connection){
die(”Database connection failed:” . mysql_error());
}
// 2.Select a database
$db_select = mysql_select_db(DB_NAME,$connection);
if(!$db_select){
die(”Database selection failed: ” . mysql_error());
}
?>
Then we just connect the our site to the database.
And we can put different kinds of code after that in the <head> & </head> as well as <body> </body> party.
After finish that we shall close the database,we just need to create another file which is called footer.php
we just need to put the code
</div>
<div id=”footer”>Copyright 2007,Widget Corp</div>
</body>
</html>
<?php
if(isset($connection)){
mysql_close($connection);
}
?>
within the footer.php
so this three files help us with create a connection the our database and disconnect ourdatabase.
Posted on 2008 under PHP |
5
Oct
First,I’d like to post a small php script,
<?php
phpinfo();
?>
This script can help you know the php installed in your servers.You can put this script between the <body> </body>,and save your file in .php,then upload that file to your hosting.
visit that file,then you can get the information of php script of your hosting.