wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
larger code on one page, or spread out(bottom of post)
wildteen88 replied to Ninjakreborn's topic in PHP Coding Help
To make it safe you first want to check that satus is not set in POST and GET at the same time. [code=php:0]// check that status is only set in either GET or POST and not both! if(isset($_GET['status']) && isset($_GET['staus'])) { die('Hacking attempt'); } elseif(isset($_GET['status'])) { $status = $_GET['status']; } elseif(isset($_POST['status'])) { $status = $_POST['staus'] } else { $status = 'Defualt value'; }[/code] -
larger code on one page, or spread out(bottom of post)
wildteen88 replied to Ninjakreborn's topic in PHP Coding Help
This is not safe. Basically what your doing is coding in register_gloabls without register_globals being on. You;re pretty much [i]simulating[/i] register_globals being on. Also if you have a say a get and sessions variable with the same name. Then one or the other will overwrite the other. Why do you want to us [i]normal[/i] variables rather than use the superglobals. If you use the superglobals you wont have to worry about your variables being overwritten and your app will be much safer. -
Howto concatenate <select> values and save in a single variable?
wildteen88 replied to daniish's topic in HTML Help
Use this as the html for your drop down menus [code]<select id="dropdown['day']"></select> <select id="dropdown['month']"></select> <select id="dropdown['year']"></select>[/code] Then you can access the day, month and year in a single variable called ($_POSt['dropdown'], which will hold an array of the three drop downs. To access the day you can use $_POST['dropdown']['day'], for the the month you use $_POST['dropdown']['month'] and $_POST['dropdown'][year'] to get the year. When you want to add them into the database, you can use implode function. Eg: [code=php:0]$date = implode("-", $_POST['dropdown'];[/code] What this will do is produce something like this: day-month-year Does that help? -
@redarrow: When you use float there is only two options left or right. There is no center option.
-
Yes its to with hieght: 100% in the #container clause. Either remove it or use min-height: 100; instead.
-
For parse errors and mysql errors. You'll want enable the display_errors (display_errors = On) directive and make sure error_reporting is set to E_ALL in the php.ini For your upload script. Check your servers error logs for any clues. Make sure where the file is being uploaded to has the correct the permissions if your dedicated server is unix based.
-
If you want the image to be a link then wrap an anchor tag around it like you have done with the your text links: [code=php:0]$display .= '<li><a href="YOUR_URL_HERE"><img src="images/navigation.gif" border="0" /></a></li>';[/code]
-
For symtopm 2 it sounds like you are browsing the file via Windows Explorer (double clicking the file to view it in IE) rather than going to http://localhost/ to view the file. This is the default behaviour of IE6 SP2 when you view html files with javascript when you view them locally. For your first symtom it appears you have not configured Apache correctly. Make sure you have added PHP as an Apache Module or as CGI and that you restarted the Apache server when you have made any changes to any configuration files (httpd.conf, php.ini). NOTE: Currently PHP is not compatible with Apache2.2.x, unless you have PHP5.2 or are using third party dll files. I'd suggest you downgrade Apache to Apache2.0.x instead.
-
The problem is to do with the the main div (#main). As it has a float its no longer part of the same scope as the container div (#container). WHat you'll want to do is clear the float from #main, by adding the following: [code]<div style="clear:both;"></div>[/code] [b]After[/b] (not before) the closing div tag for the main div (#main).
-
Check that your MySQL host accepts external connections to the mysql database. Also make sure you're using correct IP address/port number too.
-
Could you provide a link/screenshot so I can see what you mean. A Link will be prefered then I can see your html/css
-
why can't i reply on the Javascripts help forum
wildteen88 replied to daniish's topic in PHPFreaks.com Website Feedback
Add spaces around the word script if you have a scrtipt tag eg: [code]< script > blah </ script >[/code] SOkmething in your post is triggering our IPS and thus you get the document contains no data. -
Use output buffering in that case Add [code=php:0]ob_start();[/code] after the opening php tag (<?php) and [code=php:0]ob_end_flush();[/code] before the closing php tag (?>)
-
This: [code=php:0]mkdir("test/", $dir);[/code] Is supposed to be: [code=php:0]mkdir("test/". $dir);[/code]
-
Now just create a html form with a textfield called dir and submit the form to itself: [code]<?php if(isset($_POST['action']) && $_POST['action'] == "Create Directory") { $dir = $_POST['dir']; // directory name from form mkdir("test/", $dir); } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> New Directory Name: <input type="text" name="dir"><br /> <input type="submit" name="action" value="Create Directory"> </form>[/code]
-
The error is to do with this: [code=php:0]$password =isset($_POST['mypassword']) ? $_POST['mypassword'] :''; $sql ="SELECT * FROM $tbl_name WHERE staffID='$mystaffID' and password='$mypassword'";[/code] Notice in your query you use a variable called [b]mypassword[/b]. However you save the mypassword POST var ($_POST['mypassword']) in a variable called [b]password[/b] So change the following line: [code=php:0]$password =isset($_POST['mypassword']) ? $_POST['mypassword'] :'';[/code] to the following: [code=php:0]$mypassword =isset($_POST['mypassword']) ? $_POST['mypassword'] :'';[/code]
-
Looks like PHP is finding an old libmysql.dll check that there isnt any other libmysql.dll files in C:\windows\system32 Also when you added php to the Windows Path variable make sure you restarted your computer. PHP can be very fussy sometimes. There is a conflict with the libmysql.dll file somewhere and so you get the error you're getting.
-
Thats cool. Did you add your php folder to the Windows PATH variable? If you didnt then try copying libmysql.dll to C:\WINDOWS Make sure you restart Apache after.
-
Looks like something has been moved/changed as php is unable to initiate the mysql extension when loading up. Wheres is the your php.ini file located to and where is the libmysql.dll file located to? Is PHP using the correct php.ini? You can chekc by running the phpinfo() function and making sure that [b]Configuration File (php.ini) Path[/b] points to the correct location of the php.ini you're edting
-
another login popup page when you click Exit
wildteen88 replied to q1234ask's topic in PHP Installation and Configuration
That is correct behaviour. When you click th exit/logout button it'll show the login page again as you;re not logged in anymore. -
If you want to convert newlines to html line break then use the [url=http://php.net/nl2br]nl2br[/url] function.
-
look into mkdir (php.net/mkdir) for creating directories and copy (php.net/copy) or rename (php.net/rename) for duplicating files.
-
IIS is anothewr webserver. Why on earth would you want two different web servers on the same computer! You can setup IIS and Apache on the same computer if you wish. However you'll have to setup IIS or Apache to use a different port. As by default they both use the same port which is port 80 (port 80 is the standard port for HTTP requests).
-
Ctrl+A will only work on textareas/textfields. When someone posts a code into a post it is not a textarea the submited code is in. Instead it is a div with an overflow, thus making the elusion of it being a textearea when scrollbars are there. Thats why Ctrl+A selects everything on the page. You can do it with javascript. There is a method/function you can use. Seen it been done somewhere before. However I do agree that there is no point in having such a feature.
-
Umm.. little confused. Could you provide a link where you got this from. Prehaps read this [url=http://www.phpfreaks.com/forums/index.php/topic,110211.msg445108.html#msg445108]thread[/url] Explains how to add the php folder to the windows Path. To rename the php.ini-recommended file to php.ini just right click and select rename from the menu. Delete -recommended from the end. To create a php file, just open up notepad and select File > Save As.. the following exactly into the File Name box (including the quotes): [b]"your_file_name_here.php"[/b]