• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Closed] Auto Session Check

#1
[eluser]riwakawd[/eluser]
Hi I am making a auto session check. So far it works but would like to know if code is correct. Not sure on how to test the off part to make sure working.

Code:
<table class="table table-bordered">
<tbody>
<td>Session Auto Start</td>
<td>&lt;?php echo (ini_get('session_auto_start')) ? 'On' : 'Off'; ?&gt;</td>
<td>On</td>
<td>&lt;?php echo (ini_get('session_auto_start')) ? '<span class="text-success"><i class="fa fa-check-circle"></i></span>' : '<span class="text-danger"><i class="fa fa-minus-circle"></i></span>'; ?&gt;</td>
</tbody>
</table>

And also my Register Globals: should have show green tick becase it is ok but shows danger - for some reason

Code:
<tr>
<td>Register Globals:</td>
<td class="align_center">&lt;?php echo (ini_get('register_globals')) ? 'On' : 'Off'; ?&gt;</td>
<td class="align_center">Off</td>
<td>&lt;?php echo (ini_get('register_globals')) ? '<span class="text-success"><i class="fa fa-check-circle"></i></span>' : '<span class="text-danger"><i class="fa fa-minus-circle"></i></span>'; ?&gt;</td>
</tr>

#2
[eluser]riwakawd[/eluser]
My Problem Is Solved I just had to add replace ini_get with ! ini_get

Code:
<table class="table table-bordered">
<thead>
<tr>
<th class="align_left">PHP Settings</th>
<th>Current Settings</th>
<th>Required Settings</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr>
<td>PHP Version:</td>
<td class="align_center">&lt;?php echo phpversion(); ?&gt;</td>
<td class="align_center">5.1.6+</td>
<td>&lt;?php echo phpversion() ? '<span class="text-success"><i class="fa fa-check-circle"></i></span>' : '<span class="text-danger"><i class="fa fa-minus-circle"></i></span>'; ?&gt;</td>
</tr>
<tr>
<td>Register Globals:</td>
<td class="align_center">&lt;?php echo (ini_get('register_globals')) ? 'On' : 'Off'; ?&gt;</td>
<td class="align_center">Off</td>
<td>&lt;?php echo ( ! ini_get('register_globals') ) ? '<span class="text-success"><i class="fa fa-check-circle"></i></span>' : '<span class="text-danger"><i class="fa fa-minus-circle"></i></span>'; ?&gt;</td>
</tr>
<tr>
<td>Magic Quotes GPC:</td>
<td class="align_center">&lt;?php echo (ini_get('magic_quotes_gpc')) ? 'On' : 'Off'; ?&gt;</td>
<td class="align_center">Off</td>
<td>&lt;?php echo ( ! ini_get('magic_quotes_gpc') ) ? '<span class="text-success"><i class="fa fa-check-circle"></i></span>' : '<span class="text-danger"><i class="fa fa-minus-circle"></i></span>'; ?&gt;</td>
</tr>
<tr>
<td>File Uploads:</td>
<td class="align_center">&lt;?php echo (ini_get('file_uploads')) ? 'On' : 'Off'; ?&gt;</td>
<td class="align_center">On</td>
<td>&lt;?php echo (ini_get('file_uploads')) ? '<span class="text-success"><i class="fa fa-check-circle"></i></span>' : '<span class="text-danger"><i class="fa fa-minus-circle"></i></span>'; ?&gt;</td>
</tr>
<tr>
<td>Session Auto Start:</td>
<td class="align_center">&lt;?php echo (ini_get('session_auto_start')) ? 'On' : 'Off'; ?&gt;</td>
<td class="align_center">Off</td>
<td>&lt;?php echo ( ! ini_get('session_auto_start') ) ? '<span class="text-success"><i class="fa fa-check-circle"></i></span>' : '<span class="text-danger"><i class="fa fa-minus-circle"></i></span>'; ?&gt;</td>
</tr>
</tbody>
</table>

#3
[eluser]Tim Brownlaw[/eluser]
So have you actually TESTED This?????
Just negating the test is not checking it's working and I've just spent a few minutes actually testing this out...
Have you?

If you're running your own local server, you can change these in the php.ini file to test.

Well for session auto start your two test cases are
session.auto_start = 1
or
session.auto_start = 0

and to test...
echo (ini_get('session.auto_start') == 1) ? 'On' : 'Off';

Just make sure you restart your server each time you make a change.

I tried changing this in a test script using ini_set('session.auto_start','1'); and it wouldn't stick.
The ini_get only returned the value I had changed in my servers php.ini file

So it's likely I've not got that enabled as a setting I can override. I've not looked to check...

This looks like a "this is what you have and this is what it should be" deal... Just how are you advising folks to change their settings to suit your "suggested" settings if they don't match?

Cheers
Tim


#4
[eluser]riwakawd[/eluser]
[quote author="Tim Brownlaw" date="1400050363"]So have you actually TESTED This?????
Just negating the test is not checking it's working and I've just spent a few minutes actually testing this out...
Have you?

If you're running your own local server, you can change these in the php.ini file to test.

Well for session auto start your two test cases are
session.auto_start = 1
or
session.auto_start = 0

and to test...
echo (ini_get('session.auto_start') == 1) ? 'On' : 'Off';

Just make sure you restart your server each time you make a change.

I tried changing this in a test script using ini_set('session.auto_start','1'); and it wouldn't stick.
The ini_get only returned the value I had changed in my servers php.ini file

So it's likely I've not got that enabled as a setting I can override. I've not looked to check...

This looks like a "this is what you have and this is what it should be" deal... Just how are you advising folks to change their settings to suit your "suggested" settings if they don't match?

Cheers
Tim

[/quote]

I have got it all working now. You will see some below have ! below on some php area. In due time will be letting people know how to change it. At the moment just for me still few things to work out next few months. Step 3 which is next on list is front end database setup with pre built admin. I have a developer I hire to do freelance work but most of time like to try and do it my self.

Code:
<table class="table table-bordered">
<thead>
<tr>
<th class="align_left">PHP Settings</th>
<th>Current Settings</th>
<th>Required Settings</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr>
<td>PHP Version:</td>
<td class="align_center">&lt;?php echo phpversion(); ?&gt;</td>
<td class="align_center">5.1.6+</td>
<td>&lt;?php echo phpversion() ? '<span class="text-success"><i class="fa fa-check-circle"></i></span>' : '<span class="text-danger"><i class="fa fa-minus-circle"></i></span>'; ?&gt;</td>
</tr>
<tr>
<td>Register Globals:</td>
<td class="align_center">&lt;?php echo (ini_get('register_globals')) ? 'On' : 'Off'; ?&gt;</td>
<td class="align_center">Off</td>
<td>&lt;?php echo ( ! ini_get('register_globals')) ? '<span class="text-success"><i class="fa fa-check-circle"></i></span>' : '<span class="text-danger"><i class="fa fa-minus-circle"></i></span>'; ?&gt;</td>
</tr>
<tr>
<td>Magic Quotes GPC:</td>
<td class="align_center">&lt;?php echo (ini_get('magic_quotes_gpc')) ? 'On' : 'Off'; ?&gt;</td>
<td class="align_center">Off</td>
<td>&lt;?php echo ( ! ini_get('magic_quotes_gpc')) ? '<span class="text-success"><i class="fa fa-check-circle"></i></span>' : '<span class="text-danger"><i class="fa fa-minus-circle"></i></span>'; ?&gt;</td>
</tr>
<tr>
<td>File Uploads:</td>
<td class="align_center">&lt;?php echo (ini_get('file_uploads')) ? 'On' : 'Off'; ?&gt;</td>
<td class="align_center">On</td>
<td>&lt;?php echo (  ini_get('file_uploads')) ? '<span class="text-success"><i class="fa fa-check-circle"></i></span>' : '<span class="text-danger"><i class="fa fa-minus-circle"></i></span>'; ?&gt;</td>
</tr>
<tr>
<td>Session Auto Start:</td>
<td class="align_center">&lt;?php echo (ini_get('session_auto_start')) ? 'On' : 'Off'; ?&gt;</td>
<td class="align_center">Off</td>
<td>&lt;?php echo ( ! ini_get('session_auto_start')) ? '<span class="text-success"><i class="fa fa-check-circle"></i></span>' : '<span class="text-danger"><i class="fa fa-minus-circle"></i></span>'; ?&gt;</td>
</tr>
</tbody>
</table>

#5
[eluser]InsiteFX[/eluser]
And you better not use Register_Globals!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.