Posted by jhalak on July 25, 2008
I have sent HTML mail with PHP but it shows in evolution / thunderbird in Linux but not in Outlook Express in Windows. To solve the problem use the following code:
$boundary = “_e5YKJHKJHKH098090871893712893″;
$message = “–$boundary\n”;
$message .= “Content-disposition: inline\n”;
$message .= “Content-type: text/html\n\n”;
$message .= “<html>\n”;
$message .= “<head>\n”;
$message .= “<title>Your title</title>\n”;
$message .= “</head>\n”;
$message .= “<body>\n”;
$message .= “\n”;
$message .= “<TABLE width=600 border=0 cellpadding=4 cellspacing=1 bgcolor=#878676>\n”;
$message .= “ <TR>\n”;
$message .= “ <TD bgcolor=white nowrap>Your text</TD>\n”;
$message .= “ </tr>\n”;
$message .= “</TABLE>\n”;
$message .= “</body>\n”;
$message .= “</html>\n”;
$message .= “\n–$boundary–\n”;
$headers = ‘From:’ .$author. “\r\n” . ‘Reply-To:’ .$author;
$headers .= “\nContent-type: multipart/alternative; boundary=\”$boundary\”\nMime-Version: 1.0″;
if (mail($mailto, $subject , $message, $headers)) echo “Mail sent successfully”;
else echo “Something problem !!!!!!!!!!!!!!!!”;
Posted in PHP | 2 Comments »
Posted by jhalak on May 21, 2008
1) There will be three files for this widget
1) style.css
2) script.js
3) widget.php
style.css : This file contains your all styles regurding to view the page. Below is a sample of this page code:
#someId{
border:1px solid #000000;
}
.someclass{
background-color: #cccccc;
}
script.js : this file contains your all javascript codes. Below is a sample of this page code:
function someFunction(){
// do something
}
widget.php: This is the main file that contains all of your html as well as php codes for the widget. Below is a sample of this page code:
document.write(‘ <link rel=”stylesheet” href=”http://www.yourdomain.com/style.css” type=”text/css” /> ‘);
document.write(‘ <script language=”javascript” src=”http://www.yourdomain.com/script.js”></script>’);
document.write(‘ <div id=”someid0″ class=”someclass”> ‘);
document.write(‘ <div id=”tab”> ‘);
document.write(‘ <ul> ‘);
document.write(‘ <li><span id=”someid1″ style=”padding-left:3px;” onClick=”return someFunction1();”>ABCD</span></li> ‘);
document.write(‘ </ul> ‘);
document.write(‘ </div>’);
document.write(‘ <div class=”someclass2″>’);
document.write(‘ <div id=”someId4″ style=”display:block” class=”someclass”> ‘);
document.write(‘ <?php
$db_host = “yourhostname”;
$db_user = “yourdbusername”;
$db_pass = “yourdbpassword”;
$db_name = “yourdbname”;
$db_table_prifix = “yourdbtableprefix”;
if (($conn = mysql_connect($db_host, $db_user, $db_pass)) != NULL){
if (mysql_select_db($db_name,$conn)){
$get_post_sql = “YOUR QUERY “;
$get_post_res = mysql_query($get_post_sql);
while ($row = mysql_fetch_array($get_post_res, MYSQL_ASSOC)){
?> ‘);
document.write(‘ <div class = “dataDiv”> ‘);
document.write(‘ <div class = “topdata”> ‘);
document.write(‘ <a href=”http://anydomain/index.php?Id=<?php echo $row["col1"]; ?>” target=”_blank”> ‘);
document.write(‘ <?php
echo $row["col2"].”…”;
echo “</a>”;
echo “</div>”;
?> ‘);
document.write(‘ <?php
echo “</div>”;
}
mysql_close($conn);
}
}
else echo “No database connection”;
?> ‘);
document.write(‘ </div>’);
document.write(‘ </div>’);
document.write(‘ </div> ‘);
document.write(‘</div> ‘);
Now in any HTML file inside the body tag add the following line:
<script type=”text/javascript” src = “http://www.yourdomain.com/widget.php”> </script>
Thats all. Open this HTML file with any web browser. You will see the widget.
Posted in PHP | Leave a Comment »
Posted by jhalak on May 15, 2008
Problem: File upload error (the uploaded file exceeds the upload_max_filesize directive in php.ini)
Solution:
1) To update the php.ini file set
upload_max_filesize = 20M (your desired size)
post_max_size = 20M (your desired size)
max_execution_time = 3000 (your desired time)
2) Add the following lines in the .htaccess file in the root directory of the server:
php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 200
php_value max_input_time 200
3) In the php file including the following codes:
<?php ini_set(“memory_limit”,”64M”); ?>
<?php ini_set(“post_max_size”,”20M”); ?>
<?php ini_set(“upload_max_filesize”,”20M”); ?>
In HTML file from where the file will be uploaded:
<form ……………………….>
<input type=”hidden” name=”MAX_FILE_SIZE” value=”200000000″>
<input type=”file” …………………>
</form>
The choice depends upon the situation.
Posted in PHP | 2 Comments »