Jump to content

GD77

Members
  • Posts

    108
  • Joined

  • Last visited

Everything posted by GD77

  1. $va1 receiving the data from a textarea the codes till I use new line btw why used ? instead of + in: +[^\n]?$/i main code: if(!preg_match('/^[a-z0-9_\/a\-\<li\>(.*?)<\/li\>\ ]+[^\n\r]+$/i',$va1)){.....}
  2. ok I m using the following and it s working: preg_match('/^[a-z0-9_\/a\-\<li\>(.*?)<\/li\>\ ]+$/i',$va1) need to escape new line character cause m using a wysiwyg editor on a textarea apparently when i m submiting with new line it returns False...
  3. Helllo: Need to add the html tag <li>...</li> to this plz: preg_match('/^[a-z0-9_\/a\-\ ]+$/si',$va1) Thanks.
  4. list ($this->width, $this->height) = getimagesize($this->dire.$this->image); Warning: getimagesize(......) [function.getimagesize]: failed to open stream: No such file or directory in... how to fix this since the img is not uploading or moved the the dir... it s normal to get that error and when I remove $this->dir from getimagesize() you ll still get that warning
  5. I get when u said don t use echo or print inside a Method but what you ll do when u need to use a form inside and you don t want to use include()... so their s no way to totally avoid the use of print or echo inside of a Method unless you can suggest other way.
  6. Thanks a lot Christian F. Appreciate it
  7. Christian F. m sorry it s PHP Q. where you need me to post it I ll re post it and remove it from here
  8. ok Fixed thanks a lot : PFMaBiSmAd here s the main issues: 1- enctype='multipart/form-data' was type='...' 2- As ou mentioned dropped the var... and used private.. then used $this->image Don t know why did not see that I m using it in other Functions 3- $_FILES['img_Up']['name'].... was using 'image' and it is img_UP from the form input name. 4- this is the code if anyone else needed it. function img_Check() { if(isset($_POST['btn_sub'])){ $this->image = $_FILES['img_Up']['name']; if(file_exists($this->dire.$this->image)){ echo "Image Already Exists"." / ".$this->image." / ".$this->dire; }else{ if (!empty($this->image) && $this->image !== NULL){ $this->filename = $_FILES['img_Up']['name']; $this->extension = $this->getExtension($this->filename); $this->extension = strtolower($this->extension); if (($this->extension !== "jpg") && ($this->extension !== "jpeg")){ echo '<h1>Unknown extension!</h1>'; return $err_img=true; }else{ $this->size=filesize($_FILES['image']['tmp_name']); if ($this->size > $this->MAX_SIZE*1024){ echo '<h1>You have exceeded the size limit!</h1>'; return $err_img=true; }else{ //we will give an unique name, for example the time in unix time format $this->image_name=strtolower($this->image); //the new name will be containing the full path where will be stored (images folder) $this->newname=$this->dire.$this->image_name; //we verify if the image has been uploaded, and print error instead $this->copied = copy($_FILES['img_Up']['tmp_name'], $this->newname); list($this->width, $this->height) = getimagesize($this->dire.$this->image); echo $this->image." width=".$this->width." height=".$this->height; if (!$this->copied){ echo '<h1>Copy unsuccessfull!</h1>'; return $err_img=true; } } } } } } one more thing please... is their away to keep the file name in the upload input tag like doing in other type of inputs? while validating other parts of the form
  9. function img_Check() { if(isset($_POST['btn_sub'])){ $this->image = $_FILES['image']['name']; if(file_exists($this->dire.$this->image)){ echo "shitz"." / ".$this->image." / ".$this->dire; }else{ if (!empty($this->image) && $this->image!==NULL){ $this->filename = stripslashes($_FILES['image']['name']); $this->extension = $this->getExtension($this->filename); $this->extension = strtolower($this->extension); if (($this->extension !== "jpg") || ($this->extension !== "jpeg") || ($this->extension !== "png") || ($this->extension !== "gif")){ echo '<h1>Unknown extension!</h1>'; return $err_img=true; }else{ $this->size=filesize($_FILES['image']['tmp_name']); if ($this->size > $this->MAX_SIZE*1024){ echo '<h1>You have exceeded the size limit!</h1>'; return $err_img=true; }else{ //we will give an unique name, for example the time in unix time format $this->image_name=strtolower($this->image); //the new name will be containing the full path where will be stored (images folder) $this->newname=$this->dire.$this->image_name; //we verify if the image has been uploaded, and print error instead $this->copied = copy($_FILES['image']['tmp_name'], $newname); list($this->width, $this->height) = getimagesize($this->dire.$this->image); echo $this->image." width=".$this->width." height=".$this->height; if (!$this->copied){ echo '<h1>Copy unsuccessfull!</h1>'; return $err_img=true; } } } } } } BTW m calling the img_Check() inside another Fn $this->img_Check(); whether I called it or no or just used the script in another function ... still get no response nothing no matter what
  10. ok this is what I m trying to do... the script works fine outside a class Function, once inside a class... nothing.. cold DEAD and no errors I know it must be something stupid yet can t see it function img_Check() { if(isset($_POST['btn_sub'])){ $image=$_FILES['image']['name']; if(file_exists($this->dire.$image)){ echo "shitz"; echo $image;echo "<br>"; echo $this->dire; }else{ if (!empty($image) && $image!==NULL){ $filename = stripslashes($_FILES['image']['name']); $extension = getExtension($filename); $extension1 = strtolower($extension); if (($extension1 !== "jpg") && ($extension1 !== "jpeg") && ($extension1 !== "png") && ($extension1 !== "gif")){ echo '<h1>Unknown extension!</h1>'; $err_img=true; }else{ $size=filesize($_FILES['image']['tmp_name']); if ($size > MAX_SIZE*1024){ echo '<h1>You have exceeded the size limit!</h1>'; $err_img=true; }else{ //we will give an unique name, for example the time in unix time format $image_name=strtolower($image); //the new name will be containing the full path where will be stored (images folder) $newname=$this->dire.$image_name; //we verify if the image has been uploaded, and print error instead $copied = copy($_FILES['image']['tmp_name'], $newname); list($width, $height) = getimagesize($dire.$image); echo $image." width=".$width." height=".$height; if (!$copied){ echo '<h1>Copy unsuccessfull!</h1>'; $err_img=true; } } } } } } }/*END Fn img_Check*/
  11. anyone got an similar script to the new profile image uploader used here?
  12. Helllo: why do I get error when using the following in a class: var $image=$_FILES['image']['name']; Parse error: syntax error, unexpected T_VARIABLE in
  13. Barand: just a habit.. ChristianF got a point their I ll try it thx.
  14. Hello: I m trying to combine an image upload and text input and need them to be in separated forms because the second form element are driven from a database and need when the file is uploaded ( correctly ) it s path name or what ever will be inserted into the second form.. As soon as the first form is submitted what ever I ve in the second disappears, I am open to suggestions, thx. print_r("<form name='FORM1' method='post' target='_self' type='multipart/form-data' class='....'> <input type='file' name='img_Up'><button type='submit' name='btn_up' value='btn_up'>Upload IMG</button></form>"); print_r("<form name='FORM2' method='post' target='_self' class='form_tbl_insert'><table class='tbl_insert'>"); while ($i < mysql_num_fields($qry_Fields)) { $col = mysql_fetch_field($qry_Fields, $i); $value_Insert=$_POST[$col->name]; if(isset($value_Insert)) {$value_Insert1=strtolower(trim($value_Insert));}else{$value_Insert1="";} if (!$col) {print_r( "No information available<br />");exit;} //".$col->type." ".$col->max_length." if($col->name!=='id'){ switch($col->name){ case 'br':$this->f_Len="Char: 3-11";$this->max_Len="11";$this->type='text';break; case 'mo':$this->f_Len="Char: 3-50";$this->max_Len="50";$this->type='text';break; case 'sp':$this->f_Len="Char: 3-50";$this->max_Len="50";$this->type='text';break; case "inadd":$this->f_Len="Char: 3-254";$this->max_Len="254";$this->type='text';break; case "imgs":$this->f_Len="Char: 3-100";$this->max_Len="100";$this->type='text';break; case "p_GA":$this->f_Len="Num: 3-7";$this->max_Len="7";$this->type='text';break; case "p_GB":$this->f_Len="Num: 3-7";$this->max_Len="7";$this->type='text';break; case "p_GC":$this->f_Len="Num: 3-7";$this->max_Len="7";$this->type='text';break; case "active":$this->f_Len="Num: 0/1";$this->max_Len="1";$this->type='text';break; default:$this->f_Len=''; }//END switch print_r("<tr> <td>".$i."</td> <td>".$col->name."</td> <td><input type='".$this->type."' name='".$col->name."' value='".$value_Insert1."' maxlength=".$this->max_Len."> <div class='col_Len'>".$this->f_Len."</div></td></tr>"); }//END if not id $i++; }//END while print_r("<tr><td> </td><td> </td><td><button type='submit' name='btn_sub' value='btn_sub'>Insert Data</button></td></tr></table></form>"); mysql_free_result($qry_Fields);
  15. ok Solved it with the following: <div class="more-less"> <div class="more-block"> long text....... </div> </div> $(function(){ // The height of the content block when it's not expanded var adjustheight = 80; // The "more" link text var moreText = "+ More"; // The "less" link text var lessText = "- Less"; // Sets the .more-block div to the specified height and hides any content that overflows $(".more-less .more-block").css('height', adjustheight).css('overflow', 'hidden'); // The section added to the bottom of the "more-less" div $(".more-less").append('<p class="continued">[…]</p><a href="#" class="adjust"></a>'); $("a.adjust").text(moreText); $(".adjust").toggle(function() { $(this).parents("div:first").find(".more-block").css('height', 'auto').css('overflow', 'visible'); // Hide the [...] when expanded $(this).parents("div:first").find("p.continued").css('display', 'none'); $(this).text(lessText); }, function() { $(this).parents("div:first").find(".more-block").css('height', adjustheight).css('overflow', 'hidden'); $(this).parents("div:first").find("p.continued").css('display', 'block'); $(this).text(moreText); }); }); Found it somewhere hope someone needs it one day too. Thanks again for anyone tried to help
  16. found this online: <div class="item"> Text goes in here. </div> $(function(){ /* to make sure the script runs after page load */ $('.item').each(function(event){ /* select all divs with the item class */ var max_length = 150; /* set the max content length before a read more link will be added */ if($(this).html().length > max_length){ /* check for content length */ var short_content = $(this).html().substr(0,max_length); /* split the content in two parts */ var long_content = $(this).html().substr(max_length); $(this).html(short_content+ '<a href="#" class="read_more"><br/>Read More</a>'+ '<span class="more_text" style="display:none;">'+long_content+'</span>'); /* Alter the html to allow the read more functionality */ $(this).find('a.read_more').click(function(event){ /* find the a.read_more element within the new html and bind the following code to it */ event.preventDefault(); /* prevent the a from changing the url */ $(this).hide(); /* hide the read more button */ $(this).parents('.item').find('.more_text').show(); /* show the .more_text span */ }); } }); }); Can we have it to toggle plz?
  17. I'll simplify it more: how to achieve read more like when you read some text and you click on read more in the same page it expands...
  18. ok i m here now: <head> <script src="jquery.js"></script> <script> $(document).ready(function(){ $("#tog").click(function(){ $("li").toggle(); }); }); </script> </head> <body> <div id='tog'>Toggle</div> <ul> <li>text 1.</li> <li>text 2.</li> <li>text 3.</li> </ul> how to exclude the first type of <li> ?
  19. ntg just been testing with different scripts and been trying to target the height of that row with css nothing working :/
  20. jesirose thx but that is not doing what I want or at least m not figuring it out... here is what I m trying to do: http://picpaste.com/pics/tbl-yzq03lOx.1347715252.png as you see one column have long text I just want to be able to show one line of that column until it s clicked and that will be dynamic for each row.
  21. Hello: I need to have a table row showing one or two lines of data and when click to show the remaining... been trying with Google but having what I want.... Thanks...
  22. can t I delete my post? admin or moderator plz delete it solved it thx
  23. hello: I need to allow this char. in the preg_match "/": if(!preg_match('/^[a-z0-9_\/a\-]+$/i',$var)){...}
×
×
  • 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.