Jump to content

jvalarta

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jvalarta's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. How about something like: if ($HTTP_REFERER == 'paypal.com/address') {     //update db } I suppose if the referrer address is from paypal, but not always an exact string, you could use strpos() to determine if "paypal.com" is at least in the referring address.
  2. That's a long wish list for not knowing PHP. I would suggest trying to find something off the shelf that you can tweak, maybe from hotscripts.com. I don't think you're going to get anyone here to give you chucks of pre-written code, tailor made to your request. Sorry.
  3. You have to have an if/else statement so that it chooses one of the options as the SELECTED choice. You have a multi-select form field...do you need the query to build based on more than one choice? If so, you're going to need more logic when you build the query string itself.
  4. You do need to tell PHP which variables are to be stored in the session, two ways to do this: session_register('var'); or $_SESSION['var'] (I believe session_register is the old method in which to do this)
  5. Yes, using sessions is a good way to do this. The biggest error made here is not to declare the session. you should have this at the top of every page you wish to use session variables within: session_start();
  6. Use an Array to build your HTML SELECT menu...something like this should do it: [code] <SELECT NAME="PullDownID"> <OPTION VALUE="">Choose... <? $PullDownArray = array ( "1" => "One", "2" => "Two", "3" => "Three") while (list($key, $var) = each($PullDownArray)) { if ($PullDownID == $key) { echo "<OPTION VALUE=\"$key\" SELECTED>$var\n"; } else { echo "<OPTION VALUE=\"$key\">$var\n"; } } ?> </SELECT> [/code]
  7. Yes, use the mktime function to turn the dates into unix timestamps...do the math (subtract one from the other) then use date() and mktime() to format the time difference however you need. http://php.net/mktime http://php.net/date [code] $MyDate = '2006-08-01 10:30:45'; $diff = time() - mktime(substr($MyDate,11,2),substr($MyDate,14,2),substr($MyDate,17,2),substr($MyDate,5,2), substr($MyDate,8,2), substr($MyDate,0,4)); $DaysGoneBy = ($diff/86400); [/code]
  8. Im not sure this is a PHP question -- sounds more like a javascript question...ONCLICK, blah blah blah.
  9. You have to make the page "sticky", meaning, the page has to know what the last query was...by way of remembering the variables. You could do this by simply appending the variables in a GET string to each link (how I often do it) or use hidden HTML fields within a form to store the query variables (then you need a big of javascript for onclicks to execute the form action). Bottom line, you have to rebuild the query in in it's entirety each time the user clicks.
  10. Well, a couple of thoughts: - You are not required to specific MYSQL_ASSOC in the mysql_fetch_array function. If you take it out, you will be able to call variables both ways, i.e. $var and $row[1] - I use the extract function (http://www.php.net/extract) and it works great. Here's a very basic example example: [code] $sql = "SELECT * FROM table"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { extract($row); } [/code]
  11. Add this to the top of your script: [code] <? if(!isset($_SERVER['HTTP_USER_AGENT'])){   exit; } if(!$_SERVER['REQUEST_METHOD'] == "POST"){   exit;    } ?> [/code]
  12. INSERT INTO users (username,password,name,email) VALUES ('$username', '$password','$name','$email')
  13. Adding this to your httpd.conf will prevent files with these extensions from being loaded directly: <Files ~ ".pdf$">   Order allow,deny   Deny from all   Satisfy All </Files> '...drkstr' is also correct, that's a good way to go also.
  14. If you are going to create a number that needs to last for 24 hours for any user who visits, you need to store that number somehwere -- a flat file or a database. You can't use a session, or cookie, as that's a per user variable. The example I gave you would pick a number and store it in a flatfile...then you can very easily just read into a web page. And as for the cron, if you want to automate this, you really need to use a cron to have it kick off whatever process you end up choosing to create the number. I don't know of any other method that you could automate something like this. i suppose to could create a quasi-daemon in PHP by creating a loop and using sleep()...but this is hooky at best. Good luck.
  15. If you are concerned that people could just path to the file, i.e. domain.com/path/to/your/files/file.blah ... then you could just config apache to not allow this (dont allow files with certain extensions to be loaded. Then, you are secure, just use PHP to start the download -- and then you can auth the user to ensure they are legit to be downloading that file.
×
×
  • 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.