. * * ------------------------------------------------------------------------ * 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

    Top news and opinion

    based on member clicks

    Latest California news   Details

    Angels have been maddening with their consistent inconsistency


    In this article:
    Peter Miller,

    Are Democrats Up to the Task of Combating Trump's Wanton Cruelty?


    In this article:
    Kamala Harris, Barack Obama, Nancy Pelosi, Maxine Waters,

    California high court: Yelp can't be ordered to remove posts


    In this article:
    Tani Cantil-Sakauye, Ming Chin, Carol Corrigan,

    The Daily 202: One Republican senator has the power to defeat Trump's Supreme Court nominee


    In this article:
    Elliott Broidy, Hillary Clinton, Kamala Harris, John McCain, Dion Nissenbaum, Senate Democrats, Senate Republicans,

    Weaponizing the Initiative Process


    In this article:
    Sheila Kuehl, Joe Mathews, Arnold Schwarzenegger,

    Colluding With California's Russian



    State Agency Should Return to its Roots


    In this article:
    Legislature, redevelopment agencies,

    A Scandalous Abuse of the Legislative Process


    In this article:
    George Skelton,
    Bills: SB 215,

    California's new initiative process: A 'circus' or a 'good and healthy thing?'


    In this article:
    Jim Nielsen, Kristin Olsen, Darrell Steinberg,

    Cities Are Saying 'No' to ICE by Canceling Their Contracts With the Agency


    In this article:
    minimum wage, sick leave,
    Bills: SB 4,

    Pot equity + clean water + raw milk + Maryland newspaper shooting + Supreme Court


    In this article:
    Patt Morrison, Dan Walters, Maxine Waters,

    If Sacramento's cannabis industry goes corporate, these three men will be to blame


    In this article:
    Darrell Steinberg, Allen Warren,

    Exclusive: Tesla hits Model 3 manufacturing milestone, hours after deadline - factory sources


    In this article:
    Peter Henderson, Brian Johnson,

    Russia investigators likely got access to NRA's tax filings, secret donors


    In this article:
    David Axelrod, Hillary Clinton, Barack Obama, Dana Rohrabacher,

    Michael Hiltzik: Could a new court-packing scheme save the Supreme Court from hard-right domination?


    In this article:
    Erwin Chemerinsky,

    When robots take California jobs, what happens next?


    In this article:
    Kim Belshe, Barbara Boxer, California Nurses Association, Tom Campbell, Dorothy Rothrock, Dan Schnur, Angie Wei,

    Online sales tax ruling could bring 'hundreds of millions of dollars' to California


    In this article:
    Board of Equalization, Legislature, Fiona Ma, George Runner,

    'Not all machines are evil,' and other thoughts on California's changing economy


    In this article:
    Linda Ackerman, Eric Bauman, Bay Area Council, Kim Belshe, Marian Bergeson, Barbara Boxer, California Democratic Party, California Nurses Association, Tom Campbell, Jon Coupal, Gray Davis, Harmeet Dhillon, Legislature, Donna Lucas, minimum wage, Kristin Olsen, John A. Perez, Curt Pringle, Dorothy Rothrock, Rob Stutzman, Ashley Swearengin, technical education, David Townsend, Angie Wei, Timothy White, Pete Wilson, Jim Wunderman, Allan Zaremberg, Daniel Zingale,
    Bills: SB 562,

    Ripple effect*


    In this article:
    California Nurses Association, California Teachers Association, Sean Elsbernd, Dianne Feinstein, minimum wage,

    Era of resistance defines new generation of House Democrats


    In this article:
    Ro Khanna, Barack Obama, Nancy Pelosi,

    Commentary: Are Democrats about to hand the GOP another 1968?


    In this article:
    Nancy Pelosi, Maxine Waters,

    Restless Democratic Newcomers Could Bring Big Change to the House


    In this article:
    Ro Khanna, Barack Obama, Nancy Pelosi,

    LeBron James agrees to 4-year, $154M deal with Lakers


    In this article:
    Eric Garcetti,

    Dismantling California At-Risk Inmate Housing Brings Hurdles


    In this article:
    California prisons, Scott Kernan,

    As he struggles at the plate, Angels' Ian Kinsler faces uncertain future


    In this article:
    Peter Miller,

    Angels fall in series finale at Baltimore, but help is on the way


    In this article:
    Peter Miller,

    Democratic candidates for governor differ on priorities


    In this article:
    renewable energy,

    New Laws In California Set To Go Into Effect Sunday


    In this article:
    Eric Garcetti, minimum wage,

    Dismantling California at-risk inmate housing brings hurdles


    In this article:
    California prisons, Scott Kernan,

    Exclusive: Tesla hits Model 3 manufacturing milestone, hours after deadline - factory sources


    In this article:
    Peter Henderson, Brian Johnson,

    Restless Democratic newcomers bringing change to House


    In this article:
    Ro Khanna, Barack Obama, Nancy Pelosi,

    Proposed bans on plastic straws run into resistance


    In this article:
    Ian Calderon, Legislature, referendum, Tim Shestek,

    Will $15 minimum wage in SF slow down the Bay Area exodus? Here's what the numbers say


    In this article:
    Bay Area Council, minimum wage,

    Now they have a choice. Will California teachers and cops stay in their unions?


    In this article:
    Brian Dahle, SEIU, Yvonne Walker,

    All weed must go: California cannabis businesses brace for new regulations


    In this article:
    Alex Traverso,


    » More headlines
    - // STRIPE FORM