Log in with username/password: lyceum/lyceum

Changeset 426

Show
Ignore:
Timestamp:
01/18/06 05:37:10 (3 years ago)
Author:
jjb
Message:

-using token system for comment submission
-using db instead of filesystem for session data
-trying to delete tokens when done with them... i'm not sure if this works as expected with the db system

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/lib/functions.php

    r425 r426  
    8787   $token = md5(uniqid(rand(), TRUE)); 
    8888   $_SESSION['formtokens']["$name-tokens"][$token] = time();//TODO clear out old tokens(otherwise thousands will accumulate) 
    89 trace('formtoken: $token, $targetscript, $action, $id', "$token, $targetscript, $action, $id"); 
     89//trace('formtoken: $token, $targetscript, $action, $id', "$token, $targetscript, $action, $id"); 
    9090   return $token; 
    9191} 
     
    103103      return false; 
    104104 
     105   unset($_SESSION['formtokens']["$name-tokens"][$token]); 
    105106   return true; 
    106107} 
  • trunk/src/lyceum/wp-admin/upgrade-schema.php

    r406 r426  
    182182   FULLTEXT (`textdata`) 
    183183) ENGINE = MyIsam; 
     184CREATE TABLE $wpdb->sessions ( 
     185   id varchar(32) NOT NULL, 
     186   access int(10) unsigned, 
     187   data text, 
     188   PRIMARY KEY (id) 
     189) ENGINE = InnoDB; 
    184190"; 
    185191 
  • trunk/src/lyceum/wp-comments-post.php

    r370 r426  
    66$comment_post_ID = (int) $_POST['comment_post_ID']; 
    77assert('hv($comment_post_ID)'); 
     8if (!tokenIsValid($_REQUEST['token'], basename(__FILE__), 'default', $comment_post_ID)) 
     9   die("token is not valid"); 
     10 
    811$status = $wpdb->get_row("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'"); 
    912 
  • trunk/src/lyceum/wp-content/themes/default/comments.php

    r370 r426  
    7575<form action="<?php echo get_option('siteurl'); ?>/<?=comments_post_name()?>" method="post" id="commentform"> 
    7676   <?=bloginput()?> 
     77   <?=tokeninput(comments_post_name(), 'default', $id)?> 
    7778 
    7879<?php if ( $user_ID ) : ?> 
  • trunk/src/lyceum/wp-settings.php

    r389 r426  
    8787$wpdb->usermeta         = $table_prefix . 'usermeta'; 
    8888$wpdb->blogs            = $table_prefix . 'blogs'; 
    89 $wpdb->postsearch           = $table_prefix . 'postsearch'; 
     89$wpdb->postsearch       = $table_prefix . 'postsearch'; 
     90$wpdb->sessions         = $table_prefix . 'sessions'; 
    9091 
    9192$wpdb->prefix           = $table_prefix; 
     
    151152require (ABSPATH . WPINC . '/version.php'); 
    152153require (ABSPATH . '../lib/functions.php'); 
     154require (ABSPATH . '../lib/session.php'); 
    153155 
    154156//TODO use cache 
     
    271273register_shutdown_function('shutdown_action_hook'); 
    272274 
     275session_start(); 
     276 
    273277// Everything is loaded and initialized. 
    274278do_action('init'); 
Log in with username/password: lyceum/lyceum