diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2008-11-19 21:22:51 -0500 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2008-11-19 21:22:51 -0500 |
commit | 550d9853e19179d961b2f803c1fba72716a9da4c (patch) | |
tree | fc3d6ad68587c0b5c537b8beb470d68dc976fc86 /includes | |
parent | 6a66b6b2fea3fa24862586e27e9b03a2f92196a5 (diff) | |
download | fourisland-550d9853e19179d961b2f803c1fba72716a9da4c.tar.gz fourisland-550d9853e19179d961b2f803c1fba72716a9da4c.tar.bz2 fourisland-550d9853e19179d961b2f803c1fba72716a9da4c.zip |
Fixed a few code nags
Diffstat (limited to 'includes')
-rwxr-xr-x | includes/functions_quotes.php | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/includes/functions_quotes.php b/includes/functions_quotes.php index e3ca2c0..2b05cab 100755 --- a/includes/functions_quotes.php +++ b/includes/functions_quotes.php | |||
@@ -8,7 +8,7 @@ | |||
8 | 4::::4 4::::4 | 8 | 4::::4 4::::4 |
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | 9 | 4::::4 4::::4 Written and maintained by Starla Insigna |
10 | 4::::444444::::444 | 10 | 4::::444444::::444 |
11 | 4::::::::::::::::4 includes/functions_quotes.inc | 11 | 4::::::::::::::::4 includes/functions_quotes.php |
12 | 4444444444:::::444 | 12 | 4444444444:::::444 |
13 | 4::::4 Please do not use, reproduce or steal the | 13 | 4::::4 Please do not use, reproduce or steal the |
14 | 4::::4 contents of this file without explicit | 14 | 4::::4 contents of this file without explicit |
@@ -29,7 +29,7 @@ function quote_generation($query, $origin, $page = 1, $quote_limit = 50, $page_l | |||
29 | { | 29 | { |
30 | $template->adds_block('PAGENUMBERS',array('exi'=>1)); | 30 | $template->adds_block('PAGENUMBERS',array('exi'=>1)); |
31 | page_numbers($template, $origin, $quote_limit, $page, $page_limit); | 31 | page_numbers($template, $origin, $quote_limit, $page, $page_limit); |
32 | $up_lim = ($quote_limit * $page); | 32 | $up_lim = ($quote_limit * $page); |
33 | $low_lim = $up_lim - $quote_limit; | 33 | $low_lim = $up_lim - $quote_limit; |
34 | $query .= "LIMIT $low_lim,$quote_limit"; | 34 | $query .= "LIMIT $low_lim,$quote_limit"; |
35 | } | 35 | } |
@@ -110,86 +110,86 @@ function page_numbers($template, $origin, $quote_limit, $page_default, $page_lim | |||
110 | $template->add('LASTPAGE',$pagenum); | 110 | $template->add('LASTPAGE',$pagenum); |
111 | } | 111 | } |
112 | 112 | ||
113 | function user_quote_status($where, $quote_num, $template) | 113 | function user_quote_status($where, $quote_num, $template) |
114 | { | 114 | { |
115 | $tracking_verdict = ip_track($where, $quote_num); | 115 | $tracking_verdict = ip_track($where, $quote_num); |
116 | if ($where != 'flag') | 116 | if ($where != 'flag') |
117 | { | 117 | { |
118 | switch ($tracking_verdict) | 118 | switch ($tracking_verdict) |
119 | { | 119 | { |
120 | case 1: | 120 | case 1: |
121 | $template->add('TRACKING',"Quote has been modified, and data of your action has been recorded in the database."); | 121 | $template->add('TRACKING',"Quote has been modified, and data of your action has been recorded in the database."); |
122 | break; | 122 | break; |
123 | case 2: | 123 | case 2: |
124 | $template->add('TRACKING',"Quote has been modified, your IP has been logged, and data of your action has been recorded in the database."); | 124 | $template->add('TRACKING',"Quote has been modified, your IP has been logged, and data of your action has been recorded in the database."); |
125 | break; | 125 | break; |
126 | case 3: | 126 | case 3: |
127 | $template->add('TRACKING',"You have already voted on this quote, please try again later."); | 127 | $template->add('TRACKING',"You have already voted on this quote, please try again later."); |
128 | break; | 128 | break; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | return $tracking_verdict; | 131 | return $tracking_verdict; |
132 | } | 132 | } |
133 | 133 | ||
134 | function ip_track($where, $quote_num) | 134 | function ip_track($where, $quote_num) |
135 | { | 135 | { |
136 | switch ($where) | 136 | switch ($where) |
137 | { | 137 | { |
138 | case 'flag': | 138 | case 'flag': |
139 | $where2 = 'vote'; | 139 | $where2 = 'vote'; |
140 | break; | 140 | break; |
141 | case 'vote': | 141 | case 'vote': |
142 | $where2 = 'flag'; | 142 | $where2 = 'flag'; |
143 | break; | 143 | break; |
144 | } | 144 | } |
145 | 145 | ||
146 | $getip = "SELECT * FROM rash_tracking WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; | 146 | $getip = "SELECT * FROM rash_tracking WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; |
147 | $getip2 = mysql_query($getip); | 147 | $getip2 = mysql_query($getip); |
148 | $getip3 = mysql_fetch_array($getip2); | 148 | $getip3 = mysql_fetch_array($getip2); |
149 | 149 | ||
150 | if ($getip3['ip'] == $_SERVER['REMOTE_ADDR']) | 150 | if ($getip3['ip'] == $_SERVER['REMOTE_ADDR']) |
151 | { | 151 | { |
152 | $quote_array = explode(",", $getip3['quote_id']); | 152 | $quote_array = explode(",", $getip3['quote_id']); |
153 | $quote_place = array_search($quote_num, $quote_array); | 153 | $quote_place = array_search($quote_num, $quote_array); |
154 | if (in_array($quote_num, $quote_array)) | 154 | if (in_array($quote_num, $quote_array)) |
155 | { | 155 | { |
156 | $where_result = explode(",", $getip3[$where]); | 156 | $where_result = explode(",", $getip3[$where]); |
157 | if (!isset($where_result[$quote_place])) | 157 | if (!isset($where_result[$quote_place])) |
158 | { | 158 | { |
159 | $where_result[$quote_place] = 1; | 159 | $where_result[$quote_place] = 1; |
160 | $where_result = implode(",", $where_result); | 160 | $where_result = implode(",", $where_result); |
161 | $setip = "UPDATE rash_tracking SET " . $where . " = \"" . $where_result . "\" WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; | 161 | $setip = "UPDATE rash_tracking SET " . $where . " = \"" . $where_result . "\" WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; |
162 | $setip2 = mysql_query($getip); | 162 | $setip2 = mysql_query($getip); |
163 | return 1; | 163 | return 1; |
164 | } else { | 164 | } else { |
165 | return 3; | 165 | return 3; |
166 | } | 166 | } |
167 | } else { | 167 | } else { |
168 | $setip = "UPDATE rash_tracking SET " . $where . " = CONCAT(" . $where . ",\",1\"), " . $where2 . " = CONCAT(" . $where2 . ",\",0\"), quote_id = CONCAT(quote_id,\"," . $quote_num . "\") WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; | 168 | $setip = "UPDATE rash_tracking SET " . $where . " = CONCAT(" . $where . ",\",1\"), " . $where2 . " = CONCAT(" . $where2 . ",\",0\"), quote_id = CONCAT(quote_id,\"," . $quote_num . "\") WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; |
169 | $setip2 = mysql_query($setip); | 169 | $setip2 = mysql_query($setip); |
170 | return 1; | 170 | return 1; |
171 | } | 171 | } |
172 | } else { | 172 | } else { |
173 | $insip = "INSERT INTO rash_tracking (ip, quote_id, " . $where . ", " . $where2 . ") VALUES (\"" . $_SERVER['REMOTE_ADDR'] . "\", \"" . $quote_num . "\", 1, 0)"; | 173 | $insip = "INSERT INTO rash_tracking (ip, quote_id, " . $where . ", " . $where2 . ") VALUES (\"" . $_SERVER['REMOTE_ADDR'] . "\", \"" . $quote_num . "\", 1, 0)"; |
174 | $insip2 = mysql_query($insip); | 174 | $insip2 = mysql_query($insip); |
175 | return 2; | 175 | return 2; |
176 | } | 176 | } |
177 | } | 177 | } |
178 | 178 | ||
179 | function verify_int($subject) | 179 | function verify_int($subject) |
180 | { | 180 | { |
181 | $ymax = strlen($subject); | 181 | $ymax = strlen($subject); |
182 | $y = 0; | 182 | $y = 0; |
183 | while($y < $ymax) | 183 | while($y < $ymax) |
184 | { | 184 | { |
185 | if ((is_int((int)($subject{$y})) && (int)($subject{$y})) || (int)($subject{$y}) === 0 ) | 185 | if ((is_int((int)($subject{$y})) && (int)($subject{$y})) || (int)($subject{$y}) === 0 ) |
186 | { | 186 | { |
187 | $y++; | 187 | $y++; |
188 | } else { | 188 | } else { |
189 | return false; | 189 | return false; |
190 | } | 190 | } |
191 | } | 191 | } |
192 | return true; | 192 | return true; |
193 | } | 193 | } |
194 | 194 | ||
195 | ?> | 195 | ?> |