Welcome Guest, Not a member yet? Register   Sign In
Peculiar problem with session->set_flashdata
#1

[eluser]foysal[/eluser]
Hi all

I am facing a peculiar problem with session->set_flashdata.


below is the code of my contoller

Code:
if ($data_from_database->num_rows() > 0)
                                {
                                  $session_data = array('username'=> $username, 'logged_in'=> TRUE );
                                  $this->session->set_userdata($session_data);
                                                
                                  redirect('login/show_calender');
                                }
                              else
                                {
                                  $this->session->set_flashdata('message', 'Oopsie, it seems your username or password is incorrect, please try again.');
                                  redirect('login/log');
                                }


my view as like below

Code:
<div class="error1">&lt;?php $this->session->flashdata('message'); ?&gt;</div>

       <table id="tble">
        &lt;?php  echo form_open('login/logpro') ?&gt;

        <tr><td class ="td_right"><b>&lt;?php echo form_label('Username', 'username') ?&gt;</b></td>  <td>&lt;?php echo form_input('username',set_value('username')) ?&gt;</td><td>&lt;?php echo form_error('username')?&gt;</td></tr>

        <tr><td class ="td_right"><b>&lt;?php echo form_label('Password', 'password') ?&gt;</b></td>  <td>&lt;?php echo form_password('password',set_value('password')) ?&gt;</td><td>&lt;?php echo form_error('password')?&gt;</td></tr>

        <tr></tr>
        <tr></tr>
        <tr></tr>

        <tr><td colspan=3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php echo form_submit('submit','Login') ?&gt;&nbsp;&nbsp;&lt;input type="reset" value="Reset"  /&gt;&lt;/td></tr>

        &lt;?php echo form_close() ?&gt;
      </table>


When I put this controller and view in a folder named CodeIgniter and try to see the output at http://localhost/CodeIgniter/index.php/login/log , it is working fine but if I rename the folder name as CodeIgniter1 or copy whole code in a folder named CodeIgniter1 and try to see the output at http://localhost/CodeIgniter1/index.php/login/log , it is not working. This problem also arises if I change computer.


Can any one say where is the problem, what is the solution??


Foysal
#2

[eluser]WanWizard[/eluser]
Controllers go into application/controllers. In your setup, 'CodeIgniter' is a folder in your webservers docroot that contains the entire CI installation.
So what have you exactly done? Because that foldername is not relevant to your CI installation. And since you're using index.php in your URL, rewriting shouldn't be an issue here.
#3

[eluser]foysal[/eluser]
Dear WanWizard

Your words are not so clear to me.


-- Controllers go into application/controllers.

yes, I put my codes of controller into application/controllers folder.


-- In your setup, ‘CodeIgniter’ is a folder in your webservers docroot that contains the entire CI installation.


yes, You understand .



-- And since you’re using index.php in your URL, rewriting shouldn’t be an issue here.


My problem is the code works well CodeIgniter folder but if I change the folder nama to CodeIgniter1 it does not work, that means flashdata is not showing.


Thanks for reply .



Foysal
#4

[eluser]osci[/eluser]
In case you have set $config['base_url'] in config.php check if it has correct entry
#5

[eluser]InsiteFX[/eluser]
If you look in the index.php file you will see that you have to set the the
system_folder and application folders so that CodeIgniter knows were they are!

InsiteFX
#6

[eluser]foysal[/eluser]
My problem is in the below line of view.

<div class="error1">&lt;?php $this->session->flashdata('message'); ?&gt;</div>


If I use folder name CodeIgniter it is working and I get a message. but if I use folder name CodeIgniter1 then it is not working , I can not see any message.


Even if I change computer and copy the CodeIgniter folder to another computers' web root (htdocs) then it is not working also.


It is absolutely Peculiar problem.


Thanks all for reply.


Foysal
#7

[eluser]InsiteFX[/eluser]
Show us a directory listing of how you have it setup!

InsiteFX
#8

[eluser]Unknown[/eluser]
Hi Foysal

I know it has been 2 years since you originally posted this topic, but I have a similar problem and was wondering if you figured out what your problem was.

Any advice you can share would be much appreciated!

Thanks
Bianca
#9

[eluser]jairoh_[/eluser]
because u did not change the base_url sir Big Grin




Theme © iAndrew 2016 - Forum software by © MyBB