Great news regarding mod_harbour CGI !!!

mod_harbour is an Apache module that allows to run PRGs directly on the web !!!

Great news regarding mod_harbour CGI !!!

Postby Antonio Linares » Mon Nov 07, 2022 6:31 pm

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Great news regarding mod_harbour CGI !!!

Postby acuellar » Tue Nov 22, 2022 1:06 pm

Estimado Antonio

Logré que funcione, pero no muestra las imágenes :(


Antes pasaba una variable así
Code: Select all  Expand view  RUN

 Local cArM:="ArM"
<a href="MuestraDatos.prg?<?prg return cArM ?>">
 

Da error

Ahora cómo se hace?

Gracias por la ayuda
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1645
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Great news regarding mod_harbour CGI !!!

Postby Antonio Linares » Tue Nov 22, 2022 9:46 pm

Que error te dá ?

Puedes proporcionar el PRG completo ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Great news regarding mod_harbour CGI !!!

Postby acuellar » Wed Nov 23, 2022 10:36 am

Gracias estimado Antonio por responder

El error es que directamente descarga MuestraDatos.prg al dar click al botón
Code: Select all  Expand view  RUN

Function main
local cAyS:="AyS",cArM:="ArM",cFyH:="FyH",cAyC:="AyC",cRyD:="RyD",cTyH:="TyH",cBel:="Bel",cMed:="Med",cCla:="Cla",cOes:="Oes",cCri:="Cri",cTod:="Tod"

TEMPLATE PARAMS cAyS,cArM,cFyH,cAyC,cRyD,cTyH,cBel,cMed,cCla,cOes,cCri,cTod

<!DOCTYPE html>
<html lang="es">

<head>
  <meta charset="utf-8">
    <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />
    <meta name="viewport" content="width=device-width, initial-scale=0.8">
   
    <meta name="description" content="">
    <meta name="author" content="Adhemar Cuéllar R.">
    <meta name="copyright" content="AcrSoft System ©2022">
    <link rel="icon" href="images/MovieCenter.ico" type="image/x-icon">
    <link rel="shortcut icon" href="images/MovieCenter.ico" type="image/x-icon">
    <title>MovieCenter</title>

    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
   
</head>

<body>
    <div class="container">
      <center><b><h7>MOVIE CENTER La mejor opci&oacute;n para elegir que mirar</h7></b></center>
      <div align="center"><img src="cgi-bin/images/poster.jpg" width="200" height="250"></div>
         <center><b><h6>PEL&Iacute;CULAS</h6></b></center>
        <center>
           
        <a href="MuestraDatos.prg?<?prg return cAyS ?>">
            <img src="images/ays.jpg" width="90" height="60"></a>
        <a href="MuestraDatos.prg?<?prg return cArM ?>">
            <img src="images/arm.jpg" width="90" height="60"></a>
        <a href="MuestraDatos.prg?<?prg return cFyH ?>">
            <img src="images/fyh.jpg" width="90" height="60"></a>
        <a href="MuestraDatos.prg?<?prg return cAyC ?>">
            <img src="images/ayc.jpg" width="90" height="60"></a>
        <br>
   
        <a href="MuestraDatos.prg?<?prg return cAyS ?>">
            <button type="button" class="btn btn-sm btn-success">Acción <br> Suspenso</button></a>
                &nbsp;&nbsp;&nbsp;
        <a href="MuestraDatos.prg?<?prg return cArM ?>">
            <button type="button" class="btn btn-sm btn-success">Artes<br>Marciales</button></a>
        &nbsp;&nbsp;&nbsp;
        <a href="MuestraDatos.prg?<?prg return cFyH ?>">
            <button type="button" class="btn btn-sm btn-success">Ficci&oacute;n <br> H&eacute;roes</button></a>
            &nbsp;&nbsp;&nbsp
        <a href="MuestraDatos.prg?<?prg return cAyC ?>">
            <button type="button" class="btn btn-sm btn-success">Aventuras <br> Comedias</button></a>
        <br><br>   
       
        <a href="MuestraDatos.prg?<?prg return cRyD ?>">
            <img src="images/ryd.jpg" width="90" height="60"></a>
        <a href="MuestraDatos.prg?<?prg return cTyH ?>">
            <img src="images/tyh.jpg" width="90" height="60"></a>
        <a href="MuestraDatos.prg?<?prg return cBel ?>">
            <img src="images/bel.jpg" width="90" height="60"></a>
        <a href="MuestraDatos.prg?<?prg return cMed ?>">
            <img src="images/med.jpg" width="90" height="60"></a>
        <br>   
           
        <a href="MuestraDatos.prg?<?prg return cRyD ?>">
            <button type="button" class="btn btn-sm btn-success">Romance <br> Drama</button></a>
            &nbsp;&nbsp;&nbsp;&nbsp;
        <a href="MuestraDatos.prg?<?prg return cTyH ?>">
            <button type="button" class="btn btn-sm btn-success">Terror <br> Horror</button></a>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <a href="MuestraDatos.prg?<?prg return cBel ?>">
            <button type="button" class="btn btn-sm btn-success">B&eacute;licas <br> Guerra </button></a>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <a href="MuestraDatos.prg?<?prg return cMed ?>">
            <button type="button" class="btn btn-sm btn-success">Medieval <br> Ed.Media</button></a>
       
        <br><br>
        <a href="MuestraDatos.prg?<?prg return cCla ?>">
            <img src="images/cla.jpg" width="90" height="60"></a>
        <a href="MuestraDatos.prg?<?prg return cOes ?>">
        <img src="images/oes.jpg" width="90" height="60"></a>
        <a href="MuestraDatos.prg?<?prg return cCri ?>">
            <img src="images/cri.jpg" width="90" height="60"></a>
        <a href="MuestraDatos.prg?<?prg return cTod ?>">
            <img src="images/todas.jpg" width="90" height="60"></a>
        <br>

            <a href="MuestraDatos.prg?<?prg return cCla ?>">
            <button type="button" class="btn btn-sm btn-success">Cl&aacute;sicas</button></a>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <a href="MuestraDatos.prg?<?prg return cOes ?>">
            <button type="button" class="btn btn-sm btn-success">Oeste</button></a>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
         <a href="MuestraDatos.prg?<?prg return cCri ?>">
            <button type="button" class="btn btn-sm btn-success">Cristianas</button></a>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <a href="MuestraDatos.prg?<?prg return cTod ?>">
            <button type="button" class="btn btn-sm btn-success">Todas</button></a></center>
        <br>
         <center><b><h6></h6></b></center>     
        <br><br><br>
        <a href="https://adhemarcr.github.io/acrsoft/"> <img
                src="images/lAcrSoft.jpg" align="left"> <br>&nbsp; Soluciones Inform&aacute;ticas
            <br>&nbsp;Analista de Sistemas-FRELANCE</a>
        </div>
    </div>
</body>

</html>

ENDTEXT

return
 


Aquí el MuestraDatos.prg

Code: Select all  Expand view  RUN

#define PATH_DATA       HB_GetEnv( "PRGPATH" ) + '/data/'

REQUEST HB_CODEPAGE_ES850
REQUEST DBFCDX
REQUEST DBFFPT

Function Main()
  Local cAlias,aRows := {},cRows,cTit:="TODAS"

  If AP_Args()="AyS"
    cTit:="ACCIÓN - SUSPENSO"
  ElseIf AP_Args()="FyH"
    cTit:="FICCIÓN - HÉROES"
  ElseIf AP_Args()="ArM"
    cTit:="ARTES MARCIALES"
  ElseIf AP_Args()="AyC"
    cTit:="AVENTURA - COMEDIA"
  ElseIf AP_Args()="RyD"
    cTit:="ROMANCE - DRAMA"
  ElseIf AP_Args()="TyH"
    cTit:="TERROR - HORROR"
  ElseIf AP_Args()="Bel"
   cTit:="BÉLICAS - GUERRA"
  ElseIf AP_Args()="Med"
   cTit:="MEDIEVALES - EDAD MEDIA"
  ElseIf AP_Args()="Cla"
   cTit:="CLÁSICAS - ANTIGUAS"
  ElseIf AP_Args()="Oes"
   cTit:="OESTE - PISTOLEROS"
  ElseIf AP_Args()="Cri"
   cTit:="CRISTIANAS - RELIGIOSAS"
  ElseIf AP_Args()="Tod"
   cTit:="MUESTRA  TODAS"
  Endif
 
  USE (  PATH_DATA+'movies.dbf' ) SHARED NEW VIA 'DBFCDX'
  If AP_Args()="Tod"
    INDEX ON field->nombre TAG "nombre" FOR !Empty(field->ext) MEMORY      
  Else
    INDEX ON field->nombre TAG "nombre" FOR field->tipo=AP_Args() .and. !Empty(field->ext) MEMORY      
  Endif

  cAlias := Alias()
  Do While !Eof()
    Aadd( aRows,  { 'nombre'    =>  (cAlias)->nombre ,;
                             'duracion' => (cAlias)->duracion   ,;
                             'reparto'  => (cAlias)->reparto ,;                    
                             'nomchar'  => (cAlias)->nomchar    })
     (cAlias)->( dbskip() )
  EndDo
  USE  
  cRows:=hb_jsonencode(aRows)

  TEMPLATE PARAMS cRows,cTit

  <!DOCTYPE html>
  <html lang="es">
  <html>
    <head>
     <meta name="viewport" content="width=device-width, initial-scale=0.7">
     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
     <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
     <link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.18.3/dist/bootstrap-table.min.css">
     <script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
     <link rel="icon" href="images/admcon.ico" type="image/x-icon">
     <link rel="shortcut icon" href="admcon.ico" type="image/x-icon">
     <title>Movie Center</title>
     
     <div class="container">
       
             <center><b><h5>  <?prg return cTit ?> </h5></b></center>
           
       </div>
     <style>
        .fixed-height {
            height: 200px;
            overflow-y: auto;
        }
         thead {
                background-color: Grey;
                color: white;
            }
     </style>
   </head>
   <body>

     <div class="container ">  
          <div class="fixed-table-container fixed-height" style="height: 350px; padding-bottom: 35.5938px;">
            <table id="table" table-bordered data-toggle="table" data-show-footer="true" data-search="true">
                <thead>
                    <tr>
                        <th data-field="nombre"  data-footer-formatter="totalFormatter" data-sortable="true">NOMBRE</th>
                        <th data-field="duracion" data-footer-formatter="cuantosFormatter">DURA</th>
                        <th data-field="reparto" data-sortable="true" >REPARTO</th>
                        <th data-field="nomchar" </th>
                    </tr>
                </thead>
            </table>
          </div>  
    </div>
    <script>
        var picture = new Intl.NumberFormat('en-US');
       
        function totalFormatter() {
         return 'Totales '
        }
        function cuantosFormatter(data) {
        return picture.format(data.length)
        }
        var $table = $('#table')
        $(function() {
            var data =  <?prg return  cRows ?>
            $table.bootstrapTable({data: data})
            $table.bootstrapTable('hideColumn', 'nomchar')
        })
       
    </script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
    <script src="https://unpkg.com/bootstrap-table@1.18.3/dist/bootstrap-table.min.js"></script>
    <script src="https://unpkg.com/bootstrap-table@1.18.3/dist/extensions/print/bootstrap-table-print.min.js"></script>

   </body>
    <div class="container">
       <center><a href="javascript&#058; history.go(-1)">Volver</a></center>
         <br>
       <a href="https://adhemarcr.github.io/acrsoft/"> <img
            src="images/lAcrSoft.jpg" align="left"> <br>&nbsp; Soluciones Informáticas
            <br>&nbsp;&nbsp;Analista de Sistemas-FRELANCE</a>
           </div>
  </html>
ENDTEXT
Return
*
INIT PROCEDURE PrgInit
  HB_SetCodePage("ESWIN");HB_CDPSELECT("ESWIN")
  rddSetDefault( "DBFCDX" )
  SET CENTURY OFF
  SET EPOCH TO YEAR(DATE())-50
  SET DELETED ON
  SET EXCLUSIVE OFF
  SET DATE TO FREN
  SET( _SET_SOFTSEEK, .T. )
  EXTERN DESCEND
Return
 


También no muestra las imágenes

Muchas gracias por la ayuda
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1645
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Great news regarding mod_harbour CGI !!!

Postby Otto » Wed Nov 23, 2022 3:06 pm

Image


Adhemar, I installed your program.
What should I test?
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: Great news regarding mod_harbour CGI !!!

Postby Otto » Wed Nov 23, 2022 3:17 pm

Adhemar,
is this the error?

Best regards,
Otto

https://w ..........g/cgi-bin/adhemar/images/lAcrSoft.jpg


Server error!
The request cannot be answered because an internal error occurred in the server. The server is either overloaded or an error occurred in a CGI script.

If you think this is a server malfunction, please inform the webmaster about this.

Error 500

Apache/2.4.43 (Win64) OpenSSL/1.1.1b PHP/7.4.5
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: Great news regarding mod_harbour CGI !!!

Postby Antonio Linares » Wed Nov 23, 2022 3:22 pm

Estimado Adhemar,

Prueba a hacerlo asi:
http://localhost/muestradatos?tipo=AyS
<a href="MuestraDatos.prg?tipo=<?prg return cAyS ?>">
ó
<a href="MuestraDatos?tipo=<?prg return cAyS ?>">

Aquí funciona bien usando ese modo :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Great news regarding mod_harbour CGI !!!

Postby acuellar » Wed Nov 23, 2022 3:34 pm

Thanks dear Otto

please download the full project

https://drive.google.com/file/d/1d2efdcVllDHZAMHfVZyS-83oY5NTuW-y/view

Try
http://localhost/MovieCenter/main

Thanks for your help
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1645
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Great news regarding mod_harbour CGI !!!

Postby Otto » Wed Nov 23, 2022 4:29 pm

Dear Adhemar,
I have the same problem with images.

https://myserver.com/cgi-bin/moviecente ... poster.jpg

These errors out.
Here I think we need Antonio's help.
Best regards,
Otto
PS: Great APP!
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: Great news regarding mod_harbour CGI !!!

Postby Otto » Wed Nov 23, 2022 4:44 pm

Dear Adhemar,

what Antonio suggests for link is working fine for me:

Code: Select all  Expand view  RUN
<a href="muestradatos.prg?tipo=<?prg return cAyS ?>">
            <img src="images/ays.jpg" width="90" height="60"></a>
        <a href="muestradatos.prg?tipo=<?prg return cArM ?>">
            <img src="images/arm.jpg" width="90" height="60"></a>
        <a href="muestradatos.prg?tipo=<?prg return cFyH ?>">
            <img src="images/fyh.jpg" width="90" height="60"></a>
        <a href="muestradatos.prg?tipo=<?prg return cAyC ?>">
            <img src="images/ayc.jpg" width="90" height="60"></a>
        <br>


But JPG is not working.

Best regards,
Otto

PS: If you have some time, I will show you my patcher and preprocessor.
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: Great news regarding mod_harbour CGI !!!

Postby Otto » Wed Nov 23, 2022 4:58 pm

Dear Adhemar,
It is a very simple system but makes the source code much clearer.

It is similar to the Inklude files. But here I have a patcher that publishes the prg file.
Also included is a preprocessor.

Here we have for example |tipo| as placeholder. You can make as many placeholders as you want.


Write me if you are interested.
Best regards,
Otto



Image

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: Great news regarding mod_harbour CGI !!!

Postby acuellar » Wed Nov 23, 2022 5:30 pm

Estimado Antonio

De ésta manera abre Muestradatos.prg
Code: Select all  Expand view  RUN

<a href="MuestraDatos?tipo=<?prg return cAyS ?>">
 


En muestradatos AP_Args() ya no recibe la variable

Cómo tengo que preguntar?
AP_Args()="AyS" no pasa nada

Si coloco
tipo="AyS" dice no existe la variable tipo :(

Muchas gracias por la ayuda
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1645
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Great news regarding mod_harbour CGI !!!

Postby Otto » Wed Nov 23, 2022 5:49 pm

This should be:

Code: Select all  Expand view  RUN
<a href="MuestraDatos.prg?tipo=<?prg return cAyS ?>">
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: Great news regarding mod_harbour CGI !!!

Postby Antonio Linares » Wed Nov 23, 2022 6:16 pm

Prueba con este muestradatos.prg

Code: Select all  Expand view  RUN
function Main()

  ? AP_GetPairs()

return nil


salida:
{
"tipo": "AyS"
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Great news regarding mod_harbour CGI !!!

Postby Antonio Linares » Wed Nov 23, 2022 6:20 pm

acuellar wrote:Estimado Antonio

De ésta manera abre Muestradatos.prg
Code: Select all  Expand view  RUN

<a href="MuestraDatos?tipo=<?prg return cAyS ?>">
 


En muestradatos AP_Args() ya no recibe la variable

Cómo tengo que preguntar?
AP_Args()="AyS" no pasa nada

Si coloco
tipo="AyS" dice no existe la variable tipo :(

Muchas gracias por la ayuda


Revísalo o copialo aqui completo para ver donde tienes el error. Aqui AP_Args() devuelve esto:
muestradatos.prg&tipo=AyS

Luego tendrias que usar:
if "AyS" $ AP_Args()
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to mod_harbour

Who is online

Users browsing this forum: No registered users and 2 guests

cron