Новичок
Профиль
Группа: Участник
Сообщений: 16
Регистрация: 13.6.2007
Где: Москва
Репутация: нет Всего: нет
|
У меня нет возможности на хостинге использовать пхп, за то есть перл И так есть работа нужно переписать 2 файлика php и сделать их в perl Если кто хочет взяться пишем мне в асю 6141466 либо идем yapchat.ru и там пишем в чате челу с ником Kuzya И договариваемся о цене за которую вы сделаете работу! Код я выкладываю: 1: Код | <html><head><title>Flash Chat 6 add photo</title></head> <style> a{color:#000090} a:link{text-decoration:none} a:active{text-decoration:none} a:visited{text-decoration:none} a:hover{color:#990000;text-decoration:none} body{background:#ffffff;color:#000000;font-family:verdana;font-size:11} table{font-size:11} img{border:0} form{margin:0} .stm{font-size:12px;width:225;height:20;font-family:verdana} </style> <body marginheight=30 marginwidth=30 topmargin=30 bottommargin=30> <center>
<b>Photos uploading</b> <br> <br>
<form action="photo.php" method=post enctype="multipart/form-data"> <table cellpadding=1 cellspacing=0 align=center bgcolor=444444><tr><td> <table cellpadding=3 cellspacing=0 align=center> <tr bgcolor=e5e5e5 height=30> <td align=right width=100>Login <font color=990000>*</font></td><td width=10></td><td width=250><input class=stm type=text name=l maxlength=24></td> </tr><tr bgcolor=eeeeee height=30> <td align=right>Password <font color=990000>*</font></td><td width=10></td><td><input class=stm type=password name=p maxlength=24></td> </tr><tr bgcolor=e5e5e5 height=30> <td align=right>Photo <font color=990000>*</font></td><td width=10></td><td><input class=stm accept="image/jpeg" name=userfile type=file></td> </tr><tr bgcolor=eeeeee height=30> <td align=right>PhotoType <font color=990000>*</font></td><td width=10></td><td> <select name=pt size=1 class=stm style="font-size:10px"> <option value=m selected>Main Profile Photo (100x100 px)</option> <?for($i=0;$i<12;$i++){echo"<option value={$i}>Gallery Slot ".($i+1)." (150x150 px)</option>";}?> </select> </td> </tr><tr bgcolor=e5e5e5 height=30> <td align=right>ResizeStyle <font color=990000>*</font></td><td width=10></td><td> <input type=radio name=st value=1 checked>Cut borders to Square<br> <input type=radio name=st value=2>Stretch to Square </td> </tr><tr bgcolor=eeeeee height=30> <td colspan=2></td><td> <font size=1>Allowable format <b>.jpg</b><br> Maximal weight <b>200</b> Kb<br> </tr><tr bgcolor=e5e5e5> <td colspan=2></td><td><br><input type=hidden name=MAX_FILE_SIZE value=512000><input style="height:20;width:100;font-size:11" type=submit name=a value="Upload"><input style="height:20;width:100;font-size:11" type=submit name=a value="Remove"></td> </tr></table> </td></tr></table> </form>
<br> <?
$qs=split(':',@$_SERVER["QUERY_STRING"]); if(strlen($qs[0])==3){ $er='<b>ERROR!</b> '; $c1='<font color=006600>'; $c2='<font color=990000>'; $c3='</font>'; $e=array( 'e00'=>$c1.'The photo is successfully uploaded!', 'e01'=>$c2.$er.'The password is not identified!', 'e02'=>$c2.$er.'Incorrect data input!', 'e03'=>$c1.'The photo is removed!', 'e04'=>$c2.$er.'Invalid format of the Photo<br>(use <b>jpg</b>, not more than <b>512</b> Kb)', 'e05'=>$c2.$er.'Your gallery disabled by admin!', ); echo'<center><font color=990000><b>: Result :</b></font><br>'.@$e[$qs[0]].$c3; if($qs[0]=='e00'){ $upi='photo/'; if(file_exists($upi.$qs[1])){ echo'<br><br><img src="'.$upi.$qs[1].'">'; } } echo'</center>'; } ?> <br> <? //include'counts.html' ?> </body> </html>
|
----------------------------------------------------------------------------------------------------- 2: Код | <? $upi='photo/'; $jmp='location:photo_adding.php?';
$DBName='имя базы'; $DBHost='localhost'; $DBUser='имя юзера'; $DBPass='пароль';
$head='e02';
//************** // You need php_gd2.dll library in your php // uncomment `extension=php_gd2.dll` in php.ini //**************
$l = $_POST['l']; $p = $_POST['p']; $pt = $_POST['pt']; $st = $_POST['st']; $a = $_POST['a'];
if(strlen(@$l)&&strlen(@$p)>2&&strlen(@$pt)&&strlen(@$st)&&(@$a=='Upload'||@$a=='Remove')){ $l = addslashes($l); $p = addslashes($p); setlocale(LC_ALL,'ru_RU.CP1251'); $fnd=0; if(!mysql_connect($DBHost,$DBUser,$DBPass)){ echo'Can not connect to database <b>'.$DBName.'</b> !<br>'; echo'Error: <b>'.mysql_error().'</b><br>'; exit; } mysql_select_db($DBName); $r=mysql_query("select i,p,gg,gl from mem where n='{$l}'"); if(mysql_num_rows($r)){ $f=mysql_fetch_array($r); if($f['p']==md5($p)){$fnd=1;} } if(!$fnd){ sleep(2); # пароль не опознан $head='e01'; }else{ if($a=='Upload'){ $file_size=$HTTP_POST_FILES['userfile']['size']; $fpr=@getimagesize($HTTP_POST_FILES['userfile']['tmp_name']); $fxx=$fpr[0]; $fyy=$fpr[1]; $ftt=$fpr[2]; // type 1-gif 2-jpg if($file_size<=512*1024 && $ftt==2){ if($pt=='m'){ $f=$f['i'].'a.jpg'; @unlink($upi.$f); @copy($HTTP_POST_FILES['userfile']['tmp_name'],$upi.$f); @chmod($upi.$f,0777); $srx=0;$sry=0; $gx=$fxx;$gy=$fyy; if($st=='1'){ if($fxx>$fyy){ $gx=$fyy; $srx=round(($fxx-$fyy)/2); }else{ $gy=$fxx; $sry=round(($fyy-$fxx)/2); } } $desimg=Imagecreatetruecolor(100,100); #$desimg=ImageCreate(100,100); $srcimg=ImageCreateFromJPEG($HTTP_POST_FILES['userfile']['tmp_name']); imagecopyresized($desimg,$srcimg,0,0,$srx,$sry,100,100,$gx,$gy); imagejpeg($desimg,$upi.$f); $head='e00:'.$f; }else{ $pt=intval($pt); if($pt>-1&&$pt<12){ $gal=$f[gl]; if($f[gg]){ # gallery enabled $sz1=150; $sz2=40; $p1=$f[i]."g{$pt}.jpg"; $p2=$f[i]."g{$pt}m.jpg"; $gal=substr($gal,0,$pt).'1'.substr($gal,$pt+1,strlen($gal)-$pt-1); mysql_query("update mem set gl='{$gal}' where n='{$l}'"); $srx=0;$sry=0; $gx=$fxx;$gy=$fyy; if($st=='1'){ if($fxx>$fyy){ $gx=$fyy; $srx=round(($fxx-$fyy)/2); }else{ $gy=$fxx; $sry=round(($fyy-$fxx)/2); } } $desimg=Imagecreatetruecolor($sz1,$sz1); #$desimg=ImageCreate($sz1,$sz1); $srcimg=ImageCreateFromJPEG($HTTP_POST_FILES['userfile']['tmp_name']); imagecopyresized($desimg,$srcimg,0,0,$srx,$sry,$sz1,$sz1,$gx,$gy); imagejpeg($desimg,$upi.$p1); @chmod($upi.$p1,0777); $desimg=Imagecreatetruecolor($sz2,$sz2); #$desimg=ImageCreate($sz2,$sz2); $srcimg=ImageCreateFromJPEG($HTTP_POST_FILES['userfile']['tmp_name']); imagecopyresized($desimg,$srcimg,0,0,$srx,$sry,$sz2,$sz2,$gx,$gy); imagejpeg($desimg,$upi.$p2); @chmod($upi.$p2,0777); $head='e00:'.$p1; }else{$head='e05';} }else{$head='e02';} } }else{$head='e04';} }elseif($a=='Remove'){ if($pt=='m'){ @unlink($upi.$f[i].'a.jpg'); $head='e03'; }else{ $pt=intval($pt); if($pt>-1&&$pt<13){ $gal=$f[gl]; $gal=substr($gal,0,$pt).'0'.substr($gal,$pt+1,strlen($gal)-$pt-1); mysql_query("update mem set gl='{$gal}' where n='{$l}'"); @unlink($upi.$f[i]."g{$pt}.jpg"); @unlink($upi.$f[i]."g{$pt}m.jpg"); $head='e03'; }else{$head='e02';} } if(strlen($t0)>2){ if(file_exists($upi.$f[i].'.jpg')){ @unlink($upi.$f[i].'.jpg'); } } $head='e03'; }else{$head='e02';} } }else{$head='e02';}
header($jmp.$head);
?>
|
|