Jump to content

bakbai

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bakbai's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. MadTechie thank you, are you suggesting that i create an additional folder called session in my root and then, add the script you provided in the index.php?
  2. hello all, please kindly assist me, i have a site that has been running well for over a year now till last week. the session fluctuate presenting the access denied page, like the session are unset, if one clicks another link, it might open as if the session are set. it goes back and front like that. the site is hosted somewhere, not locally. my hosted suggested that setenv TIMEOUT 300, setenv CPULIMIT 100 which i guest is not the case, cos, if it really unset the session due to time, how can it automatically set the session again? please does anyone has an idea
  3. thank you very much for you response and correction. there are three files here and a folder, the first is called index_image.php, the second one is the resize.php, then the uploade.php and finally we have the folder called upload. the index_image/php call the upload.php wirh an iframe here are the code in that order <?php /******************************************************************************************************************************** PHPAsks.com Developed by Asif Khalyani Email : asif.khalyani@msn.com ********************************************************************************************************************************/ ?> <html> <head> <title>Asynchronous image file upload without AJAX | PHPasks.com</title> <style> iframe {border-width: 0px;height: 600px;width: 400px;} iframe.hidden {visibility: hidden;width:0px;height:0px;} #main1 {overflow: hidden;margin: auto;width: 90%;height: 420px;border-style: solid;border-width: 1px;background-color: white;} #images1 {width: 95%;height: auto;margin: 20px;} #images1 div {margin: 10px;width: 130px;height: 130px;border-style: solid;border-width: 2px;border-color: #DEDFDE;float: left;overflow: hidden;} #images1 div:hover {border-color: #D8F18C;} #images1 img.load { margin-top:20px;} .blacklink:link, .blacklink:alink, .blacklink:vlink, .blacklink:hover{color:#000000} a.redlink{color: #96001C; text-decoration: none} a:hover.redlink{color: #96001C; text-decoration: underline} </style> </head> <body> <table width="600" align="center" cellpadding="0" cellspacing="0" border="0"> <Tr><td><h1>PHPAsks.com</h1></td></Tr> <Tr> <td align="center" valign="middle"> <div id="main1"> <div id="iframe"> <iframe src="upload.php" frameborder="0"></iframe> </div> <div id="images1"> </div> </div> <div id="myDivLink"></div> </td> </Tr> <tr> <Td align="center"> Power by <a href="http://www.phpasks.com" class="redlink">PHPAsks.com</a> </Td> </tr> </table> </body> </html> <?php /******************************************************************************************************************************** PHPAsks.com Developed by Asif Khalyani Email : asif.khalyani@msn.com ********************************************************************************************************************************/ if($_GET['pic']){ $img = new img('upload/'.$_GET['pic']); $width = $_GET["width"]; $height = $_GET["height"]; $img->resize(); $img->show(); } class img { var $image = ''; var $temp = ''; function img($sourceFile){ if(file_exists($sourceFile)){ $this->image = ImageCreateFromJPEG($sourceFile); } else { $this->errorHandler(); } return; } function resize($width = 100, $height = 100, $aspectradio = true){ $o_wd = imagesx($this->image); $o_ht = imagesy($this->image); if(isset($aspectradio)&&$aspectradio) { $w = round($o_wd * $height / $o_ht); $h = round($o_ht * $width / $o_wd); if(($height-$h)<($width-$w)){ $width =& $w; } else { $height =& $h; } } $this->temp = imageCreateTrueColor($width,$height); imageCopyResampled($this->temp, $this->image, 0, 0, 0, 0, $width, $height, $o_wd, $o_ht); $this->sync(); return; } function sync(){ $this->image =& $this->temp; unset($this->temp); $this->temp = ''; return; } function show(){ $this->_sendHeader(); ImageJPEG($this->image); return; } function _sendHeader(){ header('Content-Type: image/jpeg'); } function errorHandler(){ echo "error"; exit(); } function store($file){ ImageJPEG($this->image,$file); return; } function watermark($pngImage, $left = 0, $top = 0){ ImageAlphaBlending($this->image, true); $layer = ImageCreateFromPNG($pngImage); $logoW = ImageSX($layer); $logoH = ImageSY($layer); ImageCopy($this->image, $layer, $left, $top, 0, 0, $logoW, $logoH); } } ?> <?php /******************************************************************************************************************************** PHPAsks.com Developed by Asif Khalyani Email : asif.khalyani@msn.com ********************************************************************************************************************************/ sleep(2); $ftmp = $_FILES['image']['tmp_name']; $oname = $_FILES['image']['name']; $extenssion = strstr($oname, "."); $fname = 'upload/'.$_FILES['image']['name']; if(move_uploaded_file($ftmp, $fname)){ ?> <html><head><script> var par = window.parent.document; var images = par.getElementById('images1'); var imgdiv = images.getElementsByTagName('div')[<?=(int)$_POST['imgnum']?>]; var image = imgdiv.getElementsByTagName('img')[0]; imgdiv.removeChild(image); var image_new = par.createElement('img'); image_new.src = 'resize.php?pic=<?=$oname?>'; image_new.className = 'loaded'; imgdiv.appendChild(image_new); var bre = par.createElement('br'); imgdiv.appendChild(bre); var myLink1 = par.createElement('a'); myLink1.href = "#"; myLink1.className = "blacklink"; myLink1.onclick=function(e){alert('x'+' Y: '+'usrname');} myLink1.appendChild(par.createTextNode('Remove')); imgdiv.appendChild(myLink1); var oNewP = par.createElement('span'); var oText = par.createTextNode(" "); oNewP.appendChild(oText); imgdiv.appendChild(oNewP); </script></head> </html> <?php exit(); } ?><html><head> <script language="javascript"> function upload(){ // hide old iframe var par = window.parent.document; var num = par.getElementsByTagName('iframe').length - 1; var iframe = par.getElementsByTagName('iframe')[num]; iframe.className = 'hidden'; // create new iframe var new_iframe = par.createElement('iframe'); new_iframe.src = 'upload.php'; new_iframe.frameBorder = '0'; par.getElementById('iframe').appendChild(new_iframe); // add image progress var images = par.getElementById('images1'); var new_div = par.createElement('div'); var new_img = par.createElement('img'); new_img.src = '/images/indicator.gif'; new_img.className = 'load'; new_div.appendChild(new_img); images.appendChild(new_div); var imgnum = images.getElementsByTagName('div').length - 1; document.iform.imgnum.value = imgnum; setTimeout(document.iform.submit(),5000); } </script> <style> #file { width: 350px; } </style> <head><body><center> <form name="iform" action="" method="post" enctype="multipart/form-data"> <input id="file" type="file" name="image" onChange="upload()" /> <input type="hidden" name="imgnum" /> </form> </center></html>
  4. please i need help, i got this code tried to run but i get this error 'Notice: Undefined index: image in \upload.php on line 10 Notice: Undefined index: image in \upload.php on line 11 Notice: Undefined index: image in \upload.php on line 14 ', can any one pls help me? the code below the upload file <?php /******************************************************************************************************************************** PHPAsks.com Developed by Asif Khalyani Email : asif.khalyani@msn.com ********************************************************************************************************************************/ sleep(2); $ftmp = $_FILES['image']['tmp_name']; $oname = $_FILES['image']['name']; $extenssion = strstr($oname, "."); $fname = 'upload/'.$_FILES['image']['name']; if(move_uploaded_file($ftmp, $fname)){ ?> <html><head><script> var par = window.parent.document; var images = par.getElementById('images1'); var imgdiv = images.getElementsByTagName('div')[<?=(int)$_POST['imgnum']?>]; var image = imgdiv.getElementsByTagName('img')[0]; imgdiv.removeChild(image); var image_new = par.createElement('img'); image_new.src = 'resize.php?pic=<?=$oname?>'; image_new.className = 'loaded'; imgdiv.appendChild(image_new); var bre = par.createElement('br'); imgdiv.appendChild(bre); var myLink1 = par.createElement('a'); myLink1.href = "#"; myLink1.className = "blacklink"; myLink1.onclick=function(e){alert('x'+' Y: '+'usrname');} myLink1.appendChild(par.createTextNode('Remove')); imgdiv.appendChild(myLink1); var oNewP = par.createElement('span'); var oText = par.createTextNode(" "); oNewP.appendChild(oText); imgdiv.appendChild(oNewP); </script></head> </html> <?php exit(); } ?><html><head> <script language="javascript"> function upload(){ // hide old iframe var par = window.parent.document; var num = par.getElementsByTagName('iframe').length - 1; var iframe = par.getElementsByTagName('iframe')[num]; iframe.className = 'hidden'; // create new iframe var new_iframe = par.createElement('iframe'); new_iframe.src = 'upload.php'; new_iframe.frameBorder = '0'; par.getElementById('iframe').appendChild(new_iframe); // add image progress var images = par.getElementById('images1'); var new_div = par.createElement('div'); var new_img = par.createElement('img'); new_img.src = '/images/indicator.gif'; new_img.className = 'load'; new_div.appendChild(new_img); images.appendChild(new_div); var imgnum = images.getElementsByTagName('div').length - 1; document.iform.imgnum.value = imgnum; setTimeout(document.iform.submit(),5000); } </script> <style> #file { width: 350px; } </style> <head><body><center> <form name="iform" action="" method="post" enctype="multipart/form-data"> <input id="file" type="file" name="image" onChange="upload()" /> <input type="hidden" name="imgnum" /> </form> </center></html> the html file below <?php /******************************************************************************************************************************** PHPAsks.com Developed by Asif Khalyani Email : asif.khalyani@msn.com ********************************************************************************************************************************/ ?> <html> <head> <title>Asynchronous image file upload without AJAX | PHPasks.com</title> <style> iframe {border-width: 0px;height: 600px;width: 400px;} iframe.hidden {visibility: hidden;width:0px;height:0px;} #main1 {overflow: hidden;margin: auto;width: 90%;height: 420px;border-style: solid;border-width: 1px;background-color: white;} #images1 {width: 95%;height: auto;margin: 20px;} #images1 div {margin: 10px;width: 130px;height: 130px;border-style: solid;border-width: 2px;border-color: #DEDFDE;float: left;overflow: hidden;} #images1 div:hover {border-color: #D8F18C;} #images1 img.load { margin-top:20px;} .blacklink:link, .blacklink:alink, .blacklink:vlink, .blacklink:hover{color:#000000} a.redlink{color: #96001C; text-decoration: none} a:hover.redlink{color: #96001C; text-decoration: underline} </style> </head> <body> <table width="600" align="center" cellpadding="0" cellspacing="0" border="0"> <Tr><td><h1>PHPAsks.com</h1></td></Tr> <Tr> <td align="center" valign="middle"> <div id="main1"> <div id="iframe"> <iframe src="upload.php" frameborder="0"></iframe> </div> <div id="images1"> </div> </div> <div id="myDivLink"></div> </td> </Tr> <tr> <Td align="center"> Power by <a href="http://www.phpasks.com" class="redlink">PHPAsks.com</a> </Td> </tr> </table> </body> </html> the resize file <?php /******************************************************************************************************************************** PHPAsks.com Developed by Asif Khalyani Email : asif.khalyani@msn.com ********************************************************************************************************************************/ if($_GET['pic']){ $img = new img('upload/'.$_GET['pic']); $width = $_GET["width"]; $height = $_GET["height"]; $img->resize(); $img->show(); } class img { var $image = ''; var $temp = ''; function img($sourceFile){ if(file_exists($sourceFile)){ $this->image = ImageCreateFromJPEG($sourceFile); } else { $this->errorHandler(); } return; } function resize($width = 100, $height = 100, $aspectradio = true){ $o_wd = imagesx($this->image); $o_ht = imagesy($this->image); if(isset($aspectradio)&&$aspectradio) { $w = round($o_wd * $height / $o_ht); $h = round($o_ht * $width / $o_wd); if(($height-$h)<($width-$w)){ $width =& $w; } else { $height =& $h; } } $this->temp = imageCreateTrueColor($width,$height); imageCopyResampled($this->temp, $this->image, 0, 0, 0, 0, $width, $height, $o_wd, $o_ht); $this->sync(); return; } function sync(){ $this->image =& $this->temp; unset($this->temp); $this->temp = ''; return; } function show(){ $this->_sendHeader(); ImageJPEG($this->image); return; } function _sendHeader(){ header('Content-Type: image/jpeg'); } function errorHandler(){ echo "error"; exit(); } function store($file){ ImageJPEG($this->image,$file); return; } function watermark($pngImage, $left = 0, $top = 0){ ImageAlphaBlending($this->image, true); $layer = ImageCreateFromPNG($pngImage); $logoW = ImageSX($layer); $logoH = ImageSY($layer); ImageCopy($this->image, $layer, $left, $top, 0, 0, $logoW, $logoH); } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.