Jump to content
xisto Community

Spectre

Members
  • Content Count

    1,034
  • Joined

  • Last visited

Everything posted by Spectre

  1. Spectre

    Server Time Help

    Hmm, not entirely true. Although UTC has superceded GMT, the term GMT is still commonly used in reference to timezones (ie. GMT+x). Anyway, this error is purely related to the PHP script being used, and has nothing to do with cPanel (I've got no idea where you're headed with that one...) In order to display the difference to GMT, simply call the date() function including 'O' in the format string, which will display the GMT difference in hours. For example: echo 'Timezone: ' . date('O');
  2. Uh, in relation to what? There isn't a single script that is going to be universally applicable to absolutely every possible situation. I would suggest you simply keep a record of how many queries are executed in the pre-processing of your page, and how long it took to execute them. It's not that difficult.
  3. Try this: date("Y-m-d H:i:s", time()+((60*60)*24)); The date() function calculates the current date based on a UNIX timestamp, which is the number of seconds passed in the UNIX epoch (from 00:00:00 01/01/1970). So to add 24 hours, you simply need to add the number of seconds that exist in 24 hours to the current timestamp - which is (60^2)*24 or 86400 seconds - and pass that to the date() function. Hope that makes sense.
  4. It makes no difference whether you use double or single quotes when referencing indexes in an array. In fact, unless you absolutely have to, I would recommend using single quotes wherever possible (and not just when working with arrays, but in all aspects of PHP), as it's processed faster. Anyway, as with most errors in PHP, the actual problem is not on the mentioned line, but prior to that. Take a look at lines 38 to 40: $success_sent_msg='{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">"; } I think you'll find therein lies your error (note the opening quote, but lack of a closing one - I'm also not sure why the squigly braces have been added). I took a quick look at the original script, and the equivalent code was: $success_sent_msg='<p align="center"><strong> </strong></p> <p align="center"><strong>Your message has been successfully sent to us<br> </strong> and we will reply as soon as possible.</p> <p align="center">A copy of your query has been sent to you.</p> <p align="center">Thank you for contacting us.</p>'; Hope that helps.
  5. like, lol...... then we can all play kewl cartoony crap, lol...... i <3 gimiix!!1Anyway (sorry, Razor - I can't help making fun of people who annoy me with their incomprehensible chatter - only a very small amount of offense inteded), the very first Nintendo Entertainment System, the Super NES, the 64 - I loved them all right from the start. But once the game cube came along, it seemed to simply lose it. Maybe I just grew out of it, I don't know. But I have little other than contempt for everything related to the company that emerged post-64 era. I mean seriously - Mario Sunshine? Luigi's Mansion? What the hell? Mario and Luigi were fantastic little Italian plumbers who collected coins which shot out of a green vertically-tilted pipe. At the risk of sounding like an '?ber' geek, the original Mario was something I wasted many an hour on after school in the elementary (and, to a lesser extent, early junior high) years, bouncing on tortoises and headbutting blocks. The new Mario game(s?) seem to, although I haven't played them a great deal, lost that simplistic awesomeness that I'm sure many people of or around my age reflect on with fond memories.And now here come the pro-GameCuber's to yell at me...
  6. Although I'll reserve comments for the site, I couldn't help but notice: Thread title: Signature: The ironing is delicious.
  7. Ugh. Excuse my impatience, but it... gets to me... when the same questions come up time and time again. You can add PHP code to any file with any extension - jpeg, gif, exe, html, php - whatever. But unless the webserver knows to pass the file along to the PHP engine, the code isn't going to be processed, and will simply be sent as output. The AddType handler instructs Apache to treat the specified file extensions as the specified file type (in this case, application/x-httpd-php - ie. give this to the PHP engine). You can also use ForceType in conjunction with the Files directive, and probably a number of other options. <Files script.jpg>ForceType application/x-httpd-php</Files>
  8. Try this. I know I'm not 'Yarrgh', but I'm the next best thing... honest... You may want to consider structuring your code a little better, too (I understand that it may have been structured and good old IPB screwed up the indentation - but if not, structure, structure, structure!) - it makes it infinately easier for others to quickly analyze and modify your code. Also, can you please edit your post and correct the 'code' bbCode tags. <?php //check to see if they are trying to view a certain projectif (isset($_GET["id"])) {$id = $_GET["id"];// Connect to the mysql and select the databasemysql_connect ( "localhost" , "" , "" );mysql_select_db( "projects" );// Get the data from the database$a = mysql_query("SELECT * from PROJECTS WHERE id = '$id'");// Put the info into an array for easy useif( $a ) { $info = @mysql_fetch_array($a);} else { // The script will process this if the query fails. // If you want, put something here - such as an error message.}}else {// Some other code to list the projects}?>
  9. William Jefferson Clinton is Bill Clinton's full name. Don't tell me you've never heard William shortened to Bill... No offense - and I do mean that - but you are an idiot, 'catfish'. I won't even bother arguing with you, other than to point out that software piracy does hurt the company, regardless of how much the original product costs or how much they make. Anyway, there is no disclaimer or warning you can post on your site that is able to override a warrant, court order, subpoena or other formal legal proceeding. So if you are enough of an idiot to think you can get away with hosting illegal files on a webserver somewhere, at least don't make yourself look even more retarded by posting such a notice. Oh, and no, the Internet Privacy Act does not exist.
  10. Adding a string value to HKLM\Software\Microsoft\Windows\CurrentVersion\Run, HKLM\...\RunServices, HKCU\...\Run or HKCU\...\RunServices pointing to the executable file will result in the program automatically launching at startup (depending on the operating system, it can be before or after the shell). There isn't a single API call you can use to access the Windows registry - there are a number of them you will need to use (RegOpenKey/RegOpenKeyA, RegCloseKeyA, RegSetValueExA... and so on). Although not overly difficult, it's too complex to mention here - I would suggest either looking for an example of source code, or searching MSDN.
  11. Maybe I'm right? Maybe? MAYBE? Tables being empty doesn't mean that the query will fail. Tables not existing or explictly specified fields not existing within tables will. If you have error reporting turned off, you will not see any errors - even with the method you mentioned, if you had full error reporting turned on, you would see an error at least once (during the first evaluation of the while() loop's condition). For example: mysql_query('CREATE TABLE test_table (test_field tinyint(1))');$result = mysql_query('SELECT test_field FROM test_table');$data = mysql_fetch_assoc($result); Obviously, the table 'test_table' has only just been created and so is empty, but this will not cause an error - the $data variable will simply be assigned a boolean value of FALSE instead of an associative array.
  12. I'm quite sure there are laws against actively advertising poker sites which play for real stakes. I don't know that for a fact, but I would suggest you look into it.I seem to remember reading somewhere that poker sites often register the same domain name accross different TLDs (eg. pokersite.com and pokersite.net), advertising one as a free place to pay poker online without real money, whilst subtly hinting at the pay-to-play site via domain association, the reason being that it's illegal in the US (and probably other Western countries) to advertise poker and online gambling sites where real money is involved. As I said, though, I don't know, and I'm no lawyer, but I would suggest you look into the legalities surrounding online gambling, or more specifically, online poker.Oh, and also, that may just be advertising in the media; you may be able to advertise online, I don't know.
  13. This error occurs when you attempt to retrieve data from a failed MySQL query. For example, you may have something like: $result = mysql_query('SELECT X FROM Y');$data = mysql_fetch_array($result); If, say, MySQL had failed to connect, the field 'X' didn't exist in the table 'Y', the table 'Y' didn't exist at all, or any of a number of other problems, the query will fail. For this reason, I would recommend you use something like: $result = mysql_query('SELECT X FROM Y');if( $result ) { $data = mysql_fetch_array($result);} If the MySQL query fails, $result will be assigned a value that evaluates to false; therefore, the data will only be retrieved in an array if $result does point to a valid MySQL resource. Hope that makes sense, and helps.
  14. Although, now at least, I don't really like using other people's scripts where I can avoid it, I learnt a lot from Planet Source Code by downloading examples of code and deconstructing it piece by piece. One of the things I like about it is, unlike HotScripts for example, everything is free and open-source (although still subject to copyright where the author states it). One of the things I don't like about it is that anyone is able to post code snippets, meaning a lot of them are fairly low quality (although I understand they have introduced 'moderated' code postings in the past year or so; whether or not they filter out the low-quality junk I don't know).
  15. If there is a posibility that PHP is going to send headers based on the outcome of something yet to be processed, you need to do all processing before any output is sent - ie. above the '<html>'. The second any output is sent, the headers are sent with it, and they can never be recalled and modified. Remember that PHP only deals with what's between the <?php ?> (or <? ?> depending on the configuration) tags, and everything else is ignored and instantly sent as output. <?php// Any processing code needs to go here.?><html><head><title>Untitled Document</title> I think this is about the 8,455,794th thread relating to exactly the same problem started on Xisto.
  16. Hmm, I didn't even pick up on that. Nice spotting. I just assumed the spaces where being added along with the option's text (as I noted, I didn't test anything).
  17. As far as indentation goes, it seems to work fine for me under Opera, FireFox, and Internet Explorer. I hope you don't mind, but I've 'cleaned up' your function slightly. Note that it is quickly written and untested, and sctructured it in the way which I normally write PHP code, which may be a bit annoying for others. Obviously, you're free to simply discard it. <?phpfunction maketree( $rootcatid, $level ) { if( !is_numeric($rootcatid) || !is_numeric($level) ) { return; } $sql = 'SELECT catid, cat_name FROM tbl_name WHERE parentid = ' . $rootcatid . ' ORDER BY cat_name'; $result = @mysql_query($sql); if( !$result || @mysql_num_rows($result) < 1 ) { return; } $level++; while( $sql_data = @mysql_fetch_assoc($result) ){ $db_catid = $sql_data['catid']; $db_catname = $sql_data['cat_name']; $display = ''; for( $i=0;$i<($level*2);$i++ ) { $display .= '?'; } $display .= '<option value="' . $db_catid . '">' . $db_catname . '</option>'; echo "$display\n"; maketree($db_catid,$level); } @mysql_free_result($result);}?>
  18. Hmm, whilst that would work (provided no variables require global usage etc), I wouldn't recommend it. It basically requests the file from the server, which a) consumes bandwidth, is simply a poor coding practice, and c) severly limits the script's functionality and capability.
  19. Using sessions is not always an option. Nor is it always desired. I try to avoid using cookie or session data wherever I can, and only ever do so if there is absolutely no other option.PHP often appends the session ID to URLs where it has no other option for 'remembering' the session owner, meaning a link to, say, '/file.php' may become '/file.php?PHPSESSID=(some 32 byte MD5 hashed string)'. This is not only problematic when someone bookmarks or links to a certain page on your website, inadvertedly including the session ID, but also when search engines attempt to crawl your site. I seem to vaguely remember Google advising against the usage of sessions where possible due to the latter reason.If you need to use data later, I would suggest storing it in a database (even a flatfile will do the trick where no other option is available). Remember that any files include()ed will have access to all variables declared on a global scope (such as $_POST), meaning that if the form submits data to 'page.php', and 'page.php' references 'script.php' via include() or require(), script.php will be able to access and manipulate the data received. If the information is not 'valuable' (for lack fo a better word) enough to store in a database, then you probably don't need to remember it outside of immediate processing anyway.
  20. Provided the function being called does not explicitly send any output (ie. not as an error), prefixing it with an '@' symbol causes any errors to be supressed for that single instance only. For example: echo file_get_contents('non_existant_file'); Will, provided error_reporting is turned on, output an error about how PHP could not find the file specified. However: echo @file_get_contents('non_existant_file'); Will prevent any error from being displayed (even though the error itself does actually occur). Instead of: @ $conn = mysql_pconnect($hostname, $username, $password); Try: $conn = @mysql_pconnect($hostname, $username, $password); Hope that makes sense.
  21. I would suggest simply including (via 'include()') the script from wherever the form is sending its data ('action="page"'), as has more or less already been mentioned.Depending on the method you instruct the form to use - ie. POST or GET - data entered in the form will be stored in either the $_POST or $_GET arrays respectively once it is submitted. So if you were to include() your script from the page that receives the data, the two abovementioned variables would be accessible.
  22. Hmm, this topic is pretty old. But anyway, in response to kvkv... Of course the headers need to be sent prior to any output. The headers inform the client of information required to ensure the client knows what to do with the data, and they must come before the data to which they are related. This is not specific to PHP (or Apache or any other web server), but rather to the hypertext transfer protocol, the protocol you are almost definately using to access webpages (see the specification for version 1.1 - the current standard - for details). For example, let's say there are two files the client requests - 'page.html', a webpage, and 'image.jpg', an image. We can associate both files with their types due to their extensions (and, in this case, their full file names), but a web browser is not going to be able to differentiate one from the other unless the server tells it which is which via the 'Content-Type' header, which would be something like 'text/html' for the webpage and 'image/jpeg' for the image. Although some clients do identify files based on their file extension, that's not the way the HTTP works, and is just one of the reasons header information must accompany every packet of data sent from a HTTP server to the client. Without the header information, the client is not going to know what the data is or what to do with it, as well as other critical information (in which case most clients treat the data as 'text/plain', which is why you will sometimes find the contents images or other binary files are being printed to the screen as text). Anyway, my overdrawn, pointless lecture slash rant is done
  23. Uh, not quite. Running PHP as a CGI is far more problematic than the module version, and opens up a whole new level of security issues. I haven't viewed it for quite a while, but I seem to remember the official PHP installation guide recommending you install PHP as an Apache module if possible for these exact reasons. Anyway... moldboy, although not conventional and very inpractical, it's possible to authenticate users with Basic HTTP Authentication via PHP. I would recommend you write your own simple login system, but as you said you would rather not, the easiest way I can think of 'bypassing' the popup is by redirecting the user to the equivalent of http://www1.domain.com/directory/ if that makes sense. This particular authentication method (along with some others) allows for the username and password to be passed along via the URI, so assuming the username and password were correct, their browser would not display a popup. Basic HTTP Authentication uses session information to 'remember' authenticated users, so it's not really possible to have your script set up authentication and then pass credentials to the user. You could, however, have the script verify the login information prior to redirecting the user, to make sure they will not encounter a popup (which their browser will display if the login information is incorrect).
  24. Er, that's VeriSign Global Registry Services. Typing mistake, sorry.
  25. Whois information can be accessed from whoever the official authority over that particular TLD is. For example, VeriSign Global Registry Servers controls the .COM and .NET top-level domains, so you would access their whois servers to retrieve a whois record for any .COM domain name (such as Xisto.com). Note that whois servers operate on port 43, so you would need to connect, in this example, to whois.verisign-grs.com:43 to retrieve a whois record. After connection, all you need to send to the server is the domain name followed by CR+LF (\r\n or chr(13).chr(10)), and the whois server will return the record if the domain exists (or will inform you if it doesn't). You will need to know a little about socket coding to access a whois records, regarldess of which programming language you wish to do it in. Here is an example of retrieving a whois record. I quickly constructed this while writing this post, and haven't tested it - theoretically, at least, it should work. <?phpfunction whois_record( $domain_name, $whois_server = 'whois.verisign-grs.com' ) { if( !($socket = @fsockopen($whois_server,43) ) { die('Could not connect to whois server.'); } // Note that the '=' symbol means the domain name is explicit, and instructs the whois server to return a result for that domain name only, not for other possible matches (e.g. try 'google.com' without the equals symbol). fputs($socket, "=$domain_name\r\n"); $whois_record = ''; while( !feof($socket) ) { $whois_record .= fgets($socket,1024); } fclose($socket); return $whois_record;}?>
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.