This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php // best practice: always have <?php at the top | |
| $host="localhost"; // Host name | |
| $username="root"; // Mysql username | |
| $password="root"; // Mysql password | |
| $db_name="account"; // Database name | |
| // Connect to server and select databse. | |
| $db = new mysqli($host, $username, $password, $db_name); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php // best practice: always have <?php at the top | |
| $host="localhost"; // Host name | |
| $username="root"; // Mysql username | |
| $password="root"; // Mysql password | |
| $db_name="account"; // Database name | |
| $tbl_name="member"; // Table name | |
| // Connect to server and select databse. | |
| mysql_connect('localhost', 'root', 'root')or die("cannot connect"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if ($x > 5) { | |
| $y = "1"; | |
| } else { | |
| $y = false; | |
| } | |
| if ($y) { | |
| echo "2"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| sleep(10); | |
| $fp = fopen("finished requests.txt", 'a+'); | |
| fwrite($fp, "at " . date("H:i:s") . "\n"); | |
| fclose($fp); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $x = 10; | |
| echo $x > 5 ? "1" : false ? "2" : "3"; | |
| // ================================ => = echo construct expression | |
| // + + => o1 = ternary operator at root | |
| // -------------------- => o1.x1 = first operand of o1 | |
| // + + => o1.x1.o1 = ternary operator at root of o1.x1 | |
| // ------ => o1.x1.o1.x1 = first operand of o1.x1.o1 | |
| // + => o1.x1.o1.x1.o1 = binary operator at root of o1.x1.o1.x1 | |
| // == => o1.x1.o1.x1.o1.x1 = first operand of o1.x1.o1.x1.o1 = 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Item extends Data { | |
| public function getSelectCategory($category_name) { | |
| $category_name = "%$category_name%"; | |
| $SQL = "SELECT category_id, category_name | |
| FROM category |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT title | |
| FROM table AS t1 | |
| JOIN (SELECT (RAND() * (SELECT MAX(id) FROM table)) AS id) AS t2 | |
| WHERE t1.id >= t2.id | |
| ORDER BY t1.id ASC | |
| LIMIT ?; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function ajax(url, settings) { | |
| var completeHandler = undefined; | |
| if (settings.complete) { | |
| completeHandler = settings.complete; | |
| } | |
| settings['complete'] = function(data, category) { | |
| ajaxResponseTrap(data, category); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Loads an image into a GD resource and scales/crops it to the given target size. | |
| * | |
| * @param string $filename The file name of the image. | |
| * @param string $mime The mime type of the image. | |
| * @param string $target_size The target size. | |
| * | |
| * @throws Exception When the image MimeType is invalid. | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Gets the image data from a GD image resource. | |
| * | |
| * @param resource $image The image resource. | |
| * @param string $format The image format. | |
| * | |
| * @throws Exception When an illegal format was specified. | |
| * |