Wolphie
-
Posts
682 -
Joined
-
Last visited
Never
Posts posted by Wolphie
-
-
If you want to assign variables to each segment of the URI use:
$segments = explode("/", $_SERVER['REQUEST_URI']); list($top_level, $second_level, $third_level) = $segments;
-
Nice BBCode Lemmin
-
You aren't going to get help that way. Read some documentation: http://uk2.php.net/manual/en/reserved.variables.get.php
-
I think you're looking for an offset. Why not just insert the time that the button was clicked into the database, and then check the current time to see if it's been more than 20 minutes since they hit the button. This is the way I would do it, however if people don't refresh the page for 20 minutes then they wouldn't be updated about the status of their army. Unless you had some kind of automated refreshing function. To do this you should either use an HTTP refresh, javascript refresh or use PHP's header() function (not sure if it's possible with header(), I don't see no reason why not).
$offset = 20 * 60; // 20 minutes $old_time = 15 * 60 * 60; // 3pm $time = time(); // current time if(($time - $old_time) < $offset) { // refresh page... }
-
Alright, I've been reading quite a lot about astro physics and physics in general, very interesting stuff! I'm sure a lot of people find it interesting too, at least I hope so!
Well, something has been bugging me, today I've been reading a lot about 4 dimensional objects (specifically tesseracts aka hypercubes etc..), I understand that a tesseract can have an infinite number of rooms, if that was the purpose, I also know all of the dimensions, they assume that time is the 4th (not proven). But they also say that mass is another dimension, however, does a tesseract have a mass? I mean surely, if it had a mass, it would be huge to have an infinite amount of rooms. I know nobody can say for definite because we don't see in 4 dimensions. But I was just wondering if anybody had an opinion or theory.
-
I think you should care, especially with that kind of attitude I hope you don't expect to get help.
-
Excuse me, but I suggest you read the forums description. This forum is for helping people with the code they already have. Not for people to write it for you, if you want people to write it for you check the Freelance forum out. If you want to actually learn something, rather than people giving you everything then I suggest you make the effort to read and attempt it yourself, and then; only then come back with your code, your problem and your objective asking for help. You got the answer to your question.
-
I find it easier to give the submit buttons different names rather than passing them along to PHP as an array. If you passed them as an array you would need to validate each value, thereby giving each submit button a different appearance and having to write more code than necessary, whereas giving the submit buttons different names all of the submit buttons could appear the same (if you wanted them to). But regardless, I still find that giving the submit buttons different names easier.
I think form controls such as checkboxes should be passed as an array because then it saves code, rather than having to assign the POST data to individual variables you could just loop through the array or use array keys.
-
A lot of hosting services have started blocking outgoing email where the FROM header is set to an outside domain. Basically they don't want people to use their servers for phishing.
Understandable, I suppose if I was in their position I wouldn't want it either.
-
^ I've had issues on my server sending emails with the "From" header not corresponding to my domain. But it may work for him...
Odd, did you set the server up yourself? I've often had mail problems because of typos in the configuration files.
-
From what I can make out of you're objective is that you want the user to enter their e-mail address, and you want the e-mail being sent to appear as if it came from the e-mail address they entered? Assuming this is true, you obviously have an input field for them to enter their e-mail address.
From that just do something similar to:
mail("blablabla@gmail.com", "Comment from website", $message, "From:" . $email); // $email being the variable which stores the post data.
-
It sometimes depends on what kind of packages/applications you've installed to set up the server. For example, if you've used a pre-built package they may place it in a different directory. But usually to access phpMyAdmin, just go to http://localhost/phpmyadmin/
It usually has to be accessed using localhost or 127.0.0.1 (which is the same as localhost), for security reasons but you can enable external access.
-
Please mark the topic solved.
-
Also do bear in mind that a lot of shared, re-seller and virtual dedicated hosting plans have prefixes of usually the username which it has been registered with, as Crayon Violent said, however with prefixes, database names you enter tend to get cut off. This has often been my problem in the past, I've known about the database prefixes, however I've sometimes assumed that the whole name I entered would be used which wasn't the case.
On a side note, most web hosting services provide local MySQL servers. And therefore you would need to enter "localhost" for the server address.
e.g.
$con = mysql_connect("localhost", "pcscript", "password123");
-
Put
error_reporting("E_ALL");
at the top of your script and report back with the results.
-
I suggest you read some documentation in understanding a switch statement.
A switch statement is just an alternative to an else if block.
Read here: http://uk2.php.net/manual/en/control-structures.switch.php
-
date("g:ia"); // Example: 10:56am
-
This should be posted in "Third Party Scripts"
-
How are you storing the files and the user information?
-
I assume that this is an upload script. For a progress bar (which tracks the progress e.g. 10%, 20% etc..) you will need to use JavaScript; however, you cannot use PHP and JavaScript alone to track the progress, you will need to use some other language such as perl or python or java because JavaScript cannot access the file system to see how much of the file is uploaded and with PHP the file has to be completely uploaded in order for it to determine the filesize. Alternatively you could use flash.
-
<?php if($con = mysql_connect('server', 'username', 'password')) mysql_select_db('db_name') or die('MySQL Error: ' . mysql_error()); $sql = mysql_query("SELECT * FROM `db_name` . `table_name`", $con) or die('MySQL Error: ' . mysql_error()); if(mysql_num_rows($sql) > 0) { while($row = mysql_fetch_array($sql)) { if($row['field_name'] == 'cat') print 'dog'; } } // Or you can use switch() as zenag suggested. if(mysql_num_rows($sql) > 0) { switch($row['field_name']) { case 'cat': print 'dog'; break; case 'dog': print 'cat'; break; default: print 'cat & dog'; break; } } mysql_close($con); ?>
-
Just out of curiosity, would it be possible to just stripslashes inside the list construct?
list(stripslashes($name)) = $othernames;
-
$content = stripslashes($content); $name = stripslashes($name);
Edit: Dark got there before me.
-
Orio accidentily mis-spelled "comments" xD
Haha. (Sorry it was necessary )
[SOLVED] [PHP] I don't understand this logic.....
in PHP Coding Help
Posted
I agree, silly little mistakes are often the biggest problem with programming. Things like typo's, forgetting semi-colons, forgetting a parenthesis.