Jump to content
php.lv forumi

This webpage is not available


ziedinjsh

Recommended Posts

Sveiki!

Esmu saputrojies un vairs nesaprotu kas notiek..

 

Kad veicu formas postu uz failu image.process.php (bildes augšupielādi) man parāda erroru to ka lapa nav pieejama, bet kad izvēlos cita formāta failu, parāda baltu lapu un viss..

 

php kods:

<?php
session_start();
include("../misc/dbase.php");
$change = "";
$abc = "";
define ("MAX_SIZE","400");
function getExtension($str) {
    	$i = strrpos($str,".");
    	if (!$i) { return ""; }
    	$l = strlen($str) - $i;
    	$ext = substr($str,$i+1,$l);
    	return $ext;
}
$errors = 0;

 $image = $_FILES["photo"]["name"];
$uploadedfile = $_FILES['photo']['tmp_name'];


 if ($image) {

  $filename = stripslashes($_FILES['photo']['name']);

$extension = getExtension($filename);
  $extension = strtolower($extension);


if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) {

$change = "Neatpazīstams bilžu formāts";
$errors = 1;
  }else{
  $size = filesize($_FILES['photo']['tmp_name']);

if ($size > MAX_SIZE*1024){
$change = "Tika pārsniegts bilžu izmērs.";
$errors = 1;
}

if($extension=="jpg" || $extension=="jpeg" ){
$uploadedfile = $_FILES['photo']['tmp_name'];
$src = imagecreatefromjpeg($uploadedfile);
}else if($extension=="png"){
$uploadedfile = $_FILES['photo']['tmp_name'];
$src = imagecreatefrompng($uploadedfile);
}else {
$src = imagecreatefromgif($uploadedfile);
}
echo $scr;
list($width,$height) = getimagesize($uploadedfile);

$newwidth = 200;
$newheight = ($height/$width)*$newwidth;
$tmp = imagecreatetruecolor($newwidth,$newheight);

$newwidth1 = 70;
$newheight1 = ($height/$width)*$newwidth1;
$tmp1 = imagecreatetruecolor($newwidth1,$newheight1);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
imagecopyresampled($tmp1,$src,0,0,0,0,$newwidth1,$newheight1,$width,$height);

$filename = "../wall/". $_FILES['photo']['name'];
$filename1 = "../wall/small/". $_FILES['photo']['name'];
$photo = $_FILES['photo']['name'];
imagejpeg($tmp,$filename,100);
imagejpeg($tmp1,$filename1,100);
imagedestroy($src);
imagedestroy($tmp);
imagedestroy($tmp1);

$firstname = mysql_real_escape_string($_SESSION['firstname']);
$lastname = mysql_real_escape_string($_SESSION['lastname']);
$city = mysql_real_escape_string($_SESSION['city']);
$email = mysql_real_escape_string($_SESSION['email']);
$genere = mysql_real_escape_string($_SESSION['genere']);
$bequest = mysql_real_escape_string($_SESSION['bequest']);
$ip = mysql_real_escape_string($_SESSION['ip']);
$date = mysql_real_escape_string($_SESSION['date']);
$statuss = mysql_real_escape_string($_SESSION['statuss']);
mysql_query("insert into peoples (firstname, lastname, city, email, genere, bequest, ip, date, statuss, photo) values ('$firstname', '$lastname', '$city', '$email', '$genere', '$bequest', '$ip', '$date', '$statuss', '$photo')") or die(mysql_error());
$_SEESION['email'] = $email;
 header("location:../index.php?p=join&step=2");
}
}
?>

 

Kapēc tā notiek!?

P.S. Paldies jau iepriekš! :)

Link to comment
Share on other sites

html:

<form method="post" action="process/join.process.php?step=1" autocomplete="" id="reg">
<p><input type="text" name="firstname" placeholder="Vārds" class="input"></p>
<p><input type="text" name="lastname" placeholder="Uzvārds" class="input"></p>
<p><input type="text" name="city" placeholder="Pilsēta" class="input"></p>
<p><input type="text" name="email" placeholder="Epasts" class="input"></p>
<p><textarea name="bequest" placeholder="Tavs novēlējums Latviešiem" class="textarea"></textarea></p>
<p><select name="genere" class="button" style="margin-bottom:5px;"><option value="">-- Dzimums --</option><option value="Vīrietis">Vīrietis</option><option value="Sieviete">Sieviete</option></select></p>
<p><input type="submit" name="add" value="Turpināt" class="button"></p>
</form>

 

header("location: ../index.php?p=join&step=2"); ceļš uz nākamo soli tu domā kapēc ir ../ tas tapēc ka tas php fails atrodas filderī

Link to comment
Share on other sites

nu jau arī uz IE neiet

biku sajaucu.. tieši kas aiziet uz konkrēto failu ir šis html

<form method='post' action='process/image.process.php' enctype='multipart/form-data'>
<p><input type='file' name='photo' class='input' style='padding:0px;'></p>
<p><input type='submit' name='doupload' value='Augšupielādēt' class='button'></p>
</form>

 

Interesanti ir tas, ka izvēltoies citu failu viņ to neparādā (vismaz iekš IE) parāda tikai baltu lapu un uz mājas locālo serveri viss strādā!

Edited by ziedinjsh
Link to comment
Share on other sites

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.

Loading...
×
×
  • Create New...