-
Notifications
You must be signed in to change notification settings - Fork 0
/
userfeatures.php
151 lines (118 loc) · 4.01 KB
/
userfeatures.php
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php
function get_all_users() {
global $db_connection;
$u_name_q = "select ID, username, email from users";
////
$q_result = @mysqli_query($db_connection,$u_name_q) or die (mysqli_error($db_connection)); //
////
return($q_result);
}
function find_user_name_id($username) {
$u_id_q = "select ID from users where ( username = '$username')";
$id = db_query_value($u_id_q);
return $id;
}
function find_user_name($username) {
$result = true;
$u_name_q = "select count(*) from users where ( username = '";
$u_name_q .= trim($username);
$u_name_q .= "')";
$counter = db_query_value($u_name_q);
if ( $counter <= 0 ) $result = false;
return $result;
}
function find_users($firstname, $lastname, $email) {
$result = true;
$u_name_q = "select count(*) from users where ( firstname = '$firstname') AND ( lastname = '$lastname') AND ( email = '$email')";
$counter = db_query_value($u_name_q);
if ( $counter <= 0 ) $result = false;
return $result;
}
function samesymbolcount($ssymname) {
$u_name_q = "select count(*) from users where ( LOCATE(username,'$ssymname') = 1 )";
$counter = db_query_value($u_name_q);
return( $counter );
}
function find_user_email($id) {
$u_email_q = "select email from users where ( ID = '$id')";
$email = db_query_value($u_email_q);
if ( !is_string($emai) ) return("");
return $email;
}
function make_initial_group($userid) {
global $updatereport;
// Create a new one.
$create_group_q = "insert into mail_groups ( ID, UID, group1 ) values ( 0, $userid, 'Everyone' )";
db_query_exe($create_group_q);
$updatereport = "Created new group members.";
}
function send_user_private($uname,$pass,$e_mail) {
//
$mailmsg = "Thank you for using Peace Names\n";
$mailmsg .= "Your account information is as follows:\n";
//
$mailmsg .= "\tUsername: " . $uname . "\n";
$mailmsg .= "\tPassword: " . $pass . "\n";
//
copious_mail($e_mail,$uname . "Registration information from Peace Names.", $mailmsg);
}
function send_new_user_company($uname,$pass,$e_mail) {
//
$company_e_mail = "[email protected]";
//
$mailmsg = "You have a new user on Peace Names\n";
//
$mailmsg .= "\tUsername: " . $uname . "\n";
$mailmsg .= "\tE-mail: " . $e_mail . "\n";
//
copious_mail($company_e_mail,"New User for Peace Names.", $mailmsg);
}
/// Read These Features from a DB OR FILE....
$user_features = array('Copious Mail','globe','energy','peacenames','electrichardware','classydex');
function set_user_features($uid) {
global $user_features;
//
$n = count($user_features);
//
for ( $i = 0; $i < $n; $i++ ) {
//
$ff = $user_features[$i];
$ff = urlencode($ff);
//
$I_feature = "insert into user_features (ID, UID, features, state) VALUES (0,$uid,'$ff',0)";
db_query_exe($I_feature);
}
}
/*
*/
function getusername($userid) {
$u_group_q = "select username from users where ( ID = '$userid' )";
$uname = db_query_value($u_group_q);
return($uname);
}
function get_user_name($id) { return(getusername($userid)); }
function getuserid($membername) {
$u_group_q = "select ID from users where ( username = '$membername' )";
$userid = db_query_value($u_group_q);
return($userid);
}
function getusername_list($userid_list) {
$uname_list = "";
if ( strlen($userid_list) > 0 ) {
$u_group_q = "select username from users where ( ID in ($userid_list) )";
$uname_list = db_query_list($u_group_q);
$uname_list = implode($uname_list,",");
}
return($uname_list);
}
function getuserid_list($username_list) {
$uname_list = "";
if ( strlen($username_list) > 0 ) {
$username_list = str_replace(',',"','",$username_list);
////
$u_group_q = "select id, username from users where ( username in ('$username_list') )";
$uname_list = db_query_row_lists($u_group_q);
}
return($uname_list);
}
?>