Jump to content

HuggieBear

Members
  • Posts

    1,899
  • Joined

  • Last visited

Everything posted by HuggieBear

  1. Your query is wrong... If you look at what your query looks like, it's like this: [color=blue]SELECT COUNT(*) AS total FROM news_stories WHERE select *, DATE_FORMAT(appeared, '%W %d %M, %Y') as published_date from news_stories where section like '%$section%' AND unix_timestamp(published) <= unix_timestamp(NOW()) AND ( headline LIKE '%$searchstring%' OR story_text LIKE '%$searchstring%'[/color] This is not valid SQL. Regards Huggie
  2. I'm quite partial to a 'logout' button, something that I couldn't see on your site. Huggie
  3. Good afternoon, I'm trying to get GD2 installed on a SunOS (Solaris 10) machine, running a cut down version of PHP 4.3.9 (Bundled with Oracle Application Server). PHP wasn't complied with GD as default, so now I want to try and get it running.  From what I understand I need a php_gd2.so file for the box and I then need to uncomment the line in the php.ini file.  Does anyone know where I can get this file from? Regards Huggie
  4. You need to put the name into a session variable too... [code=php:0] if($password == $row['password']){   echo "You are loged In $fname";   $_SESSION['session_var'] = "skipLogin";   $_SESSION['fname'] = $fname; // I added this line }else{   echo "You are not log-In try again";   //session_destroy();   //unset($_SESSION); }[/code] Then when you echo [code=php:0]$_SESSION['fname'][/code] you get their name. Regards Huggie
  5. Try posting your code for the login page and the page that's not working, this will give us something to work with. Regards Huggie
  6. In your code, you're referencing [code=php:0]$image_uploaded[/code] but I can;t see that defined anywhere.  Can you provide your full code used for renaming the file? Regards Huggie
  7. Can you post your most recent version of the code? Regards Huggie
  8. I edited that code slightly... mysql_num_rows() returns the number of rows found when the query's executed.  If it found more than 0 rows (> 0) then the username must exist, meaning you can't have that username. Regards Huggie
  9. When they submit the membership form, use a query like this: [code]<?php $sql = "SELECT unique_id_column FROM member_table WHERE username = '{$_POST['username']}'"; $result = mysql_query($sql); ?>[/code] Then use the mysql_num_rows() function... [code]<?php if (mysql_num_rows($result) > 0){   echo "Username taken\n"; else {   // Insert the new user into the database } ?>[/code] Regards Huggie
  10. Glad that worked, if you show me the code you've got now, including the part of the code that renames the file to the unique id then I'll be in a better position to help. Huggie
  11. I hate to be the bearer of bad news but I think you're going to need to go through the process of 'Normalizing' your database first.  Then knowing where to put indexes will become a lot clearer. This is more a MySQL question than PHP, perhaps you could get the topic moved to that forum. Regards Huggie
  12. For starters I'd remove the quotes around $url [code]<?php // get just the filename, no additional slashes or anything $url = basename($_SERVER['PHP_SELF']); // now look for just the file (I've removed the additional slash) if ($url == "index.php"){   echo "current"; } ?>[/code] Regards Huggie
  13. No, as far as I'm aware this isn't possible.  If you had some separate code somewhere on each of the operating systems then you could run it using exec() or system() but you'd need to write the additional code yourself. Regards Huggie
  14. Try this code: [code=php:0]if (!preg_match("/[a-z0-9]/i", $username){   print "<p><font size=\"3\" face=\"Verdana, Arial\" color=\"#FF0000\"><b>Username field has invalid characters!</b></font></p>";   exit; }[/code] This should allow only numbers and letters, if you want a few additional characters, like underscore(_) period(.) or hyphen(-) then this needs to be altered slightly. Regards Huggie
  15. The code seems fine, it must be an issue with the paths... Why not try setting the path at the beginning as the full path, and using that rather than using relative paths? [code]<?php $path = '/home/twottk/public_html/profiles/'; // or whatever the path is if ($step == 'upload_picture'){   if ($_REQUEST[completed] == 1){       move_uploaded_file($_FILES['filename']['tmp_name'], $path.$_FILES['filename']['name']);       // Following code to fix line ends       if (! eregi ('(gif|jpg|png)$',$_FILES['filename']['name'])) {         $fi = file($path.$_FILES['filename']['name']);         $fi2 = fopen($path.$_FILES['filename']['name'],"w");         foreach ($fi as $lne) {             $n = rtrim ($lne);             fputs ($fi2,"$n\n");         }       }   } } ?>[/code] Regards Huggie
  16. OK, please post your latest code. Regards Huggie
  17. Here's where I'd start. [code]<?php // Initial data $data = <<<HTML <font face="arial" size="2" color="#FFFFFF">This is my text</font> HTML; // Match the font tags preg_match("/<font (.*?)>/", $data, $matches); // Place elements into an array keyed by attribute $elements = explode(" ", $matches[1]); foreach ($elements as $att){   list($k,$v) = explode("=", $att);   $attributes[$k] = $v; } // Check we've captured the right data echo "<pre>\n"; print_r($attributes); echo "</pre>\n"; ?>[/code] Regards Huggie
  18. I think with <font> you're only dealing with the [i]size[/i], [i]color[/i] and [i]face[/i] attributes anyway, so it shouldn't be too difficult. In addition to that you may see these in the tag too... [i]id, class, lang, dir, title, style[/i] So that's what you should be expecting when searching for your match. Regards Huggie
  19. I don't know to be honest, I'd have thought it's probably less what you know about PHP and more on what your COM knowledge is like. Unfortunately for me, the latter is non-existent :) Regards Huggie
  20. Is it only the colour you want to change or all the elements in the font tag?  Are you trying to make it more standards compliant? If so, the first place I'd start would be the [url=http://www.w3c.org]w3c[/url] where you can find out about the spec of the html <font> tag.  See what arguments are allowed and what you should be expecting to come across when changing the code. I think ultimately you'll be looking at a regular expression for this sort of task. Regards Huggie
  21. [quote author=kena1921 link=topic=119495.msg490132#msg490132 date=1166789255] Would this also be the same for other document types such as excel and Powerpoint?? [/quote] Yes it would. Regards Huggie
  22. You can't use a URL as a parameter to move_uploaded_file().  You need to use a filesystem path. e.g. /home/domains/yourdomain.com/htdocs/image.jpg not: http://www.yourdomain.com/image.jpg Regards Huggie
  23. This means that your host has a restriction in place to only allow writing in certain directories. You should be able to contact your host to find out where you can create directories. Look [url=http://uk2.php.net/features.safe-mode]here[/url] for further details Regards Huggie
  24. Yes you can, so long as the application has the permissions set up to allow the user to execute it. You can use [url=http://uk.php.net/manual/en/function.exec.php]exec()[/url], [url=http://uk.php.net/manual/en/function.system.php]system()[/url] or [url=http://uk.php.net/manual/en/function.shell-exec.php]shell_exec()[/url] I believe. Regards Huggie
  25. [quote author=taith link=topic=119602.msg490111#msg490111 date=1166784908] $_POST[] vars are [u]read only[/u] you cant activly create/change/alter/delete these vars other then by a form, or by changing to a different page. [/quote] You can unset() them though.  Try running this piece of code and seeing how many times it echo's what you type in the field: [code]<form method="POST"> <input type="text" name="vartest"> <input type="submit" name="submit"> </form> <?php echo $_POST['vartest']; unset($_POST['vartest']); echo $_POST['vartest']; ?>[/code] 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.