wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
Shouldn't make a difference whether you use a password or a text input filed. Both get submitted as plain text. The password input field just hides the characters being typed. This has no affect on how it is submitted.
-
You'll need to loop through the post array in order to see if each item within the post array contains a number. foreach($_POST as $form_field => $user_input) { if(!is_numeric($_POST[$form_field])) { echo 'Form fields must only contain numbers!'; break; } }
-
use htmlentities or htmlspecialchars on the REQUEST_URI server variable. To convert & to &
-
[SOLVED] Records managment with functions
wildteen88 replied to SpireLink's topic in PHP Coding Help
rank.txt only contains two functions, add and remove. In order for list and update to work you must add those functions in. rank.txt calls either add, remove, update or list functions depending on what $_GET['do'] is set to. -
Run either the phpinfo() function or echo phpversion() to see which version of PHP is installed.
-
If you only want to your query to select data from specific columns within a table then don't use * within the Select clause. Instead list the columns you wish to be returned. So if you only want the name and email columns returned from the FBI_Applications table then use the following as the query: $query = "SELECT name, email FROM FBI_Applications WHERE ForumUsername='$ForumUsername'"; Then use $row['name'] and $row['email'] to retrieve the data (after $row = mysql_fetch_assoc($result); line), eg: if(mysql_num_rows($result) == 1) { // match found! // Lets get the data from the returned record set: // In order to get data out of a record set we must use one of the // mysql_fetch_* functions (* standing for row, array or assoc) $row = mysql_fetch_assoc($result); echo '<h1>Login successful!</h1> <h2>Your details:</h2> <b>Name:</b> ' . $row['name'] . '<br /> <b>Email:</b> ' . $row['email']; }
-
Please read this FAQ. You have to enable the mysql extension within the php.ini.
-
Try: <?php $text = 'Original text with newlines! <pre>my text should not have <br />\'s!</pre> Ohh! More'; function restore_pre($text) { $text = str_replace(array("<br />\r\n", "<br />\r", "<br />\n"), "\n", $text); return '<pre>' . htmlentities($text) . '</pre>'; } // add newlines $text = nl2br($text); // restore pre tags to orginal state. $text = preg_replace('/<pre>(.*)<\/pre>/ies', "restore_pre('$1')", $text); echo $text; ?>
-
Not sure then. I have limited experience with IIS. I thought that might of been the problem.
-
Looks like that code is using object chaining. Object chaining can only be used with PHP5. What version of PHP are you running?
-
Your html is fine. The problem is to to do with your php code. Line6 is incorrrect: $ForumUSername=$_GET['ForumUsername']; You are using $_GET to retrieve data submitted from your form. However in your html code for the form you use the POST method for submitting the form. You should change $_GET to $_POST. You use $_GET to retrieve data from the url not $_POST The next problem is line8: $query = ("SELECT * FROM FBI_Applications WHERE $ForumUsername='ForumUsername'"); The problem here is with the WHERE clause. You have your fieldname and value round the wrong way. It should be: $query = "SELECT * FROM FBI_Applications WHERE ForumUsername='$ForumUsername'"; Also no need for the parenthesis '(' and ')'. From then onwards the code is completely incorrect. Code with amendments: <?php $db = mysql_connect("localhost", "*******", "*******"); @mysql_select_db("FBI_Order", $db); // I haved added mysql_real_escape_string to the POST variable below to protect against SQL Injection $ForumUSername = mysql_real_escape_string($_POST['ForumUsername']); $query = "SELECT * FROM FBI_Applications WHERE ForumUsername='$ForumUsername'"; $result = mysql_query($query); // check that a result was returned and that there is only 1 match if(mysql_num_rows($result) == 1) { // match found! // Lets get the data from the returned record set: // In order to get data out of a record set we must use one of the // mysql_fetch_* functions (* standing for row, array or assoc) $row = mysql_fetch_assoc($result); // display data stored in the record set echo '<pre>' . print_r($row, true) . '</pre>'; } // No matches returned else { echo 'Sorry user login invalid'; } // You dont have to specify mysql_close at the end of your scripts. // PHP automatically closes the connection at the end of script execition mysql_close(); ?>
-
The true error message is logged in Apaches error log. There is most probably an error with Apache configuration. Without seeing the actual error message (logged in Apaches error log) wont be able to help you much.
-
Post line 30 - 38 here from savevote.php. Looks like something is not quite right with code.
-
[SOLVED] How to select a certain amount of fields?
wildteen88 replied to SicKn3sS's topic in PHP Coding Help
Use mysql_fetch_assoc in stead of mysql_result eg: $category = TEM; $query = "SELECT * FROM `Hitachi Consumables` WHERE Instrument='$instrument'"; $result = mysql_query($query,$sql); mysql_close(); echo "<p>$instrument</p>\n"; while($row = mysql_fetch_assoc($result)) { foreach($row as $field => $value) { echo '<b>' . $field . ':</b> ' . $value . "<br />\n"; } } -
Yes. It will attempt to change the chmod value of a specified file/folder. Please read the notes carefully for this function in the manual
-
Are you sure you are using the correct table (cf_progress) and that the column time exists within that table? Maybe you misspelt the name for the time column when creating the table. Double check your table/columns names.
-
If you want to see if a file/folder is writeable, readable or executable use is_writeable, is_readable or is_executable
-
These errors usually result in an error with your query. Add an or die statement after mysql query on this line: $rs = mysql_query( $sql ); Change the above line to: $rs = mysql_query( $sql ) or die('Query:<br />' . $sql . '<br /><br />Error:<br />' . mysql_error());
-
Have a read of this post. You must add index.php to the Indexes.
-
Need help with adding <br /> or new line to a variable.
wildteen88 replied to eldorik's topic in PHP Coding Help
Dont use nl2br before when you insert the text into the database. It is best to use it after you insert it into the database. PHP is not stripping the newlines. The problem is to do with the web browser. Browsers ignore whitespace characters. This is why your text is shown on one line. However if you view the source you'll notice the text is formatted the way you had typed into to the textarea. Using nl2br it will convert newlines into an html line break (<br />). -
Or it could be a charset issue I believe.
-
Yes the syntax will be the same regardless of the OS you are running the script from. Just make sure when you use file paths you use relative paths and not full paths. Linux wont understand Windows file paths (C:/www/my/file.php). When using include for instance you're better of doing: include $_SERVER['DOCUMENT_ROOT'] . '/path/to/script.php'; Also you are best of comparing PHP settings against the linux server and the windows server. You'll want to get the Windows servers PHP's settings as close to/the same as the Linux servers settings as possible. You may also want to run the same server software as the linux server. So if the linux server is using Apache, use Apache on windows and not IIS.
-
Probably: <?php $string = '12.56.79.35.93.22'; $num = explode('.', $string); echo 'Number: ' . $string . '<br /> <h1>Names</h1> '; $sql = 'SELECT `name` FROM `dependencies` WHERE `id` IN(' . implode(',', $num) . ')'; $qry = mysql_query($sql); $i = 0; while($row = mysql_fetch_assoc($qry)) { echo $num[$i] . ' - ' . $row['name'] . "<br />\n"; $i++; } ?>
-
You need to escape the quotes (") within your string: echo "<a href=\"payment.php\"><img src=\"images_files/button_upgrade.gif\"></a>";