Jump to content

pixy

Members
  • Posts

    295
  • Joined

  • Last visited

    Never

Everything posted by pixy

  1. 1. You will always want to escape $_GET variables so that people do not enter malicious content onto your site. 2. Here's what I think you want: [code] <?php if (isset($_GET['name'])) {   $name = $_GET['name'];   $query = "SELECT * FROM users WHERE name='$name'";   $result = mysql_query($result) or die(mysql_error());   if ($result) {     while ($row = mysql_fetch_array($result)) {       echo $row['name']; // Output all information.     }   }   else {     echo 'Error with query: '.$query.'<br>'.mysql_error();   } } else {   echo 'You must specify a name.'; } ?> [/code]
  2. ^ the buffer has a size limit and is not recommended. Instead you should learn how to do it correctly without them. Firstly, I can't remember how to use cookies. I've always used sessions. They're not only more secure...but they're better. :) It's easy to switch from cookies to sessions, so if ya want to do that I can help you there. :)
  3. It's all good, just make sure to check the stickies first (they're there for a reason, ;))
  4. Didja read this post: http://www.phpfreaks.com/forums/index.php/topic,37442.0.html ??
  5. Your site STILL has that dreadful green text. Please please please get rid of it. As for generating money, why not put some google ads on there? Seriously, they do work! When my site launches this coming winter, I could give you a link if you want.
  6. Exactly how much javascript should you know before trying to use AJAX? I know absolutely no javascript, but I'd love to use it. And is this something AJAX could do: Say you have a shop online where people buy with little points they accumulate for doing things. Then whenever a shop item is bought it disappears from the page without having to reload the page? How hard is it to incoporate PHP and AJAX to work together?
  7. Another thing I've noticed is the polls aren't working correctly. All the old polls give a single option "Array".
  8. I use tables with CSS. <table class="whatever"> Like that.
  9. Maybe you should store templates outside of the main public_html directory? That way they can't be accessed directly through the browser, but can be accessed through the direct path.
  10. pixy

    $end error ;/

    Unexpected $end means you are missing one or more brackets } somewhere. There's a sticky post about this here: http://www.phpfreaks.com/forums/index.php/topic,100473.0.html
  11. How on earth does it NOT work? <table> <tr><td> <div align="left">This text is on the left...</div><br> <div align="right">This text is on the right...</div> </td></tr></table> I know that that works.
  12. I think you should try a neutral background color (maybe a light beige or gray) and then possible color schemes: - Burgandy, red, slate gray - Dark green, sage, white, grey You'll want to make sure your header matches. Instead of using image rollovers, have you ever considered using Flash? They're really easy to do and quite a bit more flexible. If you need the program, let me know. I've got both MX 2004 pro and 8.
  13. It's on a computer that doesn't have an internet connection, so I can't download the flash plugin (the CAB file tries to access the internet, which is the problem). I'm going to try and email the people at adobe to see if they can give me the plugin. Yeah, thats why I couldn't figure out why it doesn't work in IE since it runs on the server. Oh well.
  14. Any idea why? It's not a particularly big problem, but I can't get the flash plugin to work in Firefox so I can only view flash in one browser and PHP in another (which causes complications). I'm running on Windows 2000 Professional, if that makes any difference.
  15. pixy

    php help!!

    ^ I second that. I just installed WAMP and it worked fine. However, I can only access localhost using Firefox browser and not internet explorer (which is odd, I know).
  16. Did you get an error or something? I personally use sessions on my site and that's the same syntax that works for me.
  17. You could add LIMIT 1 to the end.
  18. Why not just use <div align="left"> for the stuff you want on the left, and <div align="right"> for stuff on the right?
  19. pixy

    php help!!

    Depends. If you have PHP installed on the server, you have to upload the page to see the PHP. You can still edit it with dreamweaver, but you can't test it offline. If you have PHP installed on your computer, you can test your page before taking it online by using http://localhost/. Packages like WAMP5 and XAAMP will automatically install and configure PHP, mySQL, phpmyadmin, etc. to work together.
  20. Here's something really quick ($dbc is the variable of your connection to a database): [code] <?php // This is a function to prevent MYSQL injection function escape_data ($data) {   global $dbc; // Need the connection.   if (ini_get('magic_quotes_gpc')) {     $data = stripslashes($data); } return mysql_real_escape_string($data, $dbc); } if (isset($_POST['submitted'])) {   $errors = array();   if (empty($_POST['name'])) {     $errors[] = 'You did not enter a name!';   }   else {     $name = escape_data($_POST['name']);   }   if (empty($errors)) {     $query = "INSERT INTO tablename (name, address, city, state, zipcode, message) VALUES ('$name', '$address', '$city', '$state', '$zipcode', '$message')";     $result = mysql_query($query) or die(mysql_error());     if ($result) {       echo 'Thankyou '.escape_data($name).' for filling out the form!';     }     else {         echo mysql_error();     }   }   else {     foreach ($errors as $msg) {       echo '<li> '.$msg.'</li>';     }   } } else {    // Show the form    echo '<form action="thisfile.php" method="post">    <b>Name:</b> <input type="text" name="name" size="30">    <input type="submit" name="submit" value="Submit">   <input type="hidden" name="Submitted" value="TRUE"></form>'; } ?> [/code] I don't have time to put in all the name, address, etc. but you can just copy and paste the part I did for name. Also, you should add something for your zipcodes making sure they're numbers like so: [code]<?php if (!is_numeric($_POST['zipcode'])) {   $errors[] = 'Invalid zipcode'; } ?>[/code] As for making a drop down, you're going to be writing quite a bit, but this is the basic syntax: [code] <select name="state">   <option value="AL">Alabama</option>   <option value="AK">Alaska</option>   <option value="AZ">Arizona</option>   <option value="AR">Arkansas</option> </select>[/code] Just keep going with all the states! Quite tedious, yes, but that's the way it is. :) I'm getting offline to eat dinner, but let me know if you need help and I'll answer when I can. Good luck with the script!
  21. pixy

    Music

    Yes, but they specifically don't use his fame to promote their band. They prefer to allow the music to speak for itself, which is something I really do admire. Jared is both a talented actor and musician, but I definately prefer his music (all his movies made so far have been rated R, therefore the only acting I've got to go on is his role in "My So-Called Life").
  22. Post the code you're using in process.php (we can't see it through a browser).
  23. You mean a file manager you have set up on your server where people can download files? If a user can upload a PHP and and download PHP files, then yes it will be the actual code. If you mean just going to the PHP page and saves the page their viewing, they get nothing but HTML.
  24. For error checking you can do something like this: <?php if (isset($_POST['submitted'])) {   $errors = array();   if (empty($_POST['value'])) {     $errors[] = 'You left value blank!';   }   else {     $value = $_POST['value'];   }   if (empty($errors)) { // No errors occured     // Do the query and such   }   else {     foreach ($errors as $msg) {       echo '<li> '.$msg.'</li>';     }   } } else {     // Show the forum } ?> Then in your form just make a hidden input named "submitted" and the value TRUE. It's pretty simple. You'll need to use a regular expression to check for a valid email address. We've got a forum here just for regular expressions you should check out! EDIT: Oh, and it's not that your script wont work, it just seems ridiculously long for something that SHOULD be simple. What exactly are you trying to accomplish? + Instead of doing a random code, you could just use regular random words--they're easier for the end user to type in and just as secure IMO.
×
×
  • 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.