473,387 Members | 1,545 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Not working in Chrome, focus() function?

matheussousuke
249 100+
The following code only works in Internet Explorer, it is not working in Chrome, I suspect it is an issue with focus()

Don't know where to start from, little hand here please.





Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. include "../includes/session.php";
  4.  
  5. include "../includes/config.php";
  6.  
  7. include "../includes/function.php";
  8.  
  9. if (get_magic_quotes_gpc()) {
  10.  
  11.     $_POST = array_map('stripslashes_deep', $_POST);
  12.  
  13.     $_GET = array_map('stripslashes_deep', $_GET);
  14.  
  15.     $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
  16.  
  17. }
  18.  
  19.  
  20.  
  21. $rootserver = $_SESSION["session_rootserver"];
  22.  
  23. $secureserver=$_SESSION["session_secureserver"];
  24.  
  25. $size_per_user=0;     // passed by reference to size checking function
  26.  
  27. $allowed_space=0;    // passed by reference to size checking function
  28.  
  29. $basicLocation=fetchBasicLocation(1);    //    this function fetches the location of the install folder
  30.  
  31. $temperory_location=$basicLocation . "/workarea/tempsites";
  32.  
  33. $real_location=$basicLocation . "/workarea/sites";
  34.  
  35.  
  36.  
  37.  
  38.  
  39. //User selects publish page which will take him to the payment page which will be a secure page.
  40.  
  41. //The secure page may not have access to the session state of the normal page if the secure url
  42.  
  43. //is a shared one, hence we are passing the userid(uid), tempsiteid(tid), templateType(type), styleSheet(style)
  44.  
  45. if($_POST["pubpage"] == "publishpage") {
  46.  
  47.     $sql="select vname,vvalue from tbl_lookup where vname ='paymentsupport'";
  48.  
  49.     $result=mysql_query($sql,$con);
  50.  
  51.     $row=mysql_fetch_array($result);
  52.  
  53.     $needpaymentsupport=$row['vvalue'];
  54.  
  55.     if($needpaymentsupport=="no"){
  56.  
  57.                 header("location:../publishpage_free.php?uid=" . $_SESSION["session_userid"] . "&tid=" . $_SESSION['session_currenttempsiteid'] . "&type=advanced&style=" . $_SESSION["session_style"] . "&");
  58.  
  59.                 exit;
  60.  
  61.     }else{
  62.  
  63.            header("location:$secureserver/publishpage.php?uid=" . $_SESSION["session_userid"] . "&tid=" . $_SESSION['session_currenttempsiteid'] . "&type=advanced&style=" . $_SESSION["session_style"] . "&");
  64.  
  65.         exit;
  66.  
  67.     }
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79. }
  80.  
  81.  
  82.  
  83.  
  84.  
  85. $script_string="<script> ";
  86.  
  87.     //Functions used in various sections
  88.  
  89.  
  90.  
  91.         //function createPage($pageName,$templateId,$pageType,$editing) returns pageurl {} used to create a page in work area
  92.  
  93.         //$pageName     ==> name of the page created
  94.  
  95.         //$templateId     ==>    Id of the template
  96.  
  97.         //$tmpSiteId    ==>    Id of the temperory site the file has to be copied to
  98.  
  99.         //$pageType        ==>    '1' indicates index.htm, '2' indicates a sub.htm.
  100.  
  101.         //$editing        ==>    'true' indicates we are editing a published site(workarea/sites/siteid),
  102.  
  103.         //                    'false' indicates this site has not yet published (workarea/tempsites/tempsiteid)
  104.  
  105.         //$firstTime     ==>    'true' indicates page is being created for the first time so copy images
  106.  
  107.         //                    'false' indicates page is being created for the nth time so do not copy images
  108.  
  109.         //process        ==>    We copy a page from the templates/$templateId/[index.htm/sub.htm] based on the $pageType
  110.  
  111.         //                    to the workarea/[sites/tempsites]/[siteId/tempsiteId].  If the $pageType is 1 then we
  112.  
  113.         //                    copy index.htm, else we copy sub.htm. If the $editing == true then we copy the page to
  114.  
  115.         //                    sites/siteid also.    if $firstTime == true then we copy the templates/$templateId/watermarkimages files to
  116.  
  117.         //                    workarea/[sites/tempsites]/[siteId/tempsiteId]/images,  templates/$templateId/style.css to
  118.  
  119.         //                    workarea/[sites/tempsites]/[siteId/tempsiteId]/style.css. we give the permissions to 755.
  120.  
  121.         //                    if $gbflag == true then we replace <body> tag with the guestbook code.
  122.  
  123.         function createPage($pageName,$templateid,$tmpsiteid,$pageType,$editing,$firstTime=false,$gbflag=false) {
  124.  
  125.             //physical location of the template will be /templates/template_id/
  126.  
  127.             //2 pages will be present 'index.htm' and 'sub.htm'
  128.  
  129.             //a folder called 'images' and 'watermarkimages' will be present in this folder.
  130.  
  131.             $workLocation = "";
  132.  
  133.             $pageToCopy = "";
  134.  
  135.             if($pageType == 1) {
  136.  
  137.                 $pageToCopy = "index.htm";
  138.  
  139.             }
  140.  
  141.             else {
  142.  
  143.                 $pageToCopy = "sub.htm";
  144.  
  145.             }
  146.  
  147.             //if $editing == true then set copy location to workarea/sites/siteid, copy the page to sites/siteid also.
  148.  
  149.             //else copy location to workarea/tempsites/tempsiteid
  150.  
  151.             if($editing == true) {
  152.  
  153.                 $workLocation = "../workarea/sites/$tmpsiteid";
  154.  
  155.                @copy("../".$_SESSION["session_template_dir"]."/$templateid/$pageToCopy","../sites/$tmpsiteid/$pageName");
  156.  
  157.                @chmod("../sites/$tmpsiteid/$pageName",0755);
  158.  
  159.             }
  160.  
  161.             else {
  162.  
  163.                 $workLocation = "../workarea/tempsites/$tmpsiteid";
  164.  
  165.             }
  166.  
  167.             //If the page is created for the first time copy watermarkimages to images folder in workarea, and style.css to workarea.
  168.  
  169.             if($firstTime == true)    {
  170.  
  171.                 copydirr("../".$_SESSION["session_template_dir"]."/".$templateid."/watermarkimages",$workLocation . "/images",0755,false);
  172.  
  173.                  @copy("../".$_SESSION["session_template_dir"]."/$templateid/style.css",$workLocation . "/style.css");
  174.  
  175.                 @chmod($workLocation . "/style.css",0755);
  176.  
  177.             }
  178.  
  179.             @copy("../".$_SESSION["session_template_dir"]."/$templateid/$pageToCopy",$workLocation . "/$pageName");
  180.  
  181.                @chmod($workLocation . "/$pageName",0755);
  182.  
  183.             //If the page being created is a guestbook replace <body> tag with guestbook code(php)
  184.  
  185.             if($gbflag == true) {
  186.  
  187.                 $search_string = "</head>";
  188.  
  189.                  $replace_string='</head><span id=guestbook_span><?
  190.  
  191.                           $filename = \'gb.txt\';
  192.  
  193.                           // make sure the file exists and is writable first.
  194.  
  195.                           if (is_writable($filename)) {
  196.  
  197.                               if (!$handle = fopen($filename, \'a+\')) {
  198.  
  199.                                    $message.= "Cannot open file ($filename)";
  200.  
  201.                                    exit;
  202.  
  203.                               }
  204.  
  205.                                   If($_GET["act"]=="post"){
  206.  
  207.                                           $message= "";
  208.  
  209.                                           $content = addslashes($_POST["name"])."`|^".$_POST["email"]."`|^".$_POST["matter"]."`|^".date("Y-m-d")."~`|\n";
  210.  
  211.                                           if (fwrite($handle, $content) === FALSE) {
  212.  
  213.                                                   $message.= "Cannot write to file ($filename)";
  214.  
  215.                                                   exit;
  216.  
  217.                                           }
  218.  
  219.  
  220.  
  221.                                           $message.= "Thank you. Your Guest book entry added";
  222.  
  223.                                           fseek($handle, 0);
  224.  
  225.  
  226.  
  227.                                   }
  228.  
  229.                               //read file content to make display
  230.  
  231.                                   $displaycontents.="<table align=center width=70%><tr><td align=center><font face=verdana size=2><b>Current GuestBook Entries<br>&nbsp;</b></font></td></tr>";
  232.  
  233.  
  234.  
  235.                                   if(filesize($filename)>0){
  236.  
  237.  
  238.  
  239.                                                   $readcontents = @fread($handle, filesize($filename));
  240.  
  241.                                                   $entryarray=explode("~`|\n",$readcontents);
  242.  
  243.  
  244.  
  245.  
  246.  
  247.                                                   for($i=0;$i<count($entryarray)-1;$i++){
  248.  
  249.  
  250.  
  251.                                                           $valuearray=explode("`|^",$entryarray[$i]);
  252.  
  253.                                                           $displaycontents.="<tr><td align=left bgcolor=#dddddd><font face=verdana size=2>Posted &nbsp;by &nbsp;".stripslashes($valuearray[0])."( ".$valuearray[1]." ) &nbsp;on&nbsp; ".$valuearray[3]."</font></td></tr>";
  254.  
  255.                                                           $displaycontents.="<tr><td align=left valign=top><font face=verdana size=2><br>".$valuearray[2]."</font></td></tr>";
  256.  
  257.                                                           $displaycontents.="<tr><td align=left valign=top>&nbsp;</td></tr>";
  258.  
  259.  
  260.  
  261.  
  262.  
  263.                                                   }
  264.  
  265.  
  266.  
  267.  
  268.  
  269.                                   }else{
  270.  
  271.  
  272.  
  273.                                                   $displaycontents.="<tr><td align=center valign=top><font face=verdana size=2>Sorry! Guest book is empty.</font></td></tr>";
  274.  
  275.  
  276.  
  277.                                   }
  278.  
  279.                                   $displaycontents.="</table>";
  280.  
  281.                                   fclose($handle);
  282.  
  283.  
  284.  
  285.  
  286.  
  287.                           } else {
  288.  
  289.  
  290.  
  291.                               $message.= "The file $filename is not writable.Please provide write permission to it";
  292.  
  293.  
  294.  
  295.                           }
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.                           ?>
  306.  
  307.                           <script>
  308.  
  309.                           function checkMail(email)
  310.  
  311.                           {
  312.  
  313.                                   var str1=email;
  314.  
  315.                                   var arr=str1.split(\'@\');
  316.  
  317.                                   var eFlag=true;
  318.  
  319.                                   if(arr.length != 2)
  320.  
  321.                                   {
  322.  
  323.                                           eFlag = false;
  324.  
  325.                                   }
  326.  
  327.                                   else if(arr[0].length <= 0 || arr[0].indexOf(\' \') != -1 || arr[0].indexOf("\'") != -1 || arr[0].indexOf(\'"\') != -1 || arr[1].indexOf(\'.\') == -1)
  328.  
  329.                                   {
  330.  
  331.                                                   eFlag = false;
  332.  
  333.                                   }
  334.  
  335.                                   else
  336.  
  337.                                   {
  338.  
  339.                                           var dot=arr[1].split(\'.\');
  340.  
  341.                                           if(dot.length < 2)
  342.  
  343.                                           {
  344.  
  345.                                                   eFlag = false;
  346.  
  347.                                           }
  348.  
  349.                                           else
  350.  
  351.                                           {
  352.  
  353.                                                   if(dot[0].length <= 0 || dot[0].indexOf(\' \') != -1 || dot[0].indexOf(\'"\') != -1 || dot[0].indexOf("\'") != -1)
  354.  
  355.                                                   {
  356.  
  357.                                                           eFlag = false;
  358.  
  359.                                                   }
  360.  
  361.  
  362.  
  363.                                                   for(i=1;i < dot.length;i++)
  364.  
  365.                                                   {
  366.  
  367.                                                           if(dot[i].length <= 0 || dot[i].indexOf(\' \') != -1 || dot[i].indexOf(\'"\') != -1 || dot[i].indexOf("\'") != -1 || dot[i].length > 4)
  368.  
  369.                                                           {
  370.  
  371.                                                                   eFlag = false;
  372.  
  373.                                                           }
  374.  
  375.                                                   }
  376.  
  377.                                           }
  378.  
  379.                                   }
  380.  
  381.                                           return eFlag;
  382.  
  383.                           }
  384.  
  385.                           function validate(){
  386.  
  387.  
  388.  
  389.                                           if(document.gbForm.name.value=="" ){
  390.  
  391.  
  392.  
  393.                                                   alert("Please enter your name");
  394.  
  395.                                                   document.gbForm.name.focus();
  396.  
  397.  
  398.  
  399.                                           }else if (document.gbForm.email.value==""){
  400.  
  401.  
  402.  
  403.                                                   alert("Please enter your email");
  404.  
  405.                                                   document.gbForm.email.focus();
  406.  
  407.  
  408.  
  409.                                           }else if(checkMail(document.gbForm.email.value)==false){
  410.  
  411.  
  412.  
  413.                                                alert(\'Invalid mail format\');
  414.  
  415.                                                document.gbForm.email.focus();
  416.  
  417.                                                return false;
  418.  
  419.  
  420.  
  421.                                       }else if (document.gbForm.matter.value==""){
  422.  
  423.  
  424.  
  425.                                                   alert("Please enter your matter");
  426.  
  427.                                                   document.gbForm.matter.focus();
  428.  
  429.  
  430.  
  431.                                           }else{
  432.  
  433.  
  434.  
  435.                                                   document.gbForm.submit();
  436.  
  437.                                           }
  438.  
  439.  
  440.  
  441.                           }
  442.  
  443.                           </script>
  444.  
  445.                           <?
  446.  
  447.                           echo $displaycontents;
  448.  
  449.                           ?>
  450.  
  451.                           <table width="100%"  border="0" align="center">
  452.  
  453.                             <tr>
  454.  
  455.                               <td>&nbsp;</td>
  456.  
  457.                             </tr>
  458.  
  459.                             <tr>
  460.  
  461.                               <td align="center"><form name="gbForm" method="post" action="<? $_SERVER[\'PHP_SELF\']; ?>?act=post">
  462.  
  463.                                 <fieldset style="width:400px;">
  464.  
  465.                                     <table width="100%"  border="0">
  466.  
  467.                                   <tr align="center">
  468.  
  469.                                     <td colspan="3"><br>
  470.  
  471.                                       <strong><font face=verdana size=2>Add your guestbook entry</font> </strong><br>&nbsp;</td>
  472.  
  473.                                     </tr>
  474.  
  475.                                                     <tr>
  476.  
  477.                                     <td width="100%" align="center" colspan=3><font face=verdana size=1 color=red><? echo $message; ?></font></td>
  478.  
  479.                                   </tr>
  480.  
  481.                                   <tr>
  482.  
  483.                                     <td width="45%" align="right"><font face=verdana size=2>Your Name</font></td>
  484.  
  485.                                     <td width="3%">&nbsp;</td>
  486.  
  487.                                     <td width="52%" align="left" valign="top"><input name="name" type="text" id="name"></td>
  488.  
  489.                                   </tr>
  490.  
  491.                                   <tr>
  492.  
  493.                                     <td>&nbsp;</td>
  494.  
  495.                                     <td>&nbsp;</td>
  496.  
  497.                                     <td>&nbsp;</td>
  498.  
  499.                                   </tr>
  500.  
  501.                                   <tr>
  502.  
  503.                                     <td align="right"><font face=verdana size=2>Your Email Address</font></td>
  504.  
  505.                                     <td>&nbsp;</td>
  506.  
  507.                                     <td align="left" valign="top"><input name="email" type="text" id="email"></td>
  508.  
  509.                                   </tr>
  510.  
  511.                                   <tr>
  512.  
  513.                                     <td>&nbsp;</td>
  514.  
  515.                                     <td>&nbsp;</td>
  516.  
  517.                                     <td>&nbsp;</td>
  518.  
  519.                                   </tr>
  520.  
  521.                                   <tr>
  522.  
  523.                                     <td align="right"><font face=verdana size=2>Guest Book Matter</font></td>
  524.  
  525.                                     <td>&nbsp;</td>
  526.  
  527.                                     <td align="left" valign="top">            <textarea name="matter" id="matter"></textarea></td>
  528.  
  529.                                   </tr>
  530.  
  531.                                   <tr>
  532.  
  533.                                     <td>&nbsp;</td>
  534.  
  535.                                     <td>&nbsp;</td>
  536.  
  537.                                     <td>&nbsp;</td>
  538.  
  539.                                   </tr>
  540.  
  541.                                   <tr align="center">
  542.  
  543.                                     <td colspan="3"><input type="button" value="Sign Guest Book" onclick=validate();></td>
  544.  
  545.                                     </tr>
  546.  
  547.                                 </table>
  548.  
  549.                                     </fieldset>
  550.  
  551.                               </form></td>
  552.  
  553.                             </tr>
  554.  
  555.                           </table></span>';
  556.  
  557.                 file_replace($search_string, $replace_string, $workLocation . "/$pageName");
  558.  
  559.                 if(!is_file($workLocation . "/gb.txt")) {
  560.  
  561.                     fwrite(fopen($workLocation . "/gb.txt","w"),".");
  562.  
  563.                     @chmod($workLocation . "/gb.txt",0755);
  564.  
  565.                 }
  566.  
  567.             }
  568.  
  569.             return $workLocation . "/$pageName";
  570.  
  571.         }
  572.  
  573.  
  574.  
  575.  
  576.  
  577.         //function SaveFile($fileToSave)
  578.  
  579.         //$fileToSave ==>    the full path of the file to be saved
  580.  
  581.         //It saves the data that comes in the form Post EditorHTM,EditorHTM2,EditorHTM3,EditorHTM4,
  582.  
  583.         //EditorHTM5 variables to the location specified in $fileToSave.
  584.  
  585.         function SaveFile($fileToSave,$search_string) {
  586.  
  587.             $fp = fopen($fileToSave,"w");
  588.  
  589.             fwrite($fp,$_POST["EditorHTM"]);
  590.  
  591.             fwrite($fp,$_POST["EditorHTM2"]);
  592.  
  593.             fwrite($fp,$_POST["EditorHTM3"]);
  594.  
  595.             fwrite($fp,$_POST["EditorHTM4"]);
  596.  
  597.             fwrite($fp,$_POST["EditorHTM5"]);
  598.  
  599.             fclose($fp);
  600.  
  601.             //replace temporary location src so that relative paths will be "./" instead of "temporarylocation/"  for images and other
  602.  
  603.             //objects with src and similar tags
  604.  
  605.             file_replace ($search_string, ".", $fileToSave);
  606.  
  607.         }
  608.  
  609.  
  610.  
  611.         //file_replace ($search, $replace, $filename) returns true/false
  612.  
  613.         //$search    ==>    The string that is to replaced from the file
  614.  
  615.         //$replace    ==>    The string to replace with(normally "./")
  616.  
  617.         //$filename    ==>    The name of the file that is to be operated upon
  618.  
  619.         //We call this function normally to replace the editor generated absolute path in the files that represents the
  620.  
  621.         //temporary location of edition of files with relative "./"
  622.  
  623.         function file_replace ($search, $replace, $filename) {
  624.  
  625.            if (file_exists($filename)) {
  626.  
  627.                $cnt = file_get_contents($filename);
  628.  
  629.                    $cnt = eregi_replace($search,$replace,$cnt);
  630.  
  631.                    fwrite(fopen($filename,"w"),$cnt);  //here file_put_contents() cannot be used since it is available only on php5
  632.  
  633.                        return true;
  634.  
  635.            }
  636.  
  637.            return false;
  638.  
  639.        }
  640.  
  641.  
  642.  
  643.         //function to save changes to resource file
  644.  
  645.         //function SaveResource($resource_location,$var_deletedimages,$var_newimages)
  646.  
  647.         //$resource_location ==>    the location of the resource.txt file that has to be modified
  648.  
  649.         //$var_deletedimages ==>    '|' character seperated image file names that has to be deleted from the resource file
  650.  
  651.         //$var_newimages      ==>    '|' character seperated image file names that has to be added to the resource file
  652.  
  653.         //the resource file is read into an array using file($resourcelocation)
  654.  
  655.         //for each name in $deletedimages we delete a name from the populated array and then finally overwrite the new array into resource.txt
  656.  
  657.         //Then the contents in the $newimages is written to resourcelocation
  658.  
  659.         $resource_save_flag = false;
  660.  
  661.         function SaveResource($resource_location,$var_deletedimages,$var_newimages,$userid) {
  662.  
  663.             //resource flag is being used for correctly manipulating the resource file.
  664.  
  665.             //For each save operation the user initiates the 'checkid' parameter is sent which contains the session_checkid + 1
  666.  
  667.             //ie. if the session_checkid >= checkid(posted) then that means the page is submitted as part of a refresh operation
  668.  
  669.             // and the resource.txt file operation has been already performed.  Hence we return back to the calling location without
  670.  
  671.             //modifying the resource.txt file
  672.  
  673.             //else we set the session_checkid as checkid(posted) and resource_flag is set to true, and resource.txt file is modified.
  674.  
  675.             global $resource_save_flag;
  676.  
  677.             if($resource_save_flag == false) {
  678.  
  679.                 if($_SESSION["session_checkid"] >= $_POST["checkid"]) {
  680.  
  681.                     return;
  682.  
  683.                 }
  684.  
  685.                 else {
  686.  
  687.                     $_SESSION["session_checkid"]=$_POST["checkid"];
  688.  
  689.                     $resource_save_flag = true;
  690.  
  691.                 }
  692.  
  693.             }
  694.  
  695.  
  696.  
  697.             if(is_file($resource_location)) {
  698.  
  699.             $content_arr = file($resource_location);
  700.  
  701.             if(strlen($var_deletedimages) > 0) {    // IF Delete images > 0
  702.  
  703.                 $deleted_arr = explode('|',$var_deletedimages);
  704.  
  705.                 $deleted_count = count($deleted_arr);
  706.  
  707.                 for($i=0;$i < $deleted_count;$i++) {    // FOR LOOP - I
  708.  
  709.                         $temp_string=$deleted_arr[$i];
  710.  
  711.                         switch(substr($temp_string,0,2)) {
  712.  
  713.                             case "ug":
  714.  
  715.                                     $temp_string = "../usergallery/$userid/images/" . $temp_string;
  716.  
  717.                                     break;
  718.  
  719.                             case "sg":
  720.  
  721.                                     $temp_string = "../systemgallery/" . $temp_string;
  722.  
  723.                                     break;
  724.  
  725.                             case "sl":
  726.  
  727.                                     $temp_string = "../samplelogos/" . $temp_string;
  728.  
  729.                                     break;
  730.  
  731.                             case "fl":
  732.  
  733.                                     $temp_string = "../usergallery/$userid/flash/" . $temp_string;
  734.  
  735.                                     break;
  736.  
  737.                             default:
  738.  
  739.                                     continue;
  740.  
  741.                         }
  742.  
  743.                     $temp_count = 0;
  744.  
  745.                     foreach($content_arr as $lines) {    // FOR LOOP - II
  746.  
  747.                         if(strcmp($temp_string,rtrim($lines,"\n")) == 0) {
  748.  
  749.                             $content_arr[$temp_count] = "";
  750.  
  751.                             break;
  752.  
  753.                         }
  754.  
  755.                         $temp_count++;
  756.  
  757.                     }        // END FOR LOOP - II
  758.  
  759.                 }            // END FOR LOOP - I
  760.  
  761.             }        // END IF Delete images > 0
  762.  
  763.             }
  764.  
  765.             $fwriter=fopen($resource_location,"w");
  766.  
  767.             if(count($content_arr) > 0) {
  768.  
  769.                 foreach($content_arr as $lines) {    // FOR LOOP
  770.  
  771.                     if($lines != "") {
  772.  
  773.                         fputs($fwriter,$lines);
  774.  
  775.                     }
  776.  
  777.                 }
  778.  
  779.             }
  780.  
  781.             if(strlen($var_newimages) > 0) {    // IF New images > 0
  782.  
  783.                 $new_arr = explode('|',$var_newimages);
  784.  
  785.                 $new_count = count($new_arr);
  786.  
  787.                 for($i=0;$i < $new_count;$i++) {    // FOR LOOP - I
  788.  
  789.                     $temp_string=$new_arr[$i];
  790.  
  791.                     switch(substr($temp_string,0,2)) {
  792.  
  793.                         case "ug":
  794.  
  795.                                 $temp_string = "../usergallery/$userid/images/" . $temp_string . "\n";
  796.  
  797.                                 break;
  798.  
  799.                         case "sg":
  800.  
  801.                                 $temp_string = "../systemgallery/" . $temp_string . "\n";
  802.  
  803.                                 break;
  804.  
  805.                         case "sl":
  806.  
  807.                                 $temp_string = "../samplelogos/" . $temp_string . "\n";
  808.  
  809.                                 break;
  810.  
  811.                         case "fl":
  812.  
  813.                                     $temp_string = "../usergallery/$userid/flash/" . $temp_string . "\n";
  814.  
  815.                                     break;
  816.  
  817.                         default:
  818.  
  819.                                 continue;
  820.  
  821.                     }
  822.  
  823.                     fputs($fwriter,$temp_string);
  824.  
  825.                 }
  826.  
  827.             }    // END IF New images > 0
  828.  
  829.             fclose($fwriter);
  830.  
  831.         }
  832.  
  833.  
  834.  
  835.  
  836.  
  837.         //function removePage($pageName,$templateid,$tmpsiteid,$pageType,$editing) {
  838.  
  839.         //$pageName        ==>    name of the page to be deleted
  840.  
  841.         //$tmpsiteid    ==>    temp site id
  842.  
  843.         //$editing        ==>    'true' indicates we are removing a page while editing a published site, hence use 'sites' folder
  844.  
  845.         //                    'false' indicates  we are removing a page while creating a new site, hence use 'tempsites' folder
  846.  
  847.         function removePage($pageName,$tmpsiteid,$editing) {
  848.  
  849.             $workLocation = "";
  850.  
  851.             //if $editing == true then we delete the page sites/$tmpsiteid/$pageName
  852.  
  853.             //along with the workarea/tempsites/$tmpsiteid/$pageName
  854.  
  855.             if($editing == true) {
  856.  
  857.                 $workLocation = "../workarea/sites/$tmpsiteid/$pageName";
  858.  
  859.                 if(is_file("../sites/$tmpsiteid/$pageName")) {
  860.  
  861.                    @unlink("../sites/$tmpsiteid/$pageName");
  862.  
  863.                 }
  864.  
  865.             }
  866.  
  867.             else {
  868.  
  869.                 $workLocation = "../workarea/tempsites/$tmpsiteid/$pageName";
  870.  
  871.             }
  872.  
  873.             if (is_file($workLocation)) {
  874.  
  875.                @unlink($workLocation);
  876.  
  877.            }
  878.  
  879.         }
  880.  
  881.  
  882.  
  883.         //function setupEditSite($tmpsiteid,$templateid,&$var_guestbook) returns presentPage
  884.  
  885.         //$tmpsiteid        ==>    id of the site(published/temporary)
  886.  
  887.         //$templateid        ==>    id of the template
  888.  
  889.         //&$var_guestbook    ==>     $var_guestbook    is passed as reference to which we assign "yes" if the returned page is a guestbook
  890.  
  891.         //The folders workarea/sites/$tmpsiteid, workarea/sites/$tmpsiteid/images, workarea/sites/$tmpsiteid/flash is created
  892.  
  893.         //Images inside templates/templateId/images is copied to  workarea/sites/$tmpsiteid/images
  894.  
  895.         //Files inside sites/$tmpsiteid is copied to workarea/sites/$tmpsiteid
  896.  
  897.         //resource.txt in the  workarea/sites/$tmpsiteid is read and images,flash objects are copied to the respective folders.
  898.  
  899.         function setupEditSite($tmpsiteid,$templateid,&$var_guestbook) {
  900.  
  901.             $pageToCopy = "";
  902.  
  903.             $workLocation = "../workarea/sites/$tmpsiteid";
  904.  
  905.             //folders are created for setting up the work location
  906.  
  907.             if(!is_dir($workLocation)){
  908.  
  909.                 @mkdir($workLocation,0755);
  910.  
  911.                 @chmod($workLocation,0755);
  912.  
  913.             }
  914.  
  915.             if(!is_dir($workLocation . "/images")){
  916.  
  917.                 @mkdir($workLocation . "/images",0755);
  918.  
  919.                 @chmod($workLocation . "/images",0755);
  920.  
  921.  
  922.  
  923.                 @mkdir($workLocation . "/flash",0755);
  924.  
  925.                 @chmod($workLocation . "/flash",0755);
  926.  
  927.             }
  928.  
  929.             //images for template are copied to work location
  930.  
  931.             copydirr("../".$_SESSION["session_template_dir"]."/".$templateid."/images",$workLocation . "/images",0755,false);
  932.  
  933.             //files of the created site including resource.txt is copied to work location
  934.  
  935.             copydirr("../sites/".$tmpsiteid,$workLocation,0755,false);
  936.  
  937.             //resource.txt is read and images of user gallery/system gallery that has been referred to from the created site
  938.  
  939.             //is copied to work location/images along with the flash objects to work location/flash.
  940.  
  941.             if(is_file($workLocation . "/resource.txt")) {
  942.  
  943.                 $content_arr = file($workLocation . "/resource.txt");
  944.  
  945.                 foreach($content_arr as $lines) {
  946.  
  947.                     $file_name = rtrim($lines,"\n");
  948.  
  949.                     $base_file_name = basename($file_name);
  950.  
  951.                     switch(substr($base_file_name,0,2))
  952.  
  953.                     {
  954.  
  955.                         case "ug":
  956.  
  957.                                 $location = "/images/" . $base_file_name;
  958.  
  959.                                 break;
  960.  
  961.                         case "sg":
  962.  
  963.                                 $location = "/images/" . $base_file_name;
  964.  
  965.                                 break;
  966.  
  967.                         case "sl":
  968.  
  969.                                 $location = "/images/" . $base_file_name;
  970.  
  971.                                 break;
  972.  
  973.                         case "fl":
  974.  
  975.                                 $location = "/flash/" . $base_file_name;
  976.  
  977.                                 break;
  978.  
  979.                         default:
  980.  
  981.                                 $location = "/images/" . $base_file_name;
  982.  
  983.                     }
  984.  
  985.                     @copy($file_name, $workLocation . $location);
  986.  
  987.                     @chmod($workLocation . $location,0755);
  988.  
  989.                 }
  990.  
  991.             }
  992.  
  993.             $var_presentpage="";
  994.  
  995.             $sql = "Select * from tbl_site_pages where nsite_id='" . $tmpsiteid . "'";
  996.  
  997.             $result = mysql_query($sql) or die(mysql_error());
  998.  
  999.             if(mysql_num_rows($result) > 0)  {
  1000.  
  1001.                 $row = mysql_fetch_array($result);
  1002.  
  1003.                 $var_presentpage=$row["vpage_name"];
  1004.  
  1005.                 $var_guestbook=($row["vpage_type"] == "guestbook")?"yes":"";
  1006.  
  1007.             }
  1008.  
  1009.             return $var_presentpage;
  1010.  
  1011.         }
  1012.  
  1013.  
  1014.  
  1015.         //function isValidRequest($tmpsiteid,$templateid,$userid,$var_type) return true/false
  1016.  
  1017.         //$tmpsiteid    ==>    temp site id
  1018.  
  1019.         //$templateid    ==>    template id
  1020.  
  1021.         //$userid        ==>    user id
  1022.  
  1023.         //$var_type        ==>    if temporary then "new" else "edit"
  1024.  
  1025.         //$init_flag    ==>    init flag default to false
  1026.  
  1027.         //checks if the tenpsiteid,templateid, userid  matches in the database
  1028.  
  1029.         function isValidRequest($tmpsiteid,$templateid,$userid,$var_type,$init_flag=false) {
  1030.  
  1031.             if($init_flag == true) {
  1032.  
  1033.                 $var_insert_field="";
  1034.  
  1035.             }
  1036.  
  1037.             else {
  1038.  
  1039.                 $var_insert_field=" AND ntemplate_id='" . addslashes($templateid) . "' ";
  1040.  
  1041.             }
  1042.  
  1043.             if($var_type == "new") {
  1044.  
  1045.                 $sql = "Select ntempsite_id from tbl_tempsite_mast where ntempsite_id='" . addslashes($tmpsiteid) . "'
  1046.  
  1047.                 " . $var_insert_field . " AND nuser_id='" . addslashes($userid) . "'";
  1048.  
  1049.             }
  1050.  
  1051.             else {
  1052.  
  1053.                 $sql = "Select nsite_id from tbl_site_mast where nsite_id='" . addslashes($tmpsiteid) . "'
  1054.  
  1055.                 " . $var_insert_field . " AND nuser_id='" . addslashes($userid) . "'";
  1056.  
  1057.             }
  1058.  
  1059.             $result = mysql_query($sql) or die(mysql_error());
  1060.  
  1061.             if(mysql_num_rows($result) > 0) {
  1062.  
  1063.                 return true;
  1064.  
  1065.             }
  1066.  
  1067.             else {
  1068.  
  1069.                 return false;
  1070.  
  1071.             }
  1072.  
  1073.         }
  1074.  
  1075.  
  1076.  
  1077.         //isValidGuestbookEntry($var_gb,$var_type,$tmpsiteid) returns true/false
  1078.  
  1079.         //$var_gb        ==>    "yes" indicates has to be checked before saying true.
  1080.  
  1081.         //$var_type        ==>     Temporary then "new" else "edit"
  1082.  
  1083.         //$tmpsiteid    ==>     Temp site id
  1084.  
  1085.         // returns true if the guestbook entry for the site is valid, else, returns false.
  1086.  
  1087.         function isValidGuestbookEntry($var_gb,$var_type,$tmpsiteid) {
  1088.  
  1089.             if($var_gb != "yes") {
  1090.  
  1091.                 return true;
  1092.  
  1093.             }
  1094.  
  1095.             if($var_type == "new") {
  1096.  
  1097.                 $sql = "Select * from tbl_tempsite_pages where ntempsite_id='$tmpsiteid' AND vpage_type='guestbook'";
  1098.  
  1099.             }
  1100.  
  1101.             else {
  1102.  
  1103.                 $sql = "Select * from tbl_site_pages where nsite_id='$tmpsiteid' AND vpage_type='guestbook'";
  1104.  
  1105.             }
  1106.  
  1107.             if(mysql_num_rows(mysql_query($sql)) > 0) {
  1108.  
  1109.                 return false;
  1110.  
  1111.             }
  1112.  
  1113.             return true;
  1114.  
  1115.         }
  1116.  
  1117.     //End functions
  1118.  
  1119.  
  1120.  
  1121.     //possible values for actiontype     ==>    (editsite,init,save,saveandcreate,saveandexit,edit,saveandedit,newpage,delete,saveas)
  1122.  
  1123.     //When this page gets loaded for the first time as request comes from template selection for a non-published site
  1124.  
  1125.         //Edit a site previously created
  1126.  
  1127.         //If you are editing a temporary site type will be "new"
  1128.  
  1129.         //If you are editing a published site type will be "edit"
  1130.  
  1131.         if($_GET["actiontype"] == "editsite") {    //edit the site previously created
  1132.  
  1133.             //we check for the size factor(validateSizePerUser) and request validity(isValidRequest)
  1134.  
  1135.             //On passing both the tests, session_currenttempsiteid, session_currenttemplateid and session_templatetype is set
  1136.  
  1137.             //If the type = "new" (temporary site)
  1138.  
  1139.             //         tbl_tempsite_pages is checked to see if it contains any pages for the site
  1140.  
  1141.             //            if no then
  1142.  
  1143.             //                    an index.htm page is copied to the work location from the template section , a row is added to
  1144.  
  1145.             //                    tbl_tempsite_pages for index.htm,
  1146.  
  1147.             //            else
  1148.  
  1149.             //                    a page is randomly selected and var_presentpage and pageurl is set accordingly
  1150.  
  1151.             //            end if
  1152.  
  1153.             //Else
  1154.  
  1155.             //        we call setupeditsite function that copies files from the sites folder, read the resource.txt file and copies files
  1156.  
  1157.             //        and return the persent page, then we construct the page url
  1158.  
  1159.             //End IF
  1160.  
  1161.             //size checking, if exceeded limit, then alert the user, user taken to usermain
  1162.  
  1163.             if(!validateSizePerUser($_SESSION["session_userid"],$size_per_user,$allowed_space,"../")) {
  1164.  
  1165.                 echo "<script> alert('Your space exceeded permitted limit." .
  1166.  
  1167.                 "(Space taken by you: " . human_read($size_per_user) . " " .
  1168.  
  1169.                 "Allowed space: " . human_read($allowed_space) . ") \\r\\n" .
  1170.  
  1171.                 "Delete unused images or any/all of the sites created by you to proceed further.'); location.href='../usermain.php'; </script>";
  1172.  
  1173.                 exit();
  1174.  
  1175.             }
  1176.  
  1177.             //end size checking
  1178.  
  1179.             //If we are editing a temporary created site
  1180.  
  1181.             //'type' = new
  1182.  
  1183.             if($_GET["type"] == "new") {        // edit a non published site
  1184.  
  1185.  
  1186.  
  1187.                 $var_type=$_GET["type"];
  1188.  
  1189.                 $var_actionin = $_GET["actiontype"];            //assigned to a hidden variable(actionin)
  1190.  
  1191.                 $templateid=addslashes($_GET['templateid']);
  1192.  
  1193.                 $_SESSION['session_currenttempsiteid'] = $_GET["tempsiteid"];
  1194.  
  1195.                 $tmpsiteid=$_SESSION['session_currenttempsiteid'];
  1196.  
  1197.                 $userid=$_SESSION["session_userid"];
  1198.  
  1199.                  $_SESSION['session_currenttemplateid']=$templateid;
  1200.  
  1201.  
  1202.  
  1203.                 if(!isValidRequest($tmpsiteid,$templateid,$userid,$var_type)) {
  1204.  
  1205.                     echo("<script>alert('Invalid request! Please try again.'); location.href='../usermain.php';</script>");
  1206.  
  1207.                     exit();
  1208.  
  1209.                 }
  1210.  
  1211.                 $_SESSION['session_templatetype'] = "advanced";
  1212.  
  1213.                 $sql = "Select * from tbl_tempsite_pages where ntempsite_id='" . $_SESSION['session_currenttempsiteid'] . "'";
  1214.  
  1215.                 $result = mysql_query($sql) or die(mysql_error());
  1216.  
  1217.                 if(mysql_num_rows($result) <= 0) {    //this 'if' part never gets executed
  1218.  
  1219.                     $sql = "Insert into tbl_tempsite_pages(ntempsp_id,ntempsite_id,vpage_name,vpage_title,vpage_type,vtype)
  1220.  
  1221.                             Values('','" . $_SESSION['session_currenttempsiteid']  . "',
  1222.  
  1223.                             'index.htm','','htm','advanced')";
  1224.  
  1225.                     mysql_query($sql) or die(mysql_error());
  1226.  
  1227.                     $var_presentpage="index.htm";
  1228.  
  1229.                     $var_pageurl=createPage("index.htm",$templateid,$tmpsiteid,1,false);
  1230.  
  1231.                 }
  1232.  
  1233.                 else {
  1234.  
  1235.                     $row = mysql_fetch_array($result);
  1236.  
  1237.                     $var_presentpage=$row["vpage_name"];
  1238.  
  1239.                     $var_guestbook = ($row["vpage_type"] == "guestbook")?"yes":"";
  1240.  
  1241.                     $var_pageurl="../workarea/tempsites/$tmpsiteid/$var_presentpage";
  1242.  
  1243.                 }
  1244.  
  1245.             }    //end if $_GET["type"] == "new", if we are editing a published site 'type'=edit
  1246.  
  1247.             elseif($_GET["type"] == "edit") {    //edit a published site
  1248.  
  1249.                 $var_type=$_GET["type"];
  1250.  
  1251.                 $var_actionin = $_GET["actiontype"];            //assigned to a hidden variable(actionin)
  1252.  
  1253.                 $templateid=addslashes($_GET['templateid']);
  1254.  
  1255.                 $_SESSION['session_currenttempsiteid'] = $_GET["tempsiteid"];
  1256.  
  1257.                 $tmpsiteid=$_SESSION['session_currenttempsiteid'];
  1258.  
  1259.                 $userid=$_SESSION["session_userid"];
  1260.  
  1261.                  $_SESSION['session_currenttemplateid']=$templateid;
  1262.  
  1263.  
  1264.  
  1265.                 if(!isValidRequest($tmpsiteid,$templateid,$userid,$var_type)) {
  1266.  
  1267.                     echo("<script>alert('Invalid request! Please try again.'); location.href='../usermain.php';</script>");
  1268.  
  1269.                     exit();
  1270.  
  1271.                 }
  1272.  
  1273.                 $var_guestbook="";
  1274.  
  1275.                  $_SESSION['session_templatetype'] = "advanced";
  1276.  
  1277.                 //setupeditsite function is called to copy the files from site folder, read resource.txt and copy files accordingly
  1278.  
  1279.                 $var_presentpage=setupEditSite($tmpsiteid,$templateid,$var_guestbook);
  1280.  
  1281.                 $var_pageurl="../workarea/sites/$tmpsiteid/$var_presentpage";
  1282.  
  1283.             }// end if $_GET["type"] == edit
  1284.  
  1285.         }
  1286.  
  1287.         elseif($_GET["actiontype"] == "init") {
  1288.  
  1289.             //actiontype == init  indicates a new temporary site being created for the first time
  1290.  
  1291.             //Check for the size factor(validateSizePerUser) and request validity(isValidRequest)
  1292.  
  1293.             //On passing both the tests,  session_currenttemplateid and session_templatetype is set
  1294.  
  1295.             //If type="new" then
  1296.  
  1297.             //            tbl_tempsite_mast updated to reflect current template id and type as advanced for the current tempsiteid
  1298.  
  1299.             //            tbl_tempsite_pages is checked for pages for the site.
  1300.  
  1301.             //            if no then a row is added to tbl_tempsite_pages for the tempsite_id
  1302.  
  1303.             //            we call createPage that copies the index.htm from template to work location
  1304.  
  1305.             //End if
  1306.  
  1307.             //we add index.htm as the default page.
  1308.  
  1309.             //size checking
  1310.  
  1311.             if(!validateSizePerUser($_SESSION["session_userid"],$size_per_user,$allowed_space,"../")) {
  1312.  
  1313.                 echo "<script> alert('Your space exceeded permitted limit." .
  1314.  
  1315.                 "(Space taken by you: " . human_read($size_per_user) . " " .
  1316.  
  1317.                 "Allowed space: " . human_read($allowed_space) . ") \\r\\n" .
  1318.  
  1319.                 "Delete unused images or any/all of the sites created by you to proceed further.'); location.href='../usermain.php'; </script>";
  1320.  
  1321.                 exit();
  1322.  
  1323.             }
  1324.  
  1325.             //end size checking
  1326.  
  1327.             if($_GET["type"] == "new") {  //this page is called for a new site not yet published
  1328.  
  1329.                 $var_type=$_GET["type"];
  1330.  
  1331.                 $var_actionin = $_GET["actiontype"];            //assigned to a hidden variable(actionin)
  1332.  
  1333.                 $templateid=addslashes($_GET['templateid']);
  1334.  
  1335.                 $tmpsiteid=$_SESSION['session_currenttempsiteid'];
  1336.  
  1337.                 $userid=$_SESSION["session_userid"];
  1338.  
  1339.  
  1340.  
  1341.                 if(!isValidRequest($tmpsiteid,$templateid,$userid,$var_type,true)) {
  1342.  
  1343.                     echo("<script>alert('Invalid request! Please try again.'); location.href='../usermain.php';</script>");
  1344.  
  1345.                     exit();
  1346.  
  1347.                 }
  1348.  
  1349.                   //session_templatetype & session_currenttemplateid set
  1350.  
  1351.                   $_SESSION['session_templatetype'] = "advanced";
  1352.  
  1353.                   $_SESSION['session_currenttemplateid']=$templateid;
  1354.  
  1355.  
  1356.  
  1357.                   $qry="update tbl_tempsite_mast set ntemplate_id='".$_SESSION['session_currenttemplateid']."',vtype='advanced' where ntempsite_id='".$_SESSION['session_currenttempsiteid']."'";
  1358.  
  1359.                   mysql_query($qry);
  1360.  
  1361.  
  1362.  
  1363.                 $sql = "Select * from tbl_tempsite_pages where ntempsite_id='" . $_SESSION['session_currenttempsiteid'] . "' AND vpage_name='index.htm'";
  1364.  
  1365.                 $result = mysql_query($sql) or die(mysql_error());
  1366.  
  1367.                 if(mysql_num_rows($result) <= 0) {
  1368.  
  1369.                     $sql = "Insert into tbl_tempsite_pages(ntempsp_id,ntempsite_id,vpage_name,vpage_title,vpage_type,vtype)
  1370.  
  1371.                             Values('','" . $_SESSION['session_currenttempsiteid']  . "',
  1372.  
  1373.                             'index.htm','','homepage','advanced')";
  1374.  
  1375.                     mysql_query($sql) or die(mysql_error());
  1376.  
  1377.                 }
  1378.  
  1379.                   $var_presentpage="index.htm";
  1380.  
  1381.                 $var_pageurl=createPage("index.htm",$templateid,$tmpsiteid,1,false,true);
  1382.  
  1383.             }  //End If $_GET["type"] == "new"
  1384.  
  1385.         }        //End If $_GET["actiontype"] == "init"
  1386.  
  1387.         elseif($_POST["actiontype"] == "save" || $_POST["actiontype"] == "saveandcreate" || $_POST["actiontype"] == "saveandexit") {
  1388.  
  1389.             //saving a page, saving present page and creating a new one, saving present page and exiting
  1390.  
  1391.             //While saving the page we check the type of operation ie. we are trying to save a page in a temporary site
  1392.  
  1393.             //or in a published site depending on the 'type'.  IF type == "new" then temporary ; IF type == "edit" then published;
  1394.  
  1395.             //The file content is posted back in 5 post parameters
  1396.  
  1397.             //IF type == "new" then
  1398.  
  1399.             //            worklocation is "workarea/tempsites/tempsiteid/"
  1400.  
  1401.             //        (i) save the file(to work location )that is posted back  by calling the function saveFile().(This function also
  1402.  
  1403.             //            replaces any references like http://sitename/foldername/......  to "./" by the help of $searchstring parameter)
  1404.  
  1405.             //        (ii) save the resource file(resource.txt) by calling the function saveResource().
  1406.  
  1407.             //Else
  1408.  
  1409.             //            worklocation is "workarea/sites/siteid/"
  1410.  
  1411.             //        (i) save the file(to work location )that is posted back  by calling the function saveFile().(This function also
  1412.  
  1413.             //        replaces any references like http://sitename/foldername/......  to "./" by the help of $searchstring parameter)
  1414.  
  1415.             //        (ii) save the resource file(resource.txt) by calling the function saveResource().
  1416.  
  1417.             //        (iii) call saveFile() to save to the location sites/siteid.
  1418.  
  1419.             //        (iv)  call saveresource() to save the changes in sites/siteid/resource.txt
  1420.  
  1421.             //End If
  1422.  
  1423.             //IF actiontype == "saveandexit" then navigate back to usermain.php End IF
  1424.  
  1425.             //IF actiontype == "saveandcreate" then
  1426.  
  1427.             //    IF the newPageToCreate is a guest book(var_gbnew == "yes") then
  1428.  
  1429.             //        check for guestbook addition validity by
  1430.  
  1431.             //            (i)    checking if the current page was a guestbook(var_guestbook == "yes")
  1432.  
  1433.             //            (ii)checking database- see if there is already a guestbook entry for the siteid(isValidGuestbookEntry())
  1434.  
  1435.             //    End If
  1436.  
  1437.             //    If newPageToCreate is a guest book and doesnot pass validity checks then alert the user of the current error
  1438.  
  1439.             //    with the currentpage in the editable area.
  1440.  
  1441.             //    If size exceeded the permitted limit then alert the user of the size problem, with the current page in the editable area
  1442.  
  1443.             //    with the current page in the editable area.
  1444.  
  1445.             //    Check if the newpageName is present in the database for the siteid.
  1446.  
  1447.             //    If no then insert a row in the table tbl_tempsite_pages(temporary)/tbl_site_pages(published) or the page.
  1448.  
  1449.             //    call the function createPage() to copy index.htm/sub.htm based on user selection to work location.
  1450.  
  1451.             //    (if type == "edit" then a copy of the page is created in sites/siteid also which is done by createPage())
  1452.  
  1453.             //    The presentpage and pageurl is set according to the value returned by createPage())
  1454.  
  1455.             //END IF
  1456.  
  1457.             //    Check in tbl_tempsite_pages to see if there is a page with the
  1458.  
  1459.             $bool_type = false;
  1460.  
  1461.             $var_actionin = $_POST["actiontype"];
  1462.  
  1463.             $var_presentpage = $_POST["presentpage"];
  1464.  
  1465.             $var_pageurl=$_POST["pageurl"];
  1466.  
  1467.             $var_type = $_POST["type"];
  1468.  
  1469.             $var_deletedimages=$_POST["deletedimages"];
  1470.  
  1471.             $var_newimages=$_POST["newimages"];
  1472.  
  1473.             $var_guestbook = $_POST["guestbook"];
  1474.  
  1475.             $tmpsiteid=$_SESSION['session_currenttempsiteid']; // reconsider this statement since the session will be different in case of sites
  1476.  
  1477.             $userid=$_SESSION["session_userid"];
  1478.  
  1479.  
  1480.  
  1481.             //these 3 parameters will be passed only if "actiontype" = "saveandcreate"
  1482.  
  1483.             $templateid=$_SESSION['session_currenttemplateid'];
  1484.  
  1485.             $var_pagetype=($_POST["pagetype"] == "index")?1:2;
  1486.  
  1487.             $var_editpage = $_POST["editpage"];
  1488.  
  1489.             $bool_guestbook = false;
  1490.  
  1491.             $var_gbnew="";
  1492.  
  1493.             if($_POST["gbnew"] == "yes") {
  1494.  
  1495.                 $var_gbnew = $_POST["gbnew"];
  1496.  
  1497.                 $bool_guestbook=true;
  1498.  
  1499.                 $db_pagetype = "guestbook";
  1500.  
  1501.             }
  1502.  
  1503.             else {
  1504.  
  1505.                 $db_pagetype = ($var_pagetype == 1)?"homepage":"subpage";
  1506.  
  1507.             }
  1508.  
  1509.  
  1510.  
  1511.             if(!isValidRequest($tmpsiteid,$templateid,$userid,$var_type)) {
  1512.  
  1513.                     echo("<script>alert('Invalid request! Please try again.'); location.href='../usermain.php';</script>");
  1514.  
  1515.                     exit();
  1516.  
  1517.             }
  1518.  
  1519.  
  1520.  
  1521.             if($var_type == "new") {
  1522.  
  1523.                 $search_string=$temperory_location . "/$tmpsiteid";
  1524.  
  1525.                 $fileToSave = "../workarea/tempsites/$tmpsiteid/$var_presentpage";
  1526.  
  1527.                 $resource_location="../workarea/tempsites/$tmpsiteid/resource.txt";
  1528.  
  1529.                 $sql_check = "Select * from tbl_tempsite_pages where ntempsite_id='" . $_SESSION['session_currenttempsiteid'] . "' AND vpage_name='" . addslashes($var_editpage) . "'";
  1530.  
  1531.                 $sql_insert = "Insert into tbl_tempsite_pages(ntempsp_id,ntempsite_id,vpage_name,vpage_title,vpage_type,vtype)
  1532.  
  1533.                                 Values('','" . $_SESSION['session_currenttempsiteid']  . "',
  1534.  
  1535.                                 '" . addslashes($var_editpage) . "','','" . $db_pagetype . "','advanced')";
  1536.  
  1537.             }
  1538.  
  1539.             elseif($var_type == "edit") {
  1540.  
  1541.                 $bool_type = true;
  1542.  
  1543.                 $search_string=$real_location . "/$tmpsiteid";
  1544.  
  1545.                 $fileToSave = "../workarea/sites/$tmpsiteid/$var_presentpage";
  1546.  
  1547.                 $resource_location="../workarea/sites/$tmpsiteid/resource.txt";
  1548.  
  1549.                 $sql_check = "Select * from tbl_site_pages where nsite_id='" . $_SESSION['session_currenttempsiteid'] . "' AND vpage_name='" . addslashes($var_editpage) . "'";
  1550.  
  1551.                 $sql_insert = "Insert into tbl_site_pages(nsp_id,nsite_id,vpage_name,vpage_title,vpage_type,vtype)
  1552.  
  1553.                                 Values('','" . $_SESSION['session_currenttempsiteid']  . "',
  1554.  
  1555.                                 '" . addslashes($var_editpage) . "','','" . $db_pagetype . "','advanced')";
  1556.  
  1557.                 //save to original site location
  1558.  
  1559.                 SaveFile("../sites/$tmpsiteid/$var_presentpage",$search_string);
  1560.  
  1561.                 SaveResource("../sites/$tmpsiteid/resource.txt",$var_deletedimages,$var_newimages,$userid);
  1562.  
  1563.             }
  1564.  
  1565.             SaveFile($fileToSave,$search_string);
  1566.  
  1567.             SaveResource($resource_location,$var_deletedimages,$var_newimages,$userid);
  1568.  
  1569.             if($_POST["actiontype"] == "saveandexit") {
  1570.  
  1571.                 echo("<script>alert('Page Saved!'); location.href='../usermain.php'; </script>");
  1572.  
  1573.                 exit();
  1574.  
  1575.             }
  1576.  
  1577.             $script_string .= " alert(\"Page Saved!\");
  1578.  
  1579.                                 global_saved = true;
  1580.  
  1581.                                  global_reload = true; ";
  1582.  
  1583.  
  1584.  
  1585.             // If user selected to create a new page
  1586.  
  1587.             if($_POST["actiontype"] == "saveandcreate") {
  1588.  
  1589.                 if($var_gbnew == "" || ($var_gbnew != $var_guestbook && isValidGuestbookEntry($var_gbnew,$var_type,$_SESSION['session_currenttempsiteid']))){
  1590.  
  1591.                     if(validateSizePerUser($userid,$size_per_user,$allowed_space,"../")) {
  1592.  
  1593.                         $result = mysql_query($sql_check) or die(mysql_error());
  1594.  
  1595.                         $var_guestbook = $var_gbnew;
  1596.  
  1597.                         if(mysql_num_rows($result) <= 0) {
  1598.  
  1599.                             mysql_query($sql_insert) or die(mysql_error());
  1600.  
  1601.                         }
  1602.  
  1603.                         $var_presentpage=$var_editpage;
  1604.  
  1605.  
  1606.  
  1607.                         $var_pageurl=createPage($var_editpage,$templateid,$tmpsiteid,$var_pagetype,$bool_type,false,$bool_guestbook);
  1608.  
  1609.                     }
  1610.  
  1611.                     else {
  1612.  
  1613.                         //size checking
  1614.  
  1615.                         $script_string .= "alert('Cannot create new page. Your space exceeded permitted limit." .
  1616.  
  1617.                                         "(Space taken by you: " . human_read($size_per_user) . " " .
  1618.  
  1619.                                         "Allowed space: " . human_read($allowed_space) . ") \\r\\n" .
  1620.  
  1621.                                         "Delete unused images or any/all of the sites created by you to proceed further.');";
  1622.  
  1623.                         //end size checking
  1624.  
  1625.                     }
  1626.  
  1627.                 }
  1628.  
  1629.                 else {
  1630.  
  1631.                     $script_string .= "alert('Cannot add two guestbook at a time.');";
  1632.  
  1633.                 }
  1634.  
  1635.             }
  1636.  
  1637.             //End If user selected to create a new page
  1638.  
  1639.         }
  1640.  
  1641.         elseif($_POST["actiontype"] == "edit" || $_POST["actiontype"] == "saveandedit") {
  1642.  
  1643.             //user changes page , may be selecting by saving and moving focus
  1644.  
  1645.             //User changing the page, at times saving the current page and selecting another page to view
  1646.  
  1647.             //validity of request checked by calling isValidRequest(), if not valid navigated to usermain.php
  1648.  
  1649.             //user changing the page:
  1650.  
  1651.             //'editpage' will contain the id of the page the user selected to view/edit.
  1652.  
  1653.             //tbl_tempsite_pages is searched for the id, and name of the page is set to var_presentpage ,
  1654.  
  1655.             //and if the page selected to view is a guestbook we set var_guestbook is set to yes.
  1656.  
  1657.             //user saving the current page(actiontype == "saveandedit"):
  1658.  
  1659.             //IF type == "edit" then
  1660.  
  1661.             //    saveFile() is called to save the contents to sites/siteid/
  1662.  
  1663.             //    saveResource() is called to save the resource modifications to sites/siteid/resource.txt
  1664.  
  1665.             //    saveFile() is called to save the contents to workarea/sites/siteid/
  1666.  
  1667.             //    saveResource() is called to save the resource modifications to workarea/sites/siteid/resource.txt
  1668.  
  1669.             //Else
  1670.  
  1671.             //    saveFile() is called to save the contents to workarea/tempsites/tempsiteid/
  1672.  
  1673.             //    saveResource() is called to save the resource modifications to workarea/tempsites/tempsiteid/resource.txt
  1674.  
  1675.             //END IF
  1676.  
  1677.             $bool_type = false;
  1678.  
  1679.             $var_actionin = $_POST["actiontype"];
  1680.  
  1681.             $var_presentpage = $_POST["presentpage"];
  1682.  
  1683.             $var_pageurl=$_POST["pageurl"];
  1684.  
  1685.             $var_type = $_POST["type"];
  1686.  
  1687.             $var_deletedimages=$_POST["deletedimages"];
  1688.  
  1689.             $var_newimages=$_POST["newimages"];
  1690.  
  1691.             $tmpsiteid=$_SESSION['session_currenttempsiteid']; // reconsider this statement since the session will be different in case of sites
  1692.  
  1693.             $userid=$_SESSION["session_userid"];
  1694.  
  1695.             $templateid=$_SESSION['session_currenttemplateid'];
  1696.  
  1697.  
  1698.  
  1699.             $var_editpage=$_POST["editpage"];        // here editpage will contain the id of the page
  1700.  
  1701.  
  1702.  
  1703.             if(!isValidRequest($tmpsiteid,$templateid,$userid,$var_type)) {
  1704.  
  1705.                     echo("<script>alert('Invalid request! Please try again.'); location.href='../usermain.php';</script>");
  1706.  
  1707.                     exit();
  1708.  
  1709.             }
  1710.  
  1711.  
  1712.  
  1713.             if($var_type == "new") {
  1714.  
  1715.                 //for save
  1716.  
  1717.                 $search_string=$temperory_location . "/$tmpsiteid";
  1718.  
  1719.                 $fileToSave = "../workarea/tempsites/$tmpsiteid/$var_presentpage";
  1720.  
  1721.                 $resource_location="../workarea/tempsites/$tmpsiteid/resource.txt";
  1722.  
  1723.  
  1724.  
  1725.                 $sql = "Select * from tbl_tempsite_pages where ntempsp_id='" . addslashes($var_editpage) . "'";
  1726.  
  1727.                 $result = mysql_query($sql) or die(mysql_error());
  1728.  
  1729.                 if(mysql_num_rows($result)) {
  1730.  
  1731.                     $row = mysql_fetch_array($result);
  1732.  
  1733.                     $var_presentpage = $row["vpage_name"];
  1734.  
  1735.                     $var_guestbook = ($row["vpage_type"] == "guestbook")?"yes":"";
  1736.  
  1737.                     $var_pageurl = "../workarea/tempsites/" . $row["ntempsite_id"] . "/$var_presentpage";
  1738.  
  1739.                 }
  1740.  
  1741.             }
  1742.  
  1743.             else {
  1744.  
  1745.                 //for save
  1746.  
  1747.                 $bool_type = true;
  1748.  
  1749.                 $search_string=$real_location . "/$tmpsiteid";
  1750.  
  1751.                 $fileToSave = "../workarea/sites/$tmpsiteid/$var_presentpage";
  1752.  
  1753.                 $resource_location="../workarea/sites/$tmpsiteid/resource.txt";
  1754.  
  1755.                 $fileRealLocation = "../sites/$tmpsiteid/$var_presentpage";
  1756.  
  1757.  
  1758.  
  1759.                 $sql = "Select * from tbl_site_pages where nsp_id='" . addslashes($var_editpage) . "'";
  1760.  
  1761.                 $result = mysql_query($sql) or die(mysql_error());
  1762.  
  1763.                 if(mysql_num_rows($result)) {
  1764.  
  1765.                     $row = mysql_fetch_array($result);
  1766.  
  1767.                     $var_presentpage = $row["vpage_name"];
  1768.  
  1769.                     $var_guestbook = ($row["vpage_type"] == "guestbook")?"yes":"";
  1770.  
  1771.                     $var_pageurl = "../workarea/sites/" . $row["nsite_id"] . "/$var_presentpage";
  1772.  
  1773.                 }
  1774.  
  1775.             }
  1776.  
  1777.             if($_POST["actiontype"] == "saveandedit") {
  1778.  
  1779.                 //for save
  1780.  
  1781.                 if($var_type == "edit") {
  1782.  
  1783.                     SaveFile($fileRealLocation,$search_string);
  1784.  
  1785.                     SaveResource("../sites/$tmpsiteid/resource.txt",$var_deletedimages,$var_newimages,$userid);
  1786.  
  1787.                 }
  1788.  
  1789.                 SaveFile($fileToSave,$search_string);
  1790.  
  1791.                 SaveResource($resource_location,$var_deletedimages,$var_newimages,$userid);
  1792.  
  1793.                 $script_string .= " alert(\"Page Saved!\");
  1794.  
  1795.                                     global_saved = true;
  1796.  
  1797.                                      global_reload = true; ";
  1798.  
  1799.  
  1800.  
  1801.             }
  1802.  
  1803.         }
  1804.  
  1805.         elseif($_POST["actiontype"] == "newpage") {
  1806.  
  1807.             //USER CREATING A NEW PAGE
  1808.  
  1809.             //check if guestbookentry is proper for site isValidGuestbookEntry()
  1810.  
  1811.             //    if false then var_presentpage = currentpage,var_pageurl is set according to currentpage
  1812.  
  1813.             //size limit checked using validateSizePerUser()
  1814.  
  1815.             //    if false then var_presentpage = currentpage,var_pageurl is set according to currentpage
  1816.  
  1817.             //checked for request validity
  1818.  
  1819.             //    if false user navigated to usermain
  1820.  
  1821.             //IF type == "new then
  1822.  
  1823.             //    (i)      tbl_tempsite_pages checked for pagename in tempsiteid
  1824.  
  1825.             //    (ii)  if no identical pagename found then a row is inserted to tbl_tempsite_pages
  1826.  
  1827.             //    (iii) createpage() is called that copies index.htm/sub.htm based on user selection to workarea/tempsites/tempsiteid/pageName
  1828.  
  1829.             //    (iv)  var_presentpage and var_pageurl is set accordingly
  1830.  
  1831.             //ELSE
  1832.  
  1833.             //    (i)   tbl_site_pages checked for pagename in siteid
  1834.  
  1835.             //    (ii)  if no identical pagename found then a row is inserted to tbl_site_pages
  1836.  
  1837.             //    (iii) createpage() called that copies index.htm/sub.htm based on user selection to workarea/sites/siteid/pageName and sites/siteid/pagename
  1838.  
  1839.             //    (iv)  var_presentpage and var_pageurl is set accordingly
  1840.  
  1841.             //END IF
  1842.  
  1843.             $bool_type = false;
  1844.  
  1845.             $var_type=$_POST["type"];
  1846.  
  1847.             $var_actionin = $_POST["actiontype"];            //assigned to a hidden variable(actionin)
  1848.  
  1849.             $templateid=$_SESSION['session_currenttemplateid'];
  1850.  
  1851.             $var_pagetype=($_POST["pagetype"] == "index")?1:2;
  1852.  
  1853.             $tmpsiteid=$_SESSION['session_currenttempsiteid'];
  1854.  
  1855.             $userid=$_SESSION["session_userid"];
  1856.  
  1857.             $var_editpage = $_POST["editpage"];            // here editpage will contain the name of the page
  1858.  
  1859.             $var_guestbook=$_POST["guestbook"];
  1860.  
  1861.             $bool_guestbook = false;
  1862.  
  1863.             $db_pagetype = "";
  1864.  
  1865.             if($_POST["gbnew"] == "yes") {        //here guestbook will contain "yes" if user selected guestbook
  1866.  
  1867.                 $bool_guestbook = true;
  1868.  
  1869.                 $var_gbnew = $_POST["gbnew"];
  1870.  
  1871.                 $db_pagetype = "guestbook";
  1872.  
  1873.             }
  1874.  
  1875.             else {
  1876.  
  1877.                 $db_pagetype = ($var_pagetype == 1)?"homepage":"subpage";
  1878.  
  1879.             }
  1880.  
  1881.  
  1882.  
  1883.             if(isValidGuestbookEntry($var_gbnew,$var_type,$_SESSION['session_currenttempsiteid'])) {
  1884.  
  1885.                 if(validateSizePerUser($userid,$size_per_user,$allowed_space,"../")) {
  1886.  
  1887.                     $var_guestbook=$var_gbnew;
  1888.  
  1889.                     if(!isValidRequest($tmpsiteid,$templateid,$userid,$var_type)) {
  1890.  
  1891.                             echo("<script>alert('Invalid request! Please try again.'); location.href='../usermain.php';</script>");
  1892.  
  1893.                             exit();
  1894.  
  1895.                     }
  1896.  
  1897.  
  1898.  
  1899.                     if($var_type == "new") {  //this page is called for a new site not yet published
  1900.  
  1901.                             $sql_check = "Select * from tbl_tempsite_pages where ntempsite_id='" . $_SESSION['session_currenttempsiteid'] . "' AND vpage_name='" . addslashes($var_editpage) . "'";
  1902.  
  1903.                             $sql_insert = "Insert into tbl_tempsite_pages(ntempsp_id,ntempsite_id,vpage_name,vpage_title,vpage_type,vtype)
  1904.  
  1905.                                         Values('','" . $_SESSION['session_currenttempsiteid']  . "',
  1906.  
  1907.                                         '" . addslashes($var_editpage) . "','','" . $db_pagetype . "','advanced')";
  1908.  
  1909.                     }
  1910.  
  1911.                     else {
  1912.  
  1913.                             $bool_type = true;
  1914.  
  1915.                             $sql_check = "Select * from tbl_site_pages where nsite_id='" . $_SESSION['session_currenttempsiteid'] . "' AND vpage_name='" . addslashes($var_editpage) . "'";
  1916.  
  1917.                             $sql_insert = "Insert into tbl_site_pages(nsp_id,nsite_id,vpage_name,vpage_title,vpage_type,vtype)
  1918.  
  1919.                                         Values('','" . $_SESSION['session_currenttempsiteid']  . "',
  1920.  
  1921.                                         '" . addslashes($var_editpage) . "','','" . $db_pagetype . "','advanced')";
  1922.  
  1923.                     }
  1924.  
  1925.                     $result = mysql_query($sql_check) or die(mysql_error());
  1926.  
  1927.                     if(mysql_num_rows($result) <= 0) {
  1928.  
  1929.                         mysql_query($sql_insert) or die(mysql_error());
  1930.  
  1931.                     }
  1932.  
  1933.                     $var_presentpage=$var_editpage;
  1934.  
  1935.  
  1936.  
  1937.                     $var_pageurl=createPage($var_editpage,$templateid,$tmpsiteid,$var_pagetype,$bool_type,false,$bool_guestbook);
  1938.  
  1939.                 }
  1940.  
  1941.                 else {
  1942.  
  1943.                     $script_string .= "alert('Cannot create new page. Your space exceeded permitted limit." .
  1944.  
  1945.                                         "(Space taken by you: " . human_read($size_per_user) . " " .
  1946.  
  1947.                                         "Allowed space: " . human_read($allowed_space) . ") \\r\\n" .
  1948.  
  1949.                                         "Delete unused images or any/all of the sites created by you to proceed further.');";
  1950.  
  1951.                     $var_presentpage = $_POST["presentpage"];
  1952.  
  1953.                     $var_pageurl=$_POST["pageurl"];
  1954.  
  1955.                 }
  1956.  
  1957.             }
  1958.  
  1959.             else {
  1960.  
  1961.                 $script_string .= "alert('Cannot add two guestbooks.');";
  1962.  
  1963.                 $var_presentpage = $_POST["presentpage"];
  1964.  
  1965.                 $var_pageurl=$_POST["pageurl"];
  1966.  
  1967.             }
  1968.  
  1969.         }
  1970.  
  1971.         elseif($_POST["actiontype"] == "delete") {
  1972.  
  1973.                 //USER DELETING A PAGE
  1974.  
  1975.                 //checked for request validity using isValidRequest()
  1976.  
  1977.                 //if false then user navigated to usermain.php
  1978.  
  1979.                 //if type == "new" then
  1980.  
  1981.                 //    (i)    work location is set as workarea/tempsites/tempsiteid/
  1982.  
  1983.                 //    (ii)   delete page physically from work location by calling removePage()
  1984.  
  1985.                 //            saveResource() called to make modifications on work location/resource.txt
  1986.  
  1987.                 //    (iii)  delete from tbl_tempsite_pages the currentpage
  1988.  
  1989.                 //    (iv)   Run a select query on tbl_tempsite_pages for the current tempsiteid
  1990.  
  1991.                 //    (v)       get the first row and take the page name as var_presentpage, create var_pageurl, and var_guestbook set accordingly
  1992.  
  1993.                 //    (vi)   if there is no row present in tbl_tempsite_pages , insert a row for index.htm to tbl_tempsite_pages,
  1994.  
  1995.                 //            copy the templates/templateid/index.htm to worklocation
  1996.  
  1997.                 //else
  1998.  
  1999.                 //    (i)    work location is set as workarea/sites/siteid/
  2000.  
  2001.                 //    (ii)   delete page physically from work location by calling removePage()
  2002.  
  2003.                 //              saveResource() called to make modifications on work location/resource.txt
  2004.  
  2005.                 //           delete page physically from sites/siteid by calling removePage()
  2006.  
  2007.                 //            saveResource() called to make modifications on sites/siteid/resource.txt
  2008.  
  2009.                 //    (iii)  delete from tbl_site_pages the currentpage
  2010.  
  2011.                 //    (iv)   Run a select query on tbl_site_pages for the current siteid
  2012.  
  2013.                 //    (v)       get the first row and take the page name as var_presentpage, create var_pageurl, and var_guestbook set accordingly
  2014.  
  2015.                 //    (vi)   if there is no row present in tbl_site_pages , insert a row for index.htm to tbl_site_pages,
  2016.  
  2017.                 //            copy the templates/templateid/index.htm to worklocation, set var_presentpage, create var_pageurl.
  2018.  
  2019.                 //END IF
  2020.  
  2021.                 $bool_type = false;
  2022.  
  2023.                 $var_type=$_POST["type"];
  2024.  
  2025.                 $var_editpage=$_POST["editpage"];        // here editpage will contain the id of the page you are trying to delete
  2026.  
  2027.                 $var_actionin = $_POST["actiontype"];                //assigned to a hidden variable(actionin)
  2028.  
  2029.                 $var_presentpage = $_POST["presentpage"];
  2030.  
  2031.                 $var_deletedimages=$_POST["deletedimages"];
  2032.  
  2033.                 $templateid=$_SESSION['session_currenttemplateid'];
  2034.  
  2035.                 $tmpsiteid=$_SESSION['session_currenttempsiteid'];
  2036.  
  2037.                 $userid=$_SESSION["session_userid"];
  2038.  
  2039.  
  2040.  
  2041.                 if(!isValidRequest($tmpsiteid,$templateid,$userid,$var_type)) {
  2042.  
  2043.                     echo("<script>alert('Invalid request! Please try again.'); location.href='../usermain.php';</script>");
  2044.  
  2045.                     exit();
  2046.  
  2047.                 }
  2048.  
  2049.  
  2050.  
  2051.                 if($var_type == "new") {
  2052.  
  2053.                     $resource_location="../workarea/tempsites/$tmpsiteid/";
  2054.  
  2055.                     $sql_delete = "Delete from tbl_tempsite_pages where ntempsp_id='" . addslashes($var_editpage) . "'";
  2056.  
  2057.                     $sql_check = "Select * from tbl_tempsite_pages where ntempsite_id='" . addslashes($tmpsiteid) . "'";
  2058.  
  2059.                     $sql_insert = "Insert into tbl_tempsite_pages(ntempsp_id,ntempsite_id,vpage_name,vpage_title,vpage_type,vtype)
  2060.  
  2061.                                 Values('','" . $_SESSION['session_currenttempsiteid']  . "',
  2062.  
  2063.                                 'index.htm','','homepage','advanced')";
  2064.  
  2065.                     removePage($var_presentpage,$tmpsiteid,false);
  2066.  
  2067.                 }
  2068.  
  2069.                 elseif($var_type == "edit") {
  2070.  
  2071.                     $bool_type = true;
  2072.  
  2073.                     $sql_delete = "Delete from tbl_site_pages where nsp_id='" . addslashes($var_editpage) . "'";
  2074.  
  2075.                     $sql_check = "Select * from tbl_site_pages where nsite_id='" . addslashes($tmpsiteid) . "'";
  2076.  
  2077.                     $sql_insert = "Insert into tbl_site_pages(nsp_id,nsite_id,vpage_name,vpage_title,vpage_type,vtype)
  2078.  
  2079.                                 Values('','" . $_SESSION['session_currenttempsiteid']  . "',
  2080.  
  2081.                                 'index.htm','','homepage','advanced')";
  2082.  
  2083.                     $resource_location="../workarea/sites/$tmpsiteid/";
  2084.  
  2085.                     removePage($var_presentpage,$tmpsiteid,true);
  2086.  
  2087.                     SaveResource("../sites/$tmpsiteid/resource.txt",$var_deletedimages,"",$userid);
  2088.  
  2089.                 }
  2090.  
  2091.  
  2092.  
  2093.                 //This call to SaveResource deletes the images that was there in the page from resource.txt
  2094.  
  2095.                 SaveResource(($resource_location . "resource.txt"),$var_deletedimages,"",$userid);
  2096.  
  2097.  
  2098.  
  2099.                 mysql_query($sql_delete) or die(mysql_error());
  2100.  
  2101.  
  2102.  
  2103.                 $result=mysql_query($sql_check) or die(mysql_error());
  2104.  
  2105.                 if(mysql_num_rows($result) > 0) {
  2106.  
  2107.                     $row = mysql_fetch_array($result);
  2108.  
  2109.                     $var_presentpage = $row["vpage_name"];
  2110.  
  2111.                     $var_guestbook = ($row["vpage_type"] == "guestbook")?"yes":"";
  2112.  
  2113.                     $var_pageurl= $resource_location . $var_presentpage;
  2114.  
  2115.                 }
  2116.  
  2117.                 else {
  2118.  
  2119.                         mysql_query($sql_insert) or die(mysql_error());
  2120.  
  2121.                         $var_presentpage="index.htm";
  2122.  
  2123.                         $var_pageurl=createPage("index.htm",$templateid,$tmpsiteid,1,$bool_type);
  2124.  
  2125.                 }
  2126.  
  2127.                 $script_string .= " alert(\"Page Deleted!\");";
  2128.  
  2129.  
  2130.  
  2131.         }
  2132.  
  2133.         else if($_POST["actiontype"] == "saveas") {
  2134.  
  2135.             //SAVE AS SECTION
  2136.  
  2137.             //if guestbook == "yes" then same page shown saying 'cannot have two copies of guestbook'.
  2138.  
  2139.             //Checked for size limit using validateSizePerUser()
  2140.  
  2141.             //    if false then message shown saying 'cannot save page in new name....' and same page shown.
  2142.  
  2143.             //Checked for request validity using isValidRequest()
  2144.  
  2145.             //    if false then user navigated to usermain.php
  2146.  
  2147.             //IF type == "new" then
  2148.  
  2149.             //    set work location as workarea/tempsites/tempsiteid/
  2150.  
  2151.             //    check if newpageName exists in tbl_tempsite_pages
  2152.  
  2153.             //    if no then insert a row to tbl_tempsite_pages
  2154.  
  2155.             //    call saveFile() with the current page as the source and editpage as the destination in work location
  2156.  
  2157.             //    call saveResource() to modify resource.txt file accordingly
  2158.  
  2159.             //    set the presentpage as the newPageName and build pageUrl.
  2160.  
  2161.             //ELSE
  2162.  
  2163.             //    set work location as workarea/sites/siteid/
  2164.  
  2165.             //    check if newpageName exists in tbl_site_pages
  2166.  
  2167.             //    if no then insert a row to tbl_site_pages
  2168.  
  2169.             //    call saveFile() with the current page as the source and editpage as the destination in work location
  2170.  
  2171.             //    call saveResource() to modify resource.txt file accordingly
  2172.  
  2173.             //    call saveFile() with the current page as source and sites/siteid/newPageName as destination
  2174.  
  2175.             //    call saveResource() to modify sites/siteid/resource.txt file accordingly
  2176.  
  2177.             //    set the presentpage as the newPageName and build pageUrl.
  2178.  
  2179.             //END IF
  2180.  
  2181.             $bool_type = false;
  2182.  
  2183.             $var_actionin = $_POST["actiontype"];
  2184.  
  2185.             $var_presentpage = $_POST["presentpage"];
  2186.  
  2187.             $var_pageurl=$_POST["pageurl"];
  2188.  
  2189.             $var_type = $_POST["type"];
  2190.  
  2191.             $var_deletedimages=$_POST["deletedimages"];
  2192.  
  2193.             $var_newimages=$_POST["newimages"];
  2194.  
  2195.  
  2196.  
  2197.             $tmpsiteid=$_SESSION['session_currenttempsiteid']; // reconsider this statement since the session will be different in case of sites
  2198.  
  2199.             $userid=$_SESSION["session_userid"];
  2200.  
  2201.  
  2202.  
  2203.             //these 3 parameters will be passed only if "actiontype" = "saveandcreate"
  2204.  
  2205.             $templateid=$_SESSION['session_currenttemplateid'];
  2206.  
  2207.             //$var_pagetype=($_POST["pagetype"] == "index")?1:2;
  2208.  
  2209.             $var_editpage = $_POST["editpage"];
  2210.  
  2211.             if($_POST["guestbook"] == "yes") {
  2212.  
  2213.                 $var_guestbook = $_POST["guestbook"];
  2214.  
  2215.                 $script_string .= " alert(\"Cannot have two copies of the guestbook.!\");";
  2216.  
  2217.             }
  2218.  
  2219.             elseif(!validateSizePerUser($userid,$size_per_user,$allowed_space,"../")) {
  2220.  
  2221.                 $script_string .= "alert('Cannot save page in new name. Your space exceeded permitted limit." .
  2222.  
  2223.                                         "(Space taken by you: " . human_read($size_per_user) . " " .
  2224.  
  2225.                                         "Allowed space: " . human_read($allowed_space) . ") \\r\\n" .
  2226.  
  2227.                                         "Delete unused images or any/all of the sites created by you to proceed further.');";
  2228.  
  2229.             }
  2230.  
  2231.             else {
  2232.  
  2233.                 if(!isValidRequest($tmpsiteid,$templateid,$userid,$var_type)) {
  2234.  
  2235.                         echo("<script>alert('Invalid request! Please try again.'); location.href='../usermain.php';</script>");
  2236.  
  2237.                         exit();
  2238.  
  2239.                 }
  2240.  
  2241.                 if($var_type == "new") {
  2242.  
  2243.                     $search_string=$temperory_location . "/$tmpsiteid";
  2244.  
  2245.                     $fileToSave = "../workarea/tempsites/$tmpsiteid/$var_editpage";
  2246.  
  2247.                     $resource_location="../workarea/tempsites/$tmpsiteid/resource.txt";
  2248.  
  2249.     /*                $sql_check = "Select * from tbl_tempsite_pages where ntempsite_id='" . $_SESSION['session_currenttempsiteid'] . "' AND vpage_name='" . addslashes($var_editpage) . "'";
  2250.  
  2251.                     $sql_insert = "Insert into tbl_tempsite_pages(ntempsp_id,ntempsite_id,vpage_name,vpage_title,vpage_type,vtype)
  2252.  
  2253.                                     Values('','" . $_SESSION['session_currenttempsiteid']  . "',
  2254.  
  2255.                                     '" . addslashes($var_editpage) . "','','htm','advanced')";*/
  2256.  
  2257.                     $sql_check = "Select * from tbl_tempsite_pages where ntempsite_id='" . $_SESSION['session_currenttempsiteid'] . "' AND vpage_name='";
  2258.  
  2259.                     $sql_insert = "Insert into tbl_tempsite_pages(ntempsp_id,ntempsite_id,vpage_name,vpage_title,vpage_type,vtype)
  2260.  
  2261.                                     Values('','" . $_SESSION['session_currenttempsiteid']  . "',
  2262.  
  2263.                                     '" . addslashes($var_editpage) . "','','";
  2264.  
  2265.  
  2266.  
  2267.                 }
  2268.  
  2269.                 elseif($var_type == "edit") {
  2270.  
  2271.  
  2272.  
  2273.                     $bool_type = true;
  2274.  
  2275.                     $search_string=$real_location . "/$tmpsiteid";
  2276.  
  2277.                     $fileToSave = "../workarea/sites/$tmpsiteid/$var_editpage";
  2278.  
  2279.                     $resource_location="../workarea/sites/$tmpsiteid/resource.txt";
  2280.  
  2281.     /*                $sql_check = "Select * from tbl_site_pages where nsite_id='" . $_SESSION['session_currenttempsiteid'] . "' AND vpage_name='" . addslashes($var_editpage) . "'";
  2282.  
  2283.                     $sql_insert = "Insert into tbl_site_pages(nsp_id,nsite_id,vpage_name,vpage_title,vpage_type,vtype)
  2284.  
  2285.                                     Values('','" . $_SESSION['session_currenttempsiteid']  . "',
  2286.  
  2287.                                     '" . addslashes($var_editpage) . "','','htm','advanced')";*/
  2288.  
  2289.                     //save to original site location
  2290.  
  2291.                     $sql_check = "Select * from tbl_site_pages where nsite_id='" . $_SESSION['session_currenttempsiteid'] . "' AND vpage_name='";
  2292.  
  2293.                     $sql_insert = "Insert into tbl_site_pages(nsp_id,nsite_id,vpage_name,vpage_title,vpage_type,vtype)
  2294.  
  2295.                                     Values('','" . $_SESSION['session_currenttempsiteid']  . "',
  2296.  
  2297.                                     '" . addslashes($var_editpage) . "','','";
  2298.  
  2299.  
  2300.  
  2301.                     SaveFile("../sites/$tmpsiteid/$var_editpage",$search_string);
  2302.  
  2303.                     SaveResource("../sites/$tmpsiteid/resource.txt",$var_deletedimages,$var_newimages,$userid);
  2304.  
  2305.                 }
  2306.  
  2307.                 SaveFile($fileToSave,$search_string);
  2308.  
  2309.                 SaveResource($resource_location,$var_deletedimages,$var_newimages,$userid);
  2310.  
  2311.  
  2312.  
  2313.                 $temp_ins_string="";
  2314.  
  2315.                 $result = mysql_query($sql_check . addslashes($var_presentpage) . "'") or die(mysql_error() . 'one');
  2316.  
  2317.                 if(mysql_num_rows($result) > 0) {
  2318.  
  2319.                     $row = mysql_fetch_array($result);
  2320.  
  2321.                     $temp_ins_string=$row["vpage_type"];
  2322.  
  2323.                 }
  2324.  
  2325.                 $result = mysql_query($sql_check . addslashes($var_editpage) . "'") or die(mysql_error() . 'two');
  2326.  
  2327.                 if(mysql_num_rows($result) <= 0) {
  2328.  
  2329.                     mysql_query($sql_insert . $temp_ins_string . "','advanced')") or die(mysql_error() . 'three');
  2330.  
  2331.                 }
  2332.  
  2333.                 $var_pageurl=$fileToSave;
  2334.  
  2335.                 $var_presentpage=$var_editpage;
  2336.  
  2337.             }
  2338.  
  2339.         }
  2340.  
  2341.         $script_string .= "</script>";
  2342.  
  2343.  
  2344.  
  2345. //$show_body_on_load=true;
  2346.  
  2347. ?>
  2348.  
  2349. <SCRIPT language=JavaScript src="js/formatbar.js"></script>
  2350.  
  2351. <script>
  2352.  
  2353.     try{
  2354.  
  2355.     document.body.onload=loading();
  2356.  
  2357.     }catch(e){}
  2358.  
  2359. </script>
  2360.  
  2361. <LINK href="style/editor.css" type=text/css rel=stylesheet>
  2362.  
  2363. <?php
  2364.  
  2365.     include "./userheader.php";
  2366.  
  2367.     echo($script_string);
  2368.  
  2369. ?>
  2370.  
  2371. <table width="100%" cellpadding="0" cellspacing="0" class=background>
  2372.  
  2373.     <tr>
  2374.  
  2375.       <td width="100%" align="center">
  2376.  
  2377.       <table width="80%" cellpadding="0" cellspacing="0">
  2378.  
  2379.           <tr>
  2380.  
  2381.             <td width="100%" align="center" valign="top">
  2382.  
  2383.             <?php
  2384.  
  2385.             if($var_type == "new") {
  2386.  
  2387.                 $sql = "Select ntempsp_id as 'nsp_id',vpage_name from tbl_tempsite_pages where
  2388.  
  2389.                  ntempsite_id='" . $_SESSION['session_currenttempsiteid'] . "'";
  2390.  
  2391.                 echo("<img src=\"../images/cstep7.gif\">");
  2392.  
  2393.             }
  2394.  
  2395.             else {
  2396.  
  2397.             $sql = "Select nsp_id,vpage_name from tbl_site_pages where nsite_id='" . $_SESSION['session_currenttempsiteid'] . "'";
  2398.  
  2399.             }
  2400.  
  2401.             ?>
  2402.  
  2403.       <fieldset><legend class="maintext"><b>Current Page : </b><?php echo($var_presentpage); ?></legend>
  2404.  
  2405.        <font class="maintext"> <br>
  2406.  
  2407.        Page List</font>
  2408.  
  2409.         <select name="cmbPages" onChange="javascript:editPage();" class="selectbox" style="width:200px; ">
  2410.  
  2411.           <?php
  2412.  
  2413.  
  2414.  
  2415.             $result = mysql_query($sql) or die(mysql_error());
  2416.  
  2417.             if(mysql_num_rows($result) > 0)    {
  2418.  
  2419.                 while($row= mysql_fetch_array($result)) {
  2420.  
  2421.                     echo("<OPTION VALUE=\"" . $row["nsp_id"] . "\"" . (($var_presentpage == $row["vpage_name"])?"Selected":"") . " >" . $row["vpage_name"] . "</OPTION>");
  2422.  
  2423.                 }
  2424.  
  2425.             }
  2426.  
  2427.             mysql_free_result($result);
  2428.  
  2429.         ?>
  2430.  
  2431.         </select>
  2432.  
  2433.         &nbsp;
  2434.  
  2435.         <input type="button" name="EditButton"  value="View"  onClick="javascript:editPage();" style="display:none; ">
  2436.  
  2437.          &nbsp;&nbsp;&nbsp;&nbsp;
  2438.  
  2439.       <input type="button" name="SavePage"  value="Save"  onClick="javascript:savePage(1);" style="width:70px; " class="editorbutton">
  2440.  
  2441.       <input type="button" name="RemovePage"  value="Delete"  onClick="javascript:removePage();" style="width:70px; "  class="editorbutton">
  2442.  
  2443.       <input type="button" name="AddPage"  value="Add Page" style="width:70px; "  onClick="javascript:addPage();"  class="editorbutton">
  2444.  
  2445.       <input name="Preview" type="button" id="Preview" value="Preview" style="width:70px; " onClick="javascript:previewSite(<?php echo("'" . (($var_type == "new")?"tempsites":"sites") . "','" . $_SESSION['session_currenttempsiteid'] . "','" . $var_presentpage . "'"); ?>);"  class="editorbutton">
  2446.  
  2447.       <input name="Publish" type="button" id="Publish" value="Publish" onClick="javascript:publishSite();" class="editorbutton" style="width:70px; ">
  2448.  
  2449.         <br>&nbsp;
  2450.  
  2451.       </fieldset>
  2452.  
  2453.  
  2454.  
  2455.  
  2456.  
  2457.  
  2458.  
  2459.  
  2460.  
  2461.         <form name="PageDetails" method="post" action="editor.php">
  2462.  
  2463.             <input type="hidden" name="checkid" id="checkid" value="<?php echo($_SESSION["session_checkid"]); ?>">
  2464.  
  2465.             <input type="hidden" name="actiontype" id="actiontype" value="">
  2466.  
  2467.             <input type="hidden" name="presentpage" id="presentpage" value="<?php echo($var_presentpage); ?>">
  2468.  
  2469.             <input type="hidden" name="editpage" id="editpage" value="">
  2470.  
  2471.             <input type="hidden" name="guestbook" id="guestbook" value="<?php echo($var_guestbook); ?>">
  2472.  
  2473.             <input type="hidden" name="gbnew" id="gbnew" value="">
  2474.  
  2475.             <input type="hidden" name="basiclocation" id="basiclocation" value="<?php echo($basicLocation); ?>">
  2476.  
  2477.             <input type="hidden" name="pagetype" id="pagetype" value="">
  2478.  
  2479.             <input type="hidden" name="pageurl" id="pageurl" value="<?php echo($var_pageurl); ?>">
  2480.  
  2481.             <input type="hidden" name="actionIn" id="actionIn" value="<?php echo($var_actionin); ?>">
  2482.  
  2483.             <input type="hidden" name="type" id="type" value="<?php echo($var_type); ?>">
  2484.  
  2485.             <INPUT type=hidden name="EditorHTM" id="EditorHTM" value="">
  2486.  
  2487.             <INPUT type=hidden name="EditorHTM2"  value="">
  2488.  
  2489.              <INPUT type=hidden name="EditorHTM3"  value="">
  2490.  
  2491.              <INPUT type=hidden name="EditorHTM4"  value="">
  2492.  
  2493.              <INPUT type=hidden name="EditorHTM5"  value="">
  2494.  
  2495.              <input type="hidden" name="deletedimages" id="deletedimages" value="">
  2496.  
  2497.              <input type="hidden" name="newimages" id="newimages" value="">
  2498.  
  2499.         </form>
  2500.  
  2501.         <form name="publishPage" method="post" action="">
  2502.  
  2503.         <input type="hidden" name="pubpage" id="pubpage" value="">
  2504.  
  2505.         </form>
  2506.  
  2507.  
  2508.  
  2509.             </td>
  2510.  
  2511.         </tr>
  2512.  
  2513.       </table>
  2514.  
  2515.         </td>
  2516.  
  2517.     </tr>
  2518.  
  2519. </table>
  2520.  
  2521.  
  2522.  
  2523. <DIV class=MainBody style="WIDTH: 100%; HEIGHT: 100%">
  2524.  
  2525. <!-- Insert top menu  -->
  2526.  
  2527. <SCRIPT language=JavaScript src="js/makemenu.js"></SCRIPT>
  2528.  
  2529. <SCRIPT language=JavaScript src="js/menu.js"></script>
  2530.  
  2531. <!-- Insert format bar  -->
  2532.  
  2533.  <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  2534.  
  2535.   <TBODY>
  2536.  
  2537.   <TR>
  2538.  
  2539.   <TD class=body height=22>
  2540.  
  2541.       <TABLE class=toolbar id=toolbar_full cellSpacing=0 cellPadding=0
  2542.  
  2543.       width="100%" align=left border=0>
  2544.  
  2545.       <TBODY>
  2546.  
  2547.       <TR>
  2548.  
  2549.       <TD class=body height=22>
  2550.  
  2551.        <?php
  2552.  
  2553.        //Include the shortcut menu
  2554.  
  2555.         include("includes/formatbar.inc");
  2556.  
  2557.        ?>
  2558.  
  2559.         </TD></TR>
  2560.  
  2561.         </TBODY>
  2562.  
  2563.         </TABLE>
  2564.  
  2565.    </TD></TR>
  2566.  
  2567. </TBODY></TABLE>
  2568.  
  2569. <DIV id=charMenu style="DISPLAY: none">
  2570.  
  2571. <TABLE
  2572.  
  2573. style="BORDER-RIGHT: buttonshadow 2px solid; BORDER-TOP: buttonhighlight 1px solid; FONT-WEIGHT: bold; FONT-SIZE: 14px; BORDER-LEFT: buttonhighlight 1px solid; CURSOR: hand; BORDER-BOTTOM: buttonshadow 1px solid; FONT-FAMILY: Verdana"
  2574.  
  2575. borderColor=#666666 cellSpacing=5 cellPadding=1 bgColor=buttonface border=1>
  2576.  
  2577.   <TBODY>
  2578.  
  2579.   <TR>
  2580.  
  2581.     <TD onclick=parent.insertChar(this) width=15>¡</TD>
  2582.  
  2583.     <TD onclick=parent.insertChar(this) width=15>¿</TD>
  2584.  
  2585.     <TD onclick=parent.insertChar(this) width=15>¢</TD>
  2586.  
  2587.     <TD onclick=parent.insertChar(this) width=15>£</TD>
  2588.  
  2589.     <TD onclick=parent.insertChar(this) width=15>¥</TD></TR>
  2590.  
  2591.   <TR>
  2592.  
  2593.     <TD onclick=parent.insertChar(this) width=15>¤</TD>
  2594.  
  2595.     <TD onclick=parent.insertChar(this) width=15>§</TD>
  2596.  
  2597.     <TD onclick=parent.insertChar(this) width=15>«</TD>
  2598.  
  2599.     <TD onclick=parent.insertChar(this) width=15>»</TD>
  2600.  
  2601.     <TD onclick=parent.insertChar(this) width=15>±</TD></TR>
  2602.  
  2603.   <TR>
  2604.  
  2605.     <TD onclick=parent.insertChar(this) width=15>©</TD>
  2606.  
  2607.     <TD onclick=parent.insertChar(this) width=15>®</TD>
  2608.  
  2609.     <TD onclick=parent.insertChar(this) width=15>™</TD>
  2610.  
  2611.     <TD onclick=parent.insertChar(this) width=15>¬</TD>
  2612.  
  2613.     <TD onclick=parent.insertChar(this) width=15>¯</TD></TR>
  2614.  
  2615.   <TR>
  2616.  
  2617.     <TD onclick=parent.insertChar(this) width=15>°</TD>
  2618.  
  2619.     <TD onclick=parent.insertChar(this) width=15>•</TD>
  2620.  
  2621.     <TD onclick=parent.insertChar(this) width=15>·</TD>
  2622.  
  2623.     <TD onclick=parent.insertChar(this) width=15>†</TD>
  2624.  
  2625.     <TD onclick=parent.insertChar(this) width=15>‡</TD></TR>
  2626.  
  2627.   <TR>
  2628.  
  2629.     <TD onclick=parent.insertChar(this) width=15>¼</TD>
  2630.  
  2631.     <TD onclick=parent.insertChar(this) width=15>½</TD>
  2632.  
  2633.     <TD onclick=parent.insertChar(this) width=15>¾</TD></TR></TBODY></TABLE>
  2634.  
  2635. </DIV>
  2636.  
  2637. <SELECT id=sPageSwitch style="DISPLAY: none" unselectable="on"
  2638.  
  2639.             onchange=sGoTo(this.options[this.selectedIndex].value); ></SELECT>
  2640.  
  2641. <IFRAME id=foo contentEditable=true
  2642.  
  2643. style="BORDER-RIGHT: #000000 0px solid; PADDING-RIGHT: 0px; BORDER-TOP: #000000 0px solid; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; OVERFLOW: auto; BORDER-LEFT: #000000 0px solid; WIDTH: 100%; PADDING-TOP: 0px; BORDER-BOTTOM: #000000 0px solid; SCROLLBAR-BASE-COLOR: #dddddd; ; HEIGHT: expression(setHeight()); BACKGROUND-COLOR: white"
  2644.  
  2645. src="javascript:false;" onload="fooLoad();" onfocus="fooFocus();"></IFRAME>
  2646.  
  2647. </DIV>
  2648.  
  2649. <?
  2650.  
  2651. include "./userfooter.php";
  2652.  
  2653. ?>
  2654.  
  2655. <script language="JavaScript" type="text/JavaScript">
  2656.  
  2657. function fooFocus() {
  2658.  
  2659. }
  2660.  
  2661.  
  2662.  
  2663.  
  2664.  
  2665. </script>
Mar 14 '12 #1
0 1604

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Colin Graham | last post by:
Im working on some asp code using vbscript but i cant seem to get the following code to work. I can get the result from the database but im having to joy returning the value to the html code in...
0
by: Jon | last post by:
Hi, I have a setfocus that works fine: Private Sub SetFocus(ByVal ctrl As Control) Dim focusScript As String = "<script language='javascript'>" & _ "document.getElementById('" + ctrl.ClientID...
3
by: AnalogKid17 | last post by:
I have the following line of code in my start/login page: document.getElementById("txtLogin").focus(); When I run the website app through F5 (Debug, Start Debugging) it works fine (ie, focus...
7
by: Dave Booker | last post by:
I am using a WebBrowser object in my .NET 2.0 application, but it is not shown to the user. Every time a timer event triggers it to perform a m_WebBrowser.Navigate() I get that classic IE 'click'...
7
by: Naha | last post by:
Hi guys, I have a problem, can someone help me? I'm not sure why but none of my validation functions are working!!!! <html>
1
by: Naha | last post by:
hi, my servlet is not linking with my jsp, when i click on submit it does not load up the page. and i have mapped to the DD. import javax.servlet.*; import javax.servlet.http.*; import...
1
by: saritbhatta | last post by:
to set focus in a text box i have written document.formname.elementname.focus(); I have also tried document.formname.elementname.select(); and document.getElementById('elementname').focus() ...
1
by: Michael | last post by:
It seems that the xml application which is part of XMLStarlet 1.0.1 is unable to process transformations which require the id function in combination with an XSD scheme file. In my test example, id...
7
by: kiranrajenimbalkar | last post by:
Hi, when i am executing the below SQL its taking long time for execution so please provide me the solution. SELECT A.ID, A.IDTYPE, A.USERNAME, A.FIRSTNAME, ...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.