jcbones
Staff Alumni-
Posts
2,653 -
Joined
-
Last visited
-
Days Won
8
Everything posted by jcbones
-
You could hit the server with some jquery AJAX to check if there is new messages. This way you aren't reloading the whole script, and you can hit it every x amount of seconds you want.
-
Need help! Error in php coding, help, please?
jcbones replied to swagpixels's topic in PHP Coding Help
You are not assigning your variables correctly. There is a distinct difference between the way the first 4 variables are assigned, vs. the rest of them. Everything you need to know about PHP variables! -
I always set up my paths in my constants. This way if you are changing directories, you only have to change it in one file to affect the whole site. Example: define('PATH',$_SERVER['DOCUMENT_ROOT']); define('SITE','http://' . $_SERVER['SERVER_NAME']);
-
Example: UN-TESTED foreach($tournament as $round => $games) { foreach($games as $game => $teams) { if($teams['s1'] == -1 || $teams['s2'] == -1) { continue; } echo 'Round: ' . $round . '<br />Game: ' . $game . '<br />Teams: ' . $teams['c1'] . ', ' . $teams['c2'] . '<hr />'; } } Your array should be in a variable named $tournament;
-
Need help! Error in php coding, help, please?
jcbones replied to swagpixels's topic in PHP Coding Help
Where is the difference between this line: var $Link_ID = 0; and this one: var $Host; swagpixels.com, Also, note that this is a very old class, and should be dropped for the mysqli extension, or the PDO class. -
You should have a data handling script, that returns a json encoded array. It's the way I would do it. As MVC all interacts together, it would work the same as a regular request, it is just that the request isn't loading a new page. It is just getting the data, and inserting it into an existing page.
-
I would go with 755 unless you are assigning FTP users, then use 775 making sure the FTP user is in the proper group.
-
How to get number of days in a month and also knowing a leap year
jcbones replied to 50r's topic in PHP Coding Help
I would suggest the DateTime Class. -
Disregard that advice, there was nothing wrong with how you had it written. The problem isn't even in that page. It is a parse error, on line 4 of edit2.php, so post the contents of that file... in [ code ] [ /code ] blocks.
-
On second look, I see the problem. Your variable names under /*Gather Data*/ doesn't match your variable names under $body.
-
The problem is the user data submitted by the form, so we need to see what the datesd.php page is getting from the form page. So add this to the top of your datesd.php page. <?php //DEBUGGING echo '<pre>' . print_r($_POST,true) . '</pre>';
-
The repeating code isn't coming from the database. I would look at the plug in, or how the template is called.
-
Am I Completely Missing Something Or Is This Being Awkward For Me
jcbones replied to drewwales's topic in PHP Coding Help
You could use glob, and it will only pull files of a specified type. EX. $path = '../images/services/'; $image = glob($path . '*.jpg'); //only files that end in jpg if(is_array($image)) { foreach ($image as $filename) { echo $filename . '<br />'; } } else { echo 'No jpg images!'; } -
You would have to include the form for us to get that one. I would think it has something to do with the naming of your phone number boxes. I will go a little further and tell you that you have opened yourself up for database injection. You need to look into sanitation and validation.
-
How To Use Php Script To Turn String Into Image
jcbones replied to BradMeyer's topic in PHP Coding Help
Make you two images, one as a check, and another as an x. Then retrieve the results of your minecraft check, as they have made it easy. if the contents return true, then display the check, and if it is false, display the x. <?php if(isset($_GET['username'])) { if(file_get_contents('https://minecraft.net/haspaid.jsp?user=' . $_GET['username']) == 'true') { echo '<img src="check.png">'; } else { echo '<img src="x.png">'; } } -
Here you go: $mail_from=$_POST['customer_mail']; //$header=$_POST['mail_from']; //no good 'mail_from' doesn't exist in the $_POST array, but it does exist as a variable. $header = $mail_from; //good.
-
Cleaner Way To Replace Apostrophoes And Quotes .. ?
jcbones replied to spacepoet's topic in PHP Coding Help
You should store all data as the user has entered it. Then run it through htmlentities (with the ENT_QUOTES flag) before displaying. -
What is your first query. I'm sure you could get a join written for you that would be better, and lead to less confusion, or collision.
-
For ajax, you would send a token that is preset by the server, and checked on page request.
-
Pro's = You get data that you didn't work for. Con's = Most websites ban it in their TOS. The easiest way to do it IMHO is Simple HTML DOM parser.
-
By "machines timezone" do you mean the client, or the server?
-
Your honeypot should NOT have a value, it should be empty, as the spambot may not change values that already exist. You should also be hiding it via a css external file, and not an inline style. As some spambots may read inline styles, but not load external css files. You shouldn't name it 'botcheck' either, as some spambots may look for any type of botchecks. I typically name mine either address2 or email2, leaving the value empty, and steer away from any class definitions that hint at any kind of checks being run on that input. All you have to do scripting wise, is make sure that the honeypot is passed as an empty value.
-
Object Oriented Programming Or Traditional Coding?
jcbones replied to mostafatalebi's topic in PHP Coding Help
I shoulda grabbed a bag of popcorn before reading all these replies! -
You need to find out where $text comes from, it is most likely empty, or a string.