Online Store integration

Started by apw, February 11, 2005, 03:50:20 PM

Previous topic - Next topic

apw

Hello,

I was wondering if it's possible to integrate SMF with an online store, so that users can log in to both with the same details, and therefore only have to register once.

I'm currently using OsCommerce, and it'd be great to be able to integrate the two.

Any ideas?

Anguz

The smf_api.php may be of help.
http://www.simplemachines.org/download.php?converters

Quote
/*   This file includes functions that may help integration with other scripts
   and programs, such as portals.  It is independent of SMF, and meant to run
   without disturbing your script.  It defines several functions, all of
   which start with the smf_ prefix.  These are:

   bool smf_setLoginCookie(int length, string username or int ID_MEMBER,
         string password, bool encrypted = true)
      - sets a cookie and session variables to log the user in, for length
        seconds from now.
      - will find the ID_MEMBER for you if you specify a username.
      - please ensure that the username has slashes added to it.
      - does no authentication, but if the cookie is wrong it won't work.
      - expects the password to be pre-encrypted if encrypted is true.
      - returns false on failure (unlikely!), true on success.
      - you should call smf_authenticateUser after calling this.

   bool smf_authenticateUser()
      - authenticates the user with the current cookie ro session data.
      - loads data into the $smf_user_info variable.
      - returns false if it was unable to authenticate, true otherwise.
      - it would be good to call this at the beginning.

   void smf_logOnline(string action = $_GET['action'])
      - logs the currently authenticated user or guest as online.
      - may not always log, because it delays logging if at all possible.
      - uses the action specified as the action in the log, a good example
        would be "coppermine" or similar.
      - you can add entries to the Modifications language files so as to
        make this action show up properly on Who's Online - see Who.php for
        more details.

   bool smf_isOnline(string username or int ID_MEMBER)
      - checks if the specified member is currently online.
      - will find the appropriate ID_MEMBER if username is given instead.
      - returns true if they are online, false otherwise.

   string smf_logError(string error_message, string file, int line)
      - logs an error, assuming error logging is enabled.
      - filename and line should be __FILE__ and __LINE__, respectively.
      - returns the error message. (ie. die(log_error($msg));)

   string smf_formatTime(int time)
      - formats the timestamp time into a readable string.
      - adds the appropriate offsets to make the time equivalent to the
        user's time.
      - return the readable representation as a string.

   resource smf_query(string query, string file, int line)
      - executes a query using SMF's database connection.
      - keeps a count of queries in the $smf_settings['db_count'] setting.
      - if an error occurs while executing the query, additionally logs an
        error in SMF's error log with the proper information.
      - does not do any crashed table prevention.

   bool smf_allowedTo(string permission)
      - checks to see if the user is allowed to do the specified permission
        or any of an array of permissions.
      - always returns true for administrators.
      - does not account for banning restrictions.
      - caches all available permissions upon first call.
      - does not provide access to board permissions.
      - returns null if no connection to the database has been made, and
        true or false depending on the user's permissions.

   void smf_loadThemeData(int ID_THEME = default)
      - if no ID_THEME is passed, the user's default theme will be used.
      - allows 'theme' in the URL to specify the theme, only if ID_THEME is
        not passed.
      - loads theme settings into $smf_settings['theme'].
      - loads theme options into $smf_user_info['theme'].
      - does nothing if no connection has been made to the database.
      - should be called after loading user information.

   string smf_md5_hmac(string data, string key)
      - implements the encryption used for the passwords in SMF.

   void smf_loadSession()
      - loads the session, whether from the database or from files.
      - makes the session_id available in $smf_user_info.
      - will override session handling if the setting is enabled in SMF's
        configuration.

   bool smf_sessionOpen(string save_path, string session_name)
   bool smf_sessionClose()
   bool smf_sessionRead(string session_id)
   bool smf_sessionWrite(string session_id, string data)
   bool smf_sessionDestroy(string session_id)
   bool smf_sessionGC(int max_lifetime)
      - called only by internal PHP session handling functions.

   ---------------------------------------------------------------------------
   It also defines the following important variables:

   array $smf_settings
      - includes all the major settings from Settings.php, as well as all
        those from the settings table.
      - if smf_loadThemeData has been called, the theme settings will be
        available from the theme index.

   array $smf_user_info
      - only contains useful information after authentication.
      - major indexes are is_guest and is_admin, which easily and quickly
        tell you about the user's status.
      - also includes id, name, email, messages, unread_messages, and many
        other values from the members table.
      - you can also use the groups index to find what groups the user is in.
      - if smf_loadSession has been called, the session code is stored under
        session_id.
      - if smf_loadThemeData has been called, the theme options will be
        available from the theme index.
*/
Cristián Lávaque http://cristianlavaque.com

Advertisement: