473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

CGI and moving servers

Has anyone got a few minutes to spare to help me with a page that wont load.
http://www.yachtcrew-cv.com/cgi-bin/cv/admin/signup.cgi

Evidently it is the pathway and CHMOD that's wrong but I tried changing it and it still wont load.

If you can help I will send you further info and maybe you can spot where the glitch is.

Thanks very much

Jen
Jun 13 '06 #1
4 3290
Banfa
9,065 Expert Mod 8TB
It could be an error in signup.cgi itself
Jun 13 '06 #2
Hi Banfa

Thanks so much for replying. The script has been working for three years. It's only moving it to the new server that it's started to give me grief.

If you don't mind looking at it I will post it here. If you could help I would be so grateful.

Thanks

Jen
Jun 13 '06 #3
Below is the cgi code where I can't get the page to load but first is the mail I get from the hosts. Please please tell me what to change. How do I change paths etc :confused:
------------------------
Your website's path to Perl is usr/bin/perl and this is only for files with the .pl file extension.
The path to your cgi bin is either:
/home/virtual/yourdomain.com/var/www/cgi-bin
but if that does not work then try:
/var/www/cgi-bin

----------------------------------
Here is the actual code :eek:


#!/usr/bin/perl

print "Content-type: text/html\n\n";

use CGI;

if ($ENV{'QUERY_STRING'} =~ /signup/){
&createsignup;
}
elsif ($ENV{'QUERY_STRING'} =~ /createaccount/){
&createsignup;
}
else{
&signup;
}

sub createsignup{
$cgi = new CGI;

$username = $cgi->param('username');
$password = $cgi->param('password');
$password2 = $cgi->param('password2');
$emailaddress = $cgi->param('emailaddress');

if (!$username){
$diemessage = "You have not entered a username.";
&signup;
exit;
}
if (!$password){
$diemessage = "You have not entered a password.";
&signup;
exit;
}
if ($password ne $password2){
$diemessage = "The two password you have entered are invalid.";
&signup;
exit;
}
if (!$emailaddress){
$diemessage = "You have not entered your email address.";
&signup;
exit;
}
if ($username !~ /^[a-zA-Z0-9_]+$/){
$diemessage = "You have entered an invalid username.";
&signup;
exit;
}
if ($password !~ /^[a-zA-Z0-9_]+$/){
$diemessage = "You have entered an invalid password.";
&signup;
exit;
}

if (length($username) > 10 || length($username) < 4){
$diemessage = "The username you have entered is either too long or too short.";
&signup;
exit;
}
if (length($password) > 10 || length($password) < 4){
$diemessage = "The password you have entered is either too long or too short.";
&signup;
exit;
}
if (-e "../profiles/$username.pro"){
$diemessage = "The username you have selected already exists within the database.";
&signup;
exit;
}

mkdir("../cv/$username", 0777);
mkdir("../../../public_html/cv/$username", 0777);

open(SEND,"|/usr/sbin/sendmail -t");
print SEND "To: $emailaddress\n";
print SEND "From: merlin2066\@yahoo.com\n";
print SEND "Subject: CV Account Signup Successful\n";
print SEND <<endMAIL;

Hi,

Services to the Superyacht industry
endMAIL
close(SEND);

$password = crypt($password, "MM");

#create the profile
open(PRO,">../profiles/$username.pro");
flock(PRO,2);
print PRO "$username\n";
print PRO "$password\n";
print PRO "$emailaddress\n";
print PRO "$ENV{'REMOTE_ADDR'}\n";
flock(PRO,8);
close(PRO);

@html = htmlscope('../html/confirm.htm');
print "@html";
exit;
}

sub signup{
if ($diemessage eq ""){
$diemessage = "Please enter the fields below to create a membership account.";
}

@html = htmlscope('../html/signup.htm');
print "@html";
exit;
}

sub htmlscope{
$filename = shift;

open(HTML,"<$filename");
@html = <HTML>;
close(HTML);

foreach $line (@html){
if ($line =~ /\$/g || $line =~ /\@/){
@letters = split(/|/, $line);
$inside = 0;
foreach $letter (@letters){
chomp($letter);
if (!($letter =~ /^[a-zA-Z0-9_\{\}\']+$/)){
$inside = 0;
}
if ($inside == 1){
$string .= $letter;
}
else{
if ($letter =~ /\$/ || $letter =~ /\@/){
if ($string =~ /\$/g || $string =~ /\@/g){
$string .= "\n$letter";
}
else{
$string .= $letter;
}
$inside = 1;
}
}
}
if ($string =~ /\n/g){
@multivars = split(/\n/, $string);
foreach $var (@multivars){
push(@variables, $var);
}
}
push(@variables, $string);
foreach $var (@variables){
chomp($var);
if ($var =~ /\$/g){
$var =~ s/\$//gi;
$line =~ s/\$$var/$$var/gi;
}
else{
$var =~ s/\@//gi;
$line =~ s/\@$var/@$var/gi;
}
}
$found = 0;
$string = "";
}
}

return @html;
}
Jun 13 '06 #4
Banfa
9,065 Expert Mod 8TB
OK Perl really is my bag so I've had to read up about it but here are a couple of things to try

------------------------
Your website's path to Perl is usr/bin/perl and this is only for files with the .pl file extension.
The path to your cgi bin is either:
/home/virtual/yourdomain.com/var/www/cgi-bin
but if that does not work then try:
/var/www/cgi-bin

----------------------------------
Here is the actual code :eek:


#!/usr/bin/perl
The path in the email has no / at the beginning of it but you have a / at the beginning of the shbang.

Try the simplest script you can to test the shbang line

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl 
  2.  
  3. print "Content-type: text/html\n\n";
  4.  
  5. print "<html><head><title>Test</title></head><body><p>Hello World!</p></body></html>";
  6.  
It this works great, if not get help from your host.

If this does work then I would guess you need to look to the paths in your script to see if they are correct.

Test the function htmlscope but creating a script that contains only this function and a call to it.

You have several relative paths in the scripts (when open files and creating directories, paths including .. ), try replacing them with absolute paths.


The script is long and a little complex so you need to simplify it while you find the problem, once you have found it you can then correct the original script.
Jun 14 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: GuyInTn | last post by:
Hi all, I have been given the task of moving an sql database from one server to another. These servers are not on the same network. I know I can detach the database, copy it to a new location,...
0
by: Mirko Slavko | last post by:
Hi, I have to move two MS SQL 2000 servers from Win 2000 Domain to Windows NT 4.0 domain. This servers have transactional replication set between on one database. Does anyone have detailed...
4
by: LaSalamandra | last post by:
have a dedicated web server with Win2000 and CF MX Server. I always used ACCESS databases. Now, I bought a space under a MS SQL Server and I'm moving all my databases there. Today I moved my...
1
by: Nirbho | last post by:
Hi, I've got a c#.net web app that uses SQl Server 2000. It all works very well on my Development PC, but now I've got to install the app onto some real servers. I have 3 servers: 2 for the web...
3
by: MartyNg | last post by:
I have been looking online for pointers, and read mixed things. I was hoping if I post direct questions here, I could get some solid answers. I work for a small company with less than 10 web...
2
by: Paul Wagstaff | last post by:
Hi all Our organisation is moving form Win NT / full version of Acc 97 to Win XP / run-time version of Acc 03 (as part of Office 03) for the users. We have heaps of mdbs on the servers - some...
8
by: rick | last post by:
Hi I m trying to move only stored procedures from one database to another and also onto a database on another server, I tried db2 -x "select text from syscat.procedures where procschema =...
26
by: Bookham Measures | last post by:
Hello We are planning to set-up a load balanced web environment. Accordingly, we are going to change the session management on our website from the classic ASP Session State and session...
224
by: Jon Slaughter | last post by:
Sorry for all the cross posting but I'm interesting in getting a serious discussion about how usenet has become lately. Many people are moving away from usenet because of all the spam and cooks...
1
by: gar598 | last post by:
I don't have much experience moving these types of site, but we're changing sites, and I've been asked to move the site to a new server. It's your typical setup Windows server, ASP.Net 2.0., a few...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.