Jump to content

Ninjakreborn

Members
  • Posts

    3,922
  • Joined

  • Last visited

Everything posted by Ninjakreborn

  1. [quote]Warning:  isset() only works with variables as passing anything else will result in a parse error. For checking if constants are set use the defined() function.[/quote] As far as count, I could, but I am wondering is there another function.  I could count what is in the array, and hten say something like if ($arraycount != 0) or something, but I want something simpler, something built in.  That's why I ask, is there a function for array's, that will just simply check if there are values in the array, or if the array is empty? [quote]$a=array(); $a[0]=TRUE; $a[1]=TRUE; if($a[5]) {     //do something } else {     // there is no $a[5]; }[/quote] That wouldn't help either, as it's part of a system I am building.  It is a way to include parameters into something, I have to be able to test if any where entered, if none do something, if not do something else.
  2. What ajax and/or javascript libraries do you use, or did you create your own?
  3. What function can be used in php to check if an array has any values in it If you create an empty array (error for instance) and then register variables into the array as needed, how do you later check to see if the array is empty or has some variables in it.  If it's not empty, I then want to go ahead and display all the errors.
  4. [code]$reg = "([0-9]{2})-([0-9]{2})"; if (!preg_match($reg, $_POST['pastyears'])) { echo "Past Years Formatted Incorrectly, must be 00-00 format.<br />"; $temp = "yes"; }[/code] That returns something like [quote]Warning: preg_match() [function.preg-match]: Unknown modifier '\' in page(path to file)[/quote] Does anyone see what I might be doing wrong?  It worked when I ran that through a tester.
  5. ([0-9]{2})-([0-9]{2})  How is this, it seems to work, could there be problems with it later on?
  6. I am trying to test for 00-00 which is numbernumberdashnumbernumber just like that, it will also always be liek that. I am not having much lukc with the expression, so far I have [00]-[00] THat was my first attempt, then I noticed it failed. so I tried [0-9]-[0-9] That didn't work either. So I modified it like this ^[0-9]-[0-9]$ That didn't seem to work, any advice? I want to just make a regular expression $reg = "pattern here" then if (pregmatch($reg, $variable); However I can't get it to work, are any of these even close?
  7. Yes, a lot of time's there is a reason to put a back button functionality on a site.  Depending.  I have had a lot of clients come to me, and say have a button there that returns to the previous page, or goes back to "this page", or "this page", the javascript won't serve this purpose.  So I did the breadcrumb, and thanks obsidian for that advice, I appreciate it.
  8. Ok, good point.  I am doing the linking manually (breadcrumb) navigation instead.  I am doing that now, it's just the admin panel  on this site (program), I was building has always not been the best at userfriendliness, I was doing what I could to increase it, the breadcrumb navigation came to mind, and I have done it through 30%R of the admin panel, and it's already so much easier to get around.  I might start doing that on all of the site's I build, or maybe only where it's needed.
  9. [code]<a href="/mainadmin/admin.php" title="Return">Home</a>  | <a href="<?php $_SERVER['HTTP_REFERER']; ?>" title="Return">Return</a>  | <a href="/mainadmin/logout.php" title="Logout">Logout</a>[/code] This is what I was attempting to use, to allow me to allow the person to go back to the previous page, to an extent.  However when I use it as an inclusion, it makes it show the link as to that page.  I need it to work, the other way around.
  10. Oh ok.  So he was telling the truth about some of it, thanks. Also thanks for the links.
  11. It's for personal use, but I am releasing my personal programmer assistant, on the side once it's been severely beefed up and changed.  Incase if anyone else want's to use it, if it takes off I might release it as a full open source project.  RIght now it only accepts mysql, because I don't do a lot with other database platforms yet.  When I get more projects on them, then I will start making it more compatible, or will later on, when the time come's. That was a good idea, I will check if they have database turned on, if so run escape string, if not run the other.  Or better yet, have the option to choose whether they want to run the database situation, or the standard (add slashes)
  12. I am not thinking about these or anything, but I wanted to ask. I had a guy when I was traveling on a bus yesterday.  He was around 63.  You know how some people are, they sometimes start talking to random people, I started up a conversation with him.  after talking about 1 hour, I found out a lot.  He was in hte army, new all these fighting styles, made medicine that he said could cure a  lot.  I am not gullible so obviously I didn't trust all that he said, I knew he was in the army, but most everything else was probably fabricated, probably just lying to get attention, or feel better about himself. However we then got on a discussion about programming He told me that he had been doing programming for over 53 years.  I was wondering, if he was telling the truth, I don't think it was quite that long, but he knew quite a bit about what he was talking about.  He sounded dumb when I brought up PHP, or newer languages, so I asked him what he did. He mentioned cobal, fortran, some perl. He said that he did those for along time.  It had seemed he lied about there use, and I wanted to make sure, this is what he said for each Fortran - A medicinal related programming langauge.  Made and used for programming medical machinery, creating medicines, and other like tasks. Cobal - A military related programming languages, that deals with high level military stuff, creating military communications, military structures (with computers), and pretty much everything military related.  Then he said he did genetic engineering on high level medicines, that's when I started not believing him about that. I was wondering if the things he mentioned about these 2 programming langauges were realistic, is that what they are used for, is that there only purposes, or are they just other languages used to do desktop applications, because I NEVER hear really of anyone doing cobal or fortran, I never heard of that before him, except the name from time to time, but never looked into it.
  13. Still looking for some input on this if possible, thanks.
  14. It can never be 100% accurate.  just trap the ip, then you can use it like you wish. how many times different ip's hit one page, every page that ip visit's, seemingly how long they remain on that page Or other things, the only thing you can really identify is the IP, and sometimes it can change.
  15. Ok, if that is the case, you are not making a connection.  What webhost do you have, call them adn see if you are suppose to use "localhost" or if it's different with that host, it's not always localhost, but it is most of the time.  Make sure what it is real quick then double check  your username/password.
  16. I didn't fully undertand your question, rephrase it.
  17. [code] <?php if ($_GET['rownumberprev']) { $rownumber = mysql_real_escape_string($_GET['rownumberprev']); }elseif ($_GET['rownumbernext']) { $rownumber = mysql_real_escape_string($_GET['rownumbernext']); }else { $rownumber = 0; } $limit = 20; // get total amount of rows in database $year = date("Y"); $month = date("n"); $selecttemp = "SELECT * FROM specialimagesystem;"; $querytemp = mysql_query($selecttemp); $total_rows = mysql_num_rows($querytemp); // get current year and date, for use with query $select1 = "SELECT * FROM specialimagesystem LIMIT $rownumber, $limit;"; $query1 = mysql_query($select1); while ($row1 = mysql_fetch_array($query1)) { echo "<div class=\"specialimagesystem\">\n"; $target = "/specialimages/"; $width = "100px"; $height = "100px"; echo "<a href=\"{$target}{$row1[name]}\" class=\"thickbox\" title=\"{$row1[description]}\" rel=\"gallery1\"><img src=\"{$target}{$row1[name]}\" width=\"{$width}\" height=\"{$height}\" alt=\"{$row1[name]}\" /></a>"; echo "<span style=\"float:left;\">"; // starts span for price and id echo $row1['description']; echo "<br />"; if ($row1['price'] != "") { // if price is set, then show it echo "Price: $" . $row1['price']; echo "<br />"; }// either way show the id echo "ID: " . $row1['id']; echo "</span>"; echo "<br /></div>\n"; } ?> </div> <div class="pag"> <?php // pagination script part down here if ($rownumber != 0) { $rownumberprev = $rownumber - $limit; echo "<a href=\"totalinventorypictures.php?rownumberprev={$rownumberprev}\">Previous Page</a>"; echo "<br />"; } if ($rownumber <= ($total_rows - $limit)) { $rownumbernext = $rownumber + $limit; echo "<a href=\"totalinventorypictures.php?rownumbernext={$rownumbernext}\">Next Page</a>"; } ?> </div>[/code] Just a quick example of how I normally do pagination, to give you something to look out too.
  18. [code] <?php $headers = headers_list(); echo '<pre style="text-align: left;">' . print_r($headers, true) . '</pre>'; ?> [/code]
  19. Also array's are something I don't do a whole lot, just recently.
  20. [code]<?php function deepclean2($varinfo) { if (is_array($varinfo)) { foreach ($varinfo as $k=>$v) { $varinfo = strip_tags($v); $varinfo = htmlspecialchars($v, ENT_NOQUOTES); $varinfo = htmlentities($v); if (function_exists('get_magic_quotes_gpc')) {       $varinfo = mysql_real_escape_string($v);   } // end if } // end foreach }else { $varinfo = strip_tags($varinfo); $varinfo = htmlspecialchars($varinfo, ENT_NOQUOTES); $varinfo = htmlentities($varinfo); if (function_exists('get_magic_quotes_gpc')) {       $varinfo = mysql_real_escape_string($varinfo);   } } return $varinfo; // return variable information } ?>[/code] [code]<?php $new = array(1 => "<script", 2 => "Hello", 3 => "What are you doing?", 4 => "<script></script>", 5 => "<p></p>", 6 => "a href"); $new = deepclean2($new); echo $new[2]; ?>[/code] Testing it, that is echoing h just using echo $new is echoing a href It doesn't seem to be working, the reason I asked about mysql_real_escape_string to, is in ym program the database doesn't start off as being on.  So sometimes if someone didn't have the database connected but where just outputting something to the screen, that is my point Or my concern anyway. The reason I call one function and then another, without outputting errors, this is meant to work without giving off any interference, call the function, it cleans the variables. Any other advice on how to make this function better, it was fine, until I started trying to accomodate array's.
  21. There's no way to keep it from coming up in history.  THe browser does that automatically, and you have no control over that (as the developer) Same as in something like microsoft work, it has a history of all recently open file's, only the browsers owner has control over that.
  22. [code] <?php function deepclean($varinfo) { if (is_array($varinfo)) { foreach ($varinfo as $v=>$k) { $varinfo = strip_tags($varinfo); $varinfo = htmlspecialchars($varinfo, ENT_NOQUOTES); $varinfo = htmlentities($varinfo); if (get_magic_quotes_gpc()) {       $varinfo = mysql_real_escape_string($varinfo);   } // end if } // end foreach }else { $varinfo = strip_tags($varinfo); $varinfo = htmlspecialchars($varinfo, ENT_NOQUOTES); $varinfo = htmlentities($varinfo); if (get_magic_quotes_gpc()) {       $varinfo = mysql_real_escape_string($varinfo);   } } return $varinfo; // return variable information } ?>[/code] Ok, a few problems here. 1. I am trying to setup my function to where it use's arrays (or accepts them as well) So If I pass it an array, for instance, I have an entire array $_SESSION['user'] Everything in there is the user information $_SESSION['user']['username'] $_SESSION['user']['password'] $_SESSION['user']['firstname'] $_SESSION['user']['lastname'] I want to be able to pass it $userinfo = deepclean($_SESSION['user']); It should take them all and clean them, and put them in userinfo array, to get like this echo $userinfo['username']; echo $userinfo['password']; echo $userinfo['firstname']; echo $userinfo['lastname']; 2. Since some people may or may not be connected to a database, should I go ahead and use addslashes instead of mysql_real_escape_string for that part.
  23. Then what are you asking help with.  You wanted to stop getting emails of errors, and start databasing them, that is what you said.
  24. Good, congratulations, I am glad you got the problem solved.
  25. There is a missing bracket, it looks like an extra one.  The first part of bracket's matches, teh second don't. See about removing the last bracket, and moving that 1 line of code up into the other pre-existing bracket.
×
×
  • 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.