Skip to content
Browse files

when creating account with home, add email as a parameter

  • Loading branch information...
1 parent 5262591 commit 604dc85b0238cee9af2ffd308c76b336da245f8f @thomaspark thomaspark committed Nov 22, 2011
Showing with 4 additions and 3 deletions.
  1. +2 −1 app.php
  2. +2 −2 js/chrome/beta.js
View
3 app.php
@@ -88,14 +88,15 @@
$key = sha1($_POST['key']);
$name = $_POST['name'];
+ $email = $_POST['email'];
$sql = sprintf('select * from ownership where name="%s"', mysql_real_escape_string($name));
$result = mysql_query($sql);
header('content-type: application/json');
if (!mysql_num_rows($result)) {
// store and okay (note "key" is a reserved word - typical!)
- $sql = sprintf('insert into ownership (name, `key`) values ("%s", "%s")', mysql_real_escape_string($name), mysql_real_escape_string($key));
+ $sql = sprintf('insert into ownership (name, `key`, email) values ("%s", "%s", "%s")', mysql_real_escape_string($name), mysql_real_escape_string($key), mysql_real_escape_string($email));
$ok = mysql_query($sql);
if ($ok) {
echo json_encode(array('ok' => true, 'key' => $key, 'created' => true));
View
4 js/chrome/beta.js
@@ -7,7 +7,7 @@
//= require "stream"
- this.home = function (name, key) {
+ this.home = function (name, key, email) {
if (!key) {
console.log('A key is required to declare some sort of ownership.');
return false;
@@ -17,7 +17,7 @@
$.ajax({
url: 'sethome',
- data: { name: name, key: key },
+ data: { name: name, key: key, email: email },
type: 'post',
dataType: 'json',
success: function (data) {

0 comments on commit 604dc85

Please sign in to comment.
Something went wrong with that request. Please try again.