Jump to content
Larry Ullman's Book Forums

Craig-UK

Members
  • Posts

    35
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Craig-UK

  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.
  16. Received my copy today (in UK). I look forward to going through it after work.
  17. If you could post your code we'd gladly try and correct it for you
  18. I have mine on pre-order here in the UK and they still don't know when it will be released. No date as of yet.
  19. It is possible, not that I have tested it. // Send the content information: header('Content-type:application/pdf'); header('Content-Disposition:inline;filename="' . $filename . '"'); $fs = filesize($file); header ("Content-Length:$fs\n"); // Send the file: readfile ($file); exit(); Replace $filename with your filename and $file with the path and filename to the requested file. Please look at Larry's E-Commerce book/files for more information
  20. It may not be the best way but one way is forwarding yourself to the same page with a success tag if the file uploaded successfully. Like... header ("Location: {$_SERVER['PHP_SELF']}?success=y"); exit(); and in the code have something along the lines of if (isset ($_GET['success']) && ($_GET['success'] == "y")) { echo '<h4>The file has been uploaded!</h4>'; } That way if you click refresh it will just reload the page rather than uploading the file again.
  21. I have not tried this but it's just something that I noticed that could possibly be wrong... echo $q = "SELECT entry_id , title , date_updated , p1 , p2, FROM blog WHERE entry_id = $pid"; You say you entered echo in front of it, so I am ignoring that, but is it possibly the fact that you have a comma after p2?
  22. Have you edited the .htaccess to mod_rewrite? As without doing so your links will not work in the current format.
  23. $q = "SELECT userid, username, email FROM users WHERE (username='$u' AND password=SHA1('$p')) AND active=null"; From the looks of it you need to change "active=null" to "active IS NULL". $q = "SELECT userid, username, email FROM users WHERE (username='$u' AND password=SHA1('$p')) AND active IS NULL";
  24. From what I gather, you are still wanting people to access the PDF files but ONLY if they are logged in? If so I think I have changed the code correctly below
×
×
  • Create New...