Welcome Guest, Not a member yet? Register   Sign In
Change config values with php script
#1

I have below values in application/config/config.php
$config['name'] = 'omid';
$config['id'] = 1;

Now i need change this values with other php file
Mayne?
Reply
#2

See the Config Library in the Users Guide, but if you need to make it
permanent then you will need to create your config file and read and
write to it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(10-01-2017, 12:22 PM)InsiteFX Wrote: See the Config Library in the Users Guide, but if you need to make it
permanent then you will need to create your config file and read and
write to it.

But i need to change value and save it in same config file
Reply
#4

(This post was last modified: 10-02-2017, 10:23 AM by PaulD.)

It seems to me that these are not config variables at all. User ID and User Name are dependent on the user and IMHO not contained in a config file at all.

I often have a user library that interrogates the session in some way and returns user details, permissions and authorises access. By doing that it is just one call to the user library to get whatever I need in a controller. The user_id is identified through the session and the user details are gathered from a database table. Authorisation is done usually through ion_auth but by keeping it all in one user library you can swap auth libraries around quite easily, or write your own, although that takes quite a bit of security knowledge to do it well.

Hope that helps in some small way,

Paul

PS A config file is still just a file so you can always read it and alter it with php. However this completely defeats the purpose of a config file in my opinion.
Reply
#5

(10-02-2017, 10:21 AM)PaulD Wrote: It seems to me that these are not config variables at all. User ID and User Name are dependent on the user and IMHO not contained in a config file at all.

I often have a user library that interrogates the session in some way and returns user details, permissions and authorises access. By doing that it is just one call to the user library to get whatever I need in a controller. The user_id is identified through the session and the user details are gathered from a database table. Authorisation is done usually through ion_auth but by keeping it all in one user library you can swap auth libraries around quite easily, or write your own, although that takes quite a bit of security knowledge to do it well.

Hope that helps in some small way,

Paul

PS A config file is still just a file so you can always read it and alter it with php. However this completely defeats the purpose of a config file in my opinion.

Ok thank you
Reply




Theme © iAndrew 2016 - Forum software by © MyBB