Link to home
Start Free TrialLog in
Avatar of innovator
innovator

asked on

Small and silly code! :)

Hi...

I want someoen to write a very small code for me!

I just need it to work that way :)


well, the script name is code.cgi

when anyone clicks on http://www.MY-Website.com/code.cgi he/she will be redirected into another page on the same site....

now, i KNOW that there are many ways to redirect visitors from one page to another on my domain... but as i said, i need it to be done through a   .cgi file  (perl code)  :)

One more thing!

If someone clicks on
http://www.MY-Website.com/code.cgi?5545   or
http://www.MY-Website.com/code.cgi?ABCD   or
http://www.MY-Website.com/code.cgi?ANYTHING 

they ALL will be directed to the same page (that is mentioned within the code)

did you get it?  if i put ?XYZ  (or anything) after the code.cgi ... it still forwards visitor to the same page with no changes..

Well, hope this code will be easy engough for someone to write it!.

Thanks,


Sarah
Avatar of innovator
innovator

ASKER

you can post the code here os send it to sarah_mark_1999@usa.net
ASKER CERTIFIED SOLUTION
Avatar of shirjeel
shirjeel

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
  #! /usr/bin/perl -w

   print "Location: /~interiot/\n\n";


Or...  print "Location: http://google.com/\n\n"; or whatever.
what programming language do you wish to use?


Bob
interiot has already provided you with a perl solution.
Shell:
     #! /bin/sh

     echo "Location: /~interiot/"
     echo ""


C:
     #include <stdio.h>
     int main() {
          printf("Location: /~interiot/\n\n");
     }

Awk:
       #! /bin/awk BEGIN{printf("Location: /~interiot/\n\n")}



The string sent to a script after the question mark is sent via an environment variable.  Solutions posted here will likely simply ignore its contents and always print out the same redirection command.
shirjeel ... thanks for your code! you was the first one to email me the perl code!  and it worked fine :)

bebonham & interiot  thanks to both of you but shirjeel replyed faster ...

Thanks to all of you :)


Sarah
shirjeel, why did you not post the code?
Without the solution posted, this thread does not contain a solution and becomes a worthless PAQ.  Therefore, if the solution is not posted. I will remove the points for it.  Points can only be awarded for questions that are solved on the site and put into the PAQ.

Shirjeel,

You will need to post the solution, or I will have to remove the point award.

Inovator,

In the future please do not encourage experts to supply solutions by email.  It is clearly against site policy and goes against community interests.

I'll continue to monitor this question, and if the code is not posted, The points will be removed.

teacher_mod
Community Support Moderator
Experts-Exchange
teacher_mod@experts-exchange.com
ok man i will provide the solution that i mailed her ok

dont be angry ok

i will post the result

ok bye for now.

This is the code that i sent her



use CGI;
$query = new CGI;
print $query->redirect('http://www.My_website.com');

ok bye for now.
like

print "O";
print "h";
print " ";
print "W";
print "o";
print "w";
print "\n";

I'm impressed
certainly the best answer.
shirjeel,

I don't think anyone expressed anger. Certainly no one inteded to be offensive. There was just a request for the solution to be posted, which you have done.

Thanks,

teacher_mod
Community Support Moderator
Experts-Exchange
teacher_mod@experts-exchange.com