Jump to content

Ninjakreborn

Members
  • Posts

    3,922
  • Joined

  • Last visited

Everything posted by Ninjakreborn

  1. It shouldn't really matter. Sessions are more secure in nature than cookies, because the user can alter the cookies on there client system. However if you do it right you should be fine google "php cookies security" Get yourself up to date on the proper way to use them. Also google "Sessions vrs Cookies" to get an in-depth listing of good/bad affects of choosing cookies over sessions or sessions over cookies.
  2. http://www.google.com/search?hl=en&q=community+php+scripts&btnG=Search
  3. Ajax. In order to actually get it to happen you need a .php page somewhere that runs the query. Basically have it when they select something in the drop down menu, it uses javascript (ajax concepts) to get that php page (passing the id to it) then that php retrieves the data and now it's available. From there, just use that data to instantly update the second drop down menu. http://www.google.com/search?hl=en&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=ajax+drop+down+menu&spell=1
  4. http://www.phpclasses.org/browse/package/1532.html I just stumbled across this, and I would probably even use it if I was having some troubles with PHP bb login. Hopefully that will help you come up with something.
  5. Pagination sucks. I have always had problems dealing with it as well. I have my own thing that works but now I need something fancy, I am looking for a pagination class, or I Am going to build one, that's one of the thorns in the side of a programmer, pagination and dealing with dates.
  6. Ok, looking at this link I can tell that there is a certain order to some of the elements. I need to study up on the structure of an sql query, and try to break down hte sections into components so I make sure I know which one's can go into which order, however you helped me remember the reason for my current problem. Thanks again.
  7. I have all the "basics, and imtermediate, and a lot of the advanced" stuff mastered. As far as building using queries, it's just that list of SQL functions always seemed like it would cut off some time on the programming. THe code I showed you were just a few 2 minute example I threw up there to explain what I was trying to say, because I was trying to play around with some of those SQL only functions. However in the end you answered my question anyway, I was aware that those were SQL functions, but I didn't know that mysql didn't support all of them. That is why I have never been able to get those specifically to work. Now that I know this, in the future when working with any database system (postgresql, dbkwik, mysql, or anything) I will make sure I find a list of functions they support so I make sure I don't waste my time with specific SQL related functions that don't work with all database systems. Thanks for the advice.
  8. Thanks for the clarification on that, I will keep that in mind, thanks again.
  9. That was what it was. I had read somewhere that that order by must come after where, but I tried re-finding it to see exactly what it said and never did. Do you have a link that I could book mark, I have re-ran into this related problems multiple times and always forget where I found the description at. I know you probably read that somewhere at one point do you have a link of where I can see that, so I never lose track of that information again, thanks.
  10. Hmm I didn't even think of that, and it'll save space. I am going to officially steal your is_even function and re-use it in further projects, it was a good idea, thanks. In the end I had the problem solved, and there is a standing post here to help anyone get alternating rows in a variety of different way's, thanks again for all the feedback.
  11. I meant mysql_insert_id() however it was very perceptive that you saw that. mysql_insert_id is the one I currently use to normally get the last id. http://www.w3schools.com/sql/sql_functions.asp That is the page I saw a list of "sql functions" and I have been trying to make use of some of them for some time. However every time I try, it's just now there. It just does not work, no matter how I try to setup the query it just doesn't want to use those functions.
  12. I saw what ken did, I have created this just a few minutes before seeing that, and it seems to work all right. Even if I hadn't of figured this out using that other function, then I would of had the answer right here anyway. Thanks for all the advice Now about that is_odd function?
  13. <?php $selecttrans = "SELECT * FROM transactions WHERE userid = '" . $_SESSION['cymember'] . "' AND status <> 'Pending' ORDER BY submitted DESC;"; $querytrans = mysql_query($selecttrans); $color = 1; while ($rowtrans = mysql_fetch_array($querytrans)) { ?> <tr <?php if (is_even($color)) { echo 'bgcolor="#eeeeee"'; }?>> <td>10/30/06</td> <td>cy52860231015</td> <td>Deposit</td> <td> </td> <td>$500.00</td> <td><b>$1,677.65</b></td> </tr> <?php $color++; } ?> Based off that function I did this, and it worked perfectly. Do you have an is_odd function at all that works this well?
  14. Last insert id is one of php's Mysql functions. I am speaking directly of SQL's built in functions that are native to the SQL language itself. These are used inside the queries themselves. Yes last is one of those functions.
  15. Hmm, the formatting will help me format better in tighter situations, however I am faced with the same problem. Looking at the login behind it, it has to be Colored row Non-colored row Colored row Non-colored row all the way down. I am just wondering if there is an easier way without getting down and starting to do calculations to check even and odd numbers and all that other stuff, for something like just alternating row's, because I also have to build a pagination system into this, but it's not a normal one. It's going to have a bunch of features into it, like a select box for the pages, and single page prev-next and jump to the last row, first row. Yes, and I have done this before to get "alternating color cells", however in this situation it has to be the actual rows that alternate in color. I saw some stuff on really advanced calculations and checking for the odd/even number, but I want to keep it even simpler than that if possible. So with all of the code I know I am going to have to add to this, I wanted to keep this specific step, as light as possible.
  16. <?php $selecttrans = "SELECT * FROM transactions WHERE userid = '" . $_SESSION['cymember'] . "' AND status <> 'Pending' ORDER BY submitted DESC;"; $querytrans = mysql_query($selecttrans); $color = "yes"; while ($rowtrans = mysql_fetch_array($querytrans)) { ?> <tr <?php if ($color == "yes") { echo 'bgcolor="#eeeeee"'; }?>> <td>10/30/06</td> <td>cy52860231015</td> <td>Deposit</td> <td> </td> <td>$500.00</td> <td><b>$1,677.65</b></td> </tr> <?php } ?> This is based on PHP. What I am trying to figure out is how to get one row to display background color and the next to not. All the way through the list. Any advice? That is what I have so far, but I can't seemed to get it to just do what I want it to do.
  17. I have been lately trying to do mysql functions. I am just wondering why none of them have not been working, is there something I am doing wrong. I have tried using sum (the total amount of what is in rows) and LAST which is meant to get the last row that was entered, but nothing is working. $lastbills = "SELECT LAST(amount) FROM transactions WHERE type = 'Bill' AND userid = '" . $_SESSION['cymember'] . "' LIMIT 1;"; $lastbillq = mysql_query($lastbills); echo $lastbillsq; This is just one example of me trying to get the last occurence of something. I know queries aren't always the easiest to work with, but some of this stuff would be much simpler if I could get the hang of sql based specific functions that I can use straight in the query. Saving unnecessary time, I just have to learn to use them properly, any advice is greatly appreciated. Thanks.
  18. I have heard that some things need a specific order. $lastbills = "SELECT * FROM transactions ORDER BY submitted DESC WHERE type = 'Bill' AND userid = '" . $_SESSION['cymember'] . "' LIMIT 1;"; For example, what goes first. I need in this 3 query 3 components 1. I need to get the data 2. I need it to order by the submitted field in desc order (which is a unix timestamp) 3. I need to only get it where the type is of the "bill" type, and where the userid is the id of that specific person. 4. I need to limit the number to only 1. In essence, I need to pull out the last transaction that happened that was a bill, and display this amount. This right here returns nothing, any advice.
  19. Hmm, now I understand the way date's and unix timestamps work a lot better. Thanks for the advice.
  20. Ok, so if you put the year 2007. THen it's going to parse the rest of it at 1-01-2007 12:00 P.M. That type of situation. Then again, if you supply the date and day, and month then will will default to a specific time of day for that day. Like 04-07-2007 It's going to try to start off at the very start of that day right, so it's starting time would be 12:00 A.M. on that specific day. Is this correct, because based on what you put, and what kind of results I am getting by "playing" with it, that's what it seems like it's doing.
  21. Perfect, it works perfectly (thanks thorpe that is going to be a wonderful function to re-use, thanks again.) On to some other stuff, I am making all the same post here, because I have hada few questions I have been checking into in my spare time, these were some longstanding problems I was having. Another thing I was wondering about for awhile has to do with strtotime. Or more of unix timestamps themselfs. If someone get's a date and puts it into a unix time stamp like $date = date(); $date = strtotime($date); I understand this, it saves the time, (hours, minutes, seconds, day, date, and year). Very simple to understand this part. However what I do not understand is $date = date("Y"); // this only get's the year 2007 $date = strtotime($date); based on what I notice, the string is ONLY going to contain the year, how does it generate the other stuff (the day, the month, the date, the time, the hours minutes and second, and everything else when ALL you provide it in this situation is the Y format which is 2007 based format. I have always wondered this. Even after you get string to time and have your unix timestamp you can still do anything with that, and access any of the information, can someone explain this specific thing to me, thanks.
  22. Working with pdf's (generating) isn't that hard just use PHP's pdf library. In order to do this, you are going to have to have separate parts of the "pdf" saved as seperate files. (1 file per chapter), preferably save them as an image originally. Then when someone chooses the chapters they want then retrieve all the images of the chapters they are wanting, and formulate them into a working PDF of the chapters they downloaded.
  23. Ok, there is no straight forward way to do this using just sql/php. You have to put some manual work into it. You need a field int he database for the date, or time or some other kind of identifier of exactly "when" the records where entered. Then with that it will be simple just running a query and check for a range of date's, or dates in general. However you want to (no matter how you are setting up the dates) you wnat to save them as unix timestamps, then you can do any types of search with them a lot easier, and a lot more affectively.
  24. Right now, without passing anything to $show it throws out 7541125415 ******5 That.
  25. Ok, I originally tried thorpes, and it didn't work (because it was untested). So I checked each one of the functions to make sure I knew well what they did, and then put this together. <?php // this put's * on all except the ones that are meant to show. // The string si the string you want stripped, show is the total amount you // want showing at the end. function hidestring($string,$show=4) { $length = strlen($string) - $show); $repeat = str_repeat('*', $length); $sub = substr($string, -1, $show); $new = $repeat . $sub; return $new; } ?> Ok, pretty much the same thing just organized where I could understand it all easier. The length, is suppose to be the full length of the variable (whatever that is) minus 4 characters (the 4 that are left, or whatever is passed to show.) The repeat is meant to start repeating the * the right number of times. The sub gets the last 4 characters that were left. Then new takes the repeated * and put's the sub (what's left) at the end. This is outputting nothing though. <?php $accountnumber = mysql_real_escape_string($_POST['acctnum']); echo $accountnumber; echo "<br />"; $accountnumber = hidestring($accountnumber); echo $accountnumber; exit(); ?> That is where I am testing it out at.
×
×
  • 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.