Pages

About Me

My photo
Kulrian/Bareta, Punjab, India
I am simple and coool boy.

Friday 20 November 2009

Thursday 19 November 2009

ExtractEmails in PHP

include_once("../../business/connection_b.php");
$content=file_get_contents("emails.txt");
$emailArray=$result=array();
$pattern="/[^a-zA-Z0-9\.]+?([a-zA-Z0-9\.]+@[a-zA-Z0-9\.-]+)[^a-zA-Z0-9\.]/Uis";
preg_match_all($pattern, $content, $result, PREG_SET_ORDER);
$result=array_unique($result);
$result=array_values($result);
print_r($result); die;
$c=count($result);
for($i=0;$i<$c;$i++){
$emailArray[]=trim($result[$i][1]);
}
echo print_r($emailArray);

?>

How to Create a Calendar Using PHP | eHow.com

A PHP calendar is very easy to set up in just a few minutes. Use the calendar on your website to display the current month and date. You can also scroll through previous and coming months. With a little work you can integrate a calendar into your existing web page.

  1. Step 1

    Follow the PHP Calendar Source link in Resources. This will display PHP code. Copy it by highlighting and pressing "Ctrl" + "C."

  2. Step 2

    Open your php file editor to paste the code into a new php file. Be certain that you're saving your file and type php.

  3. Step 3

    Save the file as "calendar.php," but don't close the file. This code won't actually show a calendar just yet, but it's the code the calendar will use.

  4. Step 4

    Go to the bottom of the file and paste the following code before the final ?> (question mark and greater than symbol) at the end of the file.

    // Construct a calendar to show the current month
    $cal = new Calendar;
    echo $cal->getCurrentMonthView();

  5. Step 5

    Test the file by uploading it to your web server with your file upload program. You will see a very simple calendar with the current month displayed and the current date highlighted.

    You calendar is created.

  6. Adding Style

  7. Step 1

    Add the following CSS style blocks to the beginning of your file before the opening

  8. Step 2

    Change the color of your calendar's header by changing the follow CSS style declaration from Step 1.

    calendarHeader {font-weight: bolder; color: #CC0000; background-color: #FFFFCC;}

    You can replace the hexadecimal color #FFFFFF for the background with natural name colors like "red," "white," "blue."

    You can do the same to replace the hexadecimal colors #CC0000 for the header's text color.

  9. Step 3

    Change the color of the current date highlight by changing the follow CSS style declaration from Step 1.

    calendarToday {background-color: #FFFFFF;}

    Replace the hexadecimal color #FFFFFF for the background with natural name colors or other hexadecimal values.

  10. Step 4

    Change the background color of the whole calendar by changing the following CSS style declaration in Step 1.

    calendarToday {background-color: #FFFFFF;}

    Replace the hexadecimal color #FFFFFF for the background with natural name colors or other hexadecimal values.

    If you want to see a broader range of hexadecimal colors, visit the "Hexadecimal Color" link in Resources.

  11. Navigation

  12. Step 1

    Find the following block of code in your calendar.php file (this should be around line 418).

    // Construct a calendar to show the current month
    $cal = new Calendar;
    echo $cal->getCurrentMonthView();

  13. Step 2

    Replace the code with the following code block.

    class MyCalendar extends Calendar { function getCalendarLink($month, $year) {
    // Redisplay the current page, but with some parameters
    // to set the new month and year
    $s = getenv('SCRIPT_NAME'); return "$s?month=$month&year=$year"; } }

  14. Step 3

    Add the following code block to the end of the calendar.php file after all other code.

    $d = getdate(time());
    if ($month == "") {
    $month = $d["mon"]; }
    if ($year == "") {
    $year = $d["year"]; }
    $cal = new MyCalendar;
    echo $cal->getMonthView($month, $year);
    ?>

  15. Step 4

    Test your new customized calendar by uploading calendar.php to your web server. Your calendar will show the current month with date highlighted. You can now navigate through the months.

  16. Integration

  17. Step 1

    Open the web page you want to integrate your new calendar into. For this to work, the file in which you want to integrate the calendar must also be a php file.

  18. Step 2

    View the code of your file and paste the following code where you want your new calendar to appear.

    include ("calendar.php");
    ?>

  19. Step 3

    Put your calendar.php in the same folder/directory as your web pate that will display the calendar.