Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,

I have a CodeIgniter project it works fine when I use it on localhost (XAMPP) but when I run it online and submit the form below it gives me You don't have permission to access this resource.

Form is:

PHP
<form method="post" action="<?=site_url('quizsubmitted') ?>">
             <div class="card-body">
               <table id="example1" class="table table-bordered table-striped">
                   <thead>
                       <tr>
                           <th colspan="4" style="text-align: right;"><h4 id="time"><?=$qrow['duration'];?></h4></th>
                           <input type="hidden" name="quizid" value="<?=$qrow['quizid']; ?>">
                       </tr>
                   </thead>
                   <tbody>
                       <input type="hidden" name="studentid" value="<?=$studentid; ?>">
               <?php
               $i = 1;
                foreach($rows as $row) { ?>
                <tr>
                   <td colspan="4" ><label class="text-dark"> <?=$i; ?>. <?=$row['question'] ?></label></td>
                   <!-- <input type="hidden" name="qid[]" value="< ?=$row['qid']; ?>"> -->
                   <input type="hidden" name="question[<?=$i; ?>]" value="<?=$row['question'] ?>">
                </tr>
                   <tr>
                   <td>
                       <input type="radio" value="<?=$row['answer1'] ?>" class="form-check-input" name="answer[<?=$i; ?>]" id="answer1[<?=$i; ?>]">
                       <label class="form-check-label"><?=$row['answer1'] ?></label>
                   </td>
                       <td>
                       <input type="radio" value="<?=$row['answer2'] ?>" class="form-check-input" name="answer[<?=$i; ?>]" id="answer2[<?=$i; ?>]">
                       <label class="form-check-label"><?=$row['answer2'] ?></label>
                   </td>
                       <td>
                       <input type="radio" value="<?=$row['answer3'] ?>" class="form-check-input" name="answer[<?=$i; ?>]" id="answer3[<?=$i; ?>]">
                       <label class="form-check-label"><?=$row['answer3'] ?></label>
                   </td>
                       <td>
                       <input type="radio" value="<?=$row['answer4'] ?>" class="form-check-input" name="answer[<?=$i; ?>]" id="answer4[<?=$i; ?>]">
                       <label class="form-check-label"><?=$row['answer4'] ?></label>
                       <input type="hidden" name="correct[<?=$i; ?>]" value="<?=$row['correct'] ?>">
                   </td>
                </tr>
               <?php $i++; } ?>
                   </tbody>
               </table>
             </div>
             <div class="card-footer">
                 <button type="submit" class="btn btn-primary">Submit</button>
               </div>
             </form>


App.php

PHP
public string $baseURL = 'https://onlinequiz.ansicollege.net/';


   public array $allowedHostnames = [];


   public string $indexPage = '';

   public string $uriProtocol = 'REQUEST_URI';



Please help.

What I have tried:

htaccess is like below:

XML
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Posted

1 solution

I think it may be because some directories in your server, apache or www user lack permissions.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900