Jump to content

predator

Members
  • Posts

    58
  • Joined

  • Last visited

    Never

Everything posted by predator

  1. Sorry for not replying until now (been doing uni work). That was the only spelling error i saw. However, there are some grammer and punctuation errors throughout the system so you may want to re-think on how you word some things. Regarsd Mark
  2. well if the session is just checking a value in the div u would do this <div class="<? if($_SESSION['username'] ==1) { echo "class1"; } else { echo "class2"; } ?>">
  3. seen a few spelling errors. Nothing to major but it takes the professional look away from the app. Regards Mark
  4. it would put the same one in because all ur enterin in the database is $transaction you can just make the id field increment automatically when you enter a new row into the database did you no that?
  5. yeah wot adam has put dada will work correctly for you mate
  6. you just need a while check to see if the number generated is a 4 or more bigger than the one generated previously if it is not generate a new number until it is $tot = $newNum - $oldNum; while($tot < 4) { $newNum = rand(1,100); $tot = $newNum - $oldNum; } summin along them lines
  7. where it is echoing does not enter submit check that means it is not seeing the press of the submit button (just check the spelling for the sumbit button name with the name you have there). other than that the code you should have is this for the sessions to work <?php include ('db_connect.php'); if (isset($_POST['submit'])) { if ($_POST['email'] == "" || $_POST['password'] == "") { echo "it enters the missing fields box"; $error = 'Please fill in all fields.'; // here, they have not filled in either the username OR the password. Set an error. } else { echo "it enters the part to show fields are field in(delete me once debugged as the headers will not work other wise)"; // email and password sent from signup form $email=$_POST['email']; $password=$_POST['password']; $sql="SELECT * FROM users WHERE email='$email' and password='$password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $email and $password, table row must be 1 row if($count==1) { // Register $email, $password and redirect to file "user.php" $_SESSION['hasLoggedIn'] = 1; //get the users id that is associated with him $SQL2 = "SELECT * FROM users WHERE email='$email'"; $result2 = mysql_query($SQL); $row = mysql_fetch_assoc($result); //store the id in the session for use $_SESSION['userID'] = $row['id']; session_register("email"); session_register("password"); header("location:user.php"); } } } echo "does not enter the submit check"; ?>
  8. use this code for the no errors not showing then you can see where you are or are not entering the script <?php include ('db_connect.php'); if (isset($_POST['submit'])) { if ($_POST['email'] == "" || $_POST['password'] == "") { echo "it enters the missing fields box"; $error = 'Please fill in all fields.'; // here, they have not filled in either the username OR the password. Set an error. } else { echo "it enters the part to show fields are field in(delete me once debugged as the headers will not work other wise)"; // email and password sent from signup form $email=$_POST['email']; $password=$_POST['password']; $sql="SELECT * FROM users WHERE email='$email' and password='$password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $email and $password, table row must be 1 row if($count==1) { // Register $email, $password and redirect to file "user.php" session_register("email"); session_register("password"); header("location:user.php"); } } } echo "does not enter the submit check"; ?>
  9. right in the login script when u check to see if the users pass and and username match before u redirect them to there CP do $_SESSION['hasLoggedIn'] = 1; then make a new sql statment to do $SQL = SELECT * FROM users where username='username the person used to sign in with' $result = mysql_query($SQL); $row = mysql_fetch_assoc($result); $_SESSION['userID'] = $row['id']; then redirect user then the sessions userID contains there id for the no error showing just put some echos in the different stages to see whether or not it is getting to the areas it needs to get to
  10. ah right thanks hitman learn something new every day hehe
  11. just check it works normally to check if emptys return something with the below code. <?php include ('db_connect.php'); if (isset($_POST['submit'])) { if ($_POST['email'] == "" || $_POST['password'] == "") { $error = 'Please fill in all fields.'; // here, they have not filled in either the username OR the password. Set an error. } else { // email and password sent from signup form $email=$_POST['email']; $password=$_POST['password']; $sql="SELECT * FROM users WHERE email='$email' and password='$password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $email and $password, table row must be 1 row if($count==1){ // Register $email, $password and redirect to file "user.php" session_register("email"); session_register("password"); header("location:user.php"); } } } ?>
  12. in the login script once the have been validated you would declare the session there to = 1 but only validate it when there username and password match and are all ok. what is their id used for from the database? as for the error probs i am havin a butchers at that now for ya mate
  13. also forgot to put this you dont need fputcsv a normal fwrite will do the same job for ya Below is something i used in a past project. Hope it helps $_file = '../CSV/Admin_List.csv'; $_fp = @fopen( $_file, 'w' ); $SQL2 = "SELECT * FROM adminUsers"; $query2 = mysql_query($SQL2); while ($res2 = mysql_fetch_assoc($query2)) { $_csv_data= $res2['title'].','.$res2['name'].','.$res2['surname'].','.$res2['email'].','.$res2['postcode'].','.$comments.','.$res2['lastLogin'] .','.$stat. "\n"; @fwrite( $_fp, $_csv_data ); } @fclose( $_fp );
  14. y do u not want to use append?
  15. it is up to you how you want to run at the end of the day but OOP is becoming a bigger thing so it is better programming practise to get into these days
  16. predator

    Ranks

    yeah u could have another sql statement running allong side that to check for there rank (is probably not the cleanest way to do it but it is the fastest to get working)
  17. like you are not nulling them before you do the checks else where are you so you set it then later down the script u make the var = "" and then you are doing the check. Sometimes simple things can cause big probs.
  18. predator

    Ranks

    well u got a top 10 rank u are pretty much there just use a loop to find the user in the listing whilst u increamment a var that will give them there position (just remember before you show them their ranks do $i+1 or else it will show them one under than what they actually are)
  19. when a user uploads a new image just make it so a new record is added to the db with all the info needed (date uploaded, name of file, etc)
  20. on the login page you could have a session called hasLoggedIn = 1 and then validate that on the pages u want secure for example on the top of each page you would want <? session_start(): if($_SESSION['hasLoggedIn']!=1) { header("Location: login.php"); } ?>
  21. predator

    Ranks

    firstly what are they being ranked on? Then we can assist u
  22. we you will add the images to a database (just the location where they are found and the last date they was looked at) once you have that information it is simple you add a script that runs when you want to run it (really run it through an admin area would be best) The script looks through the records to see if an image has not been looked at for 60 days and you could do a loop through the folders to get the file names then compare them to the records in the database to see if they all match up if they do not delete the file. This is just a rough start and the file deletion could be optimized but i believe you should be able to get the idea from this. Regards Mark
  23. can u list all the code for this action so i can see how you are doing it. Thanks
  24. you are not resetting them else where in the script before you run the actual if statements are you? regards mark
  25. can anyone help me with this problem? I have looked and looked but still i cannot find an answer.
×
×
  • 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.