Jul 26, 2008

Php-fusion Cms - No session_start() used?

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

Php-fusion Cms - No session_start() used?

sonesay
A while back i was looking for free hosting and a forumn suite for my own comunity. I ended up using hostingdirect.co.nz and php-fusion from http://php-fusion.co.uk It was pretty easy to setup and run. But my site required more specific functions other then generic CMS could offer and I wanted to learn PHP so I start reading tutorials and such to learn. I was working on them locally and they seem to run fine on my own server. When i upload my own site to the hostingdirect site I find they do not have safe_mode off. I got an error in my index.php file when i try and run session_start().

From all the books and online resources I've seen we are taught to use session_start() so I wondered why was the php-fusion CMS working and my own wasnt. I looked into the source files looking to find if they did use a session_start() but could not find any. Their code was alot more complicated and longer then mine.

My question is session_start()(sessions) not required to keep track of users details when loged in? Have they used other means i.e cookies or what ever there is to do the same thing? If so are there potentional problems if they are not using sessions.

That problem has lead me here looking for a hosting site which offers safe_mode off. I just want to know if Im heading in the right track of learning PHP correctly. I just realise that tables are kinda bad. after reading and understanding what CSS can offer for layouts I just hope I dont learn PHP the wrong way.

Any insight from experience php coders apprecited ^^

 

 

 


Reply

galexcd
PHP tries to make your life easier with the session variables and session functions but there are other ways. I never liked the php built in session functions so I just make my own login script. You have 2 sql tables. One holds all the users like normal, and then you add another one called sessions. Under sessions, you have the variables sessionID, userID, and you may also include IP if you want to backcheck the session with an IP address to prevent cookie stealers.

When a person logs in, you check the username and password based on the users table, and if its correct, have php make a random group of letters and numbers. Set a cookie on the users computer to this code, and insert a new row into sessions with this code as the sessionID and the users's ID for the userID. On every page that you want to check if the user is logged in or not, have php grab the cookie off of the users computer, find the row with that session, and get the userID.

That way php will know what user is currently logged in. If you do not want two people logged into the same username, have php delete all rows from that userID when the person logs in.

I hope this helped!

 

 

 


Reply

CrazyRob
The script will not work because safe mode has not been turned off by them in php.ini

To answer your question trap17 does have safe mode turned OFF

Reply

sonesay
QUOTE(alex7h3pr0gr4m3r @ Jun 23 2007, 04:23 AM) *
That way php will know what user is currently logged in. If you do not want two people logged into the same username, have php delete all rows from that userID when the person logs in.


Thanks for your responses guys. I've got a few things Id like to ask about deleting user records to prevent users from logging in. You would have to readd the user to the users table when logging out right? what If users just close the broswer when leaving your site how would the users record be restored back into the users table?

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : php fusion cms session

  1. Php Session - (6)
  2. Storing Session Variables Generated Dynamically - (3)
    i have many pool (quiz) modules on my site with the information taken from a database. The modules
    are processed by the same function with different parameters and i need to save the pool's
    status to prevent a user vote several times. I do this setting $_SESSION to 1 , variable
    being the name of the quiz, which is taken from the database. So i get to having a code like this:
    .................... $name= $row->quiz_name; $_SESSION =1 The problem is that if
    i call $_SESSION from another part of the site (another page) the variable is al...
  3. Php - Can Anyone Tell Me What "session" Actually Do? - (5)
    php - can anyone tell me what "session" actually do? I was looking at this page
    http://www.w3schools.com/php/php_sessions.asp this paragraph here: A PHP session solves this
    problem by allowing you to store user information on the server for later use (i.e. username,
    shopping items, etc). However, session information is temporary and will be deleted after the user
    has left the website. If you need a permanent storage you may want to store the data in a database.
    Especially this part below: QUOTE A PHP session solves this problem by allowing you to store
    user in...
  4. Session Variables - Sessions in PHP behaving strangely (4)
    Hi. I am part of a development team working in PHP and MySQL. The site is using SSL, and users
    have to log to use the site. When users log in, their important details are retrieved from the
    database and stored in session variables (functionality in the site is permissions specific).
    Lately, sessions are "disappearing" for no apparent reason. Users will log in, and at some point
    (the length of time will vary unpredicatably) the sessions will lose their value (the variables are
    empty) and this causes the site to evict the user. This is very frustrating for the user b...
  5. Session Start() Problem - Need help with an error (5)
    Warning: session_start(): Cannot send session cache limiter - headers already sent (output started
    at /home/ridouan/public_html/Reviews.php:5) in /home/ridouan/public_html/Reviews.php on line 6
    Can't seem to fix the error (im a php noob) So i'd appreciate some help /smile.gif'
    border='0' style='vertical-align:middle' alt='smile.gif' /> If you need it: Gamer Online then
    click on the Reviews link...
  6. Quick Question About Session Vars - something I can't find anywhere (1)
    Can you save stuff like classes and arrays in sessionsvariables?...



Looking for php, fusion, cms, session, start,

Searching Video's for php, fusion, cms, session, start,
advertisement



Php-fusion Cms - No session_start() used?



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE