This file contains 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 simpleCMS { | |
var $host; | |
var $username; | |
var $password; | |
var $table; | |
public function display_public() { | |
This file contains 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
private function buildDB() { | |
$sql = <<<MySQL_QUERY | |
CREATE TABLE IF NOT EXISTS testDB ( | |
title VARCHAR(150), | |
bodytext TEXT, | |
created VARCHAR(100) | |
) | |
MySQL_QUERY; | |
return mysql_query($sql); |
This file contains 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
public function connect() { | |
mysql_connect($this->host,$this->username,$this->password) or die("Could not connect. " . mysql_error()); | |
mysql_select_db($this->table) or die("Could not select database. " . mysql_error()); | |
return $this->buildDB(); | |
} |
This file contains 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
public function display_admin() { | |
return <<<ADMIN_FORM | |
<form action="{$_SERVER['PHP_SELF']}" method="post"> | |
<label for="title">Title:</label> | |
<input name="title" id="title" type="text" maxlength="150" /> | |
<label for="bodytext">Body Text:</label> | |
<textarea name="bodytext" id="bodytext"></textarea> | |
<input type="submit" value="Create This Entry!" /> | |
</form> |
This file contains 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
public function write($p) { | |
if ( $p['title'] ) | |
$title = mysql_real_escape_string($p['title']); | |
if ( $p['bodytext']) | |
$bodytext = mysql_real_escape_string($p['bodytext']); | |
if ( $title && $bodytext ) { | |
$created = time(); | |
$sql = "INSERT INTO testDB VALUES('$title','$bodytext','$created')"; | |
return mysql_query($sql); | |
} else { |
This file contains 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
public function display_public() { | |
$q = "SELECT * FROM testDB ORDER BY created DESC LIMIT 3"; | |
$r = mysql_query($q); | |
if ( $r !== false && mysql_num_rows($r) > 0 ) { | |
while ( $a = mysql_fetch_assoc($r) ) { | |
$title = stripslashes($a['title']); | |
$bodytext = stripslashes($a['bodytext']); | |
$entry_display .= <<<ENTRY_DISPLAY |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>SimpleCMS</title> | |
</head> | |
<body> | |
</body> |
This file contains 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
import java.io.*; | |
import java.util.Scanner; | |
public class MixedTypeInput { | |
public static void main(String[] args) { | |
double number; | |
Scanner in = new Scanner(System.in); | |
System.out.println("Enter your gross income: "); |
This file contains 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
import java.net.InetAddress; | |
import java.net.UnknownHostException; | |
public class HostnameExample { | |
public static void main(String[] args) { | |
try { | |
InetAddress address = InetAddress.getLocalHost(); | |
System.out.println("Hostname: " + address.getHostName()); | |
} catch (UnknownHostException e) { |
This file contains 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
/* | |
* Karellism - Karel Vanhelden | |
* Problem ?? | |
*/ | |
using namespace std; | |
#include <bits/stdc++.h> | |
#define rep(i,n) for(auto i=0; i<(n); i++) |
OlderNewer