coranto.cgi forbidden

Is Coranto not working properly for you? Here's where to ask for support help; for best results, follow these steps:
  • - Check your core/addon documentation for possible solutions
  • - Search these forums for similar problems that have already been solved
  • - If you're still stumped, check out THIS TOPIC, and post your question in this forum!!

Moderators: Spunkmeyer, Dale Ray, SrNupsen, Bluetooth, Jackanape

coranto.cgi forbidden

Postby Dissident » Mon Feb 19, 2007 12:37 am

I'm receiving the following error:

Forbidden
You don't have permission to access /coranto/coranto.cgi on this server.


when I add the following php code to my default news style and attempt to save the changes:

if (!$file_handle = fopen($lines,"a")) { echo "Cannot open file"; }
fclose($file_handle);



Anyone know why I might be getting this error?
Dissident
 
Posts: 24
Joined: Thu Jan 11, 2007 6:16 am
Location: Brisbane, Australia

Postby SrNupsen » Mon Feb 19, 2007 7:58 am

What are the permissions (chmod) on the cgi-bin directory? What are the permissions on the file coranto.cgi?
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby Dissident » Mon Feb 19, 2007 9:09 am

Both 755.
Dissident
 
Posts: 24
Joined: Thu Jan 11, 2007 6:16 am
Location: Brisbane, Australia

Postby SrNupsen » Mon Feb 19, 2007 11:06 am

And you can access coranto.cgi normally on other cases, the problem occurs only when you try to save a style containing thye code you mentioned?
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby Dissident » Tue Feb 20, 2007 3:47 am

Yes thats right. Coranto (v1.24b) works perfectly until I add those specific two lines of code.
Dissident
 
Posts: 24
Joined: Thu Jan 11, 2007 6:16 am
Location: Brisbane, Australia

Postby SrNupsen » Tue Feb 20, 2007 2:51 pm

I'm no PHP expert, but it seems that code tries to close a file handle even if it isn't open. How about this:

Code: Select all
if (!$file_handle = fopen($lines,"a")) {
echo "Cannot open file";
} else {
fclose($file_handle);
}
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby SrNupsen » Tue Feb 20, 2007 2:53 pm

Oh, and ofcourse: If you want to use PHP code in your style, you have to:

a) Make sure that the profile using that style generates a file with .php extension
b) Enclose your PHP code in the <?php and ?> tags


If you experience further trouble could you please post your whole default news style?
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby Dissident » Tue Feb 20, 2007 10:38 pm

Hi SrNupsen,

The code does both these things. Those two lines are some php that I added, which caused the error. The news style contains other php code which has been working fine for some time. If it helps, the full news style is:

<If: Field: CustomField_Filename>
<table width="100%"><tr><td>
<?php
$num_positions = <Field: CustomField_Signups>; //Specify the number of positions for the trial
$lines = file ('http://www.rewardsforresearch.com/db/<Field: CustomField_Filename>.xls'); // Specify the trial participant excel file
$num_lines = count ($lines);
if (!$file_handle = fopen($lines,"a")) { echo "Cannot open file"; }
fclose($file_handle);
if ( $num_lines > $num_positions ) {
echo "Sorry, this trial is now full. <br />";}
else { include "http://www.rewardsforresearch.com/signupform.txt" ;}
?>
</td><td align="right"><A HREF="/content/viewnews.cgi?id=<Field: newsid>&SM_Profile=tellfriend">Tell A Friend About This Trial</A></td></tr></table>
<If: Else>
<div align="right"><A HREF="/content/viewnews.cgi?id=<Field: newsid>&SM_Profile=tellfriend">Tell A Friend About This</A></div>
</If>
</div>

Also, the news page is at http://www.rewardsforresearch.com/corantotest2.php

Thanks for your help so far.
Dissident
 
Posts: 24
Joined: Thu Jan 11, 2007 6:16 am
Location: Brisbane, Australia

Postby SrNupsen » Tue Feb 20, 2007 11:07 pm

Sorry, this is above my head I'm afraid. Somebody else? Hope you get it sorted out.
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby Dissident » Thu Feb 22, 2007 8:49 am

Thanks very much for your help SrNupsen.

Does anyone else have any idea why those 2 lines of php code is causing the forbidden error with coranto.cgi?
Dissident
 
Posts: 24
Joined: Thu Jan 11, 2007 6:16 am
Location: Brisbane, Australia

Postby SrNupsen » Thu Feb 22, 2007 11:33 am

... but am I wrong in thinking that the second line you inserted attempts to close the file even if the first line fails to open it?
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway


Return to Troubleshooting

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron