Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. don't allow the user to link directly to the file in the url?
  2. http://us2.php.net/mb_detect_encoding Also read the user contributed notes for alternatives.
  3. ...as in, you wanted an explanation to be posted directly in the thread, instead of having to follow a link to find out?
  4. not really familiar with that post code format, but is it letters followed by numbers? If so, you can do something like this: // assuming $_GET['post_code'] is for example A or AA etc...? $postal = $_GET['post_code']; if (preg_match('~^[a-z]+$~i',$postal) { $where_clause = "WHERE Usr_Pcode regexp '^" . $postal . "[0-9]+' = 1"; } $query = mysql_query("SELECT id FROM table" . $where_clause);
  5. http://www.phpfreaks.com/tutorial/php-basic-database-handling
  6. okay well you still haven't found/posted the actual tep_redirect function. It will look something like this: function tep_redirect(stuff here) { // code here } But looking at what you most recently posted, you could try the following: in filename.php, in the list of defines, add: define('FILENAME_CONTACT_US_WELCOME', 'welcome.php'); Then in your contact page, change this: if (tep_validate_email($email_address)) { tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address); tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success')); to this: if (tep_validate_email($email_address)) { tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address); tep_redirect(FILENAME_CONTACT_US_WELCOME);
  7. well there isn't a foreach in any of the code examples posted. But anyways, a foreach is actually pretty simple: You have an array and for each value (element) in the array, you execute the code. $array = array('a','b','c'); foreach($array as $value) { // execute code here } So in that loop, $value represents the current element value. So in the first iteration, $value == 'a', 2nd iteration, $value == 'b', etc... if you need to know the element's key, you can do this: $array = array('a','b','c'); foreach($array as $key => $value) { // execute code here } so on first iteration, $key == 0, 2nd iteration, $key == 1, etc... You can read this tutorial for more info about foreach loops (and other loops in general): http://www.phpfreaks.com/tutorial/php-loops
  8. Okay tep_redirect() is not in that file (though it is called several times). So you need to now go to all the files that are included or required in that file and look for it. If its not in any of those files, look in the files that are included in those includes. Backtrack until you find it. I know your overall goal here is to redirect to this welcome.php and I can tell you to change this: tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success')); to this: header("Location: welcome.php"); exit(); But I don't think you really want to do be doing it that way...what you probably need to be doing is finding this tep_redirect() function and finding out what it does as far as redirecting things. Or else looking in some config file somewhere that defines these constants (like FILENAME_CONTACT_US). There may be a place in some config file where you would assign tep_redirect to go welcome.php if you pass this action=success or something.
  9. june, find and post the tep_redirect() function. It's probably in includes/application_top.php
  10. doesn't matter...either strtolower the value being sent or else strtoupper what you are comparing it to. Tom-ay-to Tom-ah-to.
  11. at the very least <?php header("Location: FILENAME_CONTACT_US.action=success"); ?> would be <?php header("Location: " . FILENAME_CONTACT_US . "?action=success"); ?> PHP will not parse constants inside quotes like that. But anyways, I would first look into that tep_redirect function.
  12. You have the following in your code: if (tep_validate_email($email_address)) { tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address); tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success')); I have no idea what those function calls are supposed to do but if I had to take a guess the tep_redirect(..) function is supposed to redirect to some page stored in FILENAME_CONTACT_US constant, probably passing action=success in the parameter. And I'm going to assume that file is supposed to display some thank you message, if action = success. But that's all speculation, as I do not know what is inside tep_redirect().
  13. need more info. When do you want it to redirect? After form submission?
  14. possibly..is the file not a plain text file, stored as for instance encoded in utf-8, binary safe?
  15. Holy crap I learned something new <3 barney: In the script itself, you would use $passedid = $_GET['event_id']; Though I suggest you sanitize it first...
  16. http://www.phpfreaks.com/tutorial/php-basic-database-handling
  17. Okay so maybe I'm being a nub here (haven't really used modrewrite all that much). So you are saying that when you have that rule in .htaccess, on an actual page you can do <a href='somepage.php/1-blah/'>go to blah page!</a> and because of the rewrite rule, I can use $_GET['event_id'], $_GET['event_name'], etc..?
  18. It is not possible for file($file) to only grab one line of the file. file grabs all of the contents of the file, putting each line into an array element (\n) being the delimiter). Even if the \n's were whack, the entire file would still be in there somewhere, even if it's just in the 1st array element. So if print_r(file($file)) is only returning "1 line" the only way that is possible is that the file only contains 1 line. Are you pointing to the right file? File contain what you expect?
  19. barney0o0 is using mod_rewrite. So not sure what you're suggesting Right. He is using mod_rewrite, so that if a user were to go to www.somepage.com/somepage.php?id=1&name=Joe it would be rewritten to www.somepage.com/1-Joe/ well the problem is that now on his pages he wants to make his links be www.somepage.com/1-Joe/ so he's not actually passing params in the url anymore.
  20. It sounds like your browser is doing that to prevent the new file you are downloading from overwriting an already existing one in the target location (downloads folder or wherever your default download location is). You can change your own browser settings but you can't code it to not do that in browsers in general. Only way to prevent it is to have it create a unique zip file name every time (like, based on timestamp or something).
  21. Okay so the short answer is you can't. Not without passing them in the url as before. You can make the buttons into form submit buttons, with hidden fields passing, but that no longer really makes them links. Alternatively you could parse the new url for the info, since the new link is unique and contains the id, name, etc.. right?
  22. null values would not cause that problem. Your script is only grabbing and using the first element (element 0) from the explode, so that doesn't matter. did print_r(file($file)); not print out the whole file?
  23. btw ignace, we have a shortcut to php functions. You can do [m]functionname[/m]
  24. no point in using range, as you will have to loop through to display it anyways. echo "<select name='year'>"; for ($x = 1900;$x<=2009; $x++) { echo "<option value='$x'>$x</option>"; } echo "</select>";
×
×
  • 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.