i need a good simple exmaple of a Backend CGI script for somthing im doing in school... so.. ya.. just an example.
i need a good simple exmaple of a Backend CGI script for somthing im doing in school... so.. ya.. just an example.
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 06:24 PM.
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, worldCode:#!/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; }The latter three must obviously be compiled/assembled and linked before use.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
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!
Are we doing kid's homework now? ROTF
{CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
Follow Me on Twitter: @InkingHubris
PHP Code:$result = mysql_query("SELECT finger FROM hand WHERE id=3");
echo $result;
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!
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 } {Freelance Copywriter} {Learn to Write}
Follow Me on Twitter: @InkingHubris
PHP Code:$result = mysql_query("SELECT finger FROM hand WHERE id=3");
echo $result;
Bookmarks