Jump to content
soimuletzu1

Eroare in php

Recommended Posts

Posted

Salutare, am si eu o pb la un cod php si og pe cineva care se pricepe sa imi dea o mana de ajutor ... am un form si un script de adaugare a datelor in tabelul din db, nu primesc nici o eroare si nici continutul nu se introduce in baza de date .. am incercat sa mai schimb cate ceva .. dar tot nu ii dau de cap ... asta ii codul :



<?php
include('../includes/conexiune.php');
if(isset($_POST['submit'])) {
$erori = array();

if(empty($_POST['cheat_nume'])) {
$erori[] = '<br><br><br>Adauga nume la cheat!<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_nume = stripslashes($_POST['cheat_nume']); }

if(empty($_POST['cheat_link1'])) {
$erori[] = '<br><br><br>Adauga un link de descarcare:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_link1 = stripslashes($_POST['cheat_link1']); }

if(empty($_POST['cheat_link2'])) {
$erori[] = '<br><br><br>Adauga al-2-lea link de descarcare:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_link2 = stripslashes($_POST['cheat_link2']); }

if(empty($_POST['cheat_detectabil'])) {
$erori[] = '<br><br><br>Cheat detectabil neselectat:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_detectabil = stripslashes($_POST['cheat_detectabil']); }

if(empty($_POST['cheat_wall'])) {
$erori[] = '<br><br><br>Cheat wall neselectat:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_wall = stripslashes($_POST['cheat_wall']); }

if(empty($_POST['cheat_aim'])) {
$erori[] = '<br><br><br>Cheat aim neselectat:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_aim = stripslashes($_POST['cheat_aim']); }

if(empty($_POST['cheat_speed'])) {
$erori[] = '<br><br><br>Cheat speed neselectat:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_speed = stripslashes($_POST['cheat_speed']); }

if(empty($_POST['cheat_no'])) {
$erori[] = '<br><br><br>Cheat no smoke/flash neselectat:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_no = stripslashes($_POST['cheat_no']); }

if(empty($_POST['cheat_versiune'])) {
$erori[] = '<br><br><br>Versiunea de cs neselectata:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_versiune = stripslashes($_POST['cheat_versiune']); }

if(empty($_POST['cheat_stats'])) {
$erori[] = '<br><br><br>Modul de cs nu ii selectat(steam/no-steam):<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_stats = stripslashes($_POST['cheat_stats']); }

if(empty($_POST['cheat_imagine1'])) {
$erori[] = '<br><br><br>Prima imagine nu a fost adaugata:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_imagine1 = stripslashes($_POST['cheat_imagine1']); }

if(empty($_POST['cheat_imagine2'])) {
$erori[] = '<br><br><br>A 2-a imagine nu a fost adaugata!:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_imagine2 = stripslashes($_POST['cheat_imagine2']); }

if(empty($_POST['cheat_target'])) {
$erori[] = '<br><br><br>Target-ul de pe link neselectat:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_target = stripslashes($_POST['cheat_target']); }

if(empty($_POST['cheat_detalii'])) {
$erori[] = '<br><br><br>Nu au fost adaugate detalii pentru cheat:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_detalii = stripslashes($_POST['cheat_detalii']); }

if(!$erori) {
$query = "INSERT INTO `cheat` (`cheat_nume`, `cheat_link1`, `cheat_link2`, `cheat_detectabil`, `cheat_wall`, `cheat_aim`, `cheat_speed`, `cheat_no`, `cheat_versiune`, `cheat_stats`, `cheat_imagine1`, `cheat_imagine2`, `cheat_target`, `cheat_detalii`) VALUES ('$cheat_nume', '$cheat_link1', '$cheat_link2', '$cheat_detectabil', '$cheat_wall', '$cheat_aim', '$cheat_speed', '$cheat_no', '$cheat_versiune', '$cheat_stats', '$cheat_imagine1', '$cheat_imagine2', '$cheat_target', '$cheat_detalii')";
$res = mysql_query($query);
echo 'CODUL A FOST ADAUGAT CU SUCCES IN BAZA DE DATE!!!<br /> <a href=addcheat.php> Adauga </a> un nou cheat.'; } else {
foreach($erori as $er) {
echo "$er\n"; } }
} else {
?>
<table align="center" width="767" border="0">
<form method="post" action="addcheat.php">
<tr>
<td width="144"><label class="description" for="cheat_nume">Nume Cheat</label></td>
<td width="172"><label class="description">Caracteristici:</label></td>
<td width="437"><label class="description">Valori:</label></td>
</tr>
<tr>
<td><div>
<input id="element_1" name="cheat_nume" class="element text medium" type="text" maxlength="255" value=""/>
</div></td>
<td><label class="description">Detectabil</label></td>
<td><input name="cheat_detectabil" type="radio" class="button_text" value="Yes"/>
Yes
<input type="radio" name="cheat_detectabil" value="No" checked="checked"/>
No </td>
</tr>
<tr>
<td><label class="description" for="cheat_link1">Download link 1</label></td>
<td><label class="description">Wall</label></td>
<td><input name="chea_twall" type="radio" class="button_text" value="Yes" checked="checked"/>
Yes
<input type="radio" name="cheat_wall" value="No"/>
No</td>
</tr>
<tr>
<td><div>
<input id="element_1" name="cheat_link1" class="element text medium" type="text" maxlength="255" value=""/>
</div></td>
<td>Aim</td>
<td><input name="cheat_aim" type="radio" class="button_text" value="Yes" checked="checked"/>
Yes
<input type="radio" name="cheat_aim" value="No"/>
No</td>
</tr>
<tr>
<td><label class="description" for="cheat_link2">Download Link 2</label></td>
<td><label class="description">Speed</label></td>
<td><input name="cheat_speed" type="radio" class="button_text" value="Yes" checked="checked"/>
Yes
<input type="radio" name="cheat_speed" value="No"/>
No</td>
</tr>
<tr>
<td><div>
<input id="element_1" name="cheat_link2" class="element text medium" type="text" maxlength="255" value="#"/>
</div></td>
<td><label class="description">No flash/smoke</label></td>
<td><input name="cheat_no" type="radio" class="button_text" value="Yes" checked="checked"/>
Yes
<input type="radio" name="cheat_no" value="No"/>
No</td>
</tr>
<tr>
<td><select name="cheat_target" id="cheat_target">
<option value="_parent">Fereastra similara</option>
<option value="_blank">Fereastra noua</option>
</select></td>
<td>Detalii</td>
<td><textarea name="cheat_detalii" cols="70" rows="10" id="cheat_detalii"></textarea></td>
</tr>
<tr>
<td> </td>
<td>Versiune joc:</td>
<td><select name="cheat_versiune" id="cheat_versiune">
<option value="CS 1.6" selected="selected">Counter-Strike 1.6</option>
<option value="CS:S">Counter-Strike Source</option>
<option value="CS:Z">CS:Z</option>
</select></td>
</tr>
<tr>
<td> </td>
<td>Functionabil pe</td>
<td><select name="cheat_stats" id="cheat_stats">
<option value="Steam/Non-Steam">STEAM / NO-STEAM</option>
<option value="Steam">STEAM</option>
<option value="Non-Steam">NON-STEAM</option>
</select></td>
</tr>
<tr>
<td>Imagine</td>
<td>1.
<input id="element_3" name="cheat_imagine1" class="element text medium" type="text" maxlength="255"/></td>
<td>2,
<input id="element_4" name="cheat_imagine2" class="element text medium" type="text" maxlength="255" value=""/></td>
</tr>
<tr>
<td><input type="submit" value="TRIMITE" /></td>
<td><input name="Reset" type="reset" value="RESET" /></td>
<td></td>
</tr>
</form>
</table>

<?php
}
?>

Tabelul il am facut corect, conexiunea la fel!

Posted

mersi mult .... asta era buba, nu mam uitat atent pe cod ... acum am o noua problema .. nu imi adauga cu nici un chip continutul care il introduc in textarea <textarea name="cheat_detalii" cols="70" rows="10" id="cheat_detalii"></textarea> .. de fiecare data imi da eroare ca nu am introdus nimic ..se foloseste altceva inafara de

if(empty($_POST['cheat_detalii'])) {
$erori[] = '<br><br><br>Nu au fost adaugate detalii pentru cheat:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_detalii = stripslashes($_POST['cheat_detalii']); }

pentru textarea?

Posted

Iar am dat de o problema ... am facut scriptul ca sa pot sa editez si sa sterg din baza de date dar nu imi merge ... cred ca iar am scapat vreo linie neverificata .. rog pe cineva cu experienta daca are timp sa treaca peste codul asta :


<?php
include('../includes/conexiune.php');
if(isset($_POST['submit'])) {
$erori = array();

if(empty($_POST['cheat_nume'])) {
$erori[] = '<br><br><br>Adauga nume la cheat!<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_nume = stripslashes($_POST['cheat_nume']); }

if(empty($_POST['cheat_link1'])) {
$erori[] = '<br><br><br>Adauga un link de descarcare:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_link1 = stripslashes($_POST['cheat_link1']); }

if(empty($_POST['cheat_link2'])) {
$erori[] = '<br><br><br>Adauga al-2-lea link de descarcare:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_link2 = stripslashes($_POST['cheat_link2']); }

if(empty($_POST['cheat_detectabil'])) {
$erori[] = '<br><br><br>Cheat detectabil neselectat:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_detectabil = stripslashes($_POST['cheat_detectabil']); }

if(empty($_POST['cheat_wall'])) {
$erori[] = '<br><br><br>Cheat wall neselectat:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_wall = stripslashes($_POST['cheat_wall']); }

if(empty($_POST['cheat_aim'])) {
$erori[] = '<br><br><br>Cheat aim neselectat:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_aim = stripslashes($_POST['cheat_aim']); }

if(empty($_POST['cheat_speed'])) {
$erori[] = '<br><br><br>Cheat speed neselectat:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_speed = stripslashes($_POST['cheat_speed']); }

if(empty($_POST['cheat_no'])) {
$erori[] = '<br><br><br>Cheat no smoke/flash neselectat:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_no = stripslashes($_POST['cheat_no']); }

if(empty($_POST['cheat_versiune'])) {
$erori[] = '<br><br><br>Versiunea de cs neselectata:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_versiune = stripslashes($_POST['cheat_versiune']); }

if(empty($_POST['cheat_stats'])) {
$erori[] = '<br><br><br>Modul de cs nu ii selectat(steam/no-steam):<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_stats = stripslashes($_POST['cheat_stats']); }

if(empty($_POST['cheat_imagine1'])) {
$erori[] = '<br><br><br>Prima imagine nu a fost adaugata:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_imagine1 = stripslashes($_POST['cheat_imagine1']); }

if(empty($_POST['cheat_imagine2'])) {
$erori[] = '<br><br><br>A 2-a imagine nu a fost adaugata!:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_imagine2 = stripslashes($_POST['cheat_imagine2']); }

if(empty($_POST['cheat_target'])) {
$erori[] = '<br><br><br>Target-ul de pe link neselectat:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_target = stripslashes($_POST['cheat_target']); }

if(empty($_POST['cheat_detalii'])) {
$erori[] = '<br><br><br>Nu au fost adaugate detalii pentru cheat:<a href=addcheat.php> Clic aici! </a><br><br>'; } else {
$cheat_detalii = stripslashes($_POST['cheat_detalii']); }

if(!$erori) {
$query = "INSERT INTO `cheat` (`cheat_nume`, `cheat_link1`, `cheat_link2`, `cheat_detectabil`, `cheat_wall`, `cheat_aim`, `cheat_speed`, `cheat_no`, `cheat_versiune`, `cheat_stats`, `cheat_imagine1`, `cheat_imagine2`, `cheat_target`, `cheat_detalii`) VALUES ('$cheat_nume', '$cheat_link1', '$cheat_link2', '$cheat_detectabil', '$cheat_wall', '$cheat_aim', '$cheat_speed', '$cheat_no', '$cheat_versiune', '$cheat_stats', '$cheat_imagine1', '$cheat_imagine2', '$cheat_target', '$cheat_detalii')";
$res = mysql_query($query);
echo 'CODUL A FOST ADAUGAT CU SUCCES IN BAZA DE DATE!!!<br /> <a href=addcheat.php> Adauga </a> un nou cheat.'; } else {
foreach($erori as $er) {
echo "$er\n"; } }
} else {
?>

<form method="post" action="addcheat.php">
<table align="center" width="817" border="0" class="myform" id="stylized">

<tr>
<td width="154"><label class="description" for="cheat_nume">Nume Cheat</label></td>
<td width="212"><label class="description">Caracteristici:</label></td>
<td width="437"><label class="description">Valori:</label></td>
</tr>
<tr>
<td><div>
<input id="element_1" name="cheat_nume" class="element text medium" type="text" maxlength="255" value=""/>
</div></td>
<td><label class="description">Detectabil</label></td>
<td><input name="cheat_detectabil" type="radio" class="button_text" value="Yes"/>
Yes
<input type="radio" name="cheat_detectabil" value="No" checked="checked"/>
No </td>
</tr>
<tr>
<td><label class="description" for="cheat_link1">Download link 1</label></td>
<td><label class="description">Wall</label></td>
<td><input name="cheat_wall" type="radio" class="button_text" value="Yes" checked="checked"/>
Yes
<input type="radio" name="cheat_wall" value="No"/>
No</td>
</tr>
<tr>
<td><div>
<input id="element_1" name="cheat_link1" class="element text medium" type="text" maxlength="255" value=""/>
</div></td>
<td>Aim</td>
<td><input name="cheat_aim" type="radio" class="button_text" value="Yes" checked="checked"/>
Yes
<input type="radio" name="cheat_aim" value="No"/>
No</td>
</tr>
<tr>
<td><label class="description" for="cheat_link2">Download Link 2</label></td>
<td><label class="description">Speed</label></td>
<td><input name="cheat_speed" type="radio" class="button_text" value="Yes" checked="checked"/>
Yes
<input type="radio" name="cheat_speed" value="No"/>
No</td>
</tr>
<tr>
<td><div>
<input id="element_1" name="cheat_link2" class="element text medium" type="text" maxlength="255" value="#"/>
</div></td>
<td><label class="description">No flash/smoke</label></td>
<td><input name="cheat_no" type="radio" class="button_text" value="Yes" checked="checked"/>
Yes
<input type="radio" name="cheat_no" value="No"/>
No</td>
</tr>
<tr>
<td><select name="cheat_target" id="cheat_target">
<option value="_parent">Fereastra similara</option>
<option value="_blank">Fereastra noua</option>
</select></td>
<td>Detalii</td>
<td><textarea name="cheat_detalii" cols="70" rows="10" id="cheat_detalii"></textarea></td>
</tr>
<tr>
<td> </td>
<td>Versiune joc:</td>
<td><select name="cheat_versiune" id="cheat_versiune">
<option value="CS 1.6" selected="selected">Counter-Strike 1.6</option>
<option value="CS:S">Counter-Strike Source</option>
<option value="CS:Z">CS:Z</option>
</select></td>
</tr>
<tr>
<td> </td>
<td>Functionabil pe</td>
<td><select name="cheat_stats" id="cheat_stats">
<option value="Steam/Non-Steam">STEAM / NO-STEAM</option>
<option value="Steam">STEAM</option>
<option value="Non-Steam">NON-STEAM</option>
</select></td>
</tr>
<tr>
<td>Imagine</td>
<td><input id="element_3" name="cheat_imagine1" class="element text medium" type="text" maxlength="255"/></td>
<td><input id="element_4" name="cheat_imagine2" class="element text medium" type="text" maxlength="255" value=""/></td>
</tr>
<tr>
<td><button name="submit" type="submit" >Adaugare</button></td>
<td><button name="Reset" type="reset" value="RESET" >Reset</button></td>
<td></td>
</tr>
</table>
</form>

// PANA AICI TOTUL II OK ****************************
<?php
$action = $_GET["action"];
if ($action=="sterge"){
$id = $_GET["id_cheat"];
$res = mysql_query("DELETE FROM `cheat` WHERE id_cheat='{$id}'");
if ($res){
echo "<center>Sa sters cu succes cheatul nr: $id.<br><br><br></center>";
}else{
echo "<center><Strong>Cheatul $id nu a putut fi sters .</center></strong>";
}
}

?>
<?php
if($_POST['action']=="salveaza"){
//var_dump($_POST);
if (isset($_POST['cheat_nume']) && isset($_POST['cheat_link1']) && isset($_POST['cheat_link2']) && isset($_POST['cheat_detectabil']) && isset($_POST['cheat_wall']) && isset($_POST['cheat_aim']) && isset($_POST['cheat_speed']) && isset($_POST['cheat_no']) && isset($_POST['cheat_versiune']) && isset($_POST['cheat_stats']) && isset($_POST['cheat_imagine1']) && isset($_POST['cheat_imagine2']) && isset($_POST['cheat_target']) && isset($_POST['cheat_detalii'])) {
// Se filtreaza datele pt. eliminare posibile spatii exterioare si tag-uri
$_POST = array_map("trim", $_POST);
$_POST = array_map("strip_tags", $_POST);

// Se verifica daca "magic_quotes_gpc()" este setat ON
// Daca e ON, se aplica stripslashes() pentru a nu se adauga de 2 ori '\' cand va fi aplicat "mysql_real_escape_string()"
if(get_magic_quotes_gpc()) { $_POST = array_map("stripslashes", $_POST); }

// Se verifica daca au fost completate corect toate campurile
// Daca au fost completate le preia in variabile, in caz contrar seteaza o variabila cheatlink1 Array cu mesaj de eroare

// Verifica daca cheatnumeul are cel putin 1 caractere si maxim 150
if(strlen($_POST['cheat_nume'])>1 && strlen($_POST['cheat_nume'])<150) $cheat_nume = $_POST['cheat_nume'];
else $eroare[] = 'Error cheatnume : cheatnumeul trebuie sa contina intre 1 si 150 de caractere!';

// Verifica daca cheatlink1 are cel putin 1 si cel mult 1000
if(strlen($_POST['cheat_link1'])>1 && strlen($_POST['cheatl_ink1'])<1000) $cheat_link1 = $_POST['cheat_link1'];
else $eroare[] = 'Error cheatlink1 : cheatlink1ul trebuie sa contina intre 1 si 1000 de caractere!';

// cheatlink2 intre 0 si 100 de caractere
if(strlen($_POST['cheat_link2'])>0 && strlen($_POST['cheat_link2'])<100) $cheat_link2 = $_POST['cheat_link2'];
else $eroare[] = 'Error cheatlink2 : cheatlink2urile trebuie sa contina intre 0 si 100 caractere!';

// Verifica daca cheatdetectabilul are cel putin 1 caractere si maxim 100
if(strlen($_POST['cheat_detectabil'])>1 && strlen($_POST['cheat_detectabil'])<100) $cheat_detectabil = $_POST['cheat_detectabil'];
else $eroare[] = 'Error cheatdetectabil : cheatdetectabilurile trebuie sa contina intre 1 si 100 caractere!';

// Verifica daca cheatwall are cel putin 1 caractere si maxim 1000
if(strlen($_POST['cheat_wall'])>1 && strlen($_POST['cheat_wall'])<1000) $cheat_wall = $_POST['cheat_wall'];
else $eroare[] = 'Error cheatwall : cheatwall-ul trebuie sa contina intre 1 si 1000 caractere!';

// Verifica daca cheataimul are cel putin 1 caractere si maxim 150
if(strlen($_POST['cheat_aim'])>1 && strlen($_POST['cheat_aim'])<150) $cheat_aim = $_POST['cheat_aim'];
else $eroare[] = 'Error cheataim : cheataimul trebuie sa contina intre 1 si 150 de caractere!';

// Verifica daca cheatspeedul are cel putin 1 si cel mult 1000
if(strlen($_POST['cheat_speed'])>1 && strlen($_POST['cheat_speed'])<1000) $cheat_speed = $_POST['cheat_speed'];
else $eroare[] = 'Error cheatspeed : cheatspeed trebuie sa contina intre 1 si 1000 de caractere!';

// Verifica daca cheatno are intre 1 si 100 de caractere
if(strlen($_POST['cheat_no'])>1 && strlen($_POST['cheat_no'])<100) $cheat_no = $_POST['cheat_no'];
else $eroare[] = 'Error Cheatno : Cheatno trebuie sa contina intre 1 si 100 caractere!';

// Verifica daca cheatversiune are cel putin 1000 caractere si maxim 6
if(strlen($_POST['cheat_versiune'])>1 && strlen($_POST['cheat_versiune'])<1000) $cheat_versiune = $_POST['cheat_versiune'];
else $eroare[] = 'Error cheatversiune : cheatversiune-ul trebuie sa contina intre 1 si 1000 caractere!';

// Verifica daca cheatstatsul are cel putin 1 si cel mult 1000
if(strlen($_POST['cheat_stats'])>1 && strlen($_POST['cheat_stats'])<1000) $cheat_stats = $_POST['cheat_stats'];
else $eroare[] = 'Error cheatstats : Anti-ddosul trebuie sa contina intre 1 si 1000 de caractere!';

//Controlpanelul trebuie sa contina intre 1 si 100 de caractere
if(strlen($_POST['cheat_imagine1'])>1 && strlen($_POST['cheat_imagine1'])<100) $cheat_imagine1 = $_POST['cheat_imagine1'];
else $eroare[] = 'Error cheatimagine1: cheatimagine1ul trebuie sa contina intre 1 si 100 caractere!';

// Verifica daca cheatimagine2 are cel putin 1 caractere si maxim 100
if(strlen($_POST['cheat_imagine2'])>1 && strlen($_POST['cheat_imagine2'])<100) $cheat_imagine2 = $_POST['cheat_imagine2'];
else $eroare[] = 'Error cheatimagine2 : Sub-domeniul trebuie sa contina intre 1 si 100 caractere!';

// Verifica daca cheattarget are cel putin 1 caractere si maxim 1000
if(strlen($_POST['cheat_target'])>1 && strlen($_POST['cheat_target'])<1000) $cheat_target = $_POST['cheat_target'];
else $eroare[] = 'Error cheattarget : cheattargetle trebuie sa contina intre 1 si 1000 caractere!';

// Verifica daca valoarea are cel putin 1 si cel mult 1000
if(strlen($_POST['cheat_detalii'])>0 && strlen($_POST['cheat_detalii'])<65000) $cheat_detalii = $_POST['cheat_detalii'];
else $eroare[] = 'Error Cheat Detalii : Valoarea trebuie sa contina intre 0 si 65000 de caractere!';



$sql = "UPDATE `cheat` SET `cheat_nume`='{$cheat_nume}', `cheat_link1`='{$cheat_link1}', `cheat_link2`='{$cheat_link2}', `cheat_detectabil`='{$cheat_detectabil}', `cheat_wall`='{$cheat_wall}', `cheat_aim`='{$cheat_aim}', `cheat_speed`='{$cheat_speed}', `cheat_no`='{$cheat_no}', `cheat_versiune`='{$cheat_versiune}', `cheat_stats`='{$cheat_stats}', `cheat_imagine1`='{$cheat_imagine1}', `cheat_imagine2`='{$cheat_imagine2}', `cheat_target`='{$cheat_target}', `cheat_detalii`='{$cheat_detalii}' WHERE id_cheat='{$_POST['id']}'";

if (mysql_query($sql)) {
$mesaj = "<center><br><br><br><br>Codul a fost editat!<br><br></center>";

}
else $mesaj = '<font color="red">Codul nu a putut fi editata: '. mysql_error(). '</font>';
}
echo $mesaj;
}

if($_GET['action']=="editeaza"){
$row = mysql_fetch_array(mysql_query("SELECT * FROM `cheat` WHERE id_cheat='{$_GET['id']}'"));
$id = $row[0];
$cheat_nume = $row[1];
$cheat_link1 = $row[2];
$cheat_link2 = $row[3];
$cheat_detectabil = $row[4];
$cheat_wall = $row[5];
$cheat_aim = $row[6];
$cheat_speed = $row[7];
$cheat_no = $row[8];
$cheat_versiune = $row[9];
$cheat_stats = $row[10];
$cheat_imagine1 = $row[11];
$cheat_imagine2 = $row[12];
$cheat_target = $row[13];
$cheat_detalii = $row[14];
?>

<br />

<form method="post" action="addcheat.php">
<input type="hidden" name="action" value="salveaza" />
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<table align="center" width="817" border="0" class="myform" id="stylized">

<tr>
<td width="154"><label class="description" for="cheat_nume">Nume Cheat</label></td>
<td width="212"><label class="description">Caracteristici:</label></td>
<td width="437"><label class="description">Valori:</label></td>
</tr>
<tr>
<td><div>
<input id="element_1" name="cheat_nume" value="<?php echo $cheat_nume; ?>" type="text" maxlength="255"/>
</div></td>
<td><label class="description">Detectabil</label></td>
<td><input name="cheat_detectabil" type="radio" class="button_text" value="Yes" <?php echo $cheat_detectabil=="Yes"?"checked='checked'":""; ?>/>
Yes
<input type="radio" name="cheat_detectabil" value="No" <?php echo $cheat_detectabil=="No"?"checked='checked'":""; ?>/>
No </td>
</tr>
<tr>
<td><label class="description" for="cheat_link1">Download link 1</label></td>
<td><label class="description">Wall</label></td>
<td><input name="cheat_wall" type="radio" class="button_text" value="Yes" <?php echo $cheat_wall=="Yes"?"checked='checked'":""; ?>/>
Yes
<input type="radio" name="cheat_wall" value="No" <?php echo $cheat_wall=="No"?"checked='checked'":""; ?>/>
No</td>
</tr>
<tr>
<td><div>
<input id="element_1" name="cheat_link1" class="element text medium" type="text" maxlength="255" value="<?php echo $cheat_link1; ?>"/>
</div></td>
<td>Aim</td>
<td><input name="cheat_aim" type="radio" class="button_text" value="Yes" <?php echo $cheat_aim=="Yes"?"checked='checked'":""; ?>/>
Yes
<input type="radio" name="cheat_aim" value="No" <?php echo $cheat_aim=="No"?"checked='checked'":""; ?>/>
No</td>
</tr>
<tr>
<td><label class="description" for="cheat_link2">Download Link 2</label></td>
<td><label class="description">Speed</label></td>
<td><input name="cheat_speed" type="radio" class="button_text" value="Yes" <?php echo $cheat_speed=="Yes"?"checked='checked'":""; ?>/>
Yes
<input type="radio" name="cheat_speed" value="No" <?php echo $cheat_speed=="No"?"checked='checked'":""; ?>/>
No</td>
</tr>
<tr>
<td><div>
<input id="element_1" name="cheat_link2" class="element text medium" type="text" maxlength="255" value="<?php echo $cheat_link2; ?>"/>
</div></td>
<td><label class="description">No flash/smoke</label></td>
<td><input name="cheat_no" type="radio" class="button_text" value="Yes" <?php echo $cheat_no=="Yes"?"checked='checked'":""; ?>/>
Yes
<input type="radio" name="cheat_no" value="No" <?php echo $cheat_no=="No"?"checked='checked'":""; ?>/>
No</td>
</tr>
<tr>
<td><select name="cheat_target" id="cheat_target">
<option value="_parent">Fereastra similara</option>
<option value="_blank">Fereastra noua</option>
</select></td>
<td>Detalii</td>
<td><textarea name="cheat_detalii" cols="70" rows="10" id="cheat_detalii"><?php echo $cheat_detalii; ?></textarea></td>
</tr>
<tr>
<td> </td>
<td>Versiune joc:</td>
<td><select name="cheat_versiune" id="cheat_versiune">
<option value="CS 1.6" selected="selected">Counter-Strike 1.6</option>
<option value="CS:S">Counter-Strike Source</option>
<option value="CS:Z">CS:Z</option>
</select></td>
</tr>
<tr>
<td> </td>
<td>Functionabil pe</td>
<td><select name="cheat_stats" id="cheat_stats">
<option value="Steam/Non-Steam">STEAM / NO-STEAM</option>
<option value="Steam">STEAM</option>
<option value="Non-Steam">NON-STEAM</option>
</select></td>
</tr>
<tr>
<td>Imagine</td>
<td><input id="element_3" name="cheat_imagine1" class="element text medium" type="text" maxlength="255" value="<?php echo $cheat_imagine1; ?>"/></td>
<td><input id="element_4" name="cheat_imagine2" class="element text medium" type="text" maxlength="255" value="<?php echo $cheat_imagine2; ?>"/></td>
</tr>
<tr>
<td><button name="submit" type="submit" >Editare</button></td>
<td><button name="Reset" type="reset" value="RESET" >Reset</button></td>
<td></td>
</tr>
</table>
</form>
</td>
<?php
}
$sql = "SELECT * FROM cheat";
$resursa = mysql_query($sql);
echo "<table width='100%' cellpadding='1' cellspacing='1'>
<tr>
<th>ID</th>
<th>Cheat Name</th>
<th>Link1</th>
<th>Edit</th>
<th>Stergere</th>
</tr>
";
while ($row=mysql_fetch_array($resursa))
{
//variabilele definite
$nr = $nr+1;
$id_cheat = $row[0];
$cheat_nume = $row[1];
$cheat_link1 = $row[2];
$var = "".$row['id_cheat']."";
$dl = " <a href=\"addcheat.php?action=sterge&id_cheat=$var\"><img src=\"css/stergere.gif\" alt=\"stergere\" border=0 /></a>";
?>
<tr>
<td><? echo "$nr";?></td>
<td><? echo "$cheat_nume";?></td>
<td><? echo "$cheat_link1";?></td>
<td><a href="?action=editeaza&id=<? print $id_cheat; ?>"><img src="css/edit.gif" border="0" width="29" height="18" /></a></td>
<td><? echo $dl;?></td>
</tr>
<?php } ?>

</table>
<?php
}
?>


<br /><br />




<?php

mysql_close($conexiune);
?>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...