Autentificare
facebook MW pe Facebook
twitter MW pe Twitter
© Mobilewave.ro
versiunea desktop
Inițiator acum 13 ani
modoran
MW Addicted
Ultimul acum 8 ani
TABela
MW Addicted
Cauta in topic
Unelte topic
Dacă vă place acest articol trimiteți mai departe!

Scripturi php si configurare servere free (newbie)

35 951 vizualizări
2 743 răspunsuri
Last1Left
MW Addicted
1992 mesaje
din 30/01/2007
10 aprecieri
27 iunie 2011, 10:14:14
lasi sa se scrie si cu litere mari si pe urma folosesti strtolower

http://php.net/manual/en/function.strtolower.php
Publicitate
Publicitate
misteryo
MW Liker
62 mesaje
din 01/08/2009
29 iulie 2011, 17:18:39
Cine ma ajuta cu acest script sa redirectionez un fisier atunci cand uploadez sa se directioneze pe alt site ???



<?php
session_start();
?>

<?php
$time = date("d.m.Y, H:i:s");
$Browser = $_SERVER[HTTP_USER_AGENT];
$ip=$_SERVER[REMOTE_ADDR];
$desc=trim($_POST['desc']);
$username=trim($_POST['username']);
$category = $_POST['category'];

if(!$desc) $desc="No description available.";
if(!$user) $user="Guest";
$no="no";

include("header.php");

include("config.php");


if(isset($_SESSION['nume'])) {
      $usernames = ''.$_SESSION['nume'].'';
$stare = "Upload File <i>(wap)</i> ";
if(!$act){mysql_query("UPDATE utilizatori SET stare='$stare' WHERE nume='$usernames'");}
}

echo "<div class='hl'>Upload file</div>";
echo "<div class='txt'>";
if($_GET[page] !=="add"){
echo "<form method=\"post\" enctype=\"multipart/form-data\" action=\"upload.php?page=add$vxhtml2\">";

echo "<input type=\"file\" name=\"filetoupload\"><br>";
echo "<div class='txt'>";
echo "<b>Category</b> <select name='category'>";
$sql = mysql_query("SELECT * FROM categorii ORDER BY name");
while($row = mysql_fetch_array($sql)){
echo "<option value='$row[id]'>$row[name]</option>";}
echo "</select>
<br/>
</div>";
echo "<input type=\"Submit\" name=\"uploadform\" value=\"Upload File\">";
echo "(max. <b>".$mb."</b> MB)</div>";
echo "<div class=\"hl\">Optional</div>";



if(isset($_SESSION['nume'])) {
      $usersa = ''.$_SESSION['nume'].'';
echo "<div class=\"txt\">";
echo "<br/><input type=\"hidden\" name=\"username\" value=\"$usersa\"/>";
}else{
      echo "<div class=\"txt\"><b>User:</b>";
echo "<br/><input type=\"text\" name=\"username\" size=\"30\" /><br/>";
     
}
echo "<b>Description:</b>";
echo "<br/><textarea name=\"desc\" rows=\"4\" cols=\"40\"></textarea><br/>";
echo "<div class='Emessage'><b>Notice:You are not allowed to upload <font color='red'>'imoral material'</font> & <font color='red'>'manele'</font> ";
echo "once you submit the file, it will be available to public.</b></div>";
echo "<br/><b>Please wait while the file is uploaded, it may take several minutes depending by the size of the file and by your internet bandwidth.</b>";
echo "<br/><a href='rules.php'>Please take a look on the complete rules section.</a>";
echo "</div>";
echo "</form>";

}




if ($_REQUEST[file1]) {
$file1 = $_REQUEST[file1];
$file1 = explode("=", $file1);
$file_content = $file1[1];
$filename = str_replace("file", "", $file1[0]);

$size = strlen($file_content);


}
else {

$filename = $_FILES['filetoupload']['name'];
$size = $_FILES['filetoupload']['size'];
}

$ext = strrchr($filename,'.');
$truext=str_replace(".","",$ext);
$truext=strtolower($truext);
$ext=strtolower($ext);
$upload_dir=htmlspecialchars("fisiere/$truext/");

$filename=str_replace(" ","_",$filename);
$filename=str_replace("`","_",$filename);
$filename=str_replace("]","_",$filename);
$filename=str_replace("[","_",$filename);
$filename=str_replace(".php.",".",$filename);

$filename=str_replace("~","_",$filename);
$filename=str_replace("@","_",$filename);
$filename=str_replace("#","_",$filename);
$filename=str_replace("%","_",$filename);
$filename=str_replace("^","_",$filename);

$filename=str_replace("www.","_",$filename);
$filename=str_replace(".net","_",$filename);
$filename=str_replace(".ro","_",$filename);
$filename=str_replace(".com","_",$filename);
$filename=str_replace(".info","_",$filename);
$filename=str_replace(".biz","_",$filename);
$filename=str_replace(".org","_",$filename);
$filename=str_replace("http://","_",$filename);
$filename=str_replace(".hi2","_",$filename);
$filename=str_replace("wWw.","_",$filename);
$filename=str_replace("WwW.","_",$filename);
$filename=str_replace("WWW.","_",$filename);
$filename=str_replace(".Net","_",$filename);
$filename=str_replace(".Ro","_",$filename);
$filename=str_replace(".Oom","_",$filename);
$filename=str_replace(".Info","_",$filename);
$filename=str_replace(".Biz","_",$filename);
$filename=str_replace(".Org","_",$filename);
$filename=str_replace("http://","_",$filename);
$filename=str_replace(".Hi2","_",$filename);
$filename=str_replace("*","_",$filename);
$filename=str_replace("|","_",$filename);
$filename=str_replace("$","_",$filename);
$filename=str_replace("&lt;","_",$filename);
$filename=str_replace("<","_",$filename);
$filename=str_replace(">","_",$filename);
$filename=str_replace("&gt;","_",$filename);
$filename=str_replace("\"","_",$filename);
$filename=str_replace("'","_",$filename);

$filename =preg_replace(
'/[^a-zA-Z0-9\.\$\%\'\`\@\{\}\~\!\#\(\)\&\_\^]/'
,'',str_replace(array('cgi','htpasswd','htaccess','py','js','asp','htm','php','html','wml','xhtml',' ','`','~','&','@','!','%','`','^','$','c:','d:','e:','D:','E:','C:','|','>','<','[',']','(',')'),array('_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','','','','','','','','','','','','','','','','','','','','','','',''),$filename));



if($_GET['page']=="add"){

if (!$filename)
{
echo "<b>Please select a file for upload.</b><br />";
die();
}


if (($extlimit == "yes") && (in_array($ext,$limitedext)))
{
echo("Extension <b>$ext</b> was disabled due security reasons.The file was NOT uploaded!<br />");
echo "<br />";
die();
}


if(strlen($filename)>$lungime_nume)
{
echo "<b><font color=\"red\">Your file name has a name too long.Please rename it!</font></b><br />";
die();
}



if ($size > $size_bytes)
{
echo "<b><font color=\"red\">Your file size is too big.Maximum allowed is $mb MB.</font></b><br />";
die();
}


if (file_exists("fisiere/$upload_dir/$filename"))
{
echo("<b><font color=\"red\">File already exist.Please rename your file!</font></b><br />");
die();
}

if ($file1) {
if(!is_dir($upload_dir)){mkdir($upload_dir); chmod($upload_dir,0777); copy("htaccess.txt","$upload_dir.htaccess");}

$fp = fopen($upload_dir.$filename, "w") or die("File cannot be saved due server permissions");

fwrite($fp, base64_decode($file_content));
if (fclose($fp)) $Uploaded = TRUE;


} else {
if(!is_dir($upload_dir)){mkdir($upload_dir); chmod($upload_dir,0777); copy("htaccess.txt","$upload_dir.htaccess");}
move_uploaded_file($_FILES['filetoupload']['tmp_name'], $upload_dir.$filename) or die("Cannot move uploaded file");
$Uploaded = TRUE;
}
if ($Uploaded)
{
mysql_query("INSERT INTO fisiere (banned,file,user,browse,ip,ftype,uploaded,description,size,categorie) VALUES ('$no','$filename','$username','$Browser','$ip','$truext','$time','$desc','$size','$category')");
$sql = mysql_query("SELECT * FROM fisiere WHERE file = '$filename' ");


$idir = "fisiere/$truext/"; // Path To Images Directory
$tdir = "thumb/"; // Path To Thumbnails Directory
$twidth = "100"; // Maximum Width For Thumbnail Images
$theight = "100"; // Maximum Height For Thumbnail Images

if(in_array($truext,array("gif","jpg","jpeg","png"))){

$urls = $filename; // Set $url To Equal The Filename For Later Use

if(in_array($truext,array("jpeg"))){
$simg = imagecreatefromjpeg("$idir" . $urls); // Make A New Temporary Image To Create The Thumbanil From
}

if(in_array($truext,array("jpg"))){
$simg = imagecreatefromjpeg("$idir" . $urls); // Make A New Temporary Image To Create The Thumbanil From
}

if(in_array($truext,array("gif"))){
$simg = imagecreatefromgif("$idir" . $urls); // Make A New Temporary Image To Create The Thumbanil From
}

if(in_array($truext,array("png"))){
$simg = imagecreatefrompng("$idir" . $urls); // Make A New Temporary Image To Create The Thumbanil From
}

$currwidth = imagesx($simg); // Current Image Width
$currheight = imagesy($simg); // Current Image Height
if ($currheight > $currwidth) { // If Height Is Greater Than Width
$zoom = $twidth / $currheight; // Length Ratio For Width
$newheight = $theight; // Height Is Equal To Max Height
$newwidth = $currwidth * $zoom; // Creates The New Width
} else { // Otherwise, Assume Width Is Greater Than Height (Will Produce Same Result If Width Is Equal To Height)
$zoom = $twidth / $currwidth; // Length Ratio For Height
$newwidth = $twidth; // Width Is Equal To Max Width
$newheight = $currheight * $zoom; // Creates The New Height
}
$dimg = imagecreate($newwidth, $newheight); // Make New Image For Thumbnail
imagetruecolortopalette($simg, false, 256); // Create New Color Pallete
$palsize = ImageColorsTotal($simg);
for ($i = 0; $i < $palsize; $i++) { // Counting Colors In The Image
$colors = ImageColorsForIndex($simg, $i); // Number Of Colors Used
ImageColorAllocate($dimg, $colors['red'], $colors['green'], $colors['blue']); // Tell The Server What Colors This Image Will Use
}
imagecopyresized($dimg, $simg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight); // Copy Resized Image To The New Image (So We Can Save It)
imagejpeg($dimg, "$tdir" . $urls); // Saving The Image
imagedestroy($simg); // Destroying The Temporary Image
imagedestroy($dimg); // Destroying The Other Temporary Image
print 'Image thumbnail created successfully.</br>'; // Resize successful
}



$top="SELECT * from utilizatori where nume='$username'";
$top2=mysql_query($top);
while($top3=mysql_fetch_array($top2))
{
$setup = $top3["fisiere"];
$cpts = $top3["ptup"];
}
$setup = $setup+1;

$topup="UPDATE utilizatori SET fisiere='$setup' WHERE nume='$username'";

mysql_query($topup);
while($row = mysql_fetch_array($sql)){
$id = $row['id'];}


$pts = $cpts+5;

$ptup="UPDATE utilizatori SET ptup='$pts' WHERE nume='$username'";

mysql_query($ptup);


echo ("<b><font color=\"red\">Your file was uploaded </font><a href=\"$url/file.php?id=$id$vxhtml2\">here</a></b><br />
<u>Copy and paste the following code:</u><br />
<input value=\"$url/file.php?id=$id\" size='55' name='link' onclick='javascript:this.select();'/><br/>

Cod FORUM<br/>
<input value=\"&#91;url=$url/file.php?id=$id&#93;$filename&#91;/url&#93; ($sz)\" size=\"55\" name=\"link\" onclick=\"javascript:this.select();\"><br/>
Cod HTML<br/>
<input value=\"&lt;a href=&quot;$url/file.php?id=$id&quot;&gt;$filename&lt;/a&gt ($sz)\" size=\"55\" name=\"link\" onclick=\"javascript:this.select();\"><br/>
Cod PHP<br/>
<input value=\"&lt;?=file_get_contents(&quot;$url/file.php?id=$id&amp;prv=0&quot;)?&gt;\" size=\"55\" name=\"link\" onclick=\"javascript:this.select();\"><br/>"

);

include"footer.php";

die();
}
else
{


echo "<b><font color=\"red\">Unexpected error.Please try again.</font></b><br />";
echo "<br />";
include"footer.php";
die();
}
}

include"footer.php";
?>
whiteboy
MW Addicted
5940 mesaje
din 01/03/2008
5 aprecieri
29 iulie 2011, 19:35:35
ce sa se redirectioneze? fisierul, sau sa apara alta pagina?
misteryo
MW Liker
62 mesaje
din 01/08/2009
Opera Mini
29 iulie 2011, 19:54:31
da fisierul ...
Blandu
Art Director
6160 mesaje
din 25/08/2005
16 aprecieri
01 august 2011, 04:41:07
Stie/ma poate ajuta cineva cu un CMS pentru galerie media? In special pentru poze.
As vrea sa stie sa creeze automat thumbnails - sa faca redimensionare si crop ca thumb-urile sa se incadreze intr-o anumita dimensiune fara distorsionare, sa foloseasca lightbox si sa creeze automat pagini dupa x elemente.
Ar fi super daca ar putea face chestia asta si cu video, dar nu ma intereseaza ca fisierele video sa fie urcate pe server. Vreau sa folosesc coduri embed de pe youtube in special. Ideea e sa se comport la fel ca la poze. Sa apara un thumbnail iar rularea video sa se faca in lightbox.

Ma mai intereseaza sa poti crea mai multe galerii pentru a fi afisate pe diferite pagini.

Nu vreau ceva complicat. Cu cat mai simplu cu atat mai bine.

Multumesc!
Adrian Coroian
MW Lurker
367 mesaje
din 21/09/2007
07 august 2011, 14:52:59
Am si eu nevoie de o mica mana de ajutor. Vreau sa extrag dintr-un tabel niste date in urmatorul fel:

id1 | nume1 | luna1 | 3 voturi
id2 | nume1 | luna2 | 7 voturi
id3 | nume2 | luna1 | 5 voturi

Vreau sa mi le afiseze asa:

1 nume1 10 voturi (adica luna1 + luna2)
2 nume2 5 voturi (aici sa zicem ca nu s-a votat decat intr-o singura luna, deci ramane asa)

Am incercat cu urmatorul cod insa nu e ok:

$sql = "SELECT *, SUM(voturi) as mysum FROM nume_tabel ORDER BY mysum DESC LIMIT $limit_start, $items_per_page";

Multumesc anticipat.
misteryo
MW Liker
62 mesaje
din 01/08/2009
19 august 2011, 11:38:46
cum sa scap de eroarea asta

la linia 2 din index

<?php //003ab if(!extension_loaded('ionCube Loader')){$__oc=strtolower(substr(php_uname(),0,3));$__ln='ioncube_loader_'.$__oc.'_'.substr(phpversion(),0,3).(($__oc=='win')?'.dll':'.so');@dl($__ln);if(function_exists('_il_exec')){return _il_exec();}$__ln='/ioncube/'.$__ln;$__oid=$__id=realpath(ini_get('extension_dir'));$__here=dirname(__FILE__);if(strlen($__id)>1&&$__id[1]==':'){$__id=str_replace('\\','/',substr($__id,2));$__here=str_replace('\\','/',substr($__here,2));}$__rd=str_repeat('/..',substr_count($__id,'/')).$__here.'/';$__i=strlen($__rd);while($__i--){if($__rd[$__i]=='/'){$__lp=substr($__rd,0,$__i).$__ln;if(file_exists($__oid.$__lp)){$__ln=$__lp;break;}}}@dl($__ln);}else{die('The file '.__FILE__." is corrupted.
");}if(function_exists('_il_exec')){return _il_exec();}echo('Site error: the file <b>'.__FILE__.'</b> requires the ionCube PHP Loader '.basename($__ln).' to be installed by the site administrator.');exit(199); ?>
autor subiect #2693
modoran
MW Addicted
7605 mesaje
din 26/01/2006
33 aprecieri
19 august 2011, 23:20:07
Instaleaza Ioncube Loader.
http://www.ioncube.com/loaders.php
gyoada
Începător
24 mesaje
din 18/03/2006
1 aprecieri
09 septembrie 2011, 16:42:59 • actualizat 09 septembrie 2011, 16:44:11 (1 ori)
whiteboy 20-02-2010 16:59:49
am si eu nevoie de o chestie...
extrag dintr-un tabel cate 9 informatii/pagina
dar as vrea ca dupa fiecare a 3-a informatie extrasa sa pun un text aleatoriu...

cum sunt reclamele pe bloguri... sau intre postari aici pe mw...

$sql = mysql_query("SELECT * FROM fisiere ORDER BY id DESC LIMIT $d1,$d2");
while($row = mysql_fetch_array($sql)){
echo $row['id']."<br/>".$row['nume']."-----<br/>";
}
$sql = mysql_query("SELECT * FROM fisiere ORDER BY id DESC LIMIT $d1,$d2");
while($row = mysql_fetch_array($sql)){
$d1 = $d1+1;
echo $row['id']."<br/>".$row['nume']."-----<br/>";
//%3=3 rezultate//
if($d1 %3 ==0) echo "RECLAMA.";           
}
smek3rul
MW Addicted
4342 mesaje
din 11/01/2009
60% warn
21 septembrie 2011, 12:05:11
Salut. am si eu nevoie de un script de magazin online! Ce imi recomandati? Magazinul va fi un magazin de incaltaminte. Ce imi recomandati? eu mi-am cam prins urechile in prestashop. Ma refer ca nu reusesc sa adaug produse.
JokerBoy
MW Addicted
4952 mesaje
din 21/07/2005
21 aprecieri
BlackBerry
21 septembrie 2011, 13:24:50
Nu mai ai un pic de rabdare..  :P
TABela
MW Addicted
3952 mesaje
din 05/08/2008
77 aprecieri
Symbian
21 septembrie 2011, 13:38:32
Un magazin online care merge si pe telefoane, si foloseste flat file este aici
http://obiewebsite.sourceforge.net
Scriptul e din 2005 si merge bine, findca e mai simplist webshopul poate nu o sati placa. Usor de tradus.
whiteboy
MW Addicted
5940 mesaje
din 01/03/2008
5 aprecieri
21 septembrie 2011, 14:28:35
osCommerce?
smek3rul
MW Addicted
4342 mesaje
din 11/01/2009
60% warn
21 septembrie 2011, 18:26:21
am mai gasit http://smek3rul.hi2.ro/2/ http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/1.gif dar nu gasesc limba romana pt el . http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/2.gif iar oscommerce la fel parca nu are limba romana sau ma insel?
Publicitate
Publicitate
whiteboy
MW Addicted
5940 mesaje
din 01/03/2008
5 aprecieri
Opera Mini
21 septembrie 2011, 18:52:56
roshop.ablog.ro/2009-04-10/instalare-oscommerce-in-limba-romana.html
Înapoi la Creative Corner
cine e aici?
Subiectul a fost creat la .
versiunea desktop
0.039⋅4⋅0