PHP - Moved: Whats The Size?
This topic has been moved to Miscellaneous.
http://www.phpfreaks.com/forums/index.php?topic=320263.0 Similar TutorialsThis topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=358008.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=315426.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=307477.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=314251.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=314342.0 This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=347531.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=314962.0 This topic has been moved to Editor Help (Dreamweaver, Zend, etc). http://www.phpfreaks.com/forums/index.php?topic=307438.0 This topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=351144.0 This topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=351153.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=353875.0 This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=358122.0 could someone help in how to resize a uploaded image size, say if someone is uploading a 1mb photo to my server, i wish for it to become 100kb and also resize its width and height? here is my code Code: [Select] //////////////////////////////////////uploader else if($action=="uploader") { echo "Upload your picture and copy the link <br/>after uploading to user it at gallery.<br/><br/>"; echo "<form method=\"post\" enctype=\"multipart/form-data\" action=\"index.php?action=uploaded&sid=$sid\">"; echo "Choose Pictu <br />"; echo "<input name=\"uploaded\" type=\"file\" /><br /><br />"; echo "<input type=\"submit\" value=\"Upload\" />"; echo "</form><br/>"; echo "<p align=\"center\">"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; } //////////////////////////////////////uploader else if($action=="uploaded") { $blacklist = array(".php", ".php.jpg", ".php.jpeg", ".php.gif", ".php.png", ".phtml", ".php3", ".php4"); foreach ($blacklist as $item) { if(preg_match("/$item\$/i", $_FILES['uploaded']['name'])) { echo "<p align=\"center\">"; echo "Oops sorry we do not allow those files.<br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; exit; } } $target = "../images/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; if (file_exists("../images/" . $_FILES["uploaded"]["name"])) { echo "<p align=\"center\">"; echo $_FILES["file"]["name"] . "Oops file name already exists<br/> kindly rename your picture and upload again. <br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; }else{ //This is our size condition if ($uploaded_size > 25600){ echo "Your file is too large. We have a 25kb limit.<br/>"; $ok=0; } $types = array('image/jpeg', 'image/gif', 'image/png'); if (in_array($_FILES['uploaded']['type'], $types)) { // file is okay continue } else { $ok=0; } //Here we check that $ok was not set to 0 by an error if ($ok==0){ echo "<p align=\"center\">"; Echo "Sorry your file was not uploaded.<br/> It may be the wrong filetype. <br/>We only allow JPG, GIF, and PNG filetypes.<br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; } //If everything is ok we try to upload it else{ if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)){ echo "<p align=\"center\">"; echo "The file ". basename( $_FILES['uploadedfile']['name']). " Picture uploaded successfully.<br/><br/><b>$target <br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; } else{ echo "<p align=\"center\">"; echo "Sorry, there was a problem uploading your file.<br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; } } } } Hi there, In a string for a shopping cart I am storing both the item id and the item size selected in a number like this 12s1 where 12 is the id and 1 is the size. How can I separate these from one another again? I'm guessing it's to do with expand() ? Thanks, Jack Hi again, Here is the code $string .= (substr($string,-1) == '-') ? '' : '-'; I know what this code does but to increase my knowledge could some one tell me what is the question mark symbol for ( ? ) and what is the colon doing. As I have seen the ? in a lot of scripts but have no clue what it does and what its used for cheers! So im using textwrangler and usually when you click on the '{' or '}' it will highlight everything inbetween them, well on the top one on line 7 it does not, and i tried messing around with it to try to get it to work cause i keep getting an error on line 8 that says "Parse error: syntax error, unexpected '{' in /home/truckste/public_html/create_topic_parse.php on line 8" Code: [Select] <?php if($username){ header("Location: index.php"); exit(); } if(isset($_POST['topic_submit'])){ if (($_POST['topic_title'] == "" && ($_POST['topic_content'] == "")){ echo "You Did Not Fill In Both Fields. Please Return To The Previous Page."; exit(); } else{ requre('scripts/connect.php'); $cid = $_POST['cid']; $title = $_POST['topic_title']; $content= $_POST['topic_content']; $creator = $_POST['uid']; $sql = "INSERT INTO topics (category_id, topic_title, topic_creator, topic_date, topic_reply_date) VALUES ('".$cid."', '".$title."', '".$creator."', now(), now())"; $res = mysql_query($sql) or die(mysql_error()); $new_topic_id = mysql_insert_id(); $sql2 = "INSERT INTO posts (category_id, topics_id, post_creator, post_content, post_date) VALUES ('".$cid."', '".$new_topic_id."', '".$creator."', '".$content."', now())"; $res2 = mysql_query($sql2) or die(mysql_error()); $sql3 = "UPDATE categories SET last_post_date=now(), last_user_posted'".$creator."', WHERE id='".$cid."' LIMIT 1"; if (($res) && (res2) && (res3)){ header("Location: view_topic.php?cid".$cid."$tid=".$new_topic_id) } else{ echo "There Was A Problem Creating Your Topic. Please Try Again."; } } ?> Hi Friends,
I wanted to know what is new in PHP version 5.6.0. How is it different from its previous versions? How will benefit the security of PHP websites?
Thanks in advance.
Its a page 'Downloads'. Works great at localhost but doesnt show up @ web hosting. Code: [Select] <?php define('IN_PHPBB', true); $page = !isset($_GET["page"]) ? "None" : $_GET['page']; $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); // Start session management $user->session_begin(); $auth->acl($user->data); $user->setup(); page_header('Downloads'); if(strcmp($page,"org") == 0) { $template->set_filenames(array('body' => 'download/org.html',)); } else if(strcmp($page,"audi") == 0) { $template->set_filenames(array('body' => 'download/audi.html',)); } else if(strcmp($page,"bmw") == 0) { $template->set_filenames(array('body' => 'download/bmw.html',)); } else if(strcmp($page,"vw") == 0) { $template->set_filenames(array('body' => 'download/vw.html',)); } else if(strcmp($page,"nissan") == 0) { $template->set_filenames(array('body' => 'download/nissan.html',)); } else if(strcmp($page,"opel") == 0) { $template->set_filenames(array('body' => 'download/opel.html',)); } else if(strcmp($page,"ford") == 0) { $template->set_filenames(array('body' => 'download/ford.html',)); } else if(strcmp($page,"chevrolet") == 0) { $template->set_filenames(array('body' => 'download/chevrolet.html',)); } else if(strcmp($page,"other") == 0) { $template->set_filenames(array('body' => 'download/other.html',)); } else { $template->set_filenames(array('body' => 'download/org.html',)); } make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); page_footer(); ?> and the html: Code: [Select] <table class="tablebg" cellspacing="1" width="100%"> <tr> <th>BMW</th> </tr> <tr class="row1"> <td align="center" style="padding:5px 5px 5px 5px;"> <center> <hr width="60%" size="3" /> <table width="70%"> <tr> <td width="10%"><a href="http://www.upload.ee/image/1626514/325i_2.jpg" target = "_blank"> <img src="http://www.upload.ee/thumb/1626514/325i_2.jpg" border="0"/></a> <a href="http://www.upload.ee/image/1626518/325i_3.jpg"> <img src="http://www.upload.ee/thumb/1626518/325i_3.jpg" border="0"/></a> <td width="0%"><a href="http://www.upload.ee/image/1626519/325i_1.jpg" target = "_blank"> <img src="http://www.upload.ee/thumb/1626519/325i_1.jpg" border="0"/></a> <a href="http://www.upload.ee/image/1626521/325i_4.jpg" target = "_blank"> <img src="http://www.upload.ee/thumb/1626521/325i_4.jpg" border="0"/></a></td></td> <td><b><font color="white">Name:</font></b> 1996 BMW 325i e36 Convertible</br> <b><font color="white">Original Author:</font></b> ikey07</br> <b><font color="white">Size:</font></b> 3.89MB</br></br> <b><font color="white">Description:</font></b></br> Tunable in WAA</br> 2 Body kits included</br> 1. BMW M e36 series + Hood Vents</br> 2. BMW M e46 series + Masked Lights</br> New 2 M series wheels e36/e46</br> Realistic heavy damaged model</br> Model accuracy as real car 96%</br> Openable petrolcap</br> If you replace this car as BF Injection, the front fan is working ( spining )</br></br> <a href="http://ikey07.c-rp.net/viewtopic.php?f=6&t=2"><b><font color="white">Comments</font></b></a></br> </br> <ul id="nav"> <a class="downl" href="http://ikey07.c-rp.net/download/1996_BMW_325i_e36.rar" title="Download"><span>{L_DOWN}</span></a> </div> </br> </td> </tr> </table> <hr width="60%" size="3" /> </center> </td> </tr> </table> <br /> can you tell me whats wrong with this? Code: [Select] <?php $age= 60; if( isset($_SESSION['logedin']) ) { $q = mysql_query('SELECT id=`$id`, DATE_FORMAT(`last_activity`,"%a, %b %e %T") as `last_activity`,UNIX_TIMESTAMP(`last_activity`) as `last_activity_stamp`FROM `mymembers`WHERE `$logOptions_id` <> "'.($_SESSION['logedin']).'"'); $isonlinecheck = mysql_query($q); if ($isonlinecheck ="last_activity_stamp + $age "< time()){ $isonline = "is <font color='green'>online!</font>";} else { $isonline = "is<font color='red'> offline!</font>"; } } ?> |