Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Me I use FireFTP for uploading files. Integrates well into FF as its an extension. :) However I have used FileZilla before though.
  2. Its actually to do with how the PHP app was coded. Looks like the developer(s) where being lazy and not putting quotes around the keys when calling an item from an array. For example in your script there most probably variables like this: $some_var[some_key] if you do that then PHP thinks you're wanting to use a constant called some_key. However PHP is smart enough to figure out you mean 'some_key' and thus PHP brings up a Notice error. Quotes should be wrapped around keys. However not many developers do! Unless you know how to code in PHP then there is not much you can do but turn off the display_errors directive. That way no errors/notices will be shown. Ideally you shouldn't have errors shown on a live box.
  3. Also keep in mind $_SERVER['REMOTE_ADDR'] will not get the users true IP address if they being a proxy or if their ISP dishes out dynamic IP Addresses.
  4. One problem I found is you started to use $error[] = 'Your error message here'; then you went to error[] = 'Your error message here'; (note the lack of the dollar sign before error[]) You start to do the above from line 53 and onwards: [code]elseif ($state = "") {   errors[] = "State";   }   elseif ($zip = "") {   errors[] = "Zip/Postal Code";   }   elseif ($country = "") {   errors[] = "Country";   }   elseif ($interested = "") {   errors[] = "Your Teaching Interests";   }   elseif ($bio = "") {   errors[] = "Biography";   }   elseif ($personalinfo = "") {   errors[] = "Personal Information";   }[/code] that's your problem!
  5. By compatibility I meant. If you coded your script with the short_open_tag directive enabled and you used the following tags: <? or <?= Then your scripts will fail to work or fail to function correctly when you run your scripts that had the short_open_tag directive disabled. Which is what your experiencing now when you upgraded form PHP5.1 top PHP5.2 Not all PHP set ups will have the short_open_tag directive enabled. Thats why I said in order to make your scripts compatible you should use the full tags <?php instead of <? and <?php echo instead of <?=
  6. If that is the code in your mysql database then you'll want use eval in order run the PHP code that is stored in your database. for example when you get it out of your database you'll want to do something like this: [code=php:0]eval("$your_var = \"$row['column_name_here']\";");[/code]
  7. When you upgraded you didn't turn the [b]short_open_tag[/b] directive on in the php.ini However I do not recommend you to rely on short tags when coding your scripts, for compatibilities sake. You should use the full tag: <?php or use <?php echo instead of <?=
  8. Its session_start not start_session
  9. I see. In that you'll want to use require_once instead of require
  10. [quote author=loringe link=topic=113806.msg462785#msg462785 date=1162616557] I'm very new to PHP and I'm trying to get simple form to post the data, however I can't get around this "undefined index" error. I would like to understand why? <html> <head></head> <body> <form method="POST" action=""> <input type=text name=my_first value=""> <input type=text name=my_last value=""> <input type=submit value="Submit"> </form> <?php $db_host='localhost'; $db_database='users'; $db_username='tree'; $db_password='school'; $my_first=$_POST['my_first']; $my_last=$_POST['my_last']; mysql_connect($db_host,$db_username,$db_password); mysql_select_db($db_database) or die( "Unable to select database"); $query = "INSERT INTO contacts VALUES ('$my_first','$my_last')"; mysql_query($query); mysql_close(); ?> </body> </html> [/quote] You are always going to retrieve the undefined notice message when you go to hell.php and you haven't submitted the form as no POST data has been sent. What you should of done is add an if statement which checks whether the forum has been submitted. If it has been submitted then you can use the $_POST vars. So your code should ideally look something like the following: [code]<html> <head></head> <body> <form method="POST" action=""> <input type="text" name="my_first" value=""> <input type="text" name="my_last" value=""> <input type="submit" name="submit_btn" value="Submit"> </form> <?php // check that form has been submitted: // we this by checking whether the $_POST['submit_btn'] variable exists // if it does then the form has been submitted // submit_btn is the name of our submit button I // added name="submit_btn" to your HTML above if(isset($_POST['submit_btn'])) {     $db_host = 'localhost';     $db_database = 'users';     $db_username = 'tree';     $db_password = 'school';     $my_first = $_POST['my_first'];     $my_last = $_POST['my_last'];     mysql_connect($db_host,$db_username,$db_password);     mysql_select_db($db_database) or die( "Unable to select database");     $query = "INSERT INTO contacts VALUES ('$my_first','$my_last')";     mysql_query($query);     mysql_close(); } ?> </body> </html>[/code] Now what will happen is when you first go to hell.php PHP will now check whether the $_POST['submit_btn'] variable exists. If it does it'll run the code between [code=php:0]if(isset($_POST['submit_btn'] {[/code] and [code=php:0]}[/code]. If it doesn't then the code wont be run and the undefined index notice will not appear. If you doon't do this every time you go to hell.php and you haven't submitted the form. PHP will always execute the code below the form and report an undefined index notice and add blank values in to your database. Which is obviously not what you want. If it is then it is bad programming.
  11. [quote author=AbydosGater link=topic=113828.msg462859#msg462859 date=1162645551] It just has my db variables and then includes the common.php and in the common.php has..... function dbconnect(){ global $dbhost, $dbuname, $dbpass, $dbname; mysql_connect("$dbhost", "$dbuname", "$dbpass") or die(mysql_error()); mysql_select_db("$dbname") or die(mysql_error()); }; Anyone any idea? [/quote] dbconnect is a nbuiltin function in PHP. You'll want to change the name of your defined function dbconnect to sometyhing like db_connect or dbconn instead. In the following code: [code]function dbconnect(){       global $dbhost, $dbuname, $dbpass, $dbname;   mysql_connect("$dbhost", "$dbuname", "$dbpass") or die(mysql_error());   mysql_select_db("$dbname") or die(mysql_error()); };[/code] You are redefining the dbconnect function which you cannot do.
  12. You will need to configure your web server, in your case IIS, to run on port 8044 instead of 80 (which is the standard port for HTTP Servers to run on). PHP runs through the web server.
  13. Use percentages rather than pixels for widths. Perhaps read up on liquid layouts Not javascript involved just CSS and percentages for widths.
  14. As you are positioning the swf div. Then auto margins will fail to work as the absolute positioning will override it. What you'll want to do is put the swf div inside the header div and remove the absolute positioning. That should fix it. If I understand your problem correctly.
  15. Your PHP setup might have the following setting: [b]arg_separator.output[/b] set to &amp; which will helps to keep XHTML compliance for your website. If you dont want PHP to do this the add the following to the top of you php script: [code=php:0]ini_set("arg_separator.output", "&");[/code] Or add the following to a .htaccess file [code]php_value arg_separator.output "&" [/code]
  16. You can just delete that extra php_mysql.dll file. it most probably a older version
  17. Yes. However use Off rather than 0
  18. Superglobals are all uppercase they are not mixed case. Variables are case sensitive. So $_Get is the not the same as $_GET. PHP will treat $_Get completely different to $_GET So $_Get should be $_GET $_Post should be $_POST $_Request should be $_REQUEST
  19. Yes that is correct you will have to plan your mod_rewrite urls. You cannot expect mod_rewrite to rewrite your links too. Yes mod_rewrite is the only way to create seo friendly URLs for dynamic content sites.
  20. Use <tr></tr> will not create a "space". instead it creates a new row that is 0px tall If you want it to create a "space" you'll want to specify a height and add an empty cell: [code]<tr style="height: 30px"><td>&nsbps;</td></tr>[/code] that create a 30 pixel gap between the row above and below.
  21. The problem is you have some form of output on/near line 6 in br.php which causing the header already sent error message to appear. You cannot have any output, be it html, whitespace characters, text etc before the use of session_start. What is being outputted on line 6 in br.php. Post lines 3 to 9 here from br.php
  22. Or you could use unset $_SESSION['temp'] and it'll remove the whole $_SESSION['temp'] array.
  23. You cannot use ini_set to turn off magic_quotes_gpc magic_quotes_gpc can only be turned off in either of the following: php.ini .htaccess httpd.conf ini_set can only be used to change certain settings values in the php.ini. It cannot change every setting in the php.ini You can only disable magic_quotes_runtime in your PHP scripta using set_magic_quotes_runtime(0). However magic_quotes_runtime is not the same as magic_quotes_gpc. magaic_quotes_gpc escapes quotes in GET/POST/Cookie data. magic_quotes_runtime escapes data from external sources such as databases, text files, functions etc. If you cannot use .htaccess file then you'll need to test for magic_quotes_gpc and if its enabled you'll have to skip the part where you addslashes, or you could use stripslashes and then do whatever you do for example: [code=php:0]function makeSafe($data) {     if(get_magic_quotes_gpc())     {         // magic_quotes_gpc is enabled         $data = stripslashes($data);     }     // now you do whatever you do to escape quotes/make data safe   return $data; }[/code]
  24. This feels like a "you do it for me thread". I recommend you to post this in the correct forum which is the Freelancing forum.
  25. You can not use PHP and MySQL together in a query. You'll need to select everything from your database first and then use mysl_fetch_row and then use the in_array function.
×
×
  • 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.