Jump to content
Larry Ullman's Book Forums

Craig-UK

Members
  • Content Count

    35
  • Joined

  • Last visited

  • Days Won

    3

Craig-UK last won the day on November 5 2011

Craig-UK had the most liked content!

Community Reputation

8 Neutral

About Craig-UK

  • Rank
    Member
  1. Basically as you have said... Rewrite rule matches the first instance... in this example... www.yourdomain.com/bf/events/26 and www.yourdomain.com/bf/news/26 would both match "RewriteRule ^bf/([A_Za-z0-9]+)/([0-9-]+)$ /bf/index.php?content=$1&event_id=$2" Instead of trying to set 2 ReWriteRule's on this I would think the best way would be in the index.php itself, as there isn't really a way without changing the structure of the rules to get this to work. Make the event_id and article_id as just id. Take the last rule off and simply in the index.php make a if clause, for example: $event_id = ""; $article_id = ""; if ($_GET['content'] == "events") { $event_id = $_GET['id']; } elseif ($_GET['content'] == "news") { $article_id = $_GET['id']; } else { $error = "Some sort of error here"; } Do the obvious checks of whether content and a id exist and whether they are valid etc. Also don't forget to set $event_id and $article_id above so then no error's appear. Hope that helps
  2. I am not sure if it's relevant but I notice the @ is missing in front of "mysqli_query($dbc, $q);" in your function version.
  3. As Jonathan has said. if ($header) { Checks whether "$header" has a valid value (i.e. not FALSE or empty), so "!$header" does the opposite. if (!$header) { Just like above but this time checks whether "$header" is empty or FALSE, if so do between { }. If doing this way theres usually a else clause.
  4. I think that's cause you have ' in the $row... change all the $row['field5'] to $row[field5], that shall hopefully do the trick, same as the other field's
  5. Assuming "$row['field5']" has no value if there's no URL then you could just simple to a "if" clause if (($row['field5'] == "") || ($row['field5'] == "http://")) { // obviously change it to what suits you echo '<td align="left"></td>'; } else { echo '<td align="left"><a href="' . $row['field5'] . '">' . "Link2" . '</a></td>'; } or something similar. I haven't tested the code but you might need {} around {$row['field5']}
  6. The only idea I have for this is a time limit for completing a purchase, so from when they 'add to basket' or 'purchase' they have 10 mins to finish the order, but for as long as they are still adding the 10 mins gets refreshed with each new item added. I have never tried it but I can't see it being too hard, timestamp the basket, each additional purchase updates the time as they are still active on your site. You could give them 5-10 minutes on your site and 10-20mins with the payment processor, so once they have clicked to pay.. you could cancel out the site time-limit and start the payment time-limit. Most payment processors allow you to send additional hidden information, this could be the timestamp once the payment is completed you can cancel the time-limit. If either time-limit is exceeded then the item becomes available again. Or you could simply set a overall 30min time limit to any basket to be completed from first addition. This is only 1 idea and I am sure others will come up with maybe a better solution.
  7. To make this work you don't actually have to create folders. You can trick the URL for it to look like it's accessing a folder using .htaccess RewriteEngine on RewriteBase / RewriteRule ^([A-Za-z0-9]+)/?$ page.php?folder=$1 I think that is all you need, but someone might need to correct it. Simply get that page.php script to read from the database and show the required info. If you do need to create folders then to get the value, save the folder name when creating it by either giving it a value and passing it through the script or giving a session it's value. Although these aren't the best of ways. Hopefully I understood your question correctly as it's quite vague.
  8. May I ask as to why you're querying the password field anyway? Surely if you're doing a login script you should compare their password using the same hash code that you chose in the registration form. Also I think the reason why the last character was taken off when you queried the database is because it added a extra backslash 4th character in maybe theres a size limit exceeded.
  9. Hmm I have duplicated this on my server and it seems to work. I can't work this out myself, I even tried changing the structure to try and break it
  10. Is it the fact that you are quoting the table of which you are trying to get information from? Edit: Hmm scrap that, should work even when quoted. Is there any chance you could screenshot the phpmyadmin of the password row, just to see if any of us can spot something that you possibly missed? Don't include any unrequired but secure information
  11. You're welcome and thanks for letting everyone else know the problems with ShiftEdit IDE. Glad you sorted it out.
  12. Hi, Your first error is if (empty($errors()) { should be if (empty($errors)) { You have also forgot to close the quotations on... $q = "INSERT INTO users (first_name, last_name, email, pass, registration_date) VALUES ('$fn', '$ln', '$e', SHA1('$p'), NOW() ); And finally you have also forgot the semi-colon on this line... echo '<h1>System Error</h1> <p>You could not be registered because of a system error. We are doing everything we can to resolve it<br />Please try again later</p>' Once I corrected those mistakes the script seems to work on my server. If you have any other problems then feel free to let us know
  13. You're right it must have been a filesize problem. I just assumed to upload larger bein's the field says min 200pixels
  14. Hi, I keep trying to upload a profile picture but keep getting the same "Failed to set a new photo" error. I have tried a couples of pictures. 1. 2448 x 3264 jpg file 1,149 KB. This failed so assumed it was too big, so I made it smaller... 2. 612 x 816 jpg file, 111KB. This also fails. I have tried it by clicking on my profile picture and using it that way, also by clicking edit my profile and using the upload profile picture that way. Both seem to fail. Am I the only person havin the problem lately, as I assume those with profile pictures had them up before this new forum update? Thanks
  15. Depending on if you name them the same, you could run a function to see if the file exists. If it does exists then to delete (unlink()) then rename the new uploaded file as the same filename. If the file is named differently then there really is no other way, unless you create a "replace" button next to each pdf or a tick option, then it replaces that using the same unlink() and file upload system. If I was you I'd let the file upload, check existance (if using first option), unlink the old, then rename the new file. That way if the file fails to upload then you don't lose the old one. If you need any further assistance with what I mentioned, feel free to contact me.
×
×
  • Create New...