Part of the EllisLab Network
   
2 of 2
2
session problem
Posted: 21 December 2009 12:31 AM   [ Ignore ]   [ # 16 ]  
Grad Student
Avatar
Rank
Total Posts:  87
Joined  11-12-2009

Sorry for the wrong response, i found out that it is not necessary to set

$data = array
(   
  ‘session_id’  => random hash,
  ‘ip_address’  => ‘string - user IP address’,
  ‘user_agent’  => ‘string - user agent data’,
  ‘last_activity’ => timestamp
);
$this->session->set_userdata($data);

...

With your password remembering problem? are you using firefox? maybe you have set to remember password with
your browser. please disable remember password. does password remembering happen in IE?

 Signature 

tourdavao.com

Profile
 
 
Posted: 21 December 2009 12:46 AM   [ Ignore ]   [ # 17 ]  
Grad Student
Rank
Total Posts:  40
Joined  12-06-2009

IE does not remember any password.. so i guess i just did remember it in firefox.. that solves the problem..

since your active right now, i got other question.
1. how am i going to prevent php script from calling direct from the browser?

what happens here is that i got some ajax that calls the script but i don’t wan’t that script to be call direct in the browser..

hope your getting what i have in mind.. ^_^

Profile
 
 
Posted: 21 December 2009 01:15 AM   [ Ignore ]   [ # 18 ]  
Grad Student
Rank
Total Posts:  40
Joined  12-06-2009

or, if i put that script in model folder should that protect it? does that prevent from calling direct from the browser?

Profile
 
 
Posted: 21 December 2009 01:31 AM   [ Ignore ]   [ # 19 ]  
Grad Student
Avatar
Rank
Total Posts:  87
Joined  11-12-2009

@paulon

It is a hard problem to discuss it here. but i’ll try to explain it.
if your are in your main.php (main.php is a controller) and you are trying to call processor.php (processor.php is a controller) here is the sample code in jquery.

$(document).ready(function(){

 
$(function(){
    
$(".submit-btn").click(function(){
      
$.post('index.php?c=processor'//or $.post('index.php/processor'
        //list of post variable follows
        
samplevar      'addrequisition',
        
samplevar2     : $("[name=username]").val()
        
//...more variable
      
},function(data){
        alert(data)
//display the echo from processor.php
                     //If you echo "hello world" in processor.php
                     //and after calling ajax then hello world alerted
                     //it means that you requested the processor.php successfully
                     //note: data variable holds the values echoed from processor.php
      
});
 
});

})

note: main.php includes the jquery and other javascript.

 Signature 

tourdavao.com

Profile
 
 
Posted: 21 December 2009 01:39 AM   [ Ignore ]   [ # 20 ]  
Grad Student
Avatar
Rank
Total Posts:  87
Joined  11-12-2009

it seems above that you will be redirected to index.php/processor (index.php?c=controller),
but not. It will be requested on the fly - it will be executed without reloading the page.

 Signature 

tourdavao.com

Profile
 
 
Posted: 21 December 2009 02:10 AM   [ Ignore ]   [ # 21 ]  
Grad Student
Rank
Total Posts:  40
Joined  12-06-2009
$(document).ready(function(){

 
$(function(){
    
$(".submit-btn").click(function(){
      
$.post('index.php?c=processor'//or $.post('index.php/processor'
        //list of post variable follows
        
samplevar      'addrequisition',
        
samplevar2     : $("[name=username]").val()
        
//...more variable
      
},function(data){
        alert(data)
//display the echo from processor.php
                     //If you echo "hello world" in processor.php
                     //and after calling ajax then hello world alerted
                     //it means that you requested the processor.php successfully
                     //note: data variable holds the values echoed from processor.php
      
});
 
});

})

so you where just saying that i just need to pass another variable to to processor.php?

//processor.php

if(!define($_POST['samplevar'])){
  
die('no direct access allowed');
}else{
  
echo 'hello world';
Profile
 
 
Posted: 21 December 2009 02:43 AM   [ Ignore ]   [ # 22 ]  
Grad Student
Rank
Total Posts:  40
Joined  12-06-2009

nice it fixed my problem regarding direct access to scripts

//javascript
var obj {
get_user_online
: function(){
   
var url="<?=base_url()?>index.php/generals/getuseronline";
   $.
post(url,{isAllowed:1},
      function(
data){
         document
.getElementById("divuserlist")[removed] data;
      
});        
}

that calls in

//php script
function getuseronline(){    
   
if($_POST['isAllowed']>0){        
      $strReturn 
'Hello world';
   
}else{
      $strReturn 
'No direct access allowed';
   
}
echo $strReturn;

so when ever the link type in directly into the browser “http://localhost/CI/index.php/generals/getonlineuser”
it returns a “No direct access allowed’

Profile
 
 
Posted: 21 December 2009 03:02 AM   [ Ignore ]   [ # 23 ]  
Grad Student
Avatar
Rank
Total Posts:  87
Joined  11-12-2009

@paulon did it solve the problem?

 Signature 

tourdavao.com

Profile
 
 
Posted: 21 December 2009 03:05 AM   [ Ignore ]   [ # 24 ]  
Grad Student
Rank
Total Posts:  40
Joined  12-06-2009

@CI_avatar

yes, it resolves the problem.. +1 to you CI_avatar..
tongue laugh

Profile
 
 
Posted: 21 December 2009 03:10 AM   [ Ignore ]   [ # 25 ]  
Grad Student
Avatar
Rank
Total Posts:  87
Joined  11-12-2009

You’re welcome Pau.
later…

Kitakits next time.

 Signature 

tourdavao.com

Profile
 
 
Posted: 21 December 2009 03:20 AM   [ Ignore ]   [ # 26 ]  
Grad Student
Rank
Total Posts:  40
Joined  12-06-2009

sure makati area ako.. tnx and merry xmas..

Profile
 
 
   
2 of 2
2