diff --git a/scripts/emptyregistrations.php b/scripts/emptyregistrations.php new file mode 100644 index 0000000..9eda8a8 --- /dev/null +++ b/scripts/emptyregistrations.php @@ -0,0 +1,38 @@ + + Copyright (C) 2005 James Grant + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation, version 2. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +?> +1) +{ + echo "TRUNCATING TABLE DATA....\n"; + mysql_query("TRUNCATE TABLE registrations"); + mysql_query("TRUNCATE TABLE students"); + mysql_query("TRUNCATE TABLE projects"); + echo "DONE.\n\n"; +} +?> diff --git a/scripts/populate_fake.php b/scripts/populate_fake.php index a0e7434..73b9c5f 100644 --- a/scripts/populate_fake.php +++ b/scripts/populate_fake.php @@ -73,8 +73,8 @@ for($x=0;$x<$numprojects;$x++) if($peeps==1) $num=2; else $num=1; $gradenum=rand(1,10); - if($gradenum<6) { $grade=rand(7,8); $cat=1;} - else if($gradenum<8) { $grade=rand(9,10); $cat=2; } + if($gradenum<7) { $grade=rand(7,8); $cat=1;} + else if($gradenum<9) { $grade=rand(9,10); $cat=2; } else if($gradenum<10) { $grade=rand(11,12); $cat=3; } $schools_id=$schools[rand(0,$ns)]; @@ -84,7 +84,9 @@ for($x=0;$x<$numprojects;$x++) $sexnum=rand(1,3); if($sexnum<3) $sex="male"; else $sex="female"; - mysql_query("INSERT INTO students (registrations_id,firstname,lastname,sex,grade,year,schools_id) VALUES ('$id','".getrand($firstnames)."','".getrand($lastnames)."','$sex','$grade','2007','$schools_id')"); + $firstname=getrand($firstnames); + $email=strtolower($firstname)."@".getrand($domains); + mysql_query("INSERT INTO students (registrations_id,firstname,lastname,email,sex,grade,year,schools_id) VALUES ('$id','$firstname','".getrand($lastnames)."','$email','$sex','$grade','2007','$schools_id')"); }