[go: up one dir, main page]

Menu

[r3]: / funcoes.php  Maximize  Restore  History

Download this file

61 lines (53 with data), 2.8 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!--
########################################################################################
# Linha do Texto is a web application for exploring meaning inside textual categories. #
# Copyright (C) 2010 Ana Cristina Fricke Matte #
# #
# This program is free software; you can redistribute it and/or #
# modify it under the terms of the GNU General Public License #
# as published by the Free Software Foundation; either version 2 #
# of the License, or (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #
########################################################################################
-->
<?php
function mysql_abrir_sessao(){
include "config.php";
$dbh = mysql_connect ("$hostname", "$username", "$password");
if (!mysql_connect($hostname, $username, $password)) {
echo 'Could not connect to mysql';
return mysql_errno();
}else{
$conectadb = mysql_select_db ($database, $dbh);
if (!mysql_select_db($database, $dbh)){
echo 'Could not connect to database';
return mysql_errno();
}
}
return $dbh;}
function formulario(){
echo "<form method=\"POST\" action=\"crialinhadotexto.php\">senha para criar novo jogo: <input type=\"password\" name=\"senhanovatabela\"<br />Nome do novo jogo: <input type=\"text\" name=\"jogo\" size=\"10\"><br />e-mail do autor do jogo: <input type=\"text\" name=\"email\" size=\"10\"><br /><input type=\"submit\" name=\"apertou\" value=\" cadastrar \"></form>";
}
function listajogos(){
mysql_abrir_sessao();
$lista = mysql_query('SELECT `id_jogo`, `jogo` FROM `jogo`;');
echo "<h2>";
if (!$lista){
echo "DB Error, could not list jogos\n";
echo 'MySQL Error: ' . mysql_error();
exit;
}
while ($row = mysql_fetch_row($lista)){
echo "Jogo: {$row[0]} => {$row[1]}<br />";
}
echo "<h2>";
}
?>