Announcement

Collapse
No announcement yet.

Blank application sample

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Blank application sample

    Hi everyone,

    I am trying to use blank application in one of the module, any one has any guidence, or samples would be appreciated

    I already had checked the The Sample blank application provided is not undestandable..!

    Thanks in advance
    regards
    Dhana

  • #2
    Re: Blank application sample

    Blank application is like an empty php file.

    You create anything that you want hand coding.

    Comment


    • #3
      Re: Blank application sample

      Hi Diogo Toscano,
      Thanks for your response..!
      Yes.. It is a php file..! But I had the below requirement, and need your suggestions on this

      Please go throgh my earlier Post
      http://www.scriptcase.net/forum_en_u...p?topic=1704.0

      where i had problem in accessing files located in the server (I am still in process of checking Your Yesterday's reply on "Deployment template").

      I dropped the plan of using documents from Samba, and it is nice where in i can have a Config table where the documents is located and SC application can build the string based on the configration

      I had created Virtual directory in the IIS server and made accesable via http:[path]filename and mapped to a URL field. Now I can able to open the Docuement (with + sign too) from the server.
      But with the following disadvantages
      1. Entire path is visible in the gri application (http://servername/folder/folder/documentname)
      2. Users may copy and paste the URL and access to document without login in sc application and session


      To achieve the above, I tried to use blank application
      Here my requirement is,
      1. i want to restrict the http access when there is no session open via Sc application (Checking IIS authentication methods).
      2. When the document opened in the browser there is no buttons like Back,Refersh is availble
      3. When i use browser back button It says error

      I want to have a Back button in the blank application which should redirect the control to Grid Application.
      And when the SC project session expired, it should not open the File.

      Advise

      Thanks & Regards
      Dhana






      Comment


      • #4
        Re: Blank application sample

        If you use images in directory instead database you'll have problem with this two issues:
        1. Entire path is visible in the gri application (http://servername/folder/folder/documentname)
        2. Users may copy and paste the URL and access to document without login in sc application and session

        To the browser display the image on a directory users my copy the entire url to the image. To turn off this you cant use directly link to the img ... you need to create an php to read the image that you need and do the output directly to the browser.
        For example ... instead of using a field image ... you need to do something like this:
        {field_image} = "<img src="../blank/blank.php?image=". {image_code} ."">";

        and create a blank application to receive that parameter "image" and output the image that you want ... you'll need more expertise in php ...

        Your blank application will have this code (you need to adapt to you):

        Code:
        $imgFile = "/var/www/imgs ..../" . $_GET['image'] . ".jpg";
        
        header('Content-type: image/jpeg');
        header('Content-Length: ' . filesize($imgFile));
        $pipe = fopen($imgFile, 'rb');
        fpassthru($pipe);
        fclose($pipe);

        Comment


        • #5
          Re: Blank application sample

          Hi Diogo Toscano,
          Thanks for your immediate response.>!

          Let me check your code and get back tomorrow..!(It's 6:30 Pm)

          Thanks
          Dhana

          Comment


          • #6
            Re: Blank application sample

            Here is 9:40am :-p

            Take a look at http://www.google.com.br/search?sour...;q=img+src+php

            You just need to understand that ... you cant output the real path due to security ... so, the solution is to output the image. Even if you put in a samba path, virtual directory ... if is readable to the internet user ... the end users will have access....

            :-)

            Comment


            • #7
              Re: Blank application sample

              Diogo Toscano,
              Yes, Agreed.. I will check all you suggestions and get back to you

              Regards
              Dhana

              Comment


              • #8
                Re: Blank application sample

                Hi Diogo Toscano,

                Finally, I made it work. But I haven't used Blank application. I had given the below on the OnRecord event on the grid applilcation, Work fine..

                $file = {attr_docpath} . {ZPageNo} . "/" . {ZFileName};
                {fld_new} = "<a href=" . $file . " target=_blank >Open</a><br />";



                Thanks for your suggestions..

                Regards
                Dhana

                Comment


                • #9
                  Re: Blank application sample

                  this work too, but everyone can copy url and access direclty the image without passing your login system... isnt?

                  Comment


                  • #10
                    Re: Blank application sample

                    Hi Diogo Toscano,

                    Yes..! It can be copied and users can able to access.. Due to project rush, I have to release and it works on anoymous access to virutal directory.
                    To prevent that..! I am looking to control in the Webserver virtual directory with credentials, Keep you updated the progress. If you have any solution, please do share

                    Thanks &amp; regards
                    Dhana


                    Comment


                    • #11
                      here is my blank application example which I also need help with
                      its not entirely working, does anybody see what the problem is?
                      should create a back of database save it in the designated folder and then provide the path.
                      it doesnt seem to be creating the file as the sql file is not found, yet the dump display no error......

                      any help would be aprechiated, and plus I think my example is what is wanted
                      PHP Code:
                      $date = date('FY');
                      // file backup path
                      $path = '../_lib/file/doc/backup/'.[clubID].'';
                      // file names
                      $file_one = ''.$date.'_members_table.sql';
                      $file_two = ''.$date.'_payment_history.sql';
                      // tables to backup
                      $table_members = "mbr";
                      $table_history = "history";
                      // Check for record
                      $backup_file_one  = ''.$path.''.$file_one.'';
                      $backup_file_two  = ''.$path.''.$file_two.'';

                      // select fields to backup - table two
                      $check_sql_one = "SELECT * INTO OUTFILE '$backup_file_one' FROM $table_members WHERE clubID = '[clubID]'";
                      sc_lookup(rs1, $check_sql_one);

                      // select fields to backup - table one
                      $check_sql_two = "SELECT * INTO OUTFILE '$backup_file_two' FROM $table_history WHERE clubID = '[clubID]'";
                      sc_lookup(rs2, $check_sql_two);

                      ?>

                      <style>
                      .staff-box {width:80%;margin:0 auto;padding:20px;background-color:#FAFAFA;-webkit-border-radius: 8px;
                      border-radius: 8px;-webkit-box-shadow: 2px 2px 6px 5px #D9D2D3;
                      box-shadow: 2px 2px 6px 5px #D9D2D3;}
                      .staff-box img {float:left;padding:20px;margin-top:-20px;}
                      .staff-box-msg {padding:10px;-webkit-border-radius: 8px;
                      border-radius: 8px;background-color:#fff;}
                      .staff-box-msg a {color:#3B3B3B;text-decoration:none;font-weight:normal;font-size:12px;
                              font-family:palatino linotype, palatino, serif;}
                      .staff-box-msg a:hover  {color:#737373;
                              text-style:none;}
                      </style>
                      <div class="staff-box">
                          <h3><?php echo {lang_backup_title}; ?></h3>
                          <hr/>
                          <div class="staff-box-msg">
                              <img width="140" height="140" border="0" src="../_lib/img/sys__NM__members-only-medium.jpg"></img>
                          <div style="list-box-small">
                              
                      <?php
                      // checks and display file for download
                      if(! $check_sql_one )
                      {
                      die(
                      'Could not take data backup: ' mysql_error());
                      }
                      else
                      {
                      echo {
                      lang_backup_members};
                      ?>
                      <br/>
                      <a href="<?php echo $path?><?php echo $file_one?>"><?php echo $file_one?></a>
                      <?php
                      }
                      ?>
                      <br/>
                      <?php
                      if(! $check_sql_two )
                      {
                      die(
                      'Could not take data backup: ' mysql_error());
                      }
                      else
                      {
                      ?>
                      <br/>
                      <?php
                      echo {lang_backup_history};
                      ?>
                      <br/>
                      <a href="<?php echo $path?><?php echo $file_two?>"><?php echo $file_two?></a>
                      <br/>
                      <div style='padding-top:20px;'><?php echo {lang_backup_msg}; ?></div>
                      <?php
                      }
                      ?>
                      </div>
                      </div>
                      </div>
                      <?php

                      Comment


                      • #12
                        If I read the docs on https://dev.mysql.com/doc/refman/5.1/en/select.html I suspect you have a sql error. The into should be at the end?
                        Albert Drent
                        aducom software netherlands
                        scriptcase partner, reseller, support and (turn-key) development
                        www.scriptcase.eu / www.scriptcase.nl

                        Comment


                        • #13
                          Hi,
                          I'm not quite sure if the sc_lookup() macro works correctly in this situation. The sc_exec_sql() would be the better choice,
                          but I would suggest sc_select() because you get a return value you can check.

                          sc_select(result1,$check_sql_one);
                          if($result1 === false)
                          {
                          echo "Error: ".{result1_erro};
                          }
                          else
                          {
                          show your info;
                          }

                          In your sample you are checking for $check_sql_one which contains the sql string and therefore is always true. You will never get an error message.
                          Also make sure you have the correct permissions on the folder you want to write to.

                          Hope this helps

                          jsb

                          Comment

                          Working...
                          X