<?php

if(include("../includes/SQLConnect.php")){

?><h1>Installer</h1>


<p>
	
	After this script completes, you'll want to delete it. You'll also want to make an administrator account by signing up for an account and then editing the "admin_flag" column for that created account.

</p>
<p>
	
	If you see any FAILURE messages below, the install script failed. You'll want to run the SQL commands found in install_sql/ (a.sql, b.sql, c.sql). If you can't get those scripts to insert the Representatives table (it's rather large), you can insert the rows using the PHP files found in data/.
	
</p>

<p>

	Attempting to create contribution tables, representatives and districts....

</p>
<?php


	//Create first half of tables
	if(mysql_query(file_get_contents("install_sql/a.sql")))
		echo "First part (a.sql) succeedeed";
	else
		echo "<b>FAILURE</b>";
	
	//Create second half of tables
	if(mysql_query(file_get_contents("install_sql/b.sql")))
		echo "First part (a.sql) succeedeed";
	else
		echo "<b>FAILURE</b>";
	
	//Insert Representative data
	if(mysql_query(file_get_contents("install_sql/c.sql")))
		echo "First part (a.sql) succeedeed";
	else
		echo "<b>FAILURE</b>";

	?>
		<p>The next step you'll want to take is to change the headings in various places to suit your own needs. Same goes for logos, footers and anything else you'd like to adapt.
		</p>
		<p>The last step is to download the Govtrack.us photo assets to /assets/photos/photos/ as per the instructions here: http://www.govtrack.us/developers/data.xpd</P>
	<?php
}
else
	echo "Could not write to database. You probably do not have sufficient permissions.";
	
}
else{
	exit("Please create the SQLConnect.php file. You'll find the sample file here: includes/sample.SQLConnect.php");
}