wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
Change these lines: if($_GET["dir"] == "" || !is_dir($_GET["dir"])) $dir = getcwd(); else $dir = $_GET["dir"]; // replace backslashes, not necessary, but better to look at $dir = str_replace("\\", "/", $dir); to: if(isset($_GET['dir'])) { $_GET['dir'] = str_replace("\\", "/", $_GET['dir']); if(preg_match("#(./|\.\./)#", $_GET['dir'], $matches) || empty($_GET['dir'])) { $dir = getcwd(); } elseif(!empty($_GET['dir']) && !is_dir($_GET['dir'])) { $dir = getcwd(); } else { $dir = $_GET['dir']; } }
-
PHP developed on IIS, run on Apache?
wildteen88 replied to RobertSubnet's topic in PHP Installation and Configuration
Apache is not OS specific, Apache can run on Windows, Mac and Linux. If you install Apache on windows you can then test to see if your site works with Apache. It should run with no problems on Linux even though you coded it on Windows. -
how do u upload php on a free hosting site?
wildteen88 replied to ikester110's topic in PHP Coding Help
to upload files to any host you can either use an FTPClient or you can do it via your website's control panel - if your host provides this facility. How come you want free host? -
Check your sites error log. Your host may not allow for AddType within .htaccess files.
-
In name.php you are retrieving a cookie called user but you set a cookie called UserName
-
Try the following <?php include 'admean/db_connect.php'; include 'admean/pagina/my_pagina_class.php'; $letter = ''; if (isset($_GET['sort'])) { if($_GET['sort'] != '') { $letter = "WHERE substring(brand_name,1,1) = '" . $_GET['sort'] . "'"; } } $test = new JHpage; $test->sql = "SELECT * FROM engsoon_brands ".$letter.""; //$test->sql = "SELECT * FROM engsoon_brands ORDER BY ".$sort1 ." ".$sort3." ".$sort2." "; // the (basic) sql statement (use the SQL whatever you like) $result = $test->get_page_result(); // result set $num_rows = $test->get_page_num_rows(); // number of records in result set $nav_links = $test->navigation(" | ", "currentStyle"); // the navigation links (define a CSS class selector for the current link) $nav_info = $test->page_info(); // information about the number of records on page ("to" is the text between the number) $simple_nav_links = $test->back_forward_link(true); // the navigation with only the back and forward links, use true to use images $total_recs = $test->get_total_rows(); // the total number of records ?> <table width="500" border="0" cellspacing="4" cellpadding="0"> <tr> <td><span class="h2">Our Brands</span></td> </tr> <tr> <td>view brands by alphabetical order </td> </tr> <tr> <td>total record found:<?php echo " " .$total_recs; ?> </td> </tr> <tr> <td><a href="brands.php?id=2&sort=">All</a> <a href="brands.php?id=2&sort=A">A</a> <a href="brands.php?id=2&sort=B">B</a> <a href="brands.php?id=2&sort=C">C</a> <a href="brands.php?id=2&sort=D">D</a> <a href="brands.php?id=2&sort=E">E</a> <a href="brands.php?id=2&sort=F">F</a> <a href="brands.php?id=2&sort=G">G</a> <a href="brands.php?id=2&sort=H">H</a> <a href="brands.php?id=2&sort=I">I</a> <a href="brands.php?id=2&sort=J">J</a> <a href="brands.php?id=2&sort=K">K</a> <a href="brands.php?id=2&sort=L">L</a> <a href="brands.php?id=2&sort=M">M</a> <a href="brands.php?id=2&sort=N">N</a> <a href="brands.php?id=2&sort=O">O</a> <a href="brands.php?id=2&sort=P">P</a> <a href="brands.php?id=2&sort=Q">Q</a> <a href="brands.php?id=2&sort=R">R</a> <a href="brands.php?id=2&sort=S">S</a> <a href="brands.php?id=2&sort=T">T</a> <a href="brands.php?id=2&sort=U">U</a> <a href="brands.php?id=2&sort=V">V</a> <a href="brands.php?id=2&sort=W">W</a> <a href="brands.php?id=2&sort=X">X</a> <a href="brands.php?id=2&sort=Y">Y</a> <a href="brands.php?id=2&sort=Z">Z</a></td> </tr> <tr> <td> <?php echo "<table width=\"500\" border=\"0\" cellspacing=\"3\" cellpadding=\"0\">\n"; $columns = 5; //change the number of column $cur_col = 1; // current column counter while($row = mysql_fetch_assoc($result)) { $brand_logo = $row['brand_logo']; $big = $row['bid']; $tbl_cols = <<<EOF echo "<td><a href="brands.php?id=1&bid=$bid"><img src="../engsoon/images/brandlogo/$brand_logo" width="70" height="70"></a></td>; EOF; if($cur_col == 1) { echo "<tr>\n" . $tbl_cols . "\n"; // add table row for new column } elseif($cur_col < $columns) { echo $tbl_cols . "\n"; // add in a column } elseif($cur_col == $columns) { echo $tbl_cols . "</tr>\n"; // close table row $cur_col = 0; // reset current column count } $cur_col++; // increase curent column couunt by 1 } echo "</table>\n"; ?> </td> </tr> <tr> <td align="right"> <?php echo "<span>".$nav_links."</span>";?> </td> </tr> </table> </body> </html> It is untested.
-
If you're using Danil0's code then change this line: echo parse_bbcode($text); to this: echo parse_bbcode(htmlentities($text));
-
How do you mean? If you want to insert a new row and add data to a couple of the columns you can use INSERT along with listing the columns you want to add data to, eg: INSERT INTO tbl_name (`col1`, `col2`) VALUES ('col1_value', 'col2_value'); or if you want to add/update data to a column within an existing row you'd use UPDATE, eg: UPDATE tbl_name SET `col_name` = 'some_value' WHERE column_id = 'some_column_id_value'
-
There is probably a problem with your script as I get no cookies set when I fill in your form and submit it even though my browser does except cookies. Post the the code here that sets the cookie and how you retrieve the cookie. Make sure when you set the cookie there is now output before you use setcookie function. To retrieve a cookie you must use $_COOKIE['cookie_name_here'] variable.
-
[SOLVED] xampp help for mysql - anyone know xampp well?
wildteen88 replied to FB's topic in MySQL Help
You need to open the Windows Command Line (Start > Run > Type in cmd and then press OK. You should get a small black screen that reads out this: <Windows Version Here> <Copyright Information> C:\Documents and Settings\[YOUR_WINDOWS_USERNAME]> _ Now type in the following command: cd C:\Program Files\XAMPP\mysql\bin and press enter. NOTE: Change Change C:\Program Files\XAMPP to the path in which you installed XAMPP to, if you installed XAMPP in a different location than the default install path. You should now get a line that reads: C:\Program Files\XAMPP\mysql\bin> _ This now means you are in the bin folder for mysql. Now type in the following command: mysql -u root Press Enter. This will log you in as the default root user. root is a default user that is setup when MySQL is installed. If you have setup a password for the root user via XAMPP you will havve to run the following command instead to login to MySQL: mysql -u root -p Press enter and then type in your password when prompt followed by enter. You should now be shown a message that starts with Welcome to the MySQL Monitor and the command has changed to: mysql> _ You are now logged into the MySQL Server and you can now run you mysql queries. To logout of MySQL just type exit; and you'll be returned back to the Windows Command Line -
<?php $ranks = array( 1 => 'user', 2 => 'staff', 3 => 'moderator', 4 => 'admin' ); echo "<select name=\"rank\">\n"; foreach($ranks as $k => $rank) { // change $userlevel to the variable that holds the user level id (1, 2, 3 or 4) $selected = ($userlevel == $k) ? ' selected="selected"' : ''; echo ' <option value="' . $k . '"' . $selected . '>' . ucfirst($rank). "</option>\n"; } echo "</select>"; ?>
-
Your site shouldn't crash as such. The two records should be inserted into the database with no problems. For your second question the user could of double clicked the submit button twice which reset what was posted or when the form was submit they refreshed the page which again resubmitted the form. Or there could be a problem within your code.
-
Use strtotime with "+30 days" as its value to get the timestamp in 30days in the future and then use the date to convert the timestamp into a human readable date: $expire = date("d M Y H:i:s", strtotime("+30 Days")); echo '<b>Today: </b>' . date("d M Y H:i:s"); echo '<br /><br />'; echo '<b>Expire: </b>' . $expire; EDIT: Beaten to
-
A good site to go to is php-mysql-tutorial.com or have a read through some of the PHP and MySQL articles over at sitepoint.com. Going throigh the first four chapters of this book is a good start too.
-
nl2br is a function which converts newlines into a HTML line break (<br>. You will need to use this function when you go to display the data stored in your database. Web browsers (eg, Internet Explorer, Firefox etc) ignore newlines this why when you type something like this into a textarea: some text with newlines in And then you go to display it the page will appear a bit like this: some textwith newlinesin EDIT: Didn't see you second post.
-
You'd do something like this: <?php // place the code here that defines $status $options = array('active', 'inactive'); echo "<select name=\"status\">\n"; foreach($options as $option) { $selected = ($status == $option) ? ' selected="selected"' : ''; echo ' <option value="' . $option . '"' . $selected . '>' . strtoupper($option). "</option>\n"; } echo "</select>"; ?> That code will automatically have Active or Inactive selected from drop menu depending on the value of $status.
-
Please read this thread.
-
Check your servers error log. All causes for Internal Error messages are written to the servers error log.
-
PHP does not know what HTML is and so wont parse it. It will treat as plain text (a string). HTML is parsed by the web browser.
-
IF the configuration path line is set to C:/WINNT then it is not reading any php.ini configuration file. Only when it is set a full path and has php.ini added onto the end of it, eg: C:/WINNT/php.ini then PHP is reading that php.ini file. I would recommend you to add the php folder to the Windows PATH. PHP should then be able to read the php.ini inside C:\php. For adding the php to the path please This PHP FAQ. Also you should use the full PHP tags syntax (<?php ?>) and not shorthand PHP syntax (<? ?> or <?= ?>)as by default PHP has short tags disabled. Also coding in full PHP tags syntax allows for your code to be more portable.
-
They are there but the web browser will ignore them. You will want to use the nl2br function to convert new lines into HTML line breaks (<br>).
-
Help understanding why I'm having a variable error.
wildteen88 replied to horseatingweeds's topic in PHP Coding Help
Teng84's suggestion is right for changing this line: if ($_POST['submit']) to this: if (isset($_POST['submit'])) That will get rid of the notice message. it is not to do with the response variable. When your script runs and you haven't submitted the form yet, PHP will check to see if the $_POST['submit'] variables holds a non-false value, eg TRUE, a string, a number etc. It wont check to make sure that the variable exists yet. When it goes to check that variables value it wont be able to as it doesn't exist and this PHP reports back saying xyz is Underfined. Using Teng84's suggestion now makes PHP check whether the variable exists using isset. isset checks for variable existence. -
NO. PM Has been sent Thread locked.
-
Do you only get that error message when run a query with CREATE DATABASE. If that's the case then the ppl user doesn't have sufficient privileges for creating databases and tables and thus you are getting that error message. There is nothing you can do within your code to change your privileges or to override this. You will have to login to mysql using root (or any other user that has sufficient privileges to change another user's privileges) to grant CREATE Privileges for the ppl user.