diff --git a/article-two.html b/article-two.html new file mode 100644 index 0000000000..c1b8e6f52f --- /dev/null +++ b/article-two.html @@ -0,0 +1,6 @@ + + + + hi + + diff --git a/copytst.php b/copytst.php new file mode 100644 index 0000000000..013dc477a0 --- /dev/null +++ b/copytst.php @@ -0,0 +1,789 @@ + 'value' + * + * @var array + */ + $_where = array(), + /** + * Dynamic type list for order by condition value + */ + $_orderBy = array(), + /** + * Dynamic type list for group by condition value + */ + $_groupBy = array(), + /** + * Dynamic array that holds a combination of where condition/table data value types and parameter references + * + * @var array|null + */ + $_bindParams = null, + /** + * Name of the auto increment column + * + */ + $_lastInsertId = null, + /** + * Variable which holds last statement error + * + * @var string + */ + $_stmtError = null, + /** + * Allows the use of the tableNameToClassName method + * + * @var string + */ + $_autoClass = true, + /** + * Name of table we're performing the action on + * + * @var string + */ + $_tableName, + /** + * Type of fetch to perform + * + * @var string + */ + $_fetchType = PDO::FETCH_ASSOC, + /** + * Fetch argument + * + * @var string + */ + $_fetchArg; + public + /** + * Variable which holds an amount of returned rows during get/getOne/select queries + * + * @var string + */ + $count = 0; + private + /** + * Used for connecting to the database + * + * @var string + */ + $_connstr; + public function __construct($db, $host = localhost:5432, $user = bhanu836, $pass = db-bhanu836-69865){ + $this->_connstr = "pgsql:host=$host user=$user password=$pass dbname=$db options='--client_encoding=UTF8'"; + } + protected function _connect(){ + $this->_conn = new PDO($this->_connstr); + $this->_conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); + } + /** @return PDO */ + public function pdo(){ + if (!$this->_conn){ + $this->_connect(); + } + return $this->_conn; + } + /** + * Method attempts to prepare the SQL query + * and throws an error if there was a problem. + * + * @return PDOStatement + */ + protected function _prepareQuery(){ + try { + $stmt = $this->pdo()->prepare($this->_query); + } + catch (PDOException $e){ + throw new Exception ("Problem preparing query ($this->_query) ".$e->getMessage()); + } + return $stmt; + } + /** + * Function to replace ? with variables from bind variable + * + * @param string $str + * @param Array $vals + * + * @return string + */ + protected function _replacePlaceHolders($str, $vals){ + $i = 0; + $valcount = count($vals); + while (strpos($str, "?") !== false && $i < $valcount){ + $val = $vals[$i++]; + if (is_object($val)){ + $val = '[object]'; + } + else if ($val === null){ + $val = 'NULL'; + } + if (is_string($val)){ + $val = "'$val'"; + } + $str = preg_replace('/\?/', $val, $str, 1); + } + return $str; + } + /** + * Helper function to add variables into bind parameters array + * + * @param string Variable value + */ + protected function _bindParam($value){ + $this->_bindParams[] = $value; + } + /** + * Helper function to add variables into bind parameters array in bulk + * + * @param Array Variable with values + */ + protected function _bindParams($values){ + foreach ($values as $value){ + $this->_bindParam($value); + } + } + /** + * Helper function to add variables into bind parameters array and will return + * its SQL part of the query according to operator in ' $operator ?' + * + * @param array $operator Variable with values + * @param $value + * + * @return string + */ + protected function _buildPair($operator, $value){ + $this->_bindParam($value); + return ' '.$operator.' ? '; + } + /** + * Abstraction method that will build an JOIN part of the query + */ + protected function _buildJoin(){ + if (empty ($this->_join)){ + return; + } + foreach ($this->_join as $data){ + list ($joinType, $joinTable, $joinCondition) = $data; + $this->_query .= " $joinType JOIN ".$this->_escapeTableName($joinTable)." on $joinCondition"; + } + } + protected function _escapeApostrophe($str){ + return preg_replace('~(^|[^\'])\'~', '$1\'\'', $str); + } + /** + * Abstraction method that will build the part of the WHERE conditions + */ + protected function _buildWhere(){ + if (empty ($this->_where)){ + return; + } + //Prepare the where portion of the query + $this->_query .= ' WHERE'; + foreach ($this->_where as $cond){ + list ($concat, $varName, $operator, $val) = $cond; + if (preg_match('~^"?([a-z_\-\d]+)"?(?:->>\'?([\w\d\-]+)\'?)?$~', $varName, $match)){ + $varName = "\"$match[1]\"".(isset($match[2]) ? "->>'".self::_escapeApostrophe($match[2])."'" : ''); + } + $this->_query .= ' '.trim("$concat $varName"); + switch (strtolower($operator)) { + case 'not in': + case 'in': + $comparison = ' '.$operator.' ('; + if (is_object($val)){ + $comparison .= $this->_buildPair("", $val); + } + else { + foreach ($val as $v){ + $comparison .= ' ?,'; + $this->_bindParam($v); + } + } + $this->_query .= rtrim($comparison, ',').' ) '; + break; + case 'not between': + case 'between': + $this->_query .= " $operator ? AND ? "; + $this->_bindParams($val); + break; + case 'not exists': + case 'exists': + $this->_query .= $operator.$this->_buildPair("", $val); + break; + default: + if (is_array($val)){ + $this->_bindParams($val); + } + else if ($val === null){ + $this->_query .= $operator." NULL"; + } + else if ($val != 'DBNULL' || $val == '0'){ + $this->_query .= $this->_buildPair($operator, $val); + } + } + } + $this->_query = rtrim($this->_query); + } + public function _buildDataPairs($tableData, $tableColumns, $isInsert){ + foreach ($tableColumns as $column){ + $value = $tableData[$column]; + if (!$isInsert){ + $this->_query .= "\"$column\" = "; + } + // Simple value + if (!is_array($value)){ + if (is_bool($value)){ + $value = $value ? 'true' : 'false'; + } + $this->_bindParam($value); + $this->_query .= '?, '; + continue; + } + } + $this->_query = rtrim($this->_query, ', '); + } + /** + * Abstraction method that will build an INSERT or UPDATE part of the query + * + * @param array $tableData + */ + protected function _buildInsertQuery($tableData){ + if (!is_array($tableData)){ + return; + } + $isInsert = preg_match('/^[INSERT|REPLACE]/', $this->_query); + $dataColumns = array_keys($tableData); + if ($isInsert){ + $this->_query .= ' ("'.implode($dataColumns, '", "').'") VALUES ('; + } + else $this->_query .= " SET "; + $this->_buildDataPairs($tableData, $dataColumns, $isInsert); + if ($isInsert){ + $this->_query .= ')'; + } + } + /** + * Abstraction method that will build the GROUP BY part of the WHERE statement + * + */ + protected function _buildGroupBy(){ + if (empty ($this->_groupBy)){ + return; + } + $this->_query .= " GROUP BY "; + foreach ($this->_groupBy as $value){ + $this->_query .= "$value, "; + } + $this->_query = rtrim($this->_query, ', ').' '; + } + /** + * Abstraction method that will build the LIMIT part of the WHERE statement + * + */ + protected function _buildOrderBy(){ + if (empty($this->_orderBy)){ + return; + } + $this->_query .= " ORDER BY "; + foreach ($this->_orderBy as $prop => $value){ + if (strtolower(str_replace(' ', '', $prop)) == 'rand()'){ + $this->_query .= 'rand(), '; + } + else $this->_query .= "$prop $value, "; + } + $this->_query = rtrim($this->_query, ', '); + } + /** + * Internal function to build and execute INSERT/REPLACE calls + * + * @param string $tableName The name of the table. + * @param array $insertData Data containing information for inserting into the DB. + * @param $operation + * @param string|null $returnColumn What column to return after insert + * + * @return boolean Boolean indicating whether the insert query was completed succesfully. + */ + private function _buildInsert($tableName, $insertData, $operation, $returnColumn = null){ + $tableName = $this->_escapeTableName($tableName); + $this->_query = "$operation INTO $tableName"; + if (!empty($returnColumn)){ + $returnColumn = trim($returnColumn); + } + $stmt = $this->_buildQuery(null, $insertData, $returnColumn); + $res = $this->_execStatement($stmt); + if ($res === false || $this->count < 1){ + return false; + } + if (!empty($res[0][$returnColumn])){ + return $res[0][$returnColumn]; + } + return true; + } + /** + * Abstraction method that will build the LIMIT part of the WHERE statement + * + * @param integer|array $numRows Array to define SQL limit in format Array ($count, $offset) + * or only $count + */ + protected function _buildLimit($numRows){ + if (!isset($numRows)){ + return; + } + $this->_query .= ' LIMIT '.( + is_array($numRows) + ? (int) $numRows[1].' OFFSET '.(int) $numRows[0] + : (int) $numRows + ); + } + /** + * Abstraction method that will compile the WHERE statement, + * any passed update data, and the desired rows. + * It then builds the SQL query. + * + * @param integer|array $numRows Array to define SQL limit in format Array ($count, $offset) + * or only $count + * @param array $tableData Should contain an array of data for updating the database. + * @param string|null $returning What column to return after inserting + * + * @return PDOStatement Returns the $stmt object. + */ + protected function _buildQuery($numRows = null, $tableData = null, $returning = null){ + $this->_buildJoin(); + $this->_buildInsertQuery($tableData); + if (!empty($returning)){ + $this->_query .= " RETURNING \"$returning\""; + } + $this->_buildWhere(); + $this->_buildGroupBy(); + $this->_buildOrderBy(); + $this->_buildLimit($numRows); + $this->_alterQuery(); + $this->_lastQuery = $this->_replacePlaceHolders($this->_query, $this->_bindParams); + // Prepare query + $stmt = $this->_prepareQuery(); + return $stmt; + } + /** + * Execute raw SQL query. + * + * @param string $query User-provided query to execute. + * @param array $bindParams Variables array to bind to the SQL statement. + * + * @return array Contains the returned rows from the query. + */ + public function rawQuery($query, $bindParams = null){ + $params = array(null); // Create the empty 0 index + $this->_query = $query; + $this->_alterQuery(); + $stmt = $this->_prepareQuery(); + if (empty($bindParams)){ + $this->_bindParams = null; + } + else if (!is_array($bindParams)){ + throw new Exception('$bindParams must be an array'); + } + else { + $this->_bindParams = $bindParams; + } + $res = $this->_execStatement($stmt); + return $res; + } + /** + * Execute rawQuery with specified parameters an return a single row only + * + * @param array $args Arguments to be forwarded to rawQuery + * + * @return array + */ + public function rawQuerySingle(...$args){ + return $this->_singleRow($this->rawQuery(...$args)); + } + /** + * + * @param string $query Contains a user-provided select query. + * @param integer|array $numRows Array to define SQL limit in format Array ($count, $offset) + * + * @return array Contains the returned rows from the query. + */ + public function query($query, $numRows = null){ + $this->_query = $query; + $stmt = $this->_buildQuery($numRows); + $res = $this->_execStatement($stmt); + return $res; + } + /** + * Get number of rows in database table + * + * @param string $table Name of table + * + * @return int + */ + public function count($table){ + return $this->disableAutoClass()->getOne($table, 'COUNT(*)::int as c')['c']; + } + /** + * This method allows you to specify multiple (method chaining optional) AND WHERE statements for SQL queries. + * + * @uses $db->where('id', 7)->where('title', 'MyTitle'); + * + * @param string $whereProp The name of the database field. + * @param mixed $whereValue The value of the database field. + * @param string $operator + * @param string $cond + * + * @return self + */ + public function where($whereProp, $whereValue = 'DBNULL', $operator = '=', $cond = 'AND'){ + if (is_array($whereValue) && ($key = key($whereValue)) != "0"){ + $operator = $key; + $whereValue = $whereValue[$key]; + } + if (count($this->_where) == 0){ + $cond = ''; + } + $this->_where[] = array($cond, $whereProp, $operator, $whereValue); + return $this; + } + /** + * Sets a class to be used as the PDO::fetchAll argument + * + * @param object|string $class + * + * @return self + */ + public function setClass($class){ + $this->_fetchType = PDO::FETCH_CLASS; + $this->_fetchArg = $class; + return $this; + } + /** + * Disabled the tableNameToClassName method + * + * @return self + */ + public function disableAutoClass(){ + $this->_autoClass = false; + return $this; + } + /** + * This method allows you to specify multiple (method chaining optional) OR WHERE statements for SQL queries. + * + * @uses $db->orWhere('id', 7)->orWhere('title', 'MyTitle'); + * + * @param string $whereProp The name of the database field. + * @param mixed $whereValue The value of the database field. + * @param string $operator + * + * @return self + */ + public function orWhere($whereProp, $whereValue = 'DBNULL', $operator = '='){ + return $this->where($whereProp, $whereValue, $operator, 'OR'); + } + /** + * This method allows you to specify multiple (method chaining optional) ORDER BY statements for SQL queries. + * + * @uses $db->orderBy('id', 'desc')->orderBy('name', 'desc'); + * + * @param string $orderByField The name of the database field. + * @param string $orderbyDirection Order direction. + * + * @return self + */ + public function orderBy($orderByField, $orderbyDirection = "DESC"){ + $allowedDirection = array("ASC", "DESC"); + $orderbyDirection = strtoupper(trim($orderbyDirection)); + $orderByField = preg_replace('/[^-a-z0-9\.\(\),_"\*]+/i', '', $orderByField); + if (empty($orderbyDirection) || !in_array($orderbyDirection, $allowedDirection)){ + die ('Wrong order direction: '.$orderbyDirection); + } + $this->_orderBy[$orderByField] = $orderbyDirection; + return $this; + } + /** + * Replacement for the orderBy method, which would screw up complex order statements + * + * @param string $orderstr Raw ordering sting + * @param string $direction Order direction + * + * @return self + */ + public function orderByLiteral($orderstr, $direction = 'ASC'){ + $this->_orderBy[$orderstr] = $direction; + return $this; + } + /** + * A convenient SELECT * function. + * + * @param string $tableName The name of the database table to work with. + * @param int|int[] $numRows Array to define SQL limit in format Array ($count, $offset) + * or only $count + * @param string $columns + * + * @return array Contains the returned rows from the select query. + */ + public function get($tableName, $numRows = null, $columns = null){ + if (empty ($columns)){ + $columns = '*'; + } + $column = is_array($columns) ? implode(', ', $columns) : $columns; + $tableName = $this->_escapeTableName($tableName); + $this->_query = "SELECT $column FROM $tableName"; + $stmt = $this->_buildQuery($numRows); + if ($this->_autoClass) + $this->_tableName = $tableName; + $res = $this->_execStatement($stmt); + return $res; + } + /** + * A convenient SELECT * function to get one record. + * + * @param string $tableName The name of the database table to work with. + * @param string $columns + * + * @return array|object|null + */ + public function getOne($tableName, $columns = '*'){ + $res = $this->get($tableName, 1, $columns); + if (is_array($res) && isset ($res[0])){ + return $res[0]; + } + else if ($res){ + return $res; + } + return null; + } + /** + * A convenient function that returns TRUE if exists at least an element that + * satisfy the where condition specified calling the "where" method before this one. + * + * @param string $tableName The name of the database table to work with. + * + * @return bool + */ + public function has($tableName){ + return $this->count($tableName) >= 1; + } + /** + * Update query. Be sure to first call the "where" method. + * + * @param string $tableName The name of the database table to work with. + * @param array $tableData Array of data to update the desired row. + * + * @return bool + */ + public function update($tableName, $tableData){ + $tableName = $this->_escapeTableName($tableName); + $this->_query = "UPDATE $tableName"; + $stmt = $this->_buildQuery(null, $tableData); + $res = $this->_execStatement($stmt); + return (bool) $res; + } + /** + * Insert method to add new row + * + * @param _buildInsert($tableName, $insertData, 'INSERT', $returnColumn); + } + /** + * Delete query. Call the "where" method first. + * + * @param string $tableName The name of the database table to work with. + * @param integer|array $numRows Array to define SQL limit in format Array ($count, $offset) + * or only $count + * + * @return boolean + */ + public function delete($tableName, $numRows = null){ + $table = $this->_escapeTableName($tableName); + if (count($this->_join)){ + $this->_query = "DELETE ".preg_replace('~^".*"\s+(.*)$~', '$1', $table)." FROM $table"; + } + else { + $this->_query = "DELETE FROM $table"; + } + $stmt = $this->_buildQuery($numRows); + if ($this->_autoClass) + $this->_tableName = $tableName; + $res = $this->_execStatement($stmt); + return $this->count > 0; + } + /** + * This method allows you to concatenate joins for the final SQL statement. + * + * @uses $db->join('table1', 'field1 <> field2', 'LEFT') + * + * @param string $joinTable The name of the table. + * @param string $joinCondition the condition. + * @param string $joinType 'LEFT', 'INNER' etc. + * @param bool $disableAutoClass Disable automatic result conversion to class (since result may contain data from other tables) + * + * @return self + */ + public function join($joinTable, $joinCondition, $joinType = '', $disableAutoClass = true){ + $allowedTypes = array('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER'); + $joinType = strtoupper(trim($joinType)); + if ($joinType && !in_array($joinType, $allowedTypes)){ + die("Wrong JOIN type: $joinType"); + } + $joinTable = $this->_escapeTableName($joinTable); + $this->_join[] = array($joinType, $joinTable, $joinCondition); + if ($disableAutoClass) + $this->disableAutoClass(); + return $this; + } + /** + * Method to check if a table exists + * + * @param array $table Table name to check + * + * @returns boolean True if table exists + */ + public function tableExists($table){ + $res = $this->rawQuerySingle("SELECT to_regclass('public.$table') IS NOT NULL as exists"); + return $res['exists']; + } + /** + * @param PDOStatement $stmt Statement to execute + * + * @return bool|array|object[] + */ + protected function _execStatement($stmt){ + $success = $stmt->execute($this->_bindParams); + if ($success !== true){ + $errInfo = $stmt->errorInfo(); + $this->_stmtError = "PDO Error #{$errInfo[1]}: {$errInfo[2]}"; + $result = false; + $this->count = 0; + } + else { + $this->count = $stmt->rowCount(); + $this->_stmtError = null; + if (isset($this->_fetchArg)) + $result = $stmt->fetchAll($this->_fetchType, $this->_fetchArg); + else $result = $stmt->fetchAll($this->_fetchType); + } + $this->_lastQuery = isset($this->_bindParams) + ? $this->_replacePlaceHolders($this->_query, $this->_bindParams) + : $this->_query; + $this->reset(); + return $result; + } + public function reset(){ + $this->_autoClass = true; + $this->_tableName = null; + $this->_fetchType = PDO::FETCH_ASSOC; + $this->_fetchArg = null; + $this->_where = array(); + $this->_join = array(); + $this->_orderBy = array(); + $this->_groupBy = array(); + $this->_bindParams = array(); + $this->_query = null; + $this->_lastInsertId = null; + } + /** + * Get the first entry in a query if it exists, otherwise, return null + * + * @param array $query Array containing the query results + * + * @return array|null + */ + protected function _singleRow($query){ + return empty($query[0]) ? null : $query[0]; + } + /** + * Escapes table name for use in queries + * + * @param string $tableName + * + * @return string + */ + protected function _escapeTableName($tableName){ + return preg_replace('~^"?([a-zA-Z\d_\-]+)"?\s+([a-zA-Z\d]+)$~', '"$1" $2', trim($tableName)); + } + /** + * Replaces some custom shortcuts to make the query valid + */ + protected function _alterQuery(){ + $this->_query = preg_replace('~(\s+)&&(\s+)~', '$1AND$2', $this->_query); + } + /** + * Method returns last executed query + * + * @return string + */ + public function getLastQuery(){ + return $this->_lastQuery; + } + /** + * Return last error message + * + * @return string + */ + public function getLastError(){ + if (!$this->_conn){ + return "No connection has been made yet"; + } + return trim($this->_stmtError); + } + /** + * Returns the class name expected for the table name + * This is a utility function for use in case you want to make your own automatic table<->class bindings using a wrapper class + * + * @param bool $namespaced + * + * @return string|null + */ + public function tableNameToClassName($namespaced = false){ + $className = $this->_tableName; + if (isset($this->_tableName)){ + $className = preg_replace('/s(_|$)/','$1',preg_replace_callback('/(?:^|-)([a-z])/',function($match){ + return strtoupper($match[1]); + },$className)); + $append = $namespaced?'\\':''; + $className = preg_replace_callback('/__([a-z])/',function($match) use ($append){ + return $append.strtoupper($match[1]); + },$className); + } + return $className; + } + /** + * Close connection + */ + public function __destruct(){ + if ($this->_conn){ + $this->_conn = null; + } + } + } + diff --git a/corct.php b/corct.php new file mode 100644 index 0000000000..e964b6fbb8 --- /dev/null +++ b/corct.php @@ -0,0 +1,138 @@ + + + + +hello + + + + + +pdo(); +?> +
> +

form

+ + + + + + + + + + + + + + + + + + + + + + +
NAME
BRANCH
EMAIL
RATE US
DATE OF BIRTH +
+
+
+Hi +Your branch +email +dob +
+ + + +

PHP Form Validation Example

+

* required field.

+
"> + Name: + * +

+ E-mail: + * +

+ Website: + +

+ Comment: +

+ Gender: + Female + Male + * +

+ +
+ +Your Input:"; +echo $name; +echo "
"; +echo $email; +echo "
"; +echo $website; +echo "
"; +echo $comment; +echo "
"; +echo $gender; +?> + + \ No newline at end of file diff --git a/corct1.php b/corct1.php new file mode 100644 index 0000000000..296857de1c --- /dev/null +++ b/corct1.php @@ -0,0 +1,13 @@ + + + + +Hi +Your branch +email +dob + + diff --git a/form-one.php b/form-one.php new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/form-one.php @@ -0,0 +1 @@ + diff --git a/new.php b/new.php new file mode 100644 index 0000000000..6e6d69def6 --- /dev/null +++ b/new.php @@ -0,0 +1,42 @@ + + + + +hello + + + + + +
> +

form

+ + + + + + + + + + + + + + + + + + + + + + +
NAME
BRANCH
EMAIL
RATE US
DATE OF BIRTH +
+
+ + + \ No newline at end of file diff --git a/newcon.php b/newcon.php new file mode 100644 index 0000000000..74e4771ae8 --- /dev/null +++ b/newcon.php @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/newcon1.php b/newcon1.php new file mode 100644 index 0000000000..e9be6c9e94 --- /dev/null +++ b/newcon1.php @@ -0,0 +1,9 @@ +conn = pg_connect("host=localhost port=5432 dbname=bhanu836 password='db-bhanu836-69865' user=bhanu836 ") or die("unable to connect database"); +?> +} + +/ \ No newline at end of file diff --git a/neww.php b/neww.php new file mode 100644 index 0000000000..6edc5e73c5 --- /dev/null +++ b/neww.php @@ -0,0 +1,42 @@ + + + + +hello + + + + + +
> +

form

+ + + + + + + + + + + + + + + + + + + + + + +
NAME
BRANCH
EMAIL
RATE US
DATE OF BIRTH +
+
+ + + \ No newline at end of file diff --git a/server.js b/server.js index 3d5cece3ab..82ffb985d4 100644 --- a/server.js +++ b/server.js @@ -16,7 +16,25 @@ app.get('/ui/style.css', function (req, res) { app.get('/ui/madi.png', function (req, res) { res.sendFile(path.join(__dirname, 'ui', 'madi.png')); }); +app.get('/ui/article-one.html', function (req, res) { + res.sendFile(path.join(__dirname, 'ui', 'article-one.html')); +}); +app.get('/article-two.html', function (req, res) { + res.sendFile(path.join(__dirname, 'article-two.html')); +}); +app.get('/ui/main.js', function (req, res) { + res.sendFile(path.join(__dirname, 'ui', 'main.js')); +}); +app.get('/newcon1.php', function (req, res) { + res.sendFile(path.join(__dirname, 'newcon1.php')); +}); +app.get('/corct.php', function (req, res) { + res.sendFile(path.join(__dirname, 'corct.php')); +}); +app.get('/copytst.php', function (req, res) { + res.sendFile(path.join(__dirname, 'copytst.php')); +}); var port = 8080; // Use 8080 for local development because you might already have apache running on 80 app.listen(8080, function () { diff --git a/ui/article-one.html b/ui/article-one.html new file mode 100644 index 0000000000..9f22b9473c --- /dev/null +++ b/ui/article-one.html @@ -0,0 +1,48 @@ + + + + + + sampleweb + + + + + + + +
+

LITERATURE

+
+ +
+this is a sample website +
+ + + + + + + + + + + + + + + + + +
YOUR NAME
YOUR COLLEGE NAME
RATE YOUR COLLEGE OUT OF 10
+
+ + + + + + + diff --git a/ui/index.html b/ui/index.html index 5a28644db4..28074d8a51 100644 --- a/ui/index.html +++ b/ui/index.html @@ -3,15 +3,27 @@ - + + black dug secret + square +
+ hello + hell
- + +
+
- Hi! I am your webapp. + + Hey stu!.
+
+
- - + + diff --git a/ui/main.js b/ui/main.js index 4cf7ed58de..a985474ad3 100644 --- a/ui/main.js +++ b/ui/main.js @@ -1 +1,19 @@ console.log('Loaded!'); + +var imgo =document.getElementById("madi"); +var but =document.getElementById("but1"); +var marginleft=0; +var h=0; +var interval = setInterval(moveleft,10); +function moveleft(){ + marginleft= marginleft + 2 ; + + imgo.style.marginLeft=marginleft + "px" ; +} +imgo.addEventListener("click", moveleft); +function stop(){ + window.clearInterval(interval); +} + +but1.addEventListener("click" ,stop); + diff --git a/ui/style.css b/ui/style.css index 71a5f6acc1..43bbdf7fa8 100644 --- a/ui/style.css +++ b/ui/style.css @@ -1,4 +1,4 @@ -body { +.body { font-family: sans-serif; background-color: lightgrey; margin-top: 75px; @@ -19,4 +19,45 @@ body { .img-medium { height: 200px; } +#but1{ + + position:fixed; + color: white; + + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + z-index:1000; +} +/* article one css */ +#a1{ + +border-bottom : 1px solid black; +padding : 5px; +margin : 2px auto ; +background-color:indigo; +margin-top:0; +} +#h1{ + +text-align:center; +color:white; +} +#a2{ + +margin:20px auto; + +background-color:silver; + + +} +footer{ +clear:both; +text-align:center; +padding:5px; +margin:2px auto; +border-top:1px solid blue; +background-color :#b9acac; +}