170 likes | 282 Views
Webpage and database design for http:// www.hosannabroadcasting.com. Chia-Yao Chien. Motivation.
E N D
Webpage and database design for http://www.hosannabroadcasting.com Chia-Yao Chien
Motivation • The fundamental concept behind Hosanna Broadcasting Network (HBN) is to target the most dynamic emerging markets on earth: Africa, the Middle East, Europe and India. HBN is the first and only Christian radio network to market with a wide range of coverage. HBN is dedicated to bring the message of Jesus Christ to the under-served areas via high quality digital satellite radio to parts of the world that have not been penetrated by the gospel.
Theory • Basically the website is built on a server company called ”startlogic”. • They allow clients to access the database using phpmyadmin and php webpages.
Design Login page Register Form for first time user Forgot ID Forgot password After Login Chat room Guestbook
Design • Administrator page • asc/desc order • able/disable user • Email • Newletters
Design • Blog • Entry/re-entry for the content • Blog display page • Calendar mode for the blog • Favorites • Contact
Session( ) • Session support in PHP consists of a way to preserve certain data across subsequent accesses. This enables you to build more customized applications and increase the appeal of your web site. • How to access it • session_start() • $_session[‘save_this’] = $save_this_one;
Session( ) • How to read the data from session • session_start() • $save_from_prev_page = $_session[‘save_this’]; Note: php cannot output ANYTHING before calling session_start(), (orother functions that need to sendheaders, like cookie setting).
Cookie( ) • setcookie() defines a cookie to be sent along with the rest of the HTTP headers. Like other headers, cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place calls to this function prior to any output, including <html> and <head> tags as well as any whitespace.
Cookie( ) • How to us cookie <?php $value = 'something from somewhere'; setcookie("TestCookie", $value); setcookie("TestCookie", $value, time()+3600); /* expire in 1 hour */
Cookie( ) • setcookie("TestCookie", $value, time()+3600, "/~rasmus/", ".example.com", 1); ?> • Path The path on the server in which the cookie will be available on. • Domain The domain that the cookie is available. • Secure Indicates that the cookie should only be transmitted over a secure HTTPS connection.
Cookie( ) • Access cookie • echo $_COOKIE["TestCookie"]; • if($_COOKIE['name'] == null){ die; } • Delete cookie • setcookie ("TestCookie", "", time() - 3600);
Blog • Give and initial date, and if the current date < initial date, go to the initial date, else, go to the current. • Use $_GET['date'] to get the date on the url • Flipbar output the url with dates
Blog $today = date('Ymd'); if (isSet($_GET['date'])) { if ($_GET['date'] < $initial_entry_date) { // Go to first entry if the specified date is earlier than range $date = $initial_entry_date; } elseif ($_GET['date'] > $today) { // Go to last entry if specified date is later than range $date = $today; } else { $date = $_GET['date']; } } else { $date = $today; }
Blog $prevdate = $date - 1; $nextdate = $date + 1; if ($date == $initial_entry_date) { $flipbar = "\n<P CLASS=\"next\"><A HREF=\"$PHP_SELF?date=$nextdate\">Next --></A></P>\n"; } elseif ($date == $today) { $flipbar = "\n<P CLASS=\"previous\"><A HREF=\"$PHP_SELF?date=$prevdate\"><-- Previous</A></P>\n"; } else { $flipbar = "\n<TABLE BORDER=0><TR><TD WIDTH=\"50%\" ALIGN=\"left\"><SPAN CLASS=\"previous\"> <A HREF=\"$PHP_SELF?date=$prevdate\"><-- Previous</A></SPAN></TD> <TD WIDTH=\"50%\" ALIGN=\"right\"><SPAN CLASS=\"next\"> <A HREF=\"$PHP_SELF?date=$nextdate\">Next --> </A></SPAN></TD></TR></TABLE>\n"; }
Blog with Calendar mode • Use date() and mktime() calculate the dates for the calendar • $date = mktime (0, 0, 0, $month, $date, $year); • $actualDate = date(“m-d-y", $Febdate2[$i]); • In sql query, take out all the dates that matches with the month of the page