Jump to content

Hazukiy

Members
  • Posts

    125
  • Joined

  • Last visited

Everything posted by Hazukiy

  1. Ah ok and apart from that, would you say that all the datatypes are correctish?
  2. Hi, I'm currently trying to get my database for my website to work but at the moment I'm having a lot of issues with the new version? Basically I'm trying to create a simple registration table setup which includes: - user_id - firstname - lastname - username - email - password And the problem is that when I put them all in, set the Index's and the data types, it comes up with a message saying: "This is not a number"? I have no idea why it keeps coming up with this, any ideas? Here's what it looks like at the moment http://i.imgur.com/faOXjrs.png Thanks.
  3. Ah ok, np. Thanks for the help, it works well now.
  4. Thanks a lot for sharing ^^ Yeah this does look a lot more simple, I might give this a try Thanks.
  5. Ok so basically when I hover over the picture, the overlay does appear but when I hover over the P and H2 within the overlay it spazs out. Basically it thinks that the mouse is going out of the overlay because the H2 and P isn't added. I'm not sure how I would fix this, I've tried adding it to the code but it doesn't work. I've added the site to a sub domain if you wonna check it out. Thanks http://lucienorris.comze.com/
  6. Hi, sorry to reopen the post again but I've found an issue that I can't seem to quite get my head around? I understand the code above and I've tried all kinds of methods for this problem. Basically when I hover over the image, everything works perfect apart from the text in that overlay, for some reason when I hover over the text it thinks that I'm hovering out of the overlay and starts to spaz out. I've tried adding the H2 and P into the code but it doesn't work for me, so I guess what I'm trying to say is how would I make it so that it doesn't spaz out every time I hover over the text in the overlay? Thanks. Here's the current CSS for the photo-overlay, H2 & P: .photo-overlay { display: none; position: absolute; left: 0; top: 0; padding: 15px; width: 427px; cursor: pointer; } .photo-overlay h2 { color: #b91133; font-size: 60px; font-family: Edwardian Script ITC; } .photo-overlay p { line-height: 21px; color: #FFF; font-size: 20px; } Here's the HTML photo layout: <li class="photo-col"> <div class="preview"><img src="images/gallery/pt1.jpg" alt="photo1"></div> <div class="photo-overlay"><h2>Frog</h2><p>Information about the photo goes here.</p></div> </li> And here's the Javascript, which is the same: <script type="text/javascript"> $(document).ready( function() { $('div.photo-overlay').css({'display':'none'}); $('div.preview img').css({'opacity':'1'}); $('div.preview').hover( function () { $(this).next('.photo-overlay').css({'display':'block'}); $(this).find('img').css({'opacity':'0.6'}); }, function () { $(this).next('.photo-overlay').css({'display':'none'}); $(this).find('img').css({'opacity':'1'}); } ); }); </script>
  7. Ahhhhh I see and yeah sorry about the complete mess, I never program like that at all but I was in a rush so xD Thanks for your help
  8. Hi, I'm trying to make a picture gallery website for my friend and the way that I wanted it work is so when you hover over a picture it shows a overlay that displays the title of the picture and some information about it. I'm currently having some issues with the jQuery as I want it so when you hover over a certain picture it only displays that overlay but atm it displays all of them which isn't how I want it to work, I would only like the certain picture that you hover over to show the overlay. Thank you. Here's the HTML code: <div id="photo-container"> <ul id="photo-col-1" style="float: left; width: 457px"> <li class="photo-col"> <div class="preview"><img src="images/gallery/pt1.jpg" alt="photo1" id="post-1"></div> <div class="photo-overlay"><h2>Frog</h2><div class="photo-details"><p>Information about the photo goes here.</p></div></div> </li> <li class="photo-col"> <div class="preview"><img src="images/gallery/pt2.jpg" alt="photo2" id="post-2"></div> <div class="photo-overlay"><h2>Fast Traffic</h2><div class="photo-details"><p>Information about the photo goes here.</p></div></div> </li> <li class="photo-col"> <div class="preview"><img src="images/gallery/pt3.jpg" alt="photo3" id="post-3"></div> <div class="photo-overlay"><h2>Leaf</h2><div class="photo-details"><p>Information about the photo goes here.</p></div></div> </li> <li class="photo-col"> <div class="preview"><img src="images/gallery/pt4.jpg" alt="photo4" id="post-4"></div> <div class="photo-overlay"><h2>Sky</h2><div class="photo-details"><p>Information about the photo goes here.</p></div></div> </li> </ul> <ul id="photo-col-2" style="float: left; width: 457px"> <li class="photo-col"> <div class="preview"><img src="images/gallery/pt5.jpg" alt="photo5" id="post-5"></div> <div class="photo-overlay"><h2>Landscape</h2><div class="photo-details"><p>Information about the photo goes here.</p></div></div> </li> <li class="photo-col"> <div class="preview"><img src="images/gallery/pt6.jpg" alt="photo6" id="post-6"></div> <div class="photo-overlay"><h2>Sun</h2><div class="photo-details"><p>Information about the photo goes here.</p></div></div> </li> <li class="photo-col"> <div class="preview"><img src="images/gallery/pt7.jpg" alt="photo7" id="post-7"></div> <div class="photo-overlay"><h2>Stream</h2><div class="photo-details"><p>Information about the photo goes here.</p></div></div> </li> <li class="photo-col"> <div class="preview"><img src="images/gallery/pt8.jpg" alt="photo8" id="post-8"></div> <div class="photo-overlay"><h2>Tree</h2><div class="photo-details"><p>Information about the photo goes here.</p></div></div> </li> </ul> </div> Here's the jQuery: <script type="text/javascript"> <!--PhotoPopOut Script by Luke Harvey--> $(document).ready( function() { $('#post-1').mouseover( function() { loadloginPopup(); }); $('#post-1').mouseout( function() { unloadloginPopup(); }); function loadloginPopup() { $(".photo-overlay").css({ "display": "block" }); $(".preview img").css({ "opacity": "0.6" }); function unloadloginPopup() { $(".photo-overlay").css({ "display": "none" }); $(".preview img").css({ "opacity": "1" }); } } }); </script> Here's what it looks like when you hover over the pictures: Please excuse anything that might seem 'dumb', I've just returned back to web development and I've forgotten a lot of things
  9. Thanks, I don't know if it worked as I changed it to IE 11 (The IE version I have) and it didn't seem to work but I've added it anyway.
  10. O nice but could I have a script inside of that instead that would redirect a person to another html document? Using the document.location.href method?
  11. And as I stated this is a 3 page website and the IE version that the college has doesn't seem to like percentages in widths and height which I use, weather it's an effective method or not I'm just wondering if there's a way to BLOCK users from being able to access the website with the application Internet Explorer. And please note this is an assignment which means I don't have time to write another CSS document just so it can run in a browser that I don't even use.
  12. Hi, I'm creating a website for my college course as part of an assignment. Blocking IE isn't part of the assignment but my CSS document has percentages and for some reason the college uses a really old IE version so it completely messes up the website. What I was hoping to do is make it so all versions under and equal to 10 are blocked; IE 11 works well with my website. So overall I need a method of blocking IE version 10 and under without using PHP or .HTACCESS. What I need it to do is when the person requests the website with IE 10 and under that it returns a document named "reject.html" otherwise have it return index.html. I've done something like this last year with javascript but for some reason it's not working now? Please note that this isn't going to be a full blown website it's just a 3 page website but in order for the lectures to mark it correctly it must be on the correct browser. Help will be much appreciated. Here are the methods that I've tried so far. <script> /*@cc_on @if (@_jscript_version > 10) document.location.href = "reject.html"; @elif (@_jscript_version == 10) document.location.href = "index.html"; @elif (@_jscript_version == 9) document.location.href = "reject.html"; @elif (@_jscript_version == 5. document.location.href = "reject.html"; @elif (@_jscript_version == 5.7 && window.XMLHttpRequest) document.location.href = "reject.html"; @elif (@_jscript_version == 5.6 || (@_jscript_version == 5.7 && !window.XMLHttpRequest)) document.location.href = "reject.html"; @elif (@_jscript_version == 5.5) document.location.href = "reject.html"; @elif (@_jscript_version < 5.5) document.location.href = "reject.html"; @else document.location.href = "index.html"; @end @*/ </script> And <script language="javascript"> <!-- if (navigator.appName == "Microsoft Internet Explorer") { document.location = "reject.html"; } // --> </script>
  13. Thanks very much
  14. Hi, I just have a quick question to ask which I can't find an answer to. Is there a way to set a session time for the "start_session" because everytime I log in, it doesn't keep my session for that long when I then access the page again later. Help is appreciated
  15. Hi, I'm trying to make it so when the whomever enters invalid information into the form, it'll return the error WHICH IT DOES but it also refreshes the page. Now this is a problem for me because the register form is slides down but only when the user presses the 'Register' button. Help will be much appreciated Problem: The pages refreshes when user submits the form and the form returns an error. How it should work: When an error occurs, the page doesn't refresh and should stay where it is and just return an error. The Register Script: <div id="register-container"> <div id="register-wrapper"> <form action="" method="post" name="register_form" id="register_form"> <table border="0" id="table-register"> <th colspan="2"> <h1 class="frm-header-style">Register</h1> <?php if( !(isset( $_POST['register'] ) ) ) { ?> <?php } else { $usr = new Users; $usr->storeFormValues( $_POST ); $errorMessage = ""; $error = false; $username = $_POST['username']; $email = $_POST['email']; $password = $_POST['password']; $cpassword = $_POST['cpassword']; if( strlen($username) < 6 ) { $errorMessage .= "<li class='error'>Username must be more than 6 characters long.</li>"; $error = true; } elseif( strlen($email) < 5 ) { $errorMessage .= "<li class='error'>Email is too short.</li>"; $error = true; } elseif( strlen($password) < 5 ) { $errorMessage .= "<li class='error'>Password must be more than 5 characters long.</li>"; $error = true; } elseif( $password != $cpassword ) { $errorMessage .= "<li class='error'>Password and Confirm password not match.</li>"; $error = true; } elseif(!preg_match('/^[a-zA-Z0-9]{5,}$/', $username)) { $errorMessage .= "<li class='error'>Username can only contain letters & numbers.</li>"; $error = true; } elseif(!preg_match('/^[_A-z0-9-]+((\.|\+)[_A-z0-9-]+)*@[A-z0-9-]+(\.[A-z0-9-]+)*(\.[A-z]{2,4})$/', $email)) { $errorMessage .= "<li class='error'>Email is invalid.</li>"; $error = true; } else { echo $usr->register( $_POST ); $error = false; } if($error) { echo($errorMessage); } } ?> </th> <tr> <td> <p class="frm-text-style">Username:</p> </td> <td> <input type="text" name="username" id="username" class="frm-style" required/> </td> </tr> <tr> <td> <p class="frm-text-style">Email:</p> </td> <td> <input type="text" name="email" id="email" class="frm-style" required/> </td> </tr> <tr> <td> <p class="frm-text-style">Password:</p> </td> <td> <input type="password" name="password" id="password" class="frm-style" required/> </td> </tr> <tr> <td> <p class="frm-text-style">Retype Password:</p> </td> <td> <input type="password" name="cpassword" id="cpassword" class="frm-style" required/> </td> </tr> <tr> <th colspan="2"> <input class="frm-submit-register" name="register" type="submit" value="Submit" /> <input class="frm-submit-close" name="close" id="close-register" type="button" value="Close" /> <th> </tr> </table> </form> </div> </div>
  16. Hi, I'm trying to make it so the user can enter some text into a text box and from there it will add a link and NOT override it. Here's my problem, I can't seem to get this statement to work correctly as I don't know how to put some kind of variable. Overall: I want it so it adds what ever has been entered into the INPUT tag and add into the correct user_id Please exuse my messy code, I'm just trying to get it to work before I tidy it up. Declared variables at the top of the document: class Users { public $user_id = null; public $username = null; public $email = null; public $password = null; public $salt = "Zo4rU5Z1YyKJAASY0PT6EUg7BBYdlEhPaNLuxAwU8lqu1ElzHv0Ri7EM6irpx5w"; public $links = null; public function __construct( $data = array() ) { if( isset( $data['user_id'] ) ) $this->user_id = stripslashes( strip_tags( $data['user_id'] ) ); if( isset( $data['username'] ) ) $this->username = stripslashes( strip_tags( $data['username'] ) ); if( isset( $data['email'] ) ) $this->email = stripslashes( strip_tags( $data['email'] ) ); if( isset( $data['password'] ) ) $this->password = stripslashes( strip_tags( $data['password'] ) ); if( isset( $data['links'] ) ) $this->links = stripslashes( strip_tags( $data['links'] ) ); } Here's what I've made: public function addLink() { $correct = false; try{ $con = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD ); $con->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); $sql = "UPDATE `a8906507_members`.`list_members` SET `links` = <SOME KIND OF VARIABLE HERE> WHERE `list_members`.`user_id` = <SOME KIND OF VARIABLE HERE> LIMIT 1"; $stmt = $con->prepare( $sql ); $stmt->bindValue( "links", $this->links, PDO::PARAM_STR ); $stmt->execute(); }catch( PDOException $e ) { return $e->getMessage(); } } Here's my HTML that connects to the public function and executes it. <form action="" method="post" name="add_link" id="add_link"> <table border="0" id="table-add"> <th colspan="2"> <h1>Add a livestream</h1> <?php if( !(isset( $_POST['add_link'] ) ) ) { ?> <?php } else { $usr = new Users; $usr->storeFormValues( $_POST ); $errorMessage = ""; $error = false; if( $usr->addLink() ) { echo 'Channel added!'; $error = false; } else { $errorMessage .= "<li class='error'>Link can't be added</li>"; $error = true; } if($error) { echo($errorMessage); } } ?> </th> <tr> <td> <p>Channel Name:</p> </td> <td> <input type="text" name="channel-name" class="frm-style" /> </td> </tr> <th colspan="2"> <input class="frm-submit-add" name="add_link" type="submit" value="Add" /> <th> </tr> </table> </form> Help will be appreciated, thanks.
  17. I've managed to do the validation form by calling my Function form. <?php } else { $usr = new Users; $usr->storeFormValues( $_POST ); $n6 = 6; if( $_POST['password'] == $_POST['cpassword'] ) { echo $usr->register($_POST); } else { echo "Password and Confirm password not match"; } if( $_POST['username'] < $n6 ) { echo "Username must be more than 6 characters."; } else { echo $usr->register($_POST); } if( $_POST['password'] < $n6 ) { echo "Password must be more than 6 characters."; } else { echo $usr->register($_POST); } } ?> Thanks for all the help!
  18. Yeah that looks much neater, but as far as switch functions go, I haven't really looked into them and I'm not too sure how it would look? I've given it go anywhere, here's what I came up with. <?php $username = $_POST['username']; $email = $_POST['email']; $password = $_POST['password']; switch($username) { case ($username < 5): echo "Username must be more than 5 characters long."; break; case ($email < 6): echo "Email must be 6 or more characters long."; break; case ($password < 6): echo "Password must be 6 or more characters long."; break; default: echo "The Field is empty"; } ?>
  19. Ah I can see how this would work, thanks. As far as putting <p> tags in the <td> go that's for the headings for the form inputs. Take in mind I'm not perfecting any of my code before I've completed the BASIC functionality and made sure that everything is working correctly; this is just beta testing so I apologize for the messy code.
  20. Ah this makes much more sense now, thanks a lot. So what I need to do is create an ID for the session to bind to and test weather that ID is equal to true when they try to log in?
  21. Hi, I'm trying to make some kind of validation for my form but I've tried everything from Javascript to PHP and I can't seem to get it to work? I'll put my javascript code below but I would much rather use PHP as the validator as I don't like using alert boxes. The problem is that it's validating at all and any method that I try it just skips it and carrys on with the registration. For example I put "dd" as my username, email and password and it accepted it. Help would be much appreciated, thanks. The Javascript: <script type="text/javascript"> function validateForm(formElement) { if(formElement.username.length < 5) { alert('Username must be more than 5 characters.'); return false; } if(formElement.email.length < 5) { alert('Email must be more than 5 characters.'); return false; } if(formElement.password.length < { alert('Password should be more than 8 characters.'); return false; } } </script> The Form: <div id="register-section-wrapper"> <div id="inner-register-container"> <form action="" method="post" name="register_form" id="register_form" onsubmit="return validateForm(this);"> <table border="0" id="table-register"> <th colspan="2"> <h1>Register</h1> </th> <tr> <td> <p>Username:</p> </td> <td> <input type="text" name="username" id="username" class="frm-style" required /> </td> </tr> <tr> <td> <p>Email:</p> </td> <td> <input type="text" name="email" id="email" class="frm-style" required /> </td> </tr> <tr> <td> <p>Password:</p> </td> <td> <input type="password" name="password"id="password" class="frm-style" required /> </td> </tr> <tr> <td> <p>Retype Password:</p> </td> <td> <input type="password" name="cpassword" class="frm-style" required /> </td> </tr> <tr> <th colspan="2"> <input class="frm-submit-register" name="register" type="submit" value="Submit" onclick="return validateForm(this.form);" /> <th> </tr> </table> </form> The OLD PHP Validation: <?php $error_msg = ""; if(isset($_POST['register'])) { if(empty($_POST['username'])) { $error_msg = "Please enter your username."; } else { return true; } if($_POST['username'] < 5) { $error_msg = "Username must be more than 5 characters."; } else { return true; } } ?>
  22. <?php session_start(); $_SESSION['user_id']; ?> Then I use this to check if the session is valid but it doesn't really work. <?php if(isset($_SESSION['user_id'])) { include 'profile-c'; } else { echo 'Nope.'; } ?>
  23. I was wondering is there a different between the two and I have a small knowledge of sessions but none of cookies, I was hoping to have a better understand of differences of the two.
  24. Hi, I'm trying to create a login form so that when a user logs in, they stay logged in and I'm wondering, which is better to use? The cookie method by doing: setcookie or the session_start() method? So far I've been unsuccessful with the session_start(); method. Any suggestions? Thanks.
×
×
  • 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.