diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..56a2dfa Binary files /dev/null and b/.DS_Store differ diff --git a/.buildpath b/.buildpath new file mode 100644 index 0000000..8bcb4b5 --- /dev/null +++ b/.buildpath @@ -0,0 +1,5 @@ + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a6de823 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +/connect4.mwb +/connect4.mwb.bak +/htaccess.txt +/index.php +/license.txt +/system +/js +/images +/CVS diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..d41b0c5 --- /dev/null +++ b/.htaccess @@ -0,0 +1,8 @@ +RewriteEngine on +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule .* index.php/$0 [PT,L] + +#RewriteEngine on +#RewriteCond $1 !^(index\.php|images|captcha|css|js|robots\.txt) +#RewriteRule ^(.*)$ /index.php/$1 [L] diff --git a/.htaccess~ b/.htaccess~ new file mode 100644 index 0000000..a95724e --- /dev/null +++ b/.htaccess~ @@ -0,0 +1,3 @@ +RewriteEngine on +RewriteCond $1 !^(index\.php|images|captcha|css|js|robots\.txt) +RewriteRule ^(.*)$ /index.php/$1 [L] diff --git a/.project b/.project new file mode 100644 index 0000000..9e11a8c --- /dev/null +++ b/.project @@ -0,0 +1,34 @@ + + + csc309Login_complete + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.dltk.core.scriptbuilder + + + + + + org.eclipse.php.core.PHPNature + org.eclipse.wst.jsdt.core.jsNature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope new file mode 100644 index 0000000..2f6f983 --- /dev/null +++ b/.settings/.jsdtscope @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/.settings/CVS/Entries b/.settings/CVS/Entries new file mode 100644 index 0000000..c5f1606 --- /dev/null +++ b/.settings/CVS/Entries @@ -0,0 +1,4 @@ +/.jsdtscope/1.1/Tue Nov 13 17:11:16 2012// +/org.eclipse.php.core.prefs/1.1/Tue Nov 13 17:13:40 2012// +/org.eclipse.wst.jsdt.ui.superType.container/1.1/Tue Nov 13 17:13:40 2012/-kb/ +/org.eclipse.wst.jsdt.ui.superType.name/1.1/Tue Nov 13 17:13:40 2012/-kb/ diff --git a/.settings/CVS/Repository b/.settings/CVS/Repository new file mode 100644 index 0000000..59efd7f --- /dev/null +++ b/.settings/CVS/Repository @@ -0,0 +1 @@ +csc309Login_empty/.settings diff --git a/.settings/CVS/Root b/.settings/CVS/Root new file mode 100644 index 0000000..f99f405 --- /dev/null +++ b/.settings/CVS/Root @@ -0,0 +1 @@ +:extssh:delara@syslab.cs.toronto.edu:/home/delara/Teaching/cvsroot diff --git a/.settings/CVS/Template b/.settings/CVS/Template new file mode 100644 index 0000000..e69de29 diff --git a/.settings/org.eclipse.php.core.prefs b/.settings/org.eclipse.php.core.prefs new file mode 100644 index 0000000..4677234 --- /dev/null +++ b/.settings/org.eclipse.php.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +include_path=0;/connect4 diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..ad32966 --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.name b/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/application/.gitignore b/application/.gitignore new file mode 100644 index 0000000..4a36dff --- /dev/null +++ b/application/.gitignore @@ -0,0 +1,10 @@ +/cache +/core +/CVS +/errors +/helpers +/hooks +/language +/libraries +/logs +/third_party diff --git a/application/.htaccess b/application/.htaccess new file mode 100644 index 0000000..14249c5 --- /dev/null +++ b/application/.htaccess @@ -0,0 +1 @@ +Deny from all \ No newline at end of file diff --git a/application/config/.gitignore b/application/config/.gitignore new file mode 100644 index 0000000..6ed19fc --- /dev/null +++ b/application/config/.gitignore @@ -0,0 +1 @@ +/database.php diff --git a/application/config/CVS/Entries b/application/config/CVS/Entries new file mode 100644 index 0000000..5c38956 --- /dev/null +++ b/application/config/CVS/Entries @@ -0,0 +1,15 @@ +/autoload.php/1.1/Fri Nov 16 02:05:48 2012// +/config.php/1.1/Tue Nov 13 17:11:16 2012// +/constants.php/1.1/Tue Nov 13 17:11:16 2012// +/database.php/1.1/Wed Nov 14 17:30:36 2012// +/doctypes.php/1.1/Tue Nov 13 17:11:16 2012// +/foreign_chars.php/1.1/Tue Nov 13 17:11:16 2012// +/form_validation.php/1.1/Tue Nov 13 17:11:16 2012// +/hooks.php/1.1/Tue Nov 13 17:11:16 2012// +/index.html/1.1/Tue Nov 13 17:11:16 2012// +/migration.php/1.1/Tue Nov 13 17:11:16 2012// +/mimes.php/1.1/Tue Nov 13 17:11:16 2012// +/profiler.php/1.1/Tue Nov 13 17:11:16 2012// +/routes.php/1.1/Wed Nov 14 19:08:50 2012// +/smileys.php/1.1/Tue Nov 13 17:11:16 2012// +/user_agents.php/1.1/Tue Nov 13 17:11:16 2012// diff --git a/application/config/CVS/Repository b/application/config/CVS/Repository new file mode 100644 index 0000000..c71813d --- /dev/null +++ b/application/config/CVS/Repository @@ -0,0 +1 @@ +csc309Login_empty/application/config diff --git a/application/config/CVS/Root b/application/config/CVS/Root new file mode 100644 index 0000000..f99f405 --- /dev/null +++ b/application/config/CVS/Root @@ -0,0 +1 @@ +:extssh:delara@syslab.cs.toronto.edu:/home/delara/Teaching/cvsroot diff --git a/application/config/CVS/Template b/application/config/CVS/Template new file mode 100644 index 0000000..e69de29 diff --git a/application/config/autoload.php b/application/config/autoload.php new file mode 100644 index 0000000..69418f5 --- /dev/null +++ b/application/config/autoload.php @@ -0,0 +1,119 @@ + '', + 'xhtml1-strict' => '', + 'xhtml1-trans' => '', + 'xhtml1-frame' => '', + 'html5' => '', + 'html4-strict' => '', + 'html4-trans' => '', + 'html4-frame' => '' + ); + +/* End of file doctypes.php */ +/* Location: ./application/config/doctypes.php */ \ No newline at end of file diff --git a/application/config/foreign_chars.php b/application/config/foreign_chars.php new file mode 100644 index 0000000..14b0d73 --- /dev/null +++ b/application/config/foreign_chars.php @@ -0,0 +1,64 @@ + 'ae', + '/ö|œ/' => 'oe', + '/ü/' => 'ue', + '/Ä/' => 'Ae', + '/Ü/' => 'Ue', + '/Ö/' => 'Oe', + '/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ/' => 'A', + '/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª/' => 'a', + '/Ç|Ć|Ĉ|Ċ|Č/' => 'C', + '/ç|ć|ĉ|ċ|č/' => 'c', + '/Ð|Ď|Đ/' => 'D', + '/ð|ď|đ/' => 'd', + '/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě/' => 'E', + '/è|é|ê|ë|ē|ĕ|ė|ę|ě/' => 'e', + '/Ĝ|Ğ|Ġ|Ģ/' => 'G', + '/ĝ|ğ|ġ|ģ/' => 'g', + '/Ĥ|Ħ/' => 'H', + '/ĥ|ħ/' => 'h', + '/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ/' => 'I', + '/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı/' => 'i', + '/Ĵ/' => 'J', + '/ĵ/' => 'j', + '/Ķ/' => 'K', + '/ķ/' => 'k', + '/Ĺ|Ļ|Ľ|Ŀ|Ł/' => 'L', + '/ĺ|ļ|ľ|ŀ|ł/' => 'l', + '/Ñ|Ń|Ņ|Ň/' => 'N', + '/ñ|ń|ņ|ň|ʼn/' => 'n', + '/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ/' => 'O', + '/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º/' => 'o', + '/Ŕ|Ŗ|Ř/' => 'R', + '/ŕ|ŗ|ř/' => 'r', + '/Ś|Ŝ|Ş|Š/' => 'S', + '/ś|ŝ|ş|š|ſ/' => 's', + '/Ţ|Ť|Ŧ/' => 'T', + '/ţ|ť|ŧ/' => 't', + '/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ/' => 'U', + '/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ/' => 'u', + '/Ý|Ÿ|Ŷ/' => 'Y', + '/ý|ÿ|ŷ/' => 'y', + '/Ŵ/' => 'W', + '/ŵ/' => 'w', + '/Ź|Ż|Ž/' => 'Z', + '/ź|ż|ž/' => 'z', + '/Æ|Ǽ/' => 'AE', + '/ß/'=> 'ss', + '/IJ/' => 'IJ', + '/ij/' => 'ij', + '/Œ/' => 'OE', + '/ƒ/' => 'f' +); + +/* End of file foreign_chars.php */ +/* Location: ./application/config/foreign_chars.php */ \ No newline at end of file diff --git a/application/config/form_validation.php b/application/config/form_validation.php new file mode 100644 index 0000000..7285b7f --- /dev/null +++ b/application/config/form_validation.php @@ -0,0 +1,28 @@ + array( + array( + 'field' => 'username', + 'label' => 'Username', + 'rules' => 'required|min_length[5]|max_length[12]' + ), + array( + 'field' => 'password', + 'label' => 'Password', + 'rules' => 'required|min_length[4]' + ), + array( + 'field' => 'passconf', + 'label' => 'Password Confirmation', + 'rules' => 'required|min_length[4]|matches[password]' + ), + array( + 'field' => 'phone', + 'label' => 'Phone Number', + 'rules' => 'required|callback_phone_check' + ) + ) +); + + diff --git a/application/config/hooks.php b/application/config/hooks.php new file mode 100644 index 0000000..a4ad2be --- /dev/null +++ b/application/config/hooks.php @@ -0,0 +1,16 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/application/config/migration.php b/application/config/migration.php new file mode 100644 index 0000000..afa2645 --- /dev/null +++ b/application/config/migration.php @@ -0,0 +1,41 @@ +migration->latest() this is the version that schema will +| be upgraded / downgraded to. +| +*/ +$config['migration_version'] = 0; + + +/* +|-------------------------------------------------------------------------- +| Migrations Path +|-------------------------------------------------------------------------- +| +| Path to your migrations folder. +| Typically, it will be within your application path. +| Also, writing permission is required within the migrations path. +| +*/ +$config['migration_path'] = APPPATH . 'migrations/'; + + +/* End of file migration.php */ +/* Location: ./application/config/migration.php */ \ No newline at end of file diff --git a/application/config/mimes.php b/application/config/mimes.php new file mode 100644 index 0000000..100f7d4 --- /dev/null +++ b/application/config/mimes.php @@ -0,0 +1,106 @@ + 'application/mac-binhex40', + 'cpt' => 'application/mac-compactpro', + 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'), + 'bin' => 'application/macbinary', + 'dms' => 'application/octet-stream', + 'lha' => 'application/octet-stream', + 'lzh' => 'application/octet-stream', + 'exe' => array('application/octet-stream', 'application/x-msdownload'), + 'class' => 'application/octet-stream', + 'psd' => 'application/x-photoshop', + 'so' => 'application/octet-stream', + 'sea' => 'application/octet-stream', + 'dll' => 'application/octet-stream', + 'oda' => 'application/oda', + 'pdf' => array('application/pdf', 'application/x-download'), + 'ai' => 'application/postscript', + 'eps' => 'application/postscript', + 'ps' => 'application/postscript', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'mif' => 'application/vnd.mif', + 'xls' => array('application/excel', 'application/vnd.ms-excel', 'application/msexcel'), + 'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint'), + 'wbxml' => 'application/wbxml', + 'wmlc' => 'application/wmlc', + 'dcr' => 'application/x-director', + 'dir' => 'application/x-director', + 'dxr' => 'application/x-director', + 'dvi' => 'application/x-dvi', + 'gtar' => 'application/x-gtar', + 'gz' => 'application/x-gzip', + 'php' => 'application/x-httpd-php', + 'php4' => 'application/x-httpd-php', + 'php3' => 'application/x-httpd-php', + 'phtml' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'js' => 'application/x-javascript', + 'swf' => 'application/x-shockwave-flash', + 'sit' => 'application/x-stuffit', + 'tar' => 'application/x-tar', + 'tgz' => array('application/x-tar', 'application/x-gzip-compressed'), + 'xhtml' => 'application/xhtml+xml', + 'xht' => 'application/xhtml+xml', + 'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed'), + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mpga' => 'audio/mpeg', + 'mp2' => 'audio/mpeg', + 'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'), + 'aif' => 'audio/x-aiff', + 'aiff' => 'audio/x-aiff', + 'aifc' => 'audio/x-aiff', + 'ram' => 'audio/x-pn-realaudio', + 'rm' => 'audio/x-pn-realaudio', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'ra' => 'audio/x-realaudio', + 'rv' => 'video/vnd.rn-realvideo', + 'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'), + 'bmp' => array('image/bmp', 'image/x-windows-bmp'), + 'gif' => 'image/gif', + 'jpeg' => array('image/jpeg', 'image/pjpeg'), + 'jpg' => array('image/jpeg', 'image/pjpeg'), + 'jpe' => array('image/jpeg', 'image/pjpeg'), + 'png' => array('image/png', 'image/x-png'), + 'tiff' => 'image/tiff', + 'tif' => 'image/tiff', + 'css' => 'text/css', + 'html' => 'text/html', + 'htm' => 'text/html', + 'shtml' => 'text/html', + 'txt' => 'text/plain', + 'text' => 'text/plain', + 'log' => array('text/plain', 'text/x-log'), + 'rtx' => 'text/richtext', + 'rtf' => 'text/rtf', + 'xml' => 'text/xml', + 'xsl' => 'text/xml', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpe' => 'video/mpeg', + 'qt' => 'video/quicktime', + 'mov' => 'video/quicktime', + 'avi' => 'video/x-msvideo', + 'movie' => 'video/x-sgi-movie', + 'doc' => 'application/msword', + 'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip'), + 'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip'), + 'word' => array('application/msword', 'application/octet-stream'), + 'xl' => 'application/excel', + 'eml' => 'message/rfc822', + 'json' => array('application/json', 'text/json') + ); + + +/* End of file mimes.php */ +/* Location: ./application/config/mimes.php */ diff --git a/application/config/profiler.php b/application/config/profiler.php new file mode 100644 index 0000000..f8a5b1a --- /dev/null +++ b/application/config/profiler.php @@ -0,0 +1,17 @@ + array('grin.gif', '19', '19', 'grin'), + ':lol:' => array('lol.gif', '19', '19', 'LOL'), + ':cheese:' => array('cheese.gif', '19', '19', 'cheese'), + ':)' => array('smile.gif', '19', '19', 'smile'), + ';-)' => array('wink.gif', '19', '19', 'wink'), + ';)' => array('wink.gif', '19', '19', 'wink'), + ':smirk:' => array('smirk.gif', '19', '19', 'smirk'), + ':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'), + ':-S' => array('confused.gif', '19', '19', 'confused'), + ':wow:' => array('surprise.gif', '19', '19', 'surprised'), + ':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'), + ':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'), + '%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'), + ';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'), + ':P' => array('raspberry.gif', '19', '19', 'raspberry'), + ':blank:' => array('blank.gif', '19', '19', 'blank stare'), + ':long:' => array('longface.gif', '19', '19', 'long face'), + ':ohh:' => array('ohh.gif', '19', '19', 'ohh'), + ':grrr:' => array('grrr.gif', '19', '19', 'grrr'), + ':gulp:' => array('gulp.gif', '19', '19', 'gulp'), + '8-/' => array('ohoh.gif', '19', '19', 'oh oh'), + ':down:' => array('downer.gif', '19', '19', 'downer'), + ':red:' => array('embarrassed.gif', '19', '19', 'red face'), + ':sick:' => array('sick.gif', '19', '19', 'sick'), + ':shut:' => array('shuteye.gif', '19', '19', 'shut eye'), + ':-/' => array('hmm.gif', '19', '19', 'hmmm'), + '>:(' => array('mad.gif', '19', '19', 'mad'), + ':mad:' => array('mad.gif', '19', '19', 'mad'), + '>:-(' => array('angry.gif', '19', '19', 'angry'), + ':angry:' => array('angry.gif', '19', '19', 'angry'), + ':zip:' => array('zip.gif', '19', '19', 'zipper'), + ':kiss:' => array('kiss.gif', '19', '19', 'kiss'), + ':ahhh:' => array('shock.gif', '19', '19', 'shock'), + ':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'), + ':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'), + ':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'), + ':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'), + ':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'), + ':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'), + ':vampire:' => array('vampire.gif', '19', '19', 'vampire'), + ':snake:' => array('snake.gif', '19', '19', 'snake'), + ':exclaim:' => array('exclaim.gif', '19', '19', 'excaim'), + ':question:' => array('question.gif', '19', '19', 'question') // no comma after last item + + ); + +/* End of file smileys.php */ +/* Location: ./application/config/smileys.php */ \ No newline at end of file diff --git a/application/config/user_agents.php b/application/config/user_agents.php new file mode 100644 index 0000000..e2d3c3a --- /dev/null +++ b/application/config/user_agents.php @@ -0,0 +1,178 @@ + 'Windows Longhorn', + 'windows nt 5.2' => 'Windows 2003', + 'windows nt 5.0' => 'Windows 2000', + 'windows nt 5.1' => 'Windows XP', + 'windows nt 4.0' => 'Windows NT 4.0', + 'winnt4.0' => 'Windows NT 4.0', + 'winnt 4.0' => 'Windows NT', + 'winnt' => 'Windows NT', + 'windows 98' => 'Windows 98', + 'win98' => 'Windows 98', + 'windows 95' => 'Windows 95', + 'win95' => 'Windows 95', + 'windows' => 'Unknown Windows OS', + 'os x' => 'Mac OS X', + 'ppc mac' => 'Power PC Mac', + 'freebsd' => 'FreeBSD', + 'ppc' => 'Macintosh', + 'linux' => 'Linux', + 'debian' => 'Debian', + 'sunos' => 'Sun Solaris', + 'beos' => 'BeOS', + 'apachebench' => 'ApacheBench', + 'aix' => 'AIX', + 'irix' => 'Irix', + 'osf' => 'DEC OSF', + 'hp-ux' => 'HP-UX', + 'netbsd' => 'NetBSD', + 'bsdi' => 'BSDi', + 'openbsd' => 'OpenBSD', + 'gnu' => 'GNU/Linux', + 'unix' => 'Unknown Unix OS' + ); + + +// The order of this array should NOT be changed. Many browsers return +// multiple browser types so we want to identify the sub-type first. +$browsers = array( + 'Flock' => 'Flock', + 'Chrome' => 'Chrome', + 'Opera' => 'Opera', + 'MSIE' => 'Internet Explorer', + 'Internet Explorer' => 'Internet Explorer', + 'Shiira' => 'Shiira', + 'Firefox' => 'Firefox', + 'Chimera' => 'Chimera', + 'Phoenix' => 'Phoenix', + 'Firebird' => 'Firebird', + 'Camino' => 'Camino', + 'Netscape' => 'Netscape', + 'OmniWeb' => 'OmniWeb', + 'Safari' => 'Safari', + 'Mozilla' => 'Mozilla', + 'Konqueror' => 'Konqueror', + 'icab' => 'iCab', + 'Lynx' => 'Lynx', + 'Links' => 'Links', + 'hotjava' => 'HotJava', + 'amaya' => 'Amaya', + 'IBrowse' => 'IBrowse' + ); + +$mobiles = array( + // legacy array, old values commented out + 'mobileexplorer' => 'Mobile Explorer', +// 'openwave' => 'Open Wave', +// 'opera mini' => 'Opera Mini', +// 'operamini' => 'Opera Mini', +// 'elaine' => 'Palm', + 'palmsource' => 'Palm', +// 'digital paths' => 'Palm', +// 'avantgo' => 'Avantgo', +// 'xiino' => 'Xiino', + 'palmscape' => 'Palmscape', +// 'nokia' => 'Nokia', +// 'ericsson' => 'Ericsson', +// 'blackberry' => 'BlackBerry', +// 'motorola' => 'Motorola' + + // Phones and Manufacturers + 'motorola' => "Motorola", + 'nokia' => "Nokia", + 'palm' => "Palm", + 'iphone' => "Apple iPhone", + 'ipad' => "iPad", + 'ipod' => "Apple iPod Touch", + 'sony' => "Sony Ericsson", + 'ericsson' => "Sony Ericsson", + 'blackberry' => "BlackBerry", + 'cocoon' => "O2 Cocoon", + 'blazer' => "Treo", + 'lg' => "LG", + 'amoi' => "Amoi", + 'xda' => "XDA", + 'mda' => "MDA", + 'vario' => "Vario", + 'htc' => "HTC", + 'samsung' => "Samsung", + 'sharp' => "Sharp", + 'sie-' => "Siemens", + 'alcatel' => "Alcatel", + 'benq' => "BenQ", + 'ipaq' => "HP iPaq", + 'mot-' => "Motorola", + 'playstation portable' => "PlayStation Portable", + 'hiptop' => "Danger Hiptop", + 'nec-' => "NEC", + 'panasonic' => "Panasonic", + 'philips' => "Philips", + 'sagem' => "Sagem", + 'sanyo' => "Sanyo", + 'spv' => "SPV", + 'zte' => "ZTE", + 'sendo' => "Sendo", + + // Operating Systems + 'symbian' => "Symbian", + 'SymbianOS' => "SymbianOS", + 'elaine' => "Palm", + 'palm' => "Palm", + 'series60' => "Symbian S60", + 'windows ce' => "Windows CE", + + // Browsers + 'obigo' => "Obigo", + 'netfront' => "Netfront Browser", + 'openwave' => "Openwave Browser", + 'mobilexplorer' => "Mobile Explorer", + 'operamini' => "Opera Mini", + 'opera mini' => "Opera Mini", + + // Other + 'digital paths' => "Digital Paths", + 'avantgo' => "AvantGo", + 'xiino' => "Xiino", + 'novarra' => "Novarra Transcoder", + 'vodafone' => "Vodafone", + 'docomo' => "NTT DoCoMo", + 'o2' => "O2", + + // Fallback + 'mobile' => "Generic Mobile", + 'wireless' => "Generic Mobile", + 'j2me' => "Generic Mobile", + 'midp' => "Generic Mobile", + 'cldc' => "Generic Mobile", + 'up.link' => "Generic Mobile", + 'up.browser' => "Generic Mobile", + 'smartphone' => "Generic Mobile", + 'cellphone' => "Generic Mobile" + ); + +// There are hundreds of bots but these are the most common. +$robots = array( + 'googlebot' => 'Googlebot', + 'msnbot' => 'MSNBot', + 'slurp' => 'Inktomi Slurp', + 'yahoo' => 'Yahoo', + 'askjeeves' => 'AskJeeves', + 'fastcrawler' => 'FastCrawler', + 'infoseek' => 'InfoSeek Robot 1.0', + 'lycos' => 'Lycos' + ); + +/* End of file user_agents.php */ +/* Location: ./application/config/user_agents.php */ \ No newline at end of file diff --git a/application/controllers/CVS/Entries b/application/controllers/CVS/Entries new file mode 100644 index 0000000..4c4356c --- /dev/null +++ b/application/controllers/CVS/Entries @@ -0,0 +1,4 @@ +/account.php/1.2/Sat Nov 17 20:17:53 2012// +/arcade.php/1.1/Fri Nov 16 22:24:35 2012// +/combat.php/-1.2/Sat Nov 17 18:08:20 2012// +/index.html/1.1/Tue Nov 13 17:11:16 2012// diff --git a/application/controllers/CVS/Repository b/application/controllers/CVS/Repository new file mode 100644 index 0000000..8c9c053 --- /dev/null +++ b/application/controllers/CVS/Repository @@ -0,0 +1 @@ +csc309Login_empty/application/controllers diff --git a/application/controllers/CVS/Root b/application/controllers/CVS/Root new file mode 100644 index 0000000..f99f405 --- /dev/null +++ b/application/controllers/CVS/Root @@ -0,0 +1 @@ +:extssh:delara@syslab.cs.toronto.edu:/home/delara/Teaching/cvsroot diff --git a/application/controllers/CVS/Template b/application/controllers/CVS/Template new file mode 100644 index 0000000..e69de29 diff --git a/application/controllers/account.php b/application/controllers/account.php new file mode 100644 index 0000000..00150c0 --- /dev/null +++ b/application/controllers/account.php @@ -0,0 +1,198 @@ +load->view('account/loginForm'); + } + + function login() { + $this->load->library('form_validation'); + $this->form_validation->set_rules('username', 'Username', 'required'); + $this->form_validation->set_rules('password', 'Password', 'required'); + + if ($this->form_validation->run() == FALSE) + { + $this->load->view('account/loginForm'); + } + else + { + $login = $this->input->post('username'); + $clearPassword = $this->input->post('password'); + + $this->load->model('user_model'); + + $user = $this->user_model->get($login); + + if (isset($user) && $user->comparePassword($clearPassword)) { + $_SESSION['user'] = $user; + $data['user']=$user; + + $this->user_model->updateStatus($user->id, User::AVAILABLE); + + redirect('arcade/index', 'refresh'); //redirect to the main application page + } + else { + $data['errorMsg']='Incorrect username or password!'; + $this->load->view('account/loginForm',$data); + } + } + } + + function logout() { + $user = $_SESSION['user']; + $this->load->model('user_model'); + $this->user_model->updateStatus($user->id, User::OFFLINE); + session_destroy(); + redirect('account/index', 'refresh'); //Then we redirect to the index page again + } + + function newForm() { + $this->load->view('account/newForm'); + } + + function createNew() { + $this->load->library('form_validation'); + $this->form_validation->set_rules('username', 'Username', 'required|is_unique[user.login]'); + $this->form_validation->set_rules('password', 'Password', 'required'); + $this->form_validation->set_rules('first', 'First', "required"); + $this->form_validation->set_rules('last', 'last', "required"); + $this->form_validation->set_rules('email', 'Email', "required|is_unique[user.email]"); + + + if ($this->form_validation->run() == FALSE) + { + $this->load->view('account/newForm'); + } + else + { + $user = new User(); + + $user->login = $this->input->post('username'); + $user->first = $this->input->post('first'); + $user->last = $this->input->post('last'); + $clearPassword = $this->input->post('password'); + $user->encryptPassword($clearPassword); + $user->email = $this->input->post('email'); + + $this->load->model('user_model'); + + + $error = $this->user_model->insert($user); + + $this->load->view('account/loginForm'); + } + } + + + function updatePasswordForm() { + $this->load->view('account/updatePasswordForm'); + } + + function updatePassword() { + $this->load->library('form_validation'); + $this->form_validation->set_rules('oldPassword', 'Old Password', 'required'); + $this->form_validation->set_rules('newPassword', 'New Password', 'required'); + + + if ($this->form_validation->run() == FALSE) + { + $this->load->view('account/updatePasswordForm'); + } + else + { + $user = $_SESSION['user']; + + $oldPassword = $this->input->post('oldPassword'); + $newPassword = $this->input->post('newPassword'); + + if ($user->comparePassword($oldPassword)) { + $user->encryptPassword($newPassword); + $this->load->model('user_model'); + $this->user_model->updatePassword($user); + redirect('arcade/index', 'refresh'); //Then we redirect to the index page again + } + else { + $data['errorMsg']="Incorrect password!"; + $this->load->view('account/updatePasswordForm',$data); + } + } + } + + function recoverPasswordForm() { + $this->load->view('account/recoverPasswordForm'); + } + + function recoverPassword() { + $this->load->library('form_validation'); + $this->form_validation->set_rules('email', 'email', 'required'); + + if ($this->form_validation->run() == FALSE) + { + $this->load->view('account/recoverPasswordForm'); + } + else + { + $email = $this->input->post('email'); + $this->load->model('user_model'); + $user = $this->user_model->getFromEmail($email); + + if (isset($user)) { + $newPassword = $user->initPassword(); + $this->user_model->updatePassword($user); + + $this->load->library('email'); + + $config['protocol'] = 'smtp'; + $config['smtp_host'] = 'ssl://smtp.gmail.com'; + $config['smtp_port'] = '465'; + $config['smtp_timeout'] = '7'; + $config['smtp_user'] = 'your gmail user name'; + $config['smtp_pass'] = 'your gmail password'; + $config['charset'] = 'utf-8'; + $config['newline'] = "\r\n"; + $config['mailtype'] = 'text'; // or html + $config['validation'] = TRUE; // bool whether to validate email or not + + $this->email->initialize($config); + + $this->email->from('csc309Login@cs.toronto.edu', 'Login App'); + $this->email->to($user->email); + + $this->email->subject('Password recovery'); + $this->email->message("Your new password is $newPassword"); + + $result = $this->email->send(); + + //$data['errorMsg'] = $this->email->print_debugger(); + + //$this->load->view('emailPage',$data); + $this->load->view('account/emailPage'); + + } + else { + $data['errorMsg']="No record exists for this email!"; + $this->load->view('account/recoverPasswordForm',$data); + } + } + } + } + diff --git a/application/controllers/arcade.php b/application/controllers/arcade.php new file mode 100644 index 0000000..a4b6e22 --- /dev/null +++ b/application/controllers/arcade.php @@ -0,0 +1,251 @@ +load->view('arcade/mainPage',$data); + } + + function getAvailableUsers() { + $this->load->model('user_model'); + $users = $this->user_model->getAvailableUsers(); + $data['users']=$users; + $data['currentUser']=$_SESSION['user']; + $this->load->view('arcade/availableUsers',$data); + } + + function getInvitation() { + $user = $_SESSION['user']; + + $this->load->model('user_model'); + $user = $this->user_model->get($user->login); + + // if the current user has been invited to match + if ($user->user_status_id == User::INVITED) { + $this->load->model('invite_model'); + $invite = $this->invite_model->get($user->invite_id); + $hostUser = $this->user_model->getFromId($invite->user1_id); + + $msg = array('invited'=>true,'login'=>$hostUser->login); + echo json_encode($msg); + } + else { + $msg = array('invited'=>false); + echo json_encode($msg); + } + } + + function acceptInvitation() { + $user = $_SESSION['user']; + + $this->load->model('user_model'); + $this->load->model('invite_model'); + $this->load->model('match_model'); + + + $user = $this->user_model->get($user->login); + + $invite = $this->invite_model->get($user->invite_id); + $hostUser = $this->user_model->getFromId($invite->user1_id); + + + // start transactional mode + $this->db->trans_begin(); + + // change status of invitation to ACCEPTED + $this->invite_model->updateStatus($invite->id,Invite::ACCEPTED); + + + // create a match entry + $match = new Match(); + $match->user1_id = $user->id; + $match->user2_id = $hostUser->id; + $this->match_model->insert($match); + $matchId = mysql_insert_id(); + + // update status of both users + $this->user_model->updateStatus($user->id,User::PLAYING); + $this->user_model->updateStatus($hostUser->id,User::PLAYING); + + $this->user_model->updateMatch($user->id,$matchId); + $this->user_model->updateMatch($hostUser->id,$matchId); + + + if ($this->db->trans_status() === FALSE) + goto transactionerror; + + // if all went well commit changes + $this->db->trans_commit(); + + echo json_encode(array('status'=>'success')); + + return; + + // something went wrong + transactionerror: + $this->db->trans_rollback(); + + echo json_encode(array('status'=>'failure')); + + + } + + function declineInvitation() { + $user = $_SESSION['user']; + + $this->load->model('user_model'); + $this->load->model('invite_model'); + + $user = $this->user_model->get($user->login); + $invite = $this->invite_model->get($user->invite_id); + + // start transactional mode + $this->db->trans_begin(); + + // change status of invitation to REJECTED + $this->invite_model->updateStatus($invite->id,Invite::REJECTED); + + // update status + $this->user_model->updateStatus($user->id,User::AVAILABLE); + + if ($this->db->trans_status() === FALSE) + goto transactionerror; + + // if all went well commit changes + $this->db->trans_commit(); + + echo json_encode(array('status'=>'success')); + + return; + + // something went wrong + transactionerror: + $this->db->trans_rollback(); + + echo json_encode(array('status'=>'failure')); + } + + function checkInvitation() { + $user = $_SESSION['user']; + + $this->load->model('user_model'); + $this->load->model('invite_model'); + + $user = $this->user_model->get($user->login); + + $invite = $this->invite_model->get($user->invite_id); + + switch($invite->invite_status_id) { + case Invite::ACCEPTED: + echo json_encode(array('status'=>'accepted')); + break; + case Invite::PENDING: + echo json_encode(array('status'=>'pending')); + break; + case Invite::REJECTED: + $this->user_model->updateStatus($user->id,User::AVAILABLE); + echo json_encode(array('status'=>'rejected')); + } + } + + + function invite() { + try { + $login = $this->input->get('login'); + + if (!isset($login)) + goto loginerror; + + $user1 = $_SESSION['user']; + $user2 = null; + + $this->load->model('user_model'); + $this->load->model('invite_model'); + + // start transactional mode + $this->db->trans_begin(); + + + // lock both user records in alphabetic order to prevent deadlocks + if (strcmp($user1->login, $login) < 0) { + $user1 = $this->user_model->getExclusive($user1->login); + $user2 = $this->user_model->getExclusive($login); + } + else { + $user2 = $this->user_model->getExclusive($login); + $user1 = $this->user_model->getExclusive($user1->login); + } + + if (!isset($user2) || $user2->user_status_id != User::AVAILABLE) + goto nouser2; + + // update status of both users + $this->user_model->updateStatus($user1->id,User::WAITING); + $this->user_model->updateStatus($user2->id,User::INVITED); + + // create an invite entry + $invite = new Invite(); + $invite->user1_id = $user1->id; + $invite->user2_id = $user2->id; + + $this->invite_model->insert($invite); + + $inviteId = mysql_insert_id(); + + $this->user_model->updateInvitation($user1->id,$inviteId); + $this->user_model->updateInvitation($user2->id,$inviteId); + + + if ($this->db->trans_status() === FALSE) + goto transactionerror; + + + // if all went well commit changes + $this->db->trans_commit(); + + redirect('board/index', 'refresh'); //redirect to match stage + + + + return; + + // something went wrong + transactionerror: + nouser2: + $this->db->trans_rollback(); + + loginerror: + + $_SESSION["errmsg"] = "Sorry, this user is no longer available."; + + redirect('arcade/index', 'refresh'); //redirect to the main application page + } + catch(Exception $e) { + $this->db->trans_rollback(); + } + + } + + } + diff --git a/application/controllers/board.php b/application/controllers/board.php new file mode 100644 index 0000000..8999c4f --- /dev/null +++ b/application/controllers/board.php @@ -0,0 +1,143 @@ +load->model('user_model'); + $this->load->model('invite_model'); + $this->load->model('match_model'); + + $user = $this->user_model->get($user->login); + + $invite = $this->invite_model->get($user->invite_id); + + if ($user->user_status_id == User::WAITING) { + $invite = $this->invite_model->get($user->invite_id); + $otherUser = $this->user_model->getFromId($invite->user2_id); + } + else if ($user->user_status_id == User::PLAYING) { + $match = $this->match_model->get($user->match_id); + if ($match->user1_id == $user->id) + $otherUser = $this->user_model->getFromId($match->user2_id); + else + $otherUser = $this->user_model->getFromId($match->user1_id); + } + + $data['user']=$user; + $data['otherUser']=$otherUser; + + switch($user->user_status_id) { + case User::PLAYING: + $data['status'] = 'playing'; + break; + case User::WAITING: + $data['status'] = 'waiting'; + break; + } + + $this->load->view('match/board',$data); + } + + function postMsg() { + $this->load->library('form_validation'); + $this->form_validation->set_rules('msg', 'Message', 'required'); + + if ($this->form_validation->run() == TRUE) { + $this->load->model('user_model'); + $this->load->model('match_model'); + + $user = $_SESSION['user']; + + $user = $this->user_model->getExclusive($user->login); + if ($user->user_status_id != User::PLAYING) { + $errormsg="Not in PLAYING state"; + goto error; + } + + $match = $this->match_model->get($user->match_id); + + $msg = $this->input->post('msg'); + + if ($match->user1_id == $user->id) { + $msg = $match->u1_msg == ''? $msg : $match->u1_msg . "\n" . $msg; + $this->match_model->updateMsgU1($match->id, $msg); + } + else { + $msg = $match->u2_msg == ''? $msg : $match->u2_msg . "\n" . $msg; + $this->match_model->updateMsgU2($match->id, $msg); + } + + echo json_encode(array('status'=>'success')); + + return; + } + + $errormsg="Missing argument"; + + error: + echo json_encode(array('status'=>'failure','message'=>$errormsg)); + } + + function getMsg() { + $this->load->model('user_model'); + $this->load->model('match_model'); + + $user = $_SESSION['user']; + + $user = $this->user_model->get($user->login); + if ($user->user_status_id != User::PLAYING) { + $errormsg="Not in PLAYING state"; + goto error; + } + // start transactional mode + $this->db->trans_begin(); + + $match = $this->match_model->getExclusive($user->match_id); + + if ($match->user1_id == $user->id) { + $msg = $match->u2_msg; + $this->match_model->updateMsgU2($match->id,""); + } + else { + $msg = $match->u1_msg; + $this->match_model->updateMsgU1($match->id,""); + } + + if ($this->db->trans_status() === FALSE) { + $errormsg = "Transaction error"; + goto transactionerror; + } + + // if all went well commit changes + $this->db->trans_commit(); + + echo json_encode(array('status'=>'success','message'=>$msg)); + return; + + transactionerror: + $this->db->trans_rollback(); + + error: + echo json_encode(array('status'=>'failure','message'=>$errormsg)); + } + + } + diff --git a/application/controllers/index.html b/application/controllers/index.html new file mode 100644 index 0000000..c942a79 --- /dev/null +++ b/application/controllers/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/application/index.html b/application/index.html new file mode 100644 index 0000000..c942a79 --- /dev/null +++ b/application/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/application/models/CVS/Entries b/application/models/CVS/Entries new file mode 100644 index 0000000..b91c8ee --- /dev/null +++ b/application/models/CVS/Entries @@ -0,0 +1,7 @@ +/battle.php/-1.2/Sat Nov 17 16:15:24 2012// +/battle_model.php/-1.2/Sat Nov 17 14:04:02 2012// +/index.html/1.1/Tue Nov 13 17:11:16 2012// +/invite.php/1.1/Fri Nov 16 01:46:06 2012// +/invite_model.php/1.1/Fri Nov 16 01:48:12 2012// +/user.php/1.1/Fri Nov 16 14:51:21 2012// +/user_model.php/1.2/Sat Nov 17 14:04:15 2012// diff --git a/application/models/CVS/Repository b/application/models/CVS/Repository new file mode 100644 index 0000000..fec375e --- /dev/null +++ b/application/models/CVS/Repository @@ -0,0 +1 @@ +csc309Login_empty/application/models diff --git a/application/models/CVS/Root b/application/models/CVS/Root new file mode 100644 index 0000000..f99f405 --- /dev/null +++ b/application/models/CVS/Root @@ -0,0 +1 @@ +:extssh:delara@syslab.cs.toronto.edu:/home/delara/Teaching/cvsroot diff --git a/application/models/CVS/Template b/application/models/CVS/Template new file mode 100644 index 0000000..e69de29 diff --git a/application/models/board.php b/application/models/board.php new file mode 100644 index 0000000..83e8912 --- /dev/null +++ b/application/models/board.php @@ -0,0 +1,113 @@ +6){ + return 'error'; + } + if ($this->board[$column][5]!=0){ + return 'error'; + } + // calculate row number + foreach (array(0,1,2,3,4,5) as $row){ + if ($this->board[$column][$row]==0){ + break; + } + } + // update board + $this->board[$column][$row] = $usernum; + + // update win + $victory = false; + // check row + $counter = 0; + foreach (array(0,1,2,3,4,5,6) as $i){ + if ($this->board[$i][$row]==$usernum){ + $counter++; + if ($counter>=4){ + $victory = true; + } + } else { + $counter = 0; + } + } + // check column + $counter = 0; + foreach (array(0,1,2,3,4,5) as $i){ + if ($this->board[$column][$i]==$usernum){ + $counter++; + if ($counter>=4){ + $victory = true; + } + } else { + $counter = 0; + } + } + // check / diagonal + $counter = 0; + foreach (array(0,1,2,3,4,5) as $r){ + $c=$r+$column-$row; + if ($c>=0 && $c<=6){ + if ($this->board[$c][$r]==$usernum){ + $counter++; + if ($counter>=4){ + $victory = true; + } + } else { + $counter = 0; + } + } + } + // check \ diagonal + $counter = 0; + foreach (array(0,1,2,3,4,5) as $r){ + $c=$column+$row-$r; + if ($c>=0 && $c<=6){ + if ($this->board[$c][$r]==$usernum){ + $counter++; + if ($counter>=4){ + $victory = true; + } + } else { + $counter = 0; + } + } + } + // save result + if ($victory){ + $win = $usernum; + } + } + +} \ No newline at end of file diff --git a/application/models/index.html b/application/models/index.html new file mode 100644 index 0000000..c942a79 --- /dev/null +++ b/application/models/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/application/models/invite.php b/application/models/invite.php new file mode 100644 index 0000000..651c1b9 --- /dev/null +++ b/application/models/invite.php @@ -0,0 +1,15 @@ +db->where('id',$id); + $query = $this->db->get('invite'); + if ($query && $query->num_rows() > 0) + return $query->row(0,'Invite'); + else + return null; + } + + function getUser1($userId) { + $this->db->where('user1_id',$userId); + $query = $this->db->get('invite'); + if ($query && $query->num_rows() > 0) + return $query->row(0,'Invite'); + else + return null; + } + + function getUser2($userId) { + $this->db->where('user2_id',$userId); + $query = $this->db->get('invite'); + if ($query && $query->num_rows() > 0) + return $query->row(0,'Invite'); + else + return null; + } + + + function insert($invite) { + return $this->db->insert('invite',$invite); + } + + + function updateStatus($id, $status) { + $this->db->where('id',$id); + return $this->db->update('invite',array('invite_status_id'=>$status)); + } + +} +?> \ No newline at end of file diff --git a/application/models/match.php b/application/models/match.php new file mode 100644 index 0000000..3ebbf68 --- /dev/null +++ b/application/models/match.php @@ -0,0 +1,19 @@ +db->query($sql,array($id)); + if ($query && $query->num_rows() > 0) + return $query->row(0,'Match'); + else + return null; + } + + function get($id) + { + $this->db->where('id',$id); + $query = $this->db->get('match'); + if ($query && $query->num_rows() > 0) + return $query->row(0,'Match'); + else + return null; + } + + + function insert($match) { + return $this->db->insert('match',$match); + } + + + function updateMsgU1($id,$msg) { + $this->db->where('id',$id); + return $this->db->update('match',array('u1_msg'=>$msg)); + } + + function updateMsgU2($id,$msg) { + $this->db->where('id',$id); + return $this->db->update('match',array('u2_msg'=>$msg)); + } + + function updateStatus($id, $status) { + $this->db->where('id',$id); + return $this->db->update('match',array('match_status_id'=>$status)); + } + +} +?> \ No newline at end of file diff --git a/application/models/user.php b/application/models/user.php new file mode 100644 index 0000000..eec0bc1 --- /dev/null +++ b/application/models/user.php @@ -0,0 +1,47 @@ +salt = mt_rand(); + $this->password = sha1($this->salt . $clearPassword); + } + + + // Initializes the password to a random value + public function initPassword() { + $this->salt = mt_rand(); + $clearPassword = mt_rand(); + $this->password = sha1($this->salt . $clearPassword); + return $clearPassword; + } + + public function comparePassword($clearPassword) { + if ($this->password == sha1($this->salt . $clearPassword)) + return true; + return false; + } + + public function fullName() { + return $this->first . " " . $this->last; + } + +} \ No newline at end of file diff --git a/application/models/user_model.php b/application/models/user_model.php new file mode 100644 index 0000000..6b68b06 --- /dev/null +++ b/application/models/user_model.php @@ -0,0 +1,81 @@ +db->where('login',$username); + $query = $this->db->get('user'); + if ($query && $query->num_rows() > 0) + return $query->row(0,'User'); + else + return null; + } + + function getFromId($id) + { + $this->db->where('id',$id); + $query = $this->db->get('user'); + if ($query && $query->num_rows() > 0) + return $query->row(0,'User'); + else + return null; + } + + function getFromEmail($email) + { + $this->db->where('email',$email); + $query = $this->db->get('user'); + if ($query && $query->num_rows() > 0) + return $query->row(0,'User'); + else + return null; + } + + function insert($user) { + return $this->db->insert('user',$user); + } + + function updatePassword($user) { + $this->db->where('id',$user->id); + return $this->db->update('user',array('password'=>$user->password, + 'salt' => $user->salt)); + } + + function updateStatus($id, $status) { + $this->db->where('id',$id); + return $this->db->update('user',array('user_status_id'=>$status)); + } + + function updateInvitation($id, $invitationId) { + $this->db->where('id',$id); + return $this->db->update('user',array('invite_id'=>$invitationId)); + } + + function updateMatch($id, $matchId) { + $this->db->where('id',$id); + return $this->db->update('user',array('match_id'=>$matchId)); + } + + + function getAvailableUsers() { + $this->db->where('user_status_id',User::AVAILABLE); + $query = $this->db->get('user'); + if ($query && $query->num_rows() > 0) + return $query->result('User'); + else + return null; + } + + function getExclusive($username) + { + $sql = "select * from user where login=? for update"; + $query = $this->db->query($sql,array($username)); + if ($query && $query->num_rows() > 0) + return $query->row(0,'User'); + else + return null; + } + + +} +?> \ No newline at end of file diff --git a/application/views/CVS/Entries b/application/views/CVS/Entries new file mode 100644 index 0000000..e7a85af --- /dev/null +++ b/application/views/CVS/Entries @@ -0,0 +1,4 @@ +D/account//// +D/arcade//// +D/battle//// +/index.html/1.1/Tue Nov 13 17:11:16 2012// diff --git a/application/views/CVS/Repository b/application/views/CVS/Repository new file mode 100644 index 0000000..cb1fecb --- /dev/null +++ b/application/views/CVS/Repository @@ -0,0 +1 @@ +csc309Login_empty/application/views diff --git a/application/views/CVS/Root b/application/views/CVS/Root new file mode 100644 index 0000000..f99f405 --- /dev/null +++ b/application/views/CVS/Root @@ -0,0 +1 @@ +:extssh:delara@syslab.cs.toronto.edu:/home/delara/Teaching/cvsroot diff --git a/application/views/CVS/Template b/application/views/CVS/Template new file mode 100644 index 0000000..e69de29 diff --git a/application/views/account/CVS/Entries b/application/views/account/CVS/Entries new file mode 100644 index 0000000..73644a9 --- /dev/null +++ b/application/views/account/CVS/Entries @@ -0,0 +1,5 @@ +/emailPage.php/1.1/Wed Nov 14 17:24:15 2012// +/loginForm.php/1.1/Wed Nov 14 17:24:48 2012// +/newForm.php/1.1/Wed Nov 14 17:25:11 2012// +/recoverPasswordForm.php/1.1/Wed Nov 14 17:25:39 2012// +/updatePasswordForm.php/1.1/Wed Nov 14 17:25:39 2012// diff --git a/application/views/account/CVS/Repository b/application/views/account/CVS/Repository new file mode 100644 index 0000000..d6f3f4b --- /dev/null +++ b/application/views/account/CVS/Repository @@ -0,0 +1 @@ +csc309Login_empty/application/views/account diff --git a/application/views/account/CVS/Root b/application/views/account/CVS/Root new file mode 100644 index 0000000..f99f405 --- /dev/null +++ b/application/views/account/CVS/Root @@ -0,0 +1 @@ +:extssh:delara@syslab.cs.toronto.edu:/home/delara/Teaching/cvsroot diff --git a/application/views/account/CVS/Template b/application/views/account/CVS/Template new file mode 100644 index 0000000..e69de29 diff --git a/application/views/account/emailPage.php b/application/views/account/emailPage.php new file mode 100644 index 0000000..ac498f6 --- /dev/null +++ b/application/views/account/emailPage.php @@ -0,0 +1,31 @@ + + + + + + + + + +

Password Recovery

+ +

Please check your email for your new password. +

+ + + +" . $errorMsg . "

"; + } + + echo "

" . anchor('account/index','Login') . "

"; +?> + + + + diff --git a/application/views/account/loginForm.php b/application/views/account/loginForm.php new file mode 100644 index 0000000..037df6a --- /dev/null +++ b/application/views/account/loginForm.php @@ -0,0 +1,41 @@ + + + + + + + + + +

Login

+" . $errorMsg . "

"; + } + + + echo form_open('account/login'); + echo form_label('Username'); + echo form_error('username'); + echo form_input('username',set_value('username'),"required"); + echo form_label('Password'); + echo form_error('password'); + echo form_password('password','',"required"); + + echo form_submit('submit', 'Login'); + + echo "

" . anchor('account/newForm','Create Account') . "

"; + + echo "

" . anchor('account/recoverPasswordForm','Recover Password') . "

"; + + + echo form_close(); +?> + + + + diff --git a/application/views/account/newForm.php b/application/views/account/newForm.php new file mode 100644 index 0000000..0ec6045 --- /dev/null +++ b/application/views/account/newForm.php @@ -0,0 +1,56 @@ + + + + + + + + + + +

New Account

+ + + + + diff --git a/application/views/account/recoverPasswordForm.php b/application/views/account/recoverPasswordForm.php new file mode 100644 index 0000000..8763614 --- /dev/null +++ b/application/views/account/recoverPasswordForm.php @@ -0,0 +1,30 @@ + + + + + + + + + +

Recover Password

+" . $errorMsg . "

"; + } + + echo form_open('account/recoverPassword'); + echo form_label('Email'); + echo form_error('email'); + echo form_input('email',set_value('email'),"required"); + echo form_submit('submit', 'Recover Password'); + echo form_close(); +?> + + + + diff --git a/application/views/account/updatePasswordForm.php b/application/views/account/updatePasswordForm.php new file mode 100644 index 0000000..a83ca12 --- /dev/null +++ b/application/views/account/updatePasswordForm.php @@ -0,0 +1,51 @@ + + + + + + + + + + +

Change Password

+" . $errorMsg . "

"; + } + + echo form_open('account/updatePassword'); + echo form_label('Current Password'); + echo form_error('oldPassword'); + echo form_password('oldPassword',set_value('oldPassword'),"required"); + echo form_label('New Password'); + echo form_error('newPassword'); + echo form_password('newPassword','',"id='pass1' required"); + echo form_label('Password Confirmation'); + echo form_error('passconf'); + echo form_password('passconf','',"id='pass2' required oninput='checkPassword();'"); + echo form_submit('submit', 'Change Password'); + echo form_close(); +?> + + + + diff --git a/application/views/arcade/CVS/Entries b/application/views/arcade/CVS/Entries new file mode 100644 index 0000000..a0d2aec --- /dev/null +++ b/application/views/arcade/CVS/Entries @@ -0,0 +1,2 @@ +/availableUsers.php/1.1/Fri Nov 16 15:00:13 2012// +/mainPage.php/1.2/Sat Nov 17 18:47:42 2012// diff --git a/application/views/arcade/CVS/Repository b/application/views/arcade/CVS/Repository new file mode 100644 index 0000000..64c99e8 --- /dev/null +++ b/application/views/arcade/CVS/Repository @@ -0,0 +1 @@ +csc309Login_empty/application/views/arcade diff --git a/application/views/arcade/CVS/Root b/application/views/arcade/CVS/Root new file mode 100644 index 0000000..f99f405 --- /dev/null +++ b/application/views/arcade/CVS/Root @@ -0,0 +1 @@ +:extssh:delara@syslab.cs.toronto.edu:/home/delara/Teaching/cvsroot diff --git a/application/views/arcade/CVS/Template b/application/views/arcade/CVS/Template new file mode 100644 index 0000000..e69de29 diff --git a/application/views/arcade/availableUsers.php b/application/views/arcade/availableUsers.php new file mode 100644 index 0000000..7b0efb1 --- /dev/null +++ b/application/views/arcade/availableUsers.php @@ -0,0 +1,20 @@ + + +id != $currentUser->id) { +?> + + + + + + +
+ login,$user->fullName()) ?> +
\ No newline at end of file diff --git a/application/views/arcade/mainPage.php b/application/views/arcade/mainPage.php new file mode 100644 index 0000000..bfde104 --- /dev/null +++ b/application/views/arcade/mainPage.php @@ -0,0 +1,53 @@ + + + + + + + + + + + + +

Connect 4

+ +
+ Hello fullName() ?> +
+ +$errmsg

"; +?> +

Available Users

+
+
+ + + + + + + diff --git a/application/views/index.html b/application/views/index.html new file mode 100644 index 0000000..c942a79 --- /dev/null +++ b/application/views/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/application/views/match/board.php b/application/views/match/board.php new file mode 100644 index 0000000..1a93f2a --- /dev/null +++ b/application/views/match/board.php @@ -0,0 +1,87 @@ + + + + + + + + + + +

Game Area

+ +
+ Hello fullName() ?> +
+ +
+ login; + else + echo "Wating on " . $otherUser->login; + ?> +
+ + + + + + + + + + diff --git a/css/.DS_Store b/css/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/css/.DS_Store differ diff --git a/css/.gitignore b/css/.gitignore new file mode 100644 index 0000000..a644f54 --- /dev/null +++ b/css/.gitignore @@ -0,0 +1 @@ +/CVS diff --git a/css/template.css b/css/template.css new file mode 100644 index 0000000..25397a3 --- /dev/null +++ b/css/template.css @@ -0,0 +1,53 @@ + body{ + background-image:url('http://localhost/csc309db/images/dcs_logo.png'); + background-repeat:no-repeat; + background-size:200px; + font-family: Arial, Verdana, sans-serif; + margin:0; + padding:0; + } + + + input,label { + display: block; + } + + + h1 { + font-size:2em; + color: green; + } + + h2{ + font-size:1em; + color: blue; + } + + #header{ + font-size:12px; + width: 700px; + height: 50px; + } + + #header > h1 { + text-align:center + } + + #nav{ + padding: 5pt; + position: absolute; + width:130px; + height: 800px; + font-size: 10pt; + border:1px solid #31363E; + background: lightgray; + } + + #main{ + margin-left:160px; + width:540px; + height:800px; + background: white; + } + +