Jump to content

HuggieBear

Members
  • Posts

    1,899
  • Joined

  • Last visited

Everything posted by HuggieBear

  1. Quote your query string... [code=php:0]mysql_query("INSERT INTO v2_users (name, pass, jdate, banned) VALUES ('$username', '$password', '$date', '0')");[/code] Regards Huggie
  2. If you're using MySQL then just use the [color=green]DATE_FORMAT()[/color] function. [code]<?php // SQL statement to get date from database $sql = "SELECT DATE_FORMAT(date_column_name, '%h:%i %p') AS time FROM table_name"; $result = mysql_query($sql); if (!$result){   echo mysql_error(); // If error, why couldn't we execute $sql } else {   $time = mysql_result($result, 0, 0); // If success, assign the date to the variable $time } // Echo the time echo $time; ?>[/code] Regards Huggie
  3. Surely this should be moved to the webserver board? http://www.phpfreaks.com/forums/index.php/board,2.0.html Regards Huggie
  4. This almost works... [code=php:0]<?php // Test html code $html = <<<HTML <HTML> <HEAD> <TiTlE>This is My Title</TITlE> <body BG="Red"> This is Some Text </body> </HtML> HTML; // Regular expression echo preg_replace("/(<.*?>)/e", "''.strtolower('$1').''", $html); ?>[/code] The problem is that it escapes all the single and double quotes in the output.  Here's what it produces... [code]<html> <head> <title>This is My Title</title> <body bg=\"red\"> This is Some Text </body> </html>[/code] But it's a start. Regards Huggie
  5. HuggieBear

    Sorry

    Why not just copy it from the other site and paste it in here... It's not rocket science and it saves people be redirected to another site. Regards Huggie
  6. This line [code=php:0]$x = get_unique_name();[/code] should be passing a variable (I'm assuming the old name) to the function, so it should look something like this... [code=php:0]$x = get_unique_name($_FILES['file']['name']);[/code] It needs an argument. Regards Huggie
  7. The syntax for having those appear on your page is [code=php:0]include_once('header.php');[/code] and it's that simple :) Regards Huggie
  8. You have to delete a cookie with the same parameters you set it with, so try this as the delete cookie page... [code]<?php setcookie ("user", '', time()-3600); header("Location: http://localhost/phpuni/index.php"); /* Redirect browser */ exit; ?>[/code] The number you were getting was because you were setting [code=php:0]time()-3600[/code] as the value of the cookie, not the expiry time. Also, please use [b][nobbc][code][/code][/nobbc][/b] tags when posting code. Regards Huggie
  9. Move the function out of the foreach loop to prevent getting the error. As for why the file's not being renamed, it's because you're not calling the function anywhere. Regards Huggie
  10. The code you provided works fine for me, are you sure that none of your other code is truncating it? [code]<?php $fTitle = fopen('title.csv', 'w+'); fwrite($fTitle, stripslashes($_POST['title'])); fclose($fTitle); ?>[/code] Regards Huggie
  11. Is this PHP5?  I'm not having any issues with PHP4.3 I get exactly the response you'd expect. Regards Huggie
  12. Why not use a loop?  Assuming your array is keyed by number, something like this would work... [code]<?php $i = 0; while ($i < 5){ // enter the amount that you want to do something with here   echo $arrayname[$i]; // do what you want with the array, echo for example   $i++; // increment the counter by 1. } ?>[/code] Regards Huggie
  13. Try returning the value... [code]<?php $secret = $_POST['secret']; $secret = deepclean($secret); function deepclean($varinfo) { $varinfo = htmlspecialchars($varinfo); $varinfo = htmlentities($varinfo); $varinfo = strip_tags($varinfo); $varinfo = mysql_real_escape_string($varinfo); return $varinfo; // Added this line } ?>[/code] Regards Huggie
  14. I believe there's an option within CURL called FOLLOWLOCATION which can be set to allow the object to be redirected.  You could try something with that. You could grab the data of a url into a variable, with FOLLOWLOCATION off and then again with it on and then do a string compare.  If they're different, you know that a redirect has occurred.  This isn't ideal as dynamic content on the page could make it different each time you visit the page, giving the effect of a false positive. Regards Huggie
  15. OK, lets ties this up once and for all... How many columns are in your database table and what are they called? This is correct if you have six columns, you just need to add a comma $sql = "INSERT INTO pets_owned VALUES(''[color=red],[/color] $pet, $userid, 1, 1, 1)"; Huggie
  16. I think this is related to the fact that the code's not actually on http://einstein2.co.nr it's on http://einstein2.saiyaithai.org/einstein2/footer.php You possibly have path issues.  Maybe you could post all the code for these few pages? Regards Huggie
  17. OK, what's the first field then? You've mentioned five columns, but you're trying to insert six values! Regards Huggie
  18. Yes, can you post that snippet of code. Regards Huggie
  19. Try this: [code]<?php $i = 1; // default start value while($rows = mysql_fetch_array($result)){   echo "$i: {$rows['title']}<br>\n";   $i++; // increment the counter by 1 } ?>[/code] Regards Huggie
  20. No problem... The word 'array' in the path should have given it away. Regards Huggie
  21. Is it live somewhere that we can take a look at it? Regards Huggie
  22. If you're only uploading one file at a time, then surely this will work? [code]<?php $filepath = "/pictures/".$_FILES['filename']['name']; echo $filepath;       $source = "pictures";       move_uploaded_file($_FILES['filename']['tmp_name'],               "../webserver/mysite/$source/".$_FILES['filename']['name']); ?>[/code] Regards Huggie
  23. This is because you're only inserting 6 columns and your table obviously has more than 6 columns. Try naming the columns if you're only doing a partial insert... [color=green]INSERT INTO pets_owned (columnA, columnB, columnC) VALUES ('', 1, 1)[/color] If you're leaving the first column blank as it's an auto-increment field, then there's no need to include it at all... [color=green]INSERT INTO pets_owned (columnB, columnC) VALUES (1, 1)[/color] Regards Huggie
  24. Have you uploaded footer.php to the server? If the others are all working OK, this could be an issue.  Also check the case. Please put your code in [b][nobbc][code][/code][/nobbc][/b] tags when posting. Regards Huggie
  25. [quote author=black.horizons link=topic=118177.msg482611#msg482611 date=1165841583] whats the $c doing outside the rest of the ""s mysql_query("INSERT INTO pets_owned VALUES('', $userid, $pet, 1, 1, 1, $c"); [/quote] $c is the connection resource. Regards Huggie
×
×
  • 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.