Results 1 to 6 of 6

Thread: Backend CGI script..

  1. #1
    Join Date
    Nov 2006
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Backend CGI script..

    i need a good simple exmaple of a Backend CGI script for somthing im doing in school... so.. ya.. just an example.

  2. #2
    Join Date
    Aug 2006
    Posts
    239
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    backend to what? and _in_ what? (executable? script? batch? perl? php?)
    Code:
     #!/bin/sh
    echo "Content-type: text/plain"
    echo
    echo "Hello World"
    Last edited by ItsMeOnly; 11-09-2006 at 05:24 PM.

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    CGI can be written in any language that supports stream output and execution via a shell. A few examples would include:
    Code:
    #!/usr/bin/env perl
    print "Content-Type: text/plain\r\n\r\nHello, world";
    Code:
    #!/usr/bin/env python
    print "Content-Type: text/plain\r\n\r\nHello, world"
    Code:
    #!/usr/bin/env php
    <?php header('Content-Type: text/plain'); ?>
    Hello, world
    Code:
    #!/usr/bin/env tclsh
    echo "Content-Type: text/plain\r\n\r\nHello, world"
    Code:
    int main(int argc, char **argv) {
      printf("Content-Type: text/plain\r\n\r\nHello, world");
      return 0;
    }
    Code:
    #include <iostream>
    
    int main(int argc, char **argv) {
      std::cout << "Content-Type: text/plain\r\n\r\nHello, world";
      return 0;
    }
    Code:
    section .data
      txt db "Content-Type: text/plain", 0xD, 0xA, 0xD, 0xA, "Hello, world"
      txtlen equ $ - txt
    
    section .text
      global _start
    _start:
      mov edx, txtlen
      mov ecx, txt
      mov ebx, 1
      mov eax, 4
      int 0x80
    
      mov ebx, 0
      mov eax, 1
      int 0x80
    The latter three must obviously be compiled/assembled and linked before use.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,486
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Are we doing kid's homework now? ROTF
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I presumed that the example was to help him/her, rather than being the whole assignment. Was I wrong?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,486
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    I don't know, just the feeling I got when I read the OP. Seen it a few times from tech schools, specially from first assignments or finals due.. they come in and want something "explained" to them, then they continue to ask questions like they don't get it until someone just comes and posts the whole thing, they then copy that and turn it in.

    Not saying that is what is happening here, just a feeling I got
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •