Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. Winscp just implements scp, but they are indeed related (ssh and scp). Scp is for copying files between hosts, whilst ssh is for getting a remote shell and running commands.
  2. 2 Things: 1. Use the code /code bbcodes around your code. 2. You need to read about and understand the difference between ' and " and how it relates to string variables, interpolation and array elements. Your error was obvious and trivial.
  3. Honestly, I don't even know where to begin. About all I can say is that PHP scripts can access URL params from the $_GET superglobal variable. So if the main page had something like: Discount Coupon for Bob Jones then in coupon.php you can get access to the name variable using: //probably should be in an include -- define your list of OK people, could use to emit the original list $instructors = array(); $instructors['bobjones'] = array('fname' => 'Bob', 'lname' => 'Jones', 'Discount' => '5'}; $instructors['fredsmith'] = array('fname' => 'Fred', 'lname' => 'Smith', 'Discount' => '10'}; //etc. $name = $_GET['name']; if (array_key_exists($name, $instructors) { // Ok found the person echo "Here's your coupon for {$instructors[$name]['fname']} {$instructors[$name]['lname']}. "; echo "Discount {$instructors[$name]['Discount']}%. "; echo "Good until xyz Date."; } else { // Hacking the url? echo 'Sorry, couldn't find a valid coupon.'; }
  4. You need at minimum a couple of adjustments to your style.css for these 2 id's .container #sidebar1 { float: left; width: 80%; margin: 0; padding: 12px 15px; } .container #footer p { clear: both; padding: 0; text-align: center; } To understand why make sure you read up on the css box model.
  5. No surprise that doesn't work -- no place in the script is there a definition for the variable $websitename. Hence it's empty.
  6. Yes, what I'm saying to you is that you should create a function and put it in a file that you require_once() at the top of each of your scripts in the define directory. That function could be called cdefine(), but otherwise will have the same parameters as define. Then you simply search & replace all the calls to define() with cdefine(). The code could be as simple as: function cdefine($key, $value) { if (!defined($key)) define($key, $value); } Another option is to utilize the fact that define() will actually return true or false, so you can use that in an if statement or even trigger_error(). So you could just go ahead and modify all your defines to use something like this instead: define('const', 'value') || trigger_error('constant already defined!', E_USER_NOTICE);
  7. Whether or not your mail will be received is related to your MTA configuration. With the proliferation of spam there are a lot of things you need to do to have your email accepted, not the least of which is having a valid MX record for the server, having a valid reverse dns entry for the mail server, and having an SPF entry. Chances are your hotmail email is either being outright rejected or is being spam filtered within hotmail. Check the mail logs of the server, and the spam folder of the hotmail account you are using for testing.
  8. I do think you should figure out what is happening to your variable. However, in answer to your question, there are a couple of $_SERVER superglobs you might want to look at, like: $_SERVER["SCRIPT_URI"] or $_SERVER["HTTP_HOST"].
  9. $options = array(); foreach($query->result() as $row) { $options[$row->location] = $row->location; }
  10. Did you read the sticky I referenced? http://www.phpfreaks.com/forums/index.php/topic,37442.msg138336.html#msg138336
  11. The assumption I had is that you would create a wrapper function that would take the name and value as a parameter. The wrapper function would check defined() first and only do the define if it was no already defined. Don't get me wrong, I don't think this by any means necessary or a good idea, but it will solve your problem. Your function should probably be called cDefine or myDefine or something like that. Personally, my advice would be to keep all your defines in one include named constant.php or something like that. PHP constants have several gotchas that make them rather inflexible, so I tend not to use them all that much.
  12. Sure. Just so you know, Apache Bench can simulate multiple connections so you can save yourself a lot of time. Here's the command line switches just to give you an idea. [david@penny ~]$ ab ab: wrong number of arguments Usage: ab [options] [http[s]://]hostname[:port]/path Options are: -n requests Number of requests to perform -c concurrency Number of multiple requests to make -t timelimit Seconds to max. wait for responses -p postfile File containing data to POST -T content-type Content-type header for POSTing -v verbosity How much troubleshooting info to print -w Print out results in HTML tables -i Use HEAD instead of GET -x attributes String to insert as table attributes -y attributes String to insert as tr attributes -z attributes String to insert as td or th attributes -C attribute Add cookie, eg. 'Apache=1234. (repeatable) -H attribute Add Arbitrary header line, eg. 'Accept-Encoding: gzip' Inserted after all normal header lines. (repeatable) -A attribute Add Basic WWW Authentication, the attributes are a colon separated username and password. -P attribute Add Basic Proxy Authentication, the attributes are a colon separated username and password. -X proxy:port Proxyserver and port number to use -V Print version number and exit -k Use HTTP KeepAlive feature -d Do not show percentiles served table. -S Do not show confidence estimators and warnings. -g filename Output collected data to gnuplot format file. -e filename Output CSV file with percentages served -h Display usage information (this message) -Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers) -f protocol Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or ALL) For example, I wanted to test a queuing system that had a memory leak, and used this to hammer it: ab -n 10000 -c 100 http://omittedurl/memqtest.php So that sent 10000 requests across one hundred connections.
  13. Egaad man, if I wanted a Bat, I'd go spelunking. Look at the ears on those things.
  14. I do indeed have Puggles -- 2 in fact. I actually enjoy Pugs. We got our Puggles because my son fell in love with a friend's Pug puppy (they have 3),. They are cute, however, they are not the most spritely of dogs, and yes they do snore a lot and have breathing problems. Because the puggles are half beagle, they don't suffer from the same congenital breathing problems as the Pugs do. I like the way Pugs look actually, but I'm also pretty happy with the Puggles, although they get in a lot of trouble, probably thanks to the crazy beagle genes.
  15. You can check for a constant definition using the defined() function.
  16. By default things that are below the webroot can be accessed in "webspace" by providing their relative path. That isn't a PHP function so much as an apache function. The webroot can be thought of as a "changed root" in that, as far as people accessing the website are concerned the path to those documents starts at the "root" ie. "/". Apache hides the details from the outside world in regards to the true path of those documents. So, as noted, in embedded links, you just refer to the path starting from the webroot. However when dealing with include or require_once etc, you need to specify the real path of the scripts, or if you prefer, you can specify an include path, where every directory acts as a php root, and will find scripts that are specified as relative to the path. This allows php to include scripts that are not even in "web space" which may be a security feature you desire, depending on the application. One comment about your use of .txt files. It's always preferable to have your includes be .php files, because these will be parsed by the web server, should someone attempt to access them directly. For example, if I have the file foo.txt in webspace and I access it as http://www.yoursite.com/foo.txt, unless you've taken steps to prevent it, the contents will be returned to the user. A .php version of that file will not suffer from the same issue, since the PHP parser will process the file and return the results.
  17. Cookies are set in the HTTP header, so once the header is sent, you'll get that error. Something is causing your HTTP response to be sent. I think there's a sticky on the top of the forum about this, so I won't go into the reasons or the solution here.
  18. Yes, cookies are available in a superglobal $_COOKIE[]. I'm not clear what your scheme is, but as cookies are name value pairs, whatever cookie you've set can be referenced by checking it's name ie. echo $_COOKIE['foo'];
  19. Ok, well that is certainly doable, but you will need to create your flash application and handle all the security stuff in there. As this is no longer a PHP question per se, I'd have to recommend you look into some actionscript.
  20. That Dog is handsome, can probably run like a true dog, rather than the turtle speed that pugs can muster, and best of all, does not snore at 30 decibels everytime it falls asleep due to it's malformed nasal cavity.
  21. Basically, you simply need to join the replies table to the users table in your query, and you'll have access to the postcount and replycount. Something like this should do it: SELECT r.*, m.postcount, m.replycount FROM Replies r, Members m WHERE r.postid = $postid AND m.username = r.username ORDER BY time ASC
  22. To get straight to the point Puggles > Pugs. Sorry.
  23. No not really. Provide a complete schema for all the tables involved.
  24. The default would be a \ character. If there's no reason not to use that, then go with it.
×
×
  • 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.