Changes

Jump to: navigation, search

Geshi

957 bytes added, 11:23, 28 March 2009
ret
</source>
 
== GeSHi ==
<php><?php
echo 'Hello, world!';
# What else?
$my_cnx = mysql_open('localhost', 'user', 'pass');
if ($my_cnx === false)
die('Unable to open connection with MySQL database engine');
mysql_select_db('database', $my_cnx) or die('Unable to select database');
$request = sprintf('UPDATE table SET column=data WHERE othercolumn=\'%s\'', $_SESSION['text']);
$my_success = mysql_query($request, $my_cnx);
if ($my_success === false) {
die('Error when trying to update table');
}
mysql_close($my_cnx);</php>
 
<geshi lang=sql>
select * from lib.tbl where this=that
</geshi>
 
<geshi lang=bash>
#!/bin/ksh
 
HOST=host
USER=username
PASS=password
FILE=bad.txt
LOGFILE=log.txt
 
ftp -n -v -i ${HOST} > ${LOGFILE} 2>&1 << EOF
quote USER ${USER}
quote PASS ${PASS}
binary
put ${FILE}
quit
EOF
 
grep -q "Transfer complete." ${LOGFILE}
 
if [[ $? != 0 ]]; then
echo "ftp failed"
else
echo "ftp succeeded"
fi
 
rm ${LOGFILE}
</geshi>
1,963
edits