Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. $fn = mysql_real_escape_string($_POST['last_name']); You are overwriting the $fn with the last name, change that to be: $ln = mysql_real_escape_string($_POST['last_name']); And you should be on your way.
  2. Just copied and pasted that code in an HTML file and the window opened just fine on FF, perhaps you have a javascript syntax error prior to that code that is causing javascript to stop working?
  3. I think it is Nov 2010, but yea. Something like that.
  4. Please use to display code. Your issue lies here: foreach($display as $key => $value) { echo "<tr>"; echo "<td>" . $display['name'] . "</td>"; echo "<td>" . $display['quote'] . "</td>"; echo "</tr>"; } You are using $display to call the items, if $display is not a multi-dimmensional array then you just need to display the items, if it is you would call it this way: foreach($display as $value) { echo "<tr>"; echo "<td>" . $value['name'] . "</td>"; echo "<td>" . $value['quote'] . "</td>"; echo "</tr>"; } I am not sure which it is or is not, but if it is not a multi-dimmensional array the reason you were getting the results doubled is that you have 2 items in the array, name and quote, so foreach runs for each of those items in the array and will display it. So if that is the case and it will never be a multi-dimmensional array perhaps this is what you want: echo "<tr>"; foreach($display as $value) { echo "<td>" . $value . "</td>"; } echo "</tr>"; Not really sure, but there are a few options for you to look over and ask questions about / try.
  5. Can you post the output that is displayed when there are "no files associated" and the output when there are "files associated". I think that will help me figure out what you are after and how to get it to work for ya.
  6. That takes "paper weight" to a whole new level! I will never use my tower as paper weight again, expensive BBQ grill here I come.
  7. Agreed. I will take a look at that when I get home
  8. I believe the DOCUMENT_ROOT adds the first slash for you, try this: $path = $_SERVER['DOCUMENT_ROOT'].'../fldr_name/file.name'; If that does not work echo out $path and see where it could be going wrong, alternatively you can use explode at the / and put the items in an array and just remove the last item in the array.
  9. Ah, yea. I was under the impression he did not want them at all, good call!
  10. premiso

    TGIF

    =\ I just started my Friday, but woohoo! The only crappy thing is I have to travel 6 hours tomorrow to go see family =\ I would much rather be working on my house so I can get it appraised. Oh well, at least I can maybe get drunk tonight and I always have Sunday to fix up my house a bit.
  11. <?php $limit = 4; $output = ""; for ($i=1; $i<= $limit ;$i++) { $file = call_user_func(array($facility, 'getFile'.$i)); $filedesc = call_user_func(array($facility, 'getFileDesc'.$i)); if(empty($file)){ $output .= ' '; }else{ $img = image_tag('pdf.jpg', array('height'=>'30', 'width'=>'30')); $filedesc = ( $filedesc !== '' ) ? $filedesc : 'Download File'; $output .= "<br /><li><a href=\"/preview/uploads/facilities/{$file}\">{$img}</a> <br /> {$filedesc}<br /></li>"; } } $style = ""; if (strstr($output, "preview/uploads") === False) { $style = 'style="display:none;"'; } $output = '<div id="box_info_downloads" ' . $style . '> <h2>downloads</h2> <div id="files"> <ul class="attached_files">' . $output; echo $output; ?> That is one way to do it, generally you do not want to output stuff in the middle of processing scripts, it is generally better to store it in a variable and echo it after the script is processing as it can screw with header and make them not work. Hopefully that is what you were after. EDIT: Fixed a syntax error (added semicolon after $output = "")
  12. Nope, if it is anonymous users then yea, you cannot do much. The best you can do is Add in Captcha's ONLY for anonymous users and do a throttle by IP that if that IP has posted within 45-60 seconds they cannot re-post again. Doing that may annoy them enough to not come back if they are doing it just to bash etc. The only downfall is, it will probably annoy regular anonymous users as well, but it should not stop them from coming to the site, just from replying. EDIT: As for the IP that is logged, PHPFreaks keeps a log of IPs and they can "ban" by IP, but it is still under the same items that we described before. It is rarely used to ban someone they simply just ban the user from the site, as you have to be registered to make posts etc. But IP's are also good for statistics and to see if someone is possibly using 2 accounts, which is against ToS.
  13. The issue is pretty simple: function go() { header("Location: http://127.0.0.1/ajax/data_entry/"); exit; } That will work, for headers doing Location : throws it off as it is not proper syntax. It should be Location: Try that and see if it works for
  14. Its not, it is just a decent way to do it. You will still have to have some PHP code to write new IPs to the file if you want it dynamic. Doing the .htaccess denies them from the whole folder it is in. But as long as your PHP files as a "config" include or a "global" include file that is included on each page, this will not be a hard change to code in a banning feature by IP. But before you implement that, think of this. If you have a lot of university people visiting your site, generally banning one person's IP bans the whole university. Let me know if you have further questions or need clarification.
  15. If CustomerID is an INT, that would throw it off completely, even if it was a string, you have an extra space before and after, which will matter when comparing data. But I take it CustomerID is of type INT, so the quotes do not matter. Let's see what the error is when the OP gets back to us and go from there.
  16. The best way to ward of unwanted is have a "White List" or "Safe List", basically only members IP addresses that are on that list can access the site. Now here comes the kicker, if they do not have a static IP address, or want to access from a different location IE: Work, they will be denied access. It is pretty much a waste of time to try banning people by IP address, as anyone can get a Free Proxy and access your site through that and viola they are not banned. Or if their IP address is dynamic then yea. So try as you might, the best way is there is no best way. Add some annoyances such as Captcha and possibly a throttle on how long before they can post a new item. But yea, if IP's were unique and static for every computer, ya this would work. But they are not. But .htaccess is a decent way to do it if you do not want to write php code to block.
  17. Ok I cleaned up the indentation so it was easier to read and removed the multiple checks, since you were not using them to display a certain error and just made a $error to test if there was an error prior: <?php $error = false; if (eregi ('^[[:alpha:]\.\'\-]{2,15}$', stripslashes(trim($_POST['first_name'])))) { $fn = mysql_real_escape_string($_POST['first_name']); }else { $error = true; echo '<p><font color ="red" size="+1"> Please enter your first name!</font></p>'; } if (eregi ('^[[:alpha:]\.\'\-]{2,30}$', stripslashes(trim($_POST['last_name'])))) { $fn = mysql_real_escape_string($_POST['last_name']); }else { $error = true; echo '<p><font color ="red" size="+1"> Please enter your last name!</font></p>'; } if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,4}$', stripslashes(trim($_POST['email'])))) { $e = mysql_real_escape_string($_POST['email']); }else { $error = true; echo '<p><font color ="red" size="+1"> Please enter a correct e-mail address</font></p>'; } if (eregi ('^[[:alnum:]]{4,20}$', stripslashes(trim($_POST['password1'])))) { if ($_POST['password1'] == $_POST['password2']) { $p = mysql_real_escape_string($_POST['password1']); }else { $error = true; echo '<p><font color ="red" size="+1"> Your password did not match the confirmed password!</font></p>'; } }else { $error = true; echo '<p><font color ="red" size="+1"> Please enter a valid password!</font></p>'; } if (!$error) { $query ="SELECT username FROM users WHERE email='$e'"; $result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: ".mysql_error()); if (mysql_num_rows($result) == 0) { $a = md5(uniqid(rand(), true)); $query = "INSERT INTO users (email, pass, first_name, last_name, active, registration_date) VALUES ('$e', '$p', $'f', $'ln', $'a' )"; $result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error:" .mysql_error()); if (mysql_affected_rows() == 1) { $body = "Thank you for registering with Football Trip. Please use the link below to activate your account:\n\n"; $body .= "http://www.footballtrip.net/activate.php?x=" . mysql_insert_id() . "&y=$a"; mail($_POST['email'],'Registration Comfirmation',$body); echo '<h2> Thank you for registering! A confirmation E-Mail has been sent to your address. Please click on the link in order to activate your account</h2>'; }else { echo '<p>font color="red" size="+1"> You could not be registered due to a system error. We apologize for any inconvenience. </font></p>'; } }else { echo '<p><font color="red" size="+1"> That E-Mail address has already been registered. If you have forgotten your password, use the link to have your password sent to you.</font></p>'; } } else { echo '<p><font color="red" size="+1"> Please try again.</font></p>'; } mysql_close(); ?> Give that a try and see if it works.
  18. Yea, I did not even know it was an older show! The only ones I have seen are the Drew Carey ones. But Ryan, Collin and Wayne all rock the show, the 4th person is kinda alright depending on which it was. But Wayne does some crazy creative thinking with the songs he creates, it is just crazy!
  19. <?php include('connect.php'); mysql_select_db("gracom1_widgets", $con) or die(mysql_error()); $result = mysql_query("SELECT `custName`, custPhone, custEmail, custID FROM customers") or die(mysql_error()); echo "<table width='600px'> <tr> <th>Customer Name</th> <th>Phone</th> <th>Email</th> <th>Details</th> </tr>"; $i=0; while($row = mysql_fetch_assoc($result)) { $class = ($i % 2 == 0)?"alt":"noalt"; echo "<tr class=$class>"; echo "<td>" . $row['custName'] . "</td>"; echo "<td>" . $row['custPhone'] . "</td>"; echo '<td><a href="mailto:' . $row['custEmail'] . '?subject=">' . $row['custEmail'] . "</a></td>"; echo '<td><a href="details.php?custID=' . $row['custID'] . '">Show</a></td>'; echo "</tr>"; $i++; } echo "</table>"; mysql_close($con); ?> The code to do it is called modulus (the % ) so doing the $i % 2 checks if there is a remainder, if there is then it will not equal 0, if there is not then it is equal to 0. I am not sure of the correct terms to put it so yea. You just now need to make 2 styles, alt and noalt and do the table row backgrounds.
  20. Would strip_tags solve your issue?
  21. Sounds like a kinky boat ride. Anyhow welcome
  22. Next time, please post the relevant code inside of tags. I do not know where the function escape_data is located at, as it is not in that script you gave us, perhaps you meant mysql_real_escape_string. Try replacing the escape_data to the mysql function and see if that works.
  23. I was watching some re-runs of this show last night and man that was a funny show, granted Drew Carey kind of made parts of not funny, it was still hilarious. I just think it is crazy that those guys can think of all the on the spot and make it funny I just love impromptu, anyhow nothing special about this post, just thought of mentioning it. And BTW the best episode was with Richard Simmons, if you never seen that look it up on YouTube.
  24. Have you tried echoing out the $sql and making sure all the data there is what you expect it to be? That would be my first check and if you could post the results after you echo out the $sql that would be great EDIT: Try that after seeing if there was an error as rajiv suggested.
  25. Not sure how that is suppose to work (IE what the script expects) but you are naming the input boxes exactly the same, this is problematic as you have noticed. It simply sends you the last item. Look in the documentation and see what the page is expecting, either an array which would be setup like this: <input type="text" name="cart_quantity[1]" value="1" maxlength="6" size="4" /><br /><br /><input type="hidden" name="products_id[]" value="1" /> <input type="text" name="cart_quantity[2]" value="1" maxlength="6" size="4" /><br /><br /><input type="hidden" name="products_id[]" value="2" /> But really I am not sure, I would look at the FAQ or documentation for the multiple product insert and see what you need to do, as it all depends on how the zend cart handles it.
×
×
  • 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.