Login   Register  
PHP Classes
elePHPant
Icontem

File: personal.phtml

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Slava Ivanov  >  vCard Class  >  personal.phtml  >  Download  
File: personal.phtml
Role: Example script
Content type: text/plain
Description: example application
Class: vCard Class
Class to manipulate with vCard information
Author: By
Last change:
Date: 11 years ago
Size: 6,498 bytes
 

Contents

Class file image Download
<?
Header
("Cache-Control: no-cache");
Header("Pragma: no-cache");
Header("Expires: Sat, Jan 01 2000 01:01:01 GMT");
session_name("SID");
session_start();
include(
"datetimeclass.inc");

$SCRIPT_NAME "personal.phtml";
$title "vCard";
$FORM_NAME "jform";
$act $_POST["act"];
$error 0;
$datetime = new DATETIME();

if (
$act == "index" || $act == "home" || $act == "business" || $act == "other" || $act == "saveit") {
    
$datetime->set_datetime_byglobal("HTTP_POST_VARS");
    if (
$datetime->get_date_error()) {
        
$error++;
        
$onload "javascript:alert('Error: ".$datetime->get_date_error()."');";
    } else {
        
$_SESSION["vCardinfo"]["prefix"] = trim(stripslashes($_POST["prefix"]));
        
$_SESSION["vCardinfo"]["fname"] = trim(stripslashes($_POST["fname"]));
        
$_SESSION["vCardinfo"]["mname"] = trim(stripslashes($_POST["mname"]));
        
$_SESSION["vCardinfo"]["lname"] = trim(stripslashes($_POST["lname"]));
        
$_SESSION["vCardinfo"]["suffix"] = trim(stripslashes($_POST["suffix"]));
        
$_SESSION["vCardinfo"]["nickname"] = trim(stripslashes($_POST["nickname"]));
        
$_SESSION["vCardinfo"]["birthday"] = $datetime->get_select_years("ldigit"1900""""""11)."/".$datetime->get_select_months(1"digit"""""11)."/".$datetime->get_select_days(1""""11);
        
$_SESSION["vCardinfo"]["email1"] = trim(stripslashes($_POST["email1"]));
        
$_SESSION["vCardinfo"]["email2"] = trim(stripslashes($_POST["email2"]));
        if (
$act == "saveit")
            exit(
header("Location: index.phtml?act=saveit"));
        else
            exit(
header("Location: ".$act.".phtml"));
    }
}

if (
$_SESSION["vCardinfo"]["birthday"]) {
    
$arr_date explode("/"$_SESSION["vCardinfo"]["birthday"]);
    if (
sizeof($arr_date) == 3)    $datetime->set_datetime_bycomponents((int)$arr_date[1], (int)$arr_date[2], (int)$arr_date[0]);
}

include(
"template-header.phtml");
?>

<form method="post" action="<? echo $SCRIPT_NAME ?>" name="<? echo $FORM_NAME ?>">
<table cellspacing="1" cellpadding="0" border="0" width="485" align="center">
<? include("vmenu.phtml"); ?>
<tr>
<td colspan="8" valign="top">
    <table cellspacing="0" cellpadding="0" border="0" width="100%" bgcolor="#bebebe">
    <tr>
    <td bgcolor="#eeeeee" width="1"><img src="../images/spacer.gif" width="1" height="300"></td>
    <td valign="top">
    <br>
    <!------------------------contents go here ---------------------------------------------------------->


    <table  cellspacing="0" cellpadding="0" border="0" width="100%">
    <tr>
    <td colspan="2">
        <table cellspacing="0" cellpadding="7" border="0">
        <tr>
        <td>&nbsp;Enter personal information here.</td>
        </tr>
        </table>
    </td>
    </tr>
    <tr>
    <td valign="top">
        <table border=0>
        <tr>
        <td class="medium">Title: </td><td><input type="text" size="10" maxlength="10" name="prefix" value="<? echo ($error)? htmlspecialchars(stripslashes($_POST["prefix"])) : htmlspecialchars($_SESSION["vCardinfo"]["prefix"]); ?>"></td>
        </tr>
        <tr>
        <td class="medium">First: </td><td><input type="text" size="25" maxlength="64" name="fname" value="<? echo ($error)? htmlspecialchars(stripslashes($_POST["fname"])) : htmlspecialchars($_SESSION["vCardinfo"]["fname"]); ?>"></td>
        </tr>
        <tr>
        <td class="medium">Middle: </td><td><input type="text" size="25" maxlength="64" name="mname" value="<? echo ($error)? htmlspecialchars(stripslashes($_POST["mname"])) : htmlspecialchars($_SESSION["vCardinfo"]["mname"]); ?>"></td>
        </tr>
        <tr>
        <td class="medium">Last: </td><td><input type="text" size="25" maxlength="64" name="lname" value="<? echo ($error)? htmlspecialchars(stripslashes($_POST["lname"])) : htmlspecialchars($_SESSION["vCardinfo"]["lname"]); ?>"></td>
        </tr>
        <tr>
        <td class="medium">Suffix: </td><td class="medium"><input type="text" size="10" maxlength="10" name="suffix" value="<? echo ($error)? htmlspecialchars(stripslashes($_POST["suffix"])) : htmlspecialchars($_SESSION["vCardinfo"]["suffix"]); ?>"> e.g. Jr.</td>
        </tr>
        </table>
    </td>
    <td valign="top">
        <table>
        <tr>
        <td class="medium">Nickname: </td><td><input type="text" size="25" maxlength="64" name="nickname" value="<? echo ($error)? htmlspecialchars(stripslashes($_POST["nickname"])) : htmlspecialchars($_SESSION["vCardinfo"]["nickname"]); ?>"></td>
        </tr>
         <tr>
        <td class="medium">Birthday: </td><td><? echo $datetime->get_select_months(1"sword""month")." ".$datetime->get_select_days(1"day")." ".$datetime->get_select_years("ldigit"1900"""year"?></td>
        </tr>
        <tr>
        <td class="medium">Email: <br>(default)</td><td><input type="text" size="25" maxlength="256" name="email1" value="<? echo ($error)? htmlspecialchars(stripslashes($_POST["email1"])) : htmlspecialchars($_SESSION["vCardinfo"]["email1"]); ?>"></td>
        </tr>
       <tr>
        <td class="medium">Email: </td><td><input type="text" size="25" maxlength="256" name="email2" value="<? echo ($error)? htmlspecialchars(stripslashes($_POST["email2"])) : htmlspecialchars($_SESSION["vCardinfo"]["email2"]); ?>"></td>
        </tr>
        <tr>
        <td class="medium" colspan=2>&nbsp;</td>
        </tr>
         </table>
    </td>
    </tr>
    </table>
    <!---------------------------------------------------------------------------------->
   </td>
    <td bgcolor="black" width="1"><img src="../images/spacer.gif" width="1" height="1"></td>
    </tr>
    <tr>
    <td  bgcolor="black" colspan="3"><img src="../images/spacer.gif" width="1" height="1"></td>
    </tr>
    </table>
 </td>
</tr>
</table>

<table width="485" align="center" cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="3"><img src="../images/spacer.gif" width="1" height="2"></td>
</tr>
<tr  bgcolor="#e5e5e5">
<td  align="right"><input type="button" name="delete" value="Delete" onclick="javascript:dosubmit('deleteit',document.<? echo $FORM_NAME ?>);">&nbsp;<input type="button" name="cancel" value="Cancel" onclick="javascript:dosubmit('cancelit',document.<? echo $FORM_NAME ?>);">&nbsp;<input type="button" name="save" value=" Save " onclick="javascript:dosubmit('saveit',document.<? echo $FORM_NAME ?>);"></td>
</tr>
</table>

<input type="hidden" name="act" value="">
</form>

<? include("template-footer.phtml"); ?>