daGrevis Posted July 20, 2012 Report Share Posted July 20, 2012 > Nē, es domāju tā, ka tu izmanto tikai lai iegūtu vērtību, nevis tur ierakstītu. Tas pats attiecas uz $_POST masīvu Link to comment Share on other sites More sharing options...
Amerika Posted July 21, 2012 Author Report Share Posted July 21, 2012 $_GET['n'] = mysql_real_escape_string($_GET['n']); vietā kāpec tu neizmanto - $variable = mysql_real_escape_string($_GET['n']); http://php.lv/f/topic/20570-php-papildus-info/page__view__findpost__p__160563 Tādēļ ka balstījos uz briedis pārmetuma. :) Link to comment Share on other sites More sharing options...
aaxc Posted July 21, 2012 Report Share Posted July 21, 2012 Kurš mūsdienās vēl vispār izmanto mysql_real_escape_string ??? Link to comment Share on other sites More sharing options...
briedis Posted July 21, 2012 Report Share Posted July 21, 2012 Kurš mūsdienās vēl vispār izmanto mysql_real_escape_string ??? Visi iesācēji, kās vēl nav uzzinājuši, ka ir citi veidi, kā ORM, PDO, etc.. Link to comment Share on other sites More sharing options...
Mr.Key Posted July 22, 2012 Report Share Posted July 22, 2012 ORM taču ir lēns... (jox) Link to comment Share on other sites More sharing options...
Kavacky Posted July 23, 2012 Report Share Posted July 23, 2012 (jox) FAIL. Link to comment Share on other sites More sharing options...
y2ok Posted July 23, 2012 Report Share Posted July 23, 2012 http://php.lv/f/topi...post__p__160563 Tādēļ ka balstījos uz briedis pārmetuma. :) Viņa pārmetums bija par to, ka tu definē mainīgos un nekur viņus pēc tam neizmanto. Link to comment Share on other sites More sharing options...
Amerika Posted July 23, 2012 Author Report Share Posted July 23, 2012 Skripts, kas pārsūta failus uz web servera. $query3 = "SELECT id FROM news ORDER BY id DESC LIMIT 1"; $data3 = mysql_query ($query3) or die(mysql_error()); $row3 = mysql_fetch_array( $data3 ); $img_type = explode(".", $_FILES['uploaded']['name']); $image_ext = ($row3['id'] + 1).".".$img_type['1']; $target = "upload/" . $image_ext; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; $file = $_FILES['uploaded']; $allowedExtensions = array("jpg", "gif", "png"); function isAllowedExtension($fileName) { global $allowedExtensions; return in_array(end(explode(".", $fileName)), $allowedExtensions); } ..... else { if($file['error'] == UPLOAD_ERR_OK) { if(isAllowedExtension($file['name'])){ if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded"; } else { echo "Sorry, there was a problem uploading your file."; } } else { echo "Wrong file type.(.jpg,.png,.gif)"; } } else { echo "Cant upload error $ok = 0"; } } iznākumā vēlos lai faila nosaukums atbilstu $image_ext variablim. Liekot bildes iekšā beigās rezultātam vajadzētu būt 1.jpg 2.jpg 3.png utt. Bet nevaru variabli savienot ar move_uploaded_file. Labākajā variantā man sanāca 1.jpgkautkas.jpg Izskatīju vairākus sourcus iespējams, kaut ko palaižu garām visu laiku. Link to comment Share on other sites More sharing options...
Val Posted July 24, 2012 Report Share Posted July 24, 2012 Kāpēc, Tu baidies definēt jaunus mainīgos? Viņš grib atklāt jaunu Ameriku. Link to comment Share on other sites More sharing options...
Amerika Posted July 24, 2012 Author Report Share Posted July 24, 2012 (edited) Viņš grib atklāt jaunu Ameriku. Labs offtopiks. Ļoti palīdzēji. Atrisināju. TC! Edited July 24, 2012 by Amerika Link to comment Share on other sites More sharing options...
Recommended Posts