Results 1 to 5 of 5

Thread: Help with php on windows nt server

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523

    Help with php on windows nt server

    Why would this code not work with my windows host? (It works under unix/linux). The error I'm getting is :"HTTP 405 - Resource not allowed"

    Thanks
    Q

    PHP Code:
    <html>
    <body bgcolor=#339999>
    <font face=Verdana size=2>
    <title>Poll Admin Page</title>
    <head>
    <script langauge="javascript">
    <!--
        function selectText() {
            document.res.S1.select()
        }
        
        function validate() {
            valid = true;
            if (document.frm.S1.value == "") {
                alert("Enter Question")
                valid = false
            }
            else if (document.frm.T1.value =="" || parseInt(document.frm.T1.value)<1 || parseInt(document.frm.T1.value)>10) {
                alert("enter number of answers (1-10)")
                valid = false
            }
            else {
                document.frm.Answers.value = ""
                for (i=0; i<(parseInt(document.frm.T1.value)); i++) {
                    if (document.frm.ans[i].value == "") {
                        alert('Answer ' + (i+1) + ' cannot be empty')
                        valid = false
                        break;
                    }
                    document.frm.Answers.value += document.frm.ans[i].value + '|||'
                }
            }

            if (valid == true) {
                html = '<!-- POLL START -->\n<script language="javascript">\n<!--\nfunction popUpPoll() {\n'
                html = html + 'var newWindow = window.open("poll/results.php","pollresultspopup","width=550,height=300,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=no,screenX=10,screenY=10,top=10,left=10")\n'
                html = html + 'newWindow.location.href = "poll/results.php"\n}\n//-->\n</scrip'
                html = html + 't>\n'
                html = html + '\n'
                html = html + '<table width="200" cellpadding="5" cellspacing="0" border="1">\n'
                html = html + '<!--Question Start -->\n<form name="Poll" method="Post" action="poll/results.php" target="pollresultspopup">\n'
                html = html + '\n<font color="#ffffff">\n<tr>\n<td width="200" bgcolor="#006666" colspan="2" style="border-style: solid; border-width:1; text-align:left" valign="top">'
                html = html + '\n<p style="margin-top:0; margin-bottom:0"><font face="Arial" color="#ffffff" size="2">'
                html = html + document.frm.S1.value + '<br></font></p>\n</td>\n</tr>\n</font>\n\n'
                html = html + '<font face="Arial" color="#999999" size="2">\n<!-- /End Question -->\n'
                for(i=1;i<=(parseInt(document.frm.T1.value));i++) {
                    html = html + '<!-- Answer ' + i + ' -->\n<tr>\n'
                    html = html + '<td width="214" style="border-left-style:solid; border-left-width:1; border-right-style:none; border-right-width:medium; border-bottom-style:none; border-bottom-width:medium; border-top-style:none">'
                    html = html + '\n<font face="Arial" size="2" color="#000000">' + document.frm.ans[i-1].value + '</font></td>\n'
                    html = html + '<td width="92" style="border-left-style:none; border-left-width:medium; border-right-style:solid; border-right-width:1; border-bottom-style:none; border-bottom-width:medium; border-top-style:none">\n'
                    html = html + '<input type="radio" name="Answer" value="' + i + '"></td>\n</tr>\n<!-- /End Answer ' + i + ' -->\n'
                }
                html = html + '<tr>\n<td width="214" style="border-left-style:solid; border-left-width:1; border-right-style:none; border-top-style:none; border-bottom-style:solid; border-bottom-width:1">\n'
                html = html + '<a href="javascript:popUpPoll()"><font face="Arial" size="2" color="#000080">See the results</font></a>\n'
                html = html + '<td width="92" style="border-left-style:none; border-right-style:solid; border-right-width:1; border-top-style:none; border-bottom-style:solid; border-bottom-width:1">'
                html = html + '\n<input type="submit" value="Vote" onClick="javascript:popUpPoll()"></font></td>\n</tr>\n</form>\n</table>\n<!-- POLL END -->'
                
                document.res.S1.value = html
                document.res.S1.select()
            }    
        }
    //-->
    </script>
    </head>

    <body>
    <?
    if(isset($S1)) {
    include("poll.ini");

    $PollDataFile1 = file($PollDataFile);
    $PollQuestion = $PollDataFile1[0];
    $PollNumbers = explode($PollDataString, chop($PollDataFile1[1]));

    if(isset($auto)) {
        if($auto==1)
            copy("$PollDataFile","$OldDataFolder/$PollNumbers[0]$PollDataFile");
    }

    $num = $PollNumbers[0] + 1;
    $ans = explode($PollDataString, chop($Answers));
            //Update Poll Data
            $FileToUpdate = $BasePath.$PollDataFile;
            $file = fopen($FileToUpdate,"w+"); 
            fwrite($file, $S1);
            fwrite($file, "\n");
            fwrite($file, "$num|||$T1");
            fwrite($file, "\n");
            for ($i = 0; $i < $T1; $i++) {
                if ($i == ($T1 - 1))
                    fwrite($file, "$ans[$i]");
                else
                    fwrite($file, "$ans[$i]|||");
            }
            fwrite($file, "\n");
            for ($i = 0; $i < $T1; $i++) {
                if ($i == ($T1 - 1))
                    fwrite($file, "0");
                else
                    fwrite($file, "0|||");
            }
            fwrite($file,"\n");
            fwrite($file,$Add);
            fclose($file);
        echo("New poll has been created. Paste the generated HTML code where you want the poll to appear\n");
        echo ("You may close this window now");
    }
    ?>
    <form name="frm" method="post" onSubmit="return true" action="poll/pollAdmin.php">
      <b>Question:</b><p></p>
      <p><b><textarea rows="5" name="S1" cols="31"></textarea></b></p>
      <p><b>Number of Answers (max 10): <input type="text" name="T1" size="28"></b></p>
      <hr>
      <p><b>Answer 1 <input type="text" name="ans" size="20">&nbsp;&nbsp; Answer 2
      <input type="text" name="ans" size="20">&nbsp;&nbsp; Answer 3
      <input type="text" name="ans" size="20"></b></p>
      <p><b>Answer 4 <input type="text" name="ans" size="20">&nbsp;&nbsp; Answer 5
      <input type="text" name="ans" size="20">&nbsp;&nbsp; Answer 6
      <input type="text" name="ans" size="20"></b></p>
      <p><b>Answer 7 <input type="text" name="ans" size="20">&nbsp;&nbsp; Answer 8
      <input type="text" name="ans" size="20">&nbsp;&nbsp; Answer 9
      <input type="text" name="ans" size="20"></b></p>
      <p><b>Answer 10 <input type="text" name="ans" size="20"></b></p>
      <input type="hidden" name="Answers">
      <hr>
      <p><b>Additional information</b><textarea rows="5" name="Add" cols="31"></TEXTAREA></p>
      <p><b>AutoSave old Poll's Data? <input type="radio" name="auto" value="1" checked> Yes&nbsp;
      <input type="radio" value="2" name="auto"> No</b></p>
      First <input type="button" value="Generate Poll's HTML code" name="B3" onClick="validate()"> and copy it to clipboard.
      Then <input type="Submit" value="Create Poll" name="B1">&nbsp;&nbsp; <input type="reset" value="Reset" name="B2"><p>
      </p>
    </form>

    <form name="res">
      <textarea rows="28" name="S1" cols="79"></textarea></p>
      <input type="button" value="Select All" name="B1" onClick="selectText()"></p>
    </form>
    </body>

    </html>

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Do simpler scripts work? And what file extension are you using and how is that mapped on the server?
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523
    problem solved. My (ex)$150/month webhosting company doesn't support PHP
    Thanks for a hint

  4. #4
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Well, the stable version of PHP runs as CGI under NT, so I would see why they wouldn't put it on.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  5. #5
    scoutt
    Guest
    Originally posted by QWERTY
    problem solved. My (ex)$150/month webhosting company doesn't support PHP
    Thanks for a hint
    $150 month and doesn't support PHP, with that kind of money they should be wiping your arse

Posting Permissions

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



Click Here to Expand Forum to Full Width