Jump to content

Ninjakreborn

Members
  • Posts

    3,922
  • Joined

  • Last visited

Everything posted by Ninjakreborn

  1. yes at this point, I understand almost everything I see with php/mysql, because of the hardships I faced in recent projects, I feel as thought I can do almost anything with php.  My current difficulty is pagination but I am not doing that right now, I will create a new system myself later on down the road when I have time.  The reason I learnt so fast, is I started creating everything I did from scratch.
  2. I know you want it, but it has to do with creating it Paypal instant notification system is what you are looking for, you can find out more at paypal's developer site.  You have to activate it, it's simple, just look at the documentation.  MAKE sure that the page that the payment notification system is going to IS NOT password protected, or carrying sessions, or it'll kill it midway, 6 hours of fighting with this has taught me that lesson, other than that it's pretty straight forward.
  3. I like resetting my database's completely before going live, but I have a question for now.  How do I figure out how to reset the id's on my auto-incremented fields.  I have 1 auto-incremented id field for almost every table, but I like resetting those id's before everything goes live so that start counting back from one, how do I do this using phpmyadmin.
  4. and I apologize for being rude, stuck on a dumb ass under-priced huge project, and I am a little pissed.
  5. [code]if ($X != 1) { // do this } or if ($X != 1) { // do this } else { // do this if it is equal to 1! } // end if/else statement[/code] were do you get simple from, some of the stuff people posted on this, I don't even understand yet, some of this was far from simple.
  6. I don't understand when someone says command line, all I deal with is host based php/mysql programming, I never ran it from a straight server, as for exec, it should work, if not I think system() there about the same, the main thing is though don't feed user input into system it's dangerous.
  7. and if you want sessions, sessions are simple. On a basic level there are only 3 parts to sessions. RULE NUMBER 1- ALWAYS have session_start(); at the very top of the page, BEFORE ANYTHING ELSE and don't keep any output, like echo's or print's too close to it, or it will still give you headers already sent.  That is pretty straightforward, and always have session_start(); on every page you are wanting the sessions to carry over too. RULE NUMBER 2- if you want to create a session it's simple $_SESSION['username'] = $password; That's it, the same way you create a variable, and if you can't create a variable then how the hell can you learn sessions.  Always it's the same thing. RULE NUMBER 3- when you begin getting ready to read those sessions(same as reading an array $_SESSION['username'] that's it or $_SESSION[username] if it's in extrapolation (THIS MEANS- putting a variable inside of the middle of text for instance echo "Hello this {$variable} got extrapolated in this echo statement. The same thing for sessions echo "Hello this {$_SESSION[variable]} got extrapolated in this echo statement."; if you don't understand the basics of what I am talking about now, stop doing sessions, and go back and pick up php for dummies, until you have next to mastered 1. variables and general variable theories 2. arrays 3. control structures examples if, elseif, while, do while, foreach, and whatever else. 4. basic to intermediate string manipulation once you know those THEN you can probably safety attempt sessions.
  8. The bottom line is if you want it fed through a spoon go find another career.  I learnt in 3 months, if I would have learnt SIMPLY I wouldn't have learn for 4 years, you either want to learn it or you don't.  If you do shut up whining, take people's advice and get your ass out there and program.  Books will help< I know this, but understand, too many books will waste your time you ahve to get your ass out there and build applications yourself to be a programmer.  Simpler won't help.
  9. Now for cutting on and off people viewing things it's like [code]if ($_SESSION['controller'] === true) { // show what you want to show }else { echo "You have to be logged in to view this"; }[/code] or you can reverse it to NOT display something WHEN someone is logged in
  10. example You have a register form where they sign up don't forget on the password to put [code]$passhash = md5($password);[/code] or something similar Then when your ready to test, do this. [code]$password = md5($password); // this is going to check the password they typed during login against the hash of the password in the // database, so you know whether it's the same or not, and you still have encryption. $select = "SELECT username, password FROM userinfo WHERE username = '$username' AND password = '$password';": $query = mysql_query($select); if ($row = mysql_fetch_array($query)) { $_SESSION['username'] = $row['username']; $_SESSION['password'] = $row['password']; $_SESSION['controller'] = true; // I use controller to control what they can view/not view when logged in, I remove the login panel and // everything when there logged in, so I get full control with the controller session item. }else { echo "Go to hell you haven't logged in right"; } }[/code]
  11. session_start(); at the top of EVERY page used with sessions. Inside the php.ini [quote]Session] session.save_handler[/quote] should be set to files unless your doing custom handling session name should be set to sessid and left at default unless you know what your doing, use only cookies is safer.  if you change the max lifetime of the session cookie to a specific number of seconds, If you search on google they have a system to calculate second just put like number of seconds in 4 hours or something, it'll auto calculate that for you. My standard is 4 hours, it's fair to the person,a nd they can do what they need to do before it kicks them out, don't forget to hash your passwords. session.cookie_lifetime   = 14400 that will set you to 4 hours, you can double that for 8 hours, not recommended or safe, or you can lower it in quarters to recieve hourly.  25 percent of that is 1 hour, every other 25 percent of that is an extra hour. Or you can auto-calculate them in google as I said.
  12. [code]echo 'Your Password And/Or Username Are Not Correct-Please Try Again <a href="index.php">Here</a>';[/code] also you should give your coding better form. [code] echo "Your Password And/Or Username Are Not Correct-Please Try Again <a href=\"index.php\">Here</a>";[/code] or something similar, you don't try and put strings together or do string manipulation with single quotes, when you get to more advanced code  you will regret that habit.
  13. also you don't call a session variable like that it's $_SESSION['whatever'] = "whatever"; you have your session in all lowercase.
  14. [code]f ($num_1===0) {     echo 'Your Password And/Or Username Are Not Correct-Please Try Again <a href="index.php">Here</a>';     } else { $query_2="SELECT id FROM users WHERE username='$username'"; $result_2=mysql_query($query_2) or die(mysql_error()); $id=mysql_num_rows($result_2); // returns numbers of matches found. echo "$id"; session_start(); $_session['$id']='$username'; }; ?>[/code] why do I see a session start popped in the middle of all that code??
  15. [code]echo 'Hello '.$_SESSION['$id'];[/code] take that out. Pull session_start(); up to the VERY top of the page right after the <?php
  16. That's the thing about php, it's about imaginition, and fun.  As far as speed, it wouldn't make a bit of different either way, the speed factor is just associated mostly with major calculations, or a lot of db calls.  Unless unfortunately your just a shitty programmer, that needs to redo his form.  As people have said before being neat is important too, by what you are currently asking, it wouldn't show things down, I like keeping alot of things, I never have so far used includes for db connections or logins, I use db's for navigational bars and things like that, but I see how it could be useful.  because on the project I am working on right now, if we switched to postgresql you couldn't count the number of database connections I have to rewrite after that, so maybe it's helpful, just do what you think is right, you don't foul either way.
  17. config.inc would be dumb if you have includes do config.inc.php that's all I can say because I haven't gotten into php oop yet.
  18. 1. contact your host and ask them. 2. contact the company of the third party and try there support. 3. The best advice could be to rebuild it yourself 4.  sessions??
  19. most people use pear, it's quicker, cleaner, and funner.  I haven't touched it yet, but of course I intend too.  What is this an advancement onto the pear package?
  20. Or you could just do what php is for and build your own if you find anything. I am saying nothing but i try not to use third parties for anything except occassionally stat statistics when I don't have time to build my own system.  Craigslist could be built within 1 month.  I think you should try and build one, i couldn't help ont hat because I don't know what you mean, but if it can be done with php you can build it.
  21. nevermind I nixed pagination until the site get's bigger, it can just live with whatever number of queries per page.  because of this price on this project, I am only putting int he necessities, and at 100 post's per page, I don't need to worry about it displaying anything, so I will set it up like this for now, and integrate pagination later on.
  22. quick help here, anyone with big guns or big balls. Anyone with pagination experiences. Ideas, hints, tips, and tricks welcome.
  23. [code]<?php $connect = mysql_connect("localhost", "#####", "######"); $select = mysql_select_db("elostand_general"); $directory = split("/", $_SERVER['PHP_SELF']); $category = $directory[1]; $subcategory = $directory[2]; $newarray = explode(".", $subcategory); $subcategory = $newarray[0]; $select = "SELECT * FROM foundpostings WHERE category = '$category' AND subcategory = '$subcategory';"; $query = mysql_query($select); while ($row = mysql_fetch_array($query)) { echo "<a href=\"/view/foundpost/{$row[foundpostid]}\" target=\"_blank\">{$row[generictitle]}</a>"; $test = true; } if ($test != true) { echo "<span class=\"logspan\">"; echo "I apologize but your current search did not yield any results.<br />"; echo "Please try your search again, or nothing came up with this search<br />"; echo "criteria<br />"; echo "</span>"; } ?>[/code] Ok this is the system I set up now, the redirects work, everything populates properly.  I need to ask something now, here is when I need to ask a question. The thing now is the pagination, I may not even need it, I could probably populate 100-200 per set, but eventually the site may get big enough to get bigger than that, but for now, what direction should I gear this to paginate.
  24. header location, for some reason doesn't always have to be at the top, there are a lot of times I use header location to change people over to a page based on them doing something.  I might ahve a bunch of scripts already ran, or running on the page, includes, and calculations, and everythin gelse, then in the middle of the page, have 1 header location based on if they do something wrong, it still seems to work no matter where you put the redirect at.
  25. I can strip this down some in my own application if I run into a road block, until I get my application running thouroughly but I realized just now some of my older scripts have problems(not problems) but I forgot to add in a few features that were asked I am going to try to get those situated right now.
×
×
  • 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.