function login($uname, $passwd) { if (!empty($uname) && !empty($passwd)) { $dbconn = new_conn(); $query_raw_salt = "SELECT `raw_salt` FROM `user` WHERE `username` = '{$uname}'"; $result_raw_salt = $dbconn->query($query_raw_salt); if ($result_raw_salt) { if ($result_raw_salt->num_rows == 1) { $row = $result_raw_salt->fetch_array(); $raw_salt = $row['raw_salt']; $query_passwd = "SELECT `id`,`username` FROM `user` WHERE `username` = '{$uname}' AND `password` = " . my_hash($passwd, $raw_salt); $result_passwd = $dbconn->query($query_passwd); if ($result_passwd->num_rows == 1) { $row = $result_passwd->fetch_array(); $_SESSION['uid'] = $row['id']; $_SESSION['uname'] = $row['username']; return TRUE; } } } } return FALSE; }
// From http://api.drupal.org/api/drupal/modules%21comment%21comment.pages.inc/function/comment_reply/7: // $pid: Some comments are replies to other comments. In those cases, $pid is the parent comment's cid. $pid = mysql_result($result_c, $i_c, "pid"); // 9-digit decimal = 32bit. $pid_hash = my_hash($pid, 32); // August 13, 2012 8:11 AM $formatted_date = date('F m, Y h:i A', mysql_result($result_c, $i_c, "created")); $parent_blogger_id = "tag:blogger.com,1999:blog-{$blogger_id}.post-{$parent_id}"; // print "\n <entry>\n <id>tag:blogger.com,1999:blog-{$blogger_id}.post-{$comment_id}</id>\n <published>{$created}</published>\n <updated>{$changed}</updated>\n <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/blogger/2008/kind#comment'/>\n <title type='text'>{$title}</title>\n <content type='html'>{$body}</content>\n <link href=\"http://www.blogger.com/feeds/{$blogger_id}/{$parent_id}/comments/default/{$comment_id}\" rel=\"edit\" type=\"application/atom+xml\"/>\n <link href=\"http://www.blogger.com/feeds/{$blogger_id}/{$parent_id}/comments/default/{$comment_id}\" rel=\"self\" type=\"application/atom+xml\"/>\n <link href=\"{$parent_url}?showComment=1344870684962#c{$comment_id}\" rel=\"alternate\" title=\"\" type=\"text/html\"/>"; // If the post is a reply to a reply, add "related" link. This always refers to the top-level comment. // In Drupal, a comment on a comments is marked by having PID!=0. Thus, find the highest-level related // comment with PID=0. $curr_pid = $pid; if ($curr_pid != 0) { while ($curr_pid != 0) { $prev_pid = $curr_pid; $curr_pid = mysql_result($result_c, $prev_pid, "pid"); } // At this point, $prev_pid is the ID of the comment with PID=0. $related_comment_id = my_hash($prev_pid + $numrows_node, 63); print "<link href=\"http://www.blogger.com/feeds/{$blogger_id}/{$parent_id}/comments/default/{$related_comment_id}\" rel=\"related\" type=\"application/atom+xml\"/>"; } print "\n <author>\n <name>{$author_name}</name>"; if (!empty($author_url)) { print "\n <uri>{$author_url}</uri>"; } print "\n <email>noreply@blogger.com</email>\n </author>\n "; print "<thr:in-reply-to href=\"{$parent_url}\" ref=\"{$parent_blogger_id}\" source=\"http://www.blogger.com/feeds/{$blogger_id}/posts/default/{$parent_id}\" type=\"text/html\"/>\n <gd:extendedProperty name=\"blogger.itemClass\" value=\"pid-{$pid_hash}\"/>\n <gd:extendedProperty name=\"blogger.displayTime\" value=\"{$formatted_date}\"/>\n </entry>\n "; } echo "\n";