Jump to content

Azercii

Members
  • Posts

    45
  • Joined

  • Last visited

Everything posted by Azercii

  1. I can't seem to find tutorials that are actually secure, I really would like to learn how to secure uploads properly and the best way to go about it. With naming the file, would it be better to combine it with the users ID? Not sure if it can be done like this, but maybe: 07-mynewsetup.jpg.
  2. Currently have no speakers plugged in, thought the captions would help but I couldn't have been more wrong aha Part of me wants to leave it as is, as I know they can't upload anything but an image file (no .txt, .html, .php, .js, etc) which for the standard user is fine. I need to work out how to do moderation of files via an admin panel, so that anything that isn't an image, or is deemed unsuitable, can be removed before being shown via the gallery. Problem is, if that one smart-*** does come along and bypasses it, I have no one to blame but myself.
  3. I'm not amazing with PhP, so excuse me if it looks terrible xD I've taken tutorials, edited them to fit my wanting and tried it out, it seems to deny anything other than an image type, but could it be abused? <div id="image-upload"> <h2>Upload your image</h2> <form action="upload.php" method="post" enctype="multipart/form-data"> Upload:<br><br> <input type="file" name="image"><br><br> Image Title:<br><br> <input type="text" name="image_title"><br><br> <input type="submit" name="submit" value="Upload"> </form> <?php include("upload_file.php"); function GetImageExtension($imagetype) { if(empty($imagetype)) return false; switch($imagetype) { case 'image/bmp': return '.bmp'; case 'image/jpeg': return '.jpg'; case 'image/png': return '.png'; default: return false; } } if ($_FILES['image']['error'] !== UPLOAD_ERR_OK) { die(); } $extension = getimagesize($_FILES['image']['tmp_name']); if ($extension === FALSE) { die("<br><font color='#8B0000'>Unable to determine image typeof uploaded file</font>"); } if (($extension[2] !== IMAGETYPE_GIF) && ($extension[2] !== IMAGETYPE_JPEG) && ($extension[2] !== IMAGETYPE_PNG)) { die("<br><font color='#8B0000'>Only images are allowed!</font>"); } if (!empty($_FILES["image"]["name"])) { $file_name=$_FILES["image"]["name"]; $temp_name=$_FILES["image"]["tmp_name"]; $imgtype=$_FILES["image"]["type"]; $ext= GetImageExtension($imgtype); $imagename=$_FILES["image"]["name"]; $target_path = "../../images/upload/".$imagename; $title = $_POST["image_title"]; if(move_uploaded_file($temp_name, $target_path)) { $query_upload="INSERT into `images_tbl` (`images_path`,`submission_date`,`image_title`) VALUES ('".$target_path."','".date("Y-m-d")."','".$title."')"; mysql_query($query_upload) or die("error in $query_upload == ----> ".mysql_error()); echo '<br>Image uploaded!'; }else{ echo '<br><font color="#8B0000">Only images are allowed!</font>'; } } ?>
  4. Okay, I figured it was repeating the call (the original code wouldn't show without 4 <img src> lines, now removed 3) Now to get them to display in a line
  5. I'm having a really hard time getting my carousel to display in a line when I call my images from the table: <div id="user-gallery"> <h2>Recent Images</h2> <button class="prev"><<</button> <button class="next">>></button> <?php include("file/image/upload_file.php"); $select_query = "SELECT `images_path` FROM `images_tbl` ORDER by `images_id` DESC LIMIT 9"; $sql = mysql_query($select_query) or die(mysql_error()); while($row = mysql_fetch_array($sql,MYSQL_BOTH)){ ?> <div class="anyClass"> <ul> <li><img src="<?php echo $row["images_path"]; ?>" alt="" width="125" height="70" ></li> <li><img src="<?php echo $row["images_path"]; ?>" alt="" width="125" height="70" ></li> <li><img src="<?php echo $row["images_path"]; ?>" alt="" width="125" height="70" ></li> <li><img src="<?php echo $row["images_path"]; ?>" alt="" width="125" height="70"></li> </ul> </div> <?php } ?> </div> Without the carousel it will display perfectly, but as soon as I implement it, the images won't behave normal :/
  6. I have tested it myself on several handheld devices and all seems well, but it all depends on the user and how they feel about scrolling and zooming. I'll probably look at responsive in the future if, like you said, there is a lot of mobile traffic. I'll learn while I'm going though, just so I'm ready for when I do go ahead with it
  7. Little topic that's gonna bug me if I don't ask I'm trying to learn static layouts, and I'm just getting the hang of them. A few friends are telling me to go responsive to accommodate mobile/tablet users? I can see it from a business sites perspective where you want all types of users and with ease of access, but my site is going to be a gaming modification community, where mobile users aren't really the target audience as it's quicker and easier to download them on the PC than a Phone. I was going to accommodate that audience by allowing them very basic usage (chat, forums, account) and leave off the heavy parts like the gallery, and downloads. Am I going in the wrong direction? Should I be heading down the responsive route? I've literally only just started the first page for the site, but it'd mean re-learning a whole bunch more new stuff which'd prolong the sites progress. Just looking for a little advice in which direction to head
  8. Looks like it's back to the drawing board then? I can understand a little PhP, but I can't understand how to do things with user forms. I'm not sure how to put it without sounding ridiculous lol if you gave me a login script and said "I want you to use this on your site, change what's needed and echo out any information for the user", I'd know how it functioned and where errors lie, where to change and what not to touch etc. But if I were to create my own, I wouldn't even know where to begin Do you have any sites that you can recommend that would help me along that path?
  9. After getting my site hacked, I'm not really up for learning PhP, so I'm trying to use uMScript. On the demo site, and when I just load up the files on my server, it will redirect upon log in. But when I then use my styling, for some reason the login_submit.php gives me a blank page and does not redirect, nor does it log the user in. I don't change anything except the positioning of the forum and the container around it, no PhP or JS changes, weird? I can not seem to get a hold of the creator, nor can I find a user script that matches what I'm looking for. Heck, I'm so close to going mad, I'm even willing to pay someone to do the user PhP for me haha Has anyone used this script successfully? You can try it out here: http://mod-universe.com/index.php Demo: http://www.venturehapa.biz/umscript/demo/index.php (I couldn't get the demo credentials to log in, created a new user = Okriani, kieran09)
  10. You'd use css input[type="submit"] { background: url(location here); border: 0; width: 180px; height: 30px; }
  11. In HTML 5 you can use <col> tag to style the width of each column. <col style="width:35%"> <col style="width:40%"> <col style="width:25%"> Place it under your <table> tag. They all need to total 100%, so as you have 10 columns, that would make each <col> 10% width. For tidier code, I would go with the css route; CSS: table { table-layout: fixed; width: 250%; } HTML: <table cellspacing="1" border="1" BGCOLOR="white"> <tr> <th>Week #</th> <th>18</th> <th>19</th> <th>20</th> <th>21</th> <th>22</th> <th>23</th> <th>24</th> <th>25</th> <th>26</th> </tr> <tr> <td>Visits</td> <td>300</td><td>346</td><td>266</td><td>216</td><td>339</td><td>288</td><td>231</td><td>213</td><td></td></tr> <tr> <td>From</td> <td>28/04/2014</td><td>05/05/2014</td><td>12/05/2014</td><td>19/05/2014</td><td>26/05/2014</td><td>02/06/2014</td><td>09/06/2014</td><td>16/06/2014</td><td>23/06/2014</td> </tr> <tr> <td>To</td> <td>04/05/2014</td><td>11/05/2014</td><td>18/05/2014</td><td>25/05/2014</td><td>01/06/2014</td><td>08/06/2014</td><td>15/06/2014</td><td>22/06/2014</td><td>29/06/2014</td> </tr> <tr> <td>USA</td><td>161</td><td>158</td><td>148</td><td>79</td><td>132</td><td>105</td><td>81</td><td>70</td><td></td> etc......... </table> UPDATE: http://jsfiddle.net/Hhg2x/ I know you've solved this, just thought I'd chime in and add a further suggestion in case others find the thread
  12. I know to sort the upload first just wanted to make sure going with the server route will get the result I'm looking for Host/server includes GD library
  13. I'm gonna need to read up some more on this before it's even usable lol Just to make sure I am heading in the right direction; I want a user to upload his/her image, the gallery then grabs the most recent and displays them in descending order. By adding $title to the database, would I be able to display a caption overlay on the img with the users inputted information?
  14. I come out with 1 of 3 things; 4 of one image 4 of the error loading image Boolean error Would uploading to the server and adding the file path, name, and desc to the database be any easier to work with?
  15. bump Anyone wanna break this down for me? Not asking for final code, just a helping hand to better understand
  16. [phpBB Debug] PHP Warning: in file /home/moduni/public_html/index.php on line 296:mysql_fetch_assoc() expects parameter 1 to be resource, boolean given I'm just getting the hang of PhP haha could you break it down a little more?
  17. I can only get one image to display using; <?php mysql_connect("localhost","",""); mysql_select_db("moduni_images"); if(isset($_GET['id'])) { $id = mysql_real_escape_string($_GET['id']); $query = mysql_query("SELECT * FROM `images` ORDER BY `id` DESC LIMIT 4"); while($row = mysql_fetch_assoc($query)) { $imageData = $row["image"]; } header("content-type: image/jpeg"); echo $imageData; } else { echo "Error!"; } ?>
  18. The simplest of methods, how did that slip my mind! Thanks man! Little offset from the href, but I can live with that could you give it one final check?
  19. I want to be able to grab any new images uploaded and display them right away on the front page, at the moment I can grab the id of each but that won't update the gallery. Once 4 images are uploaded, the next one to be uploaded pushes the last out of the gallery. At the moment, I only have 2 images on the db, but I want it ready to be used by a community <form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data"> Upload:<br><br> <input type="file" name="image"><br><br> <input type="submit" name="submit" value="Upload"> </form> <?php if(isset($_POST['submit'])) { mysql_connect("localhost","____","____"); mysql_select_db("moduni_images"); $imageName = mysql_real_escape_string($_FILES["image"]["name"]); $imageData = mysql_real_escape_string(file_get_contents($_FILES["image"]["tmp_name"])); $imageType = mysql_real_escape_string($_FILES["image"]["type"]); if(substr($imageType,0,5) == "image") { mysql_query("INSERT INTO `images` VALUES('','$imageName','$imageData')"); echo "Image uploaded!"; } else { echo '<br>O<font color="#8B0000">nly images are allowed!</font>'; } } ?> <?php mysql_connect("localhost","____","____"); mysql_select_db("moduni_images"); if(isset($_GET['id'])) { $id = mysql_real_escape_string($_GET['id']); $query = mysql_query("SELECT * FROM `images` WHERE `id`='$id'"); while($row = mysql_fetch_assoc($query)) { $imageData = $row["image"]; } header("content-type: image/jpeg"); echo $imageData; } else { echo "Error!"; } ?> <div id="user-gallery"> <h2>Gallery</h2> <div class="img"> <a href="scripts/show_image.php?id=2" data-lightbox="image-1"> <img src="scripts/show_image.php?id=2" width="125px" height="71px"> </a> </div> <div class="img"> <a href="scripts/show_image.php?id=2" data-lightbox="image-1"> <img src="scripts/show_image.php?id=2" width="125px" height="71px"> </a> </div> <div class="img"> <a href="scripts/show_image.php?id=2" data-lightbox="image-1"> <img src="scripts/show_image.php?id=2" width="125px" height="71px"> </a> </div> <div class="img"> <a href="scripts/show_image.php?id=2" data-lightbox="image-1"> <img src="scripts/show_image.php?id=2" width="125px" height="71px"> </a> </div> </div>
  20. With my topbar-navigation inside the wrapper, it breaks the full span of the element. I can see how floating right within 1000px gives me what I'm asking (aside from a little problem after shifting the <ul>'s margin into place) Should I place the menu and site logo into the wrapper separate from the nav itself, with the nav sitting behind it? Thanks for that heads up on Clearfix! That was why I was calling height, that annoyed me so much but could never explain to Google what was happening
  21. http://mod-universe.com/ Username: test Password: test123 I know the spacing was there because whenever I type margin-left on here, it blanks the entire thing out
  22. That one works! Just playing around with it now, thank you How would I get the menu over to where I want it? I have styling ready for the text placement; .welcome-user { font-family: 'sinkin_sans400_regular'; font-size: 12px; color: #99a0a8; position: absolute; margin - left: auto; margin - right: auto; margin - top: 20px; top: 0; left: 765px; right: 0; } But that moves the menu out of screen if I style the UL, styling the A messes with the top bars placement also :/
  23. Fixed comment after bug happened again
  24. That ; is a bug with this site, encountered it a few times now. It just removed a line (margin - left -8px ; ) from the style after pasting. So it should be working as far as you can see? I don't understand why the untouched one wouldn't work either :/
  25. I've followed a few tutorials, as I've never touched drop down before (more of a conventional navbar guy ). But none are dropping the nested list . I even took the code from one, no changes made, and it still didn't drop the menu This is as far as I got on this tutorial (http://line25.com/tutorials/how-to-create-a-pure-css-dropdown-menu) before coming here #topbar-navigation { width: 101%; margin: 0 auto; ; margin-top: -8px; height: 56px; background: #ffffff; display: inline-block; text-align: center; min-width: 1100px; -webkit-box-shadow: 0 1px 8px 0px #b5b5b5; -moz-box-shadow: 0 1px 8px 0px #b5b5b5; box-shadow: 0 1px 8px 0px #b5b5b5; } #topbar-navigation ul { display: inline-table; list-style: none; position: absolute; margin-left: auto; margin-right: auto; margin-top: 20px; top: 0; left: 765px; right: 0; } #topbar-navigation ul:after { content: ""; clear: both; display: block; } #topbar-navigation ul ul { display: none; } #topbar-navigation ul li:hover > ul { display: block; } #topbar-navigation ul li a { display: block; padding: 25px 40px; color: #99a0a8; text-decoration: none; font-family: 'sinkin_sans400_regular'; font-size: 12px; } <div id="topbar-navigation"> <a href="index.php"><img src="images/moduniverselogo.png" class="site-logo" draggable="false" /></a> <ul> <li><a href="#">Welcome, <b style="color:#ff924e" ><?php echo $user->data['username'] ?></b></a></li> <ul> <li><a href="#">My Profile</a></li> <li><a href="#">Edit Account</a></li> <li><a href="#">Log Out</a></li> </ul> </ul> </div> I want it nested to the right like on the site currently: http://i.imgur.com/llZPUbZ.png
×
×
  • 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.