SQLlogin.php 1.55 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/*
to import, use "source ..." use full path, dont use ";", use ".sql" @ the end

to describe a table in mysql:
	mysql> desc employee;

to describe in green geeks:

table> select a table> structure

checked tables:
	employee
		change pw to a 64 byte hash
			https://stackoverflow.com/questions/14722305/what-kind-of-datatype-should-one-use-to-store-hashes
			use sha2_512 for PW hashes
			https://stackoverflow.com/questions/1966154/sha-512-library-for-php
	jobs

	market
	schedule is the same, but add some fields to it
		EMP_ID here is the admin
	shift
		chttp://php.net/manual/en/function.mktime.php
		mktime gets a timestamp for a time



to add to schedule:
	
	-delete accounts that never set the password through the email
		add a cron job to delete fake user accounts:
		https://code.tutsplus.com/tutorials/managing-cron-jobs-with-php--net-19428




this page connects to the SQL server. It includes 
the username and password, which are private.
Hence, it won't be put on the public web server.

http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers
*/
include_once(dirname(__FILE__)."../configNuts.php");

function SQLlogin(){
	$server = "localhost";
	$username = "root";
	$password = "root";

	if(strstr(PHP_ROOT,"nuts") === FALSE){
		//greengeeks credentials

		$server = "mynutrients123.com";
		$username = "sellmysh";
		$password = "j8C4Rrh5f9";
		
	}
	$con = new mysqli($server,$username,$password);
	$con->select_db("sellmysh_nuts");//TRUE on success, FALSE on fail
	return $con;
}

/*
closes the connection
*/
function SQLclose($conn){
	$conn->close();
}


?>