function getString($lang, $key) { $con = mysqli_connect("localhost", "root", getMysqlPass(), "multsyst"); if (mysqli_connect_errno()) { echo "ERROR" . mysqli_connect_error(); } mysqli_set_charset($con, "utf8"); $query = "SELECT value FROM `metafraseis` WHERE `key` LIKE '{$key}' AND `lang` LIKE '{$lang}'"; //echo $query; $result = mysqli_query($con, $query); $res = "{$key}"; if ($row = mysqli_fetch_array($result)) { $res = $row[0]; } mysqli_close($con); return $res; }
$id = getId(); echo "<ul class=\"list_lang\" >"; echo "<li> <a href=\"music_vote.php?lang=GR&thesh={$thesh}&pass={$pass}\"> GR </a> </li>"; echo "<li> <a href=\"music_vote.php?lang=EN&thesh={$thesh}&pass={$pass}\"> EN </a> </li>"; echo "</ul>"; if ($thesh == -1 || $pass == -1 || correctPass($thesh, $pass) == 0) { echo "<ul class=\"list_main\" >"; echo "<li>"; echo getString($lang, "please_connect"); echo "</li>"; echo "</ul>"; echo "<a class=\"button\" href=\"index.php?lang={$lang}\"> " . getString($lang, "connect") . " </a>"; } else { echo "<ul class=\"list_main\" >"; echo "<li>"; $con = mysqli_connect("localhost", "root", getMysqlPass(), "multsyst"); if (mysqli_connect_errno()) { echo "ERROR" . mysqli_connect_error(); } mysqli_set_charset($con, "utf8"); //Elegxos an yparxei tragoydi me sygkekrimeno id. $query = "SELECT * FROM `tragoudia` WHERE id={$id};"; //echo $query; $result = mysqli_query($con, $query); if ($result && mysqli_num_rows($result) > 0) { //To tragoydi yparxei. //Elegxos an exoyme pano apo 5 psifoys to teleytaio pentalepto. To timestamp einai ths morfhs 201408200159-201408200200 $query = "SELECT count(*) FROM `psifoi` WHERE id_theshs={$thesh} AND mytimestamp>CURRENT_TIMESTAMP-500;"; //echo $query; $result = mysqli_query($con, $query); if ($result && mysqli_num_rows($result) > 0) {