-
Posts
3,145 -
Joined
-
Last visited
-
Days Won
37
Everything posted by cyberRobot
-
To help prevent SQL injection, you should start looking here: http://php.net/manual/en/function.mysql-real-escape-string.php You should also look through some of the other resources available through Google: https://www.google.com/search?q=php+sql+injection
-
With regard to the error, see the notes about session_start() here: http://php.net/session_start
-
Once AddGraph has done it's thing, it could call another method to close the tag.
-
Instead of calling the AddContent method directly, the AddGraph method could perform the call. Side note: some of the basics for creating classes in PHP have changed. For example, "var" is no longer required. More information can be found here: http://php.net/manual/en/language.oop5.php
-
Fill form out based on drop down selection
cyberRobot replied to edgarasm's topic in PHP Coding Help
If you don't want the page to reload, you'll need to use something like JavaScript to populate the fields based on a drop-down selection. If you need to pull information from a database, you could use AJAX to connect with a PHP script. Or you could look into pre-loading the information into JavaScript. What in the form are you trying to auto fill? -
To center content blocks on the screen, you could define the width of those content blocks and then use "auto" for the left/right margins to center the blocks. Here's a quick example: <html> <head> <style type="text/css"> .centerContent { color:#FFFFFF; background-color:#000000; margin:0 auto; width:600px; } </style> </head> <body> <div class="centerContent"> <ul> <li>Item 1</li> <li>Item 2</li> </ul> <p>Paragraph goes here</p> </div><!-- centerContent --> </body> </html>
-
To change your signature on PHPFreaks Click your username (NebuJohn) in the upper-right corner of the website Click My Settings Click Signature
-
Sorry, it's unclear what you're asking. If you're looking to redirect to a different page, try using header redirects: http://php.net/manual/en/function.header.php Just be sure to use the header() function before any output to the screen. If you're looking for something else, please describe the issue a little further. Are you getting errors? If so, what are the exact errors? If you post more code, please surround it with tags. This makes the code and your post easier to read.
-
Redirect or error if the code doesn't exist in code.txt
cyberRobot replied to FocuSoft's topic in PHP Coding Help
The links for both file() and in_array() provide examples. You just need to put the pieces together.- 9 replies
-
- php
- javascript
-
(and 3 more)
Tagged with:
-
Comparing two lists of email addresses with PHP
cyberRobot replied to ionicle's topic in PHP Coding Help
You could try using array_diff() to get the difference. And then adapt the solution provided a few days ago to get unique domains: http://forums.phpfreaks.com/topic/284098-pick-a-random-email-address-out-of-a-maillist/?do=findComment&comment=1459187 -
Comparing two lists of email addresses with PHP
cyberRobot replied to ionicle's topic in PHP Coding Help
Nevermind....I just re-read the question and noticed my solution doesn't quite meet your needs. -
Redirect or error if the code doesn't exist in code.txt
cyberRobot replied to FocuSoft's topic in PHP Coding Help
You could try reading the file into an array with file(): http://www.php.net/file You could then use in_array() to check if the code exists: http://www.php.net/in_array- 9 replies
-
- php
- javascript
-
(and 3 more)
Tagged with:
-
Comparing two lists of email addresses with PHP
cyberRobot replied to ionicle's topic in PHP Coding Help
Does array_diff() return the desired results? If so, you could assign the results back to the variable holding list 1. -
Redirect or error if the code doesn't exist in code.txt
cyberRobot replied to FocuSoft's topic in PHP Coding Help
Or you could just use file_put_contents() and file_get_contents(): http://www.php.net/file_put_contents/ http://www.php.net/file_get_contents/ Did you visit the link? It's used to write to text files.- 9 replies
-
- php
- javascript
-
(and 3 more)
Tagged with:
-
Redirect or error if the code doesn't exist in code.txt
cyberRobot replied to FocuSoft's topic in PHP Coding Help
So are you just wondering how to write something to a text file? If so, check out file_put_contents(): http://us1.php.net/file_put_contents- 9 replies
-
- php
- javascript
-
(and 3 more)
Tagged with:
-
Comparing two lists of email addresses with PHP
cyberRobot replied to ionicle's topic in PHP Coding Help
Have you looked into array_diff(): http://us2.php.net/manual/en/function.array-diff.php -
Have you tried echoing the other variables to see if they contain expected values? As $chachg_time changes, for example, you could add the following to see what it contains: echo '<pre>' . print_r($chachg_time, true) . '</pre>';
-
I want to make a good impression to my client - Need Help!
cyberRobot replied to markjans's topic in Website Critique
Topic moved to the Website Critique forum. -
I think the issue is that you were originally passing 'l' to the date function which gives you a value from "Sunday" through "Saturday". Have you tried "j"? $today = date('j'); That gives you the day of the month 1 to 31.
-
For validating email addresses, you'll want to review the following: http://php.net/manual/en/filter.examples.validation.php
-
@grucker - When posting the code, please surround it with tags. It makes the code and the post easier to read.
-
For that JavaScript line, it looks like you need to escape all the single quotes. Try (function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute(\'data-cfemail\');if(a){s=\'\';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})();
-
FYI, Dreamweaver also indicates that you have an extra comma in the if statement here: if (!filter_var(trim($_POST['email']),, $email1)){ echo 'Email is incorrect'; It also doesn't like this line: (function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute(\'data-cfemail\');if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})(); Perhaps that will narrow things down.
-
You should be able to copy/paste the code blocks, but yeah it can be a lot of work. Bug hunting isn't always fun.
-
Perhaps your server is set to hide errors. In addition to enabling error, try adding a line to display them: error_reporting(E_ALL); ini_set('display_errors', 1); If you still don't see any errors, you could try removing all the code which prevents the page from running. Then slowly add everything back (one block at a time) until the page breaks. That should help you figure out which block of code is causing the error.