. * * ------------------------------------------------------------------------ * DESCRIPTION: * ------------------------------------------------------------------------ * This library tells the PHP4 session handler to write to a MySQL database * instead of creating individual files for each session. * * Create a new database in MySQL called "sessions" like so: * * CREATE TABLE sessions ( * sesskey char(32) not null, * expiry int(11) unsigned not null, * value text not null, * PRIMARY KEY (sesskey) * ); * * ------------------------------------------------------------------------ * INSTALLATION: * ------------------------------------------------------------------------ * Make sure you have MySQL support compiled into PHP4. Then copy this * script to a directory that is accessible by the rest of your PHP * scripts. * * ------------------------------------------------------------------------ * USAGE: * ------------------------------------------------------------------------ * Include this file in your scripts before you call session_start(), you * don't have to do anything special after that. */ $SESS_DBHOST = "scottflodin.duckdns.org"; /* database server hostname */ $SESS_DBUSER = "scottflodin"; /* database user */ $SESS_DBPASS = "nidolf"; /* database password */ $SESS_DBNAME = "totalca_main"; /* database name */ $SESS_DBHOST = "localhost"; /* database server hostname */ $SESS_DBUSER = "totalca"; /* database user */ $SESS_DBPASS = "j5#8Cu4a"; /* database password */ $SESS_DBNAME = "totalca_main"; /* database name */ $SESS_DBH = ""; $SESS_LIFE = (3600 * 24 * 365); // (1 hour) * (24 hours) * (365 days) session_set_cookie_params($SESS_LIFE); function sess_open($save_path, $session_name) { global $SESS_DBHOST, $SESS_DBNAME, $SESS_DBUSER, $SESS_DBPASS, $SESS_DBH; if (! $SESS_DBH = mysql_connect($SESS_DBHOST, $SESS_DBUSER, $SESS_DBPASS)) { echo "
  • Can't connect to $SESS_DBHOST as $SESS_DBUSER"; echo "
  • MySQL Error: ", mysql_error() . ' - SESSION duck'; die; } if (! mysql_select_db($SESS_DBNAME, $SESS_DBH)) { echo "
  • Unable to select database $SESS_DBNAME" . ' - SESSION duck'; die; } return true; } function sess_close() { return true; } function sess_read($key) { global $SESS_DBH, $SESS_LIFE; $qry = "SELECT value FROM sessions WHERE sesskey = '".$key."'"; $qid = mysql_query($qry, $SESS_DBH); if (list($value) = mysql_fetch_row($qid)) { return $value; } return false; } function sess_write($key, $val) { global $SESS_DBH, $SESS_LIFE; $expiry = time() + $SESS_LIFE; $value = addslashes($val); $qry = "INSERT INTO sessions VALUES ('$key', $expiry, '$value')"; $qid = mysql_query($qry, $SESS_DBH); if (! $qid) { $qry = "UPDATE sessions SET expiry = $expiry, value = '".$value."' WHERE sesskey = '".$key."'"; $qid = mysql_query($qry, $SESS_DBH); } return $qid; } function sess_destroy($key) { global $SESS_DBH; $qry = "DELETE FROM sessions WHERE sesskey = '".$key."'"; $qid = mysql_query($qry, $SESS_DBH); session_unset(); // FLODIN added 2004_09_20 global $session_expired; // FLODIN added 2005_07_26 $session_expired = 1; // FLODIN added 2004_09_20 return $qid; } function sess_gc($maxlifetime) { global $SESS_DBH; $qry = "DELETE FROM sessions WHERE expiry < " . time(); //$qid = mysql_query($qry, $SESS_DBH); //return mysql_affected_rows($SESS_DBH); } session_set_save_handler( "sess_open", "sess_close", "sess_read", "sess_write", "sess_destroy", "sess_gc"); ?> California Politics and People | TotalCapitol

    Headlines older than those on home page

    » Return to latest headlines

     All weed must go: California cannabis businesses brace for new regulations
    KGO-TV - June 30, 8:15 pm
    KGO-TV - June 30, 8:15 pm

    In this article: Alex Traverso,

     Angels score five runs in eighth inning to rally past Orioles 6-2
    Los Angeles Times / Top of the Ticket - June 30, 5:30 pm
    Los Angeles Times - June 30, 5:30 pm

    In this article: Peter Miller,

     Angels tag Deck McGuire as 12th starting pitcher this season
    Los Angeles Times / Top of the Ticket - June 30, 5:25 pm
    Los Angeles Times - June 30, 5:25 pm

    In this article: Peter Miller,

     Angels Score 5 In Eighth Inning To Pluck Orioles, 6-2
    KCBS - June 30, 4:41 pm
    KCBS - June 30, 4:41 pm

     Maxine Waters Just Tore Up Trump's Threats in a Fiery Speech at the LA Immigration Rally
    Mother Jones - June 30, 1:49 pm
    Mother Jones - June 30, 1:49 pm

    In this article: Nancy Pelosi, Maxine Waters,


     A shooting in the family: The Capital Gazette is in my journalism DNA
    Sacramento Bee / Opinion - June 30, 11:41 am
    Sacramento Bee - June 30, 11:41 am

    In this article: CalPERS,



     Justice Kennedy May Soon Find Himself Disappointed And His Legacy Undermined
    National Public Radio - June 30, 5:44 am
    National Public Radio - June 30, 5:44 am

    In this article: Rick Hasen,

     Democrats' civility rift is the latest intraparty problem. And they can't agree how to resolve it.
    Washington Post - June 30, 5:20 am
    Washington Post - June 30, 5:20 am

    In this article: Nancy Pelosi, Maxine Waters,

     Find a better reason than 'she's old' to want Dianne Feinstein to retire
    Los Angeles Times / Top of the Ticket - June 30, 4:00 am
    Los Angeles Times - June 30, 4:00 am

    In this article: Dianne Feinstein, Gavin Newsom, Maxine Waters, Herb Wesson,

     Be uncivil. Resist Trump. But don't go crazy
    Los Angeles Times / Top of the Ticket - June 30, 4:00 am
    Los Angeles Times - June 30, 4:00 am

    In this article: Erwin Chemerinsky, Patt Morrison, Maxine Waters,

     From LA to NY, hundreds of thousands join nationwide rallies to protest Trump's immigration policies
    Sacramento Bee - June 30, 1:00 am
    Sacramento Bee - June 30, 1:00 am

    In this article: Eric Garcetti, Kamala Harris, Gavin Newsom,

     San Francisco will have first $15-an-hour minimum wage
    KGO-TV - June 29, 11:59 pm
    KGO-TV - June 29, 11:59 pm

    In this article: Ed Lee, minimum wage, Phil Ting,

     Q&A on next steps for GOP in Congress' immigration fight
    Sacramento Bee - June 29, 9:27 pm
    Sacramento Bee - June 29, 9:27 pm

    In this article: Jeff Denham, David Valadao,

     Angels pitcher Tyler Skaggs returns to Camden Yards four years after injury
    Los Angeles Times - June 29, 8:55 pm
    Los Angeles Times - June 29, 8:55 pm

    In this article: Peter Miller,

     State revs up the plan to build high-speed-rail system faster by focusing on the Valley
    Sacramento Bee - June 29, 4:14 pm
    Sacramento Bee - June 29, 4:14 pm

    In this article: High-Speed Rail, Brian Kelly, Dan Richard,

     Here Are The 12 Ballot Propositions On California's November 2018 Election
    Capitol Public Radio - June 29, 3:42 pm
    Capitol Public Radio - June 29, 3:42 pm

    In this article: Legislature, meal and rest, Proposition 2,


     LA Voters To Weigh In On City-Owned Bank Idea
    KCBS - June 29, 2:01 pm
    KCBS - June 29, 2:01 pm

    In this article: Gavin Newsom, Herb Wesson,


     If Gov. Brown wants a legacy, he must follow through on clean water
    Sacramento Bee / Opinion - June 29, 12:00 pm
    Sacramento Bee - June 29, 12:00 pm

    In this article: Legislature, water,

     There's Still So Much of the Border Crisis to Cover. We're There. Here Are Our Video Dispatches.
    Mother Jones - June 29, 10:59 am
    Mother Jones - June 29, 10:59 am

    In this article: Norma Garcia,

     Lawmakers Announce Deal To Halt Lead Paint Ballot Measure
    Capitol Public Radio - June 29, 10:56 am
    Capitol Public Radio - June 29, 10:56 am

    In this article: Toni Atkins, David Chiu, Anthony Rendon,

     Obama to Democrats: "Do not wait for the perfect message" or "tingle in your spine" to vote
    CBS News - June 29, 10:42 am
    CBS News - June 29, 10:42 am

    In this article: Anna Eshoo, Nancy Pelosi,

     New Light Rail Line Approved For The San Fernando Valley
    KCBS - June 29, 10:10 am
    KCBS - June 29, 10:10 am

    In this article: Eric Garcetti, Paul Krekorian, Nury Martinez,

     Resistance Alone Won't Save Us. We Need Radical Action.
    Yahoo - June 29, 9:22 am
    Yahoo - June 29, 9:22 am

    In this article: Brian Bilbray, Darrell Issa, Nancy Pelosi, Maxine Waters,

     California blocks local soda taxes until 2031
    KABC - June 29, 9:14 am
    KABC - June 29, 9:14 am

    In this article: Anne Gust, Legislature, Darrell Steinberg, Evan Westrup,


    » Most recent headlines
    - // STRIPE FORM