wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
looking for good article/wiki type of script
wildteen88 replied to mikefrederick's topic in PHP Coding Help
have a look at mediawiki -
Apache 2.2.8 PHP 5.2.5 Installation...
wildteen88 replied to SlyCayer's topic in PHP Installation and Configuration
You don't need copy/move files anywhere. Read the following steps: 1. First of all download the Apache 2.2.8 MSI Installer and the PHP 5.2.5 zip package save these files to your Desktop 2. Run through the Apache installer. When the installer asks you for the Network Domain and Server Name enter localhost in both boxes, you can use any email address (fake or real) for the Admins Email address. Click Ok to the remaining steps 3. After the installer is finished. Apache will be up an running and ready for http requests. To test whether Apache is installed correctly and is running just open your web browser and go to http://localhost/ you should get a It Works message. 4. Now extract the contents of the php-5.2.5-Win32 zip file to C:\PHP. Once the contents of the zip are extracted PHP is installed! Well not quite you'll now need to configure Apache with PHP. 5. Now go to Start > Program Files > Apache HTTP Server 2.2.8 > Configure Apache Server > and right click the menu itemEdit the Apache httpd.conf Configuration File and select Properties In the properties box click the Find Target button. This should open Windows Explorer and open Apaches conf/ folder 6. Open the file called httpd.conf and scroll down the bottom of the file and find this line: # Secure (SSL/TLS) connections Before that line add the following lines: # PHP5 Configuration Include conf/httpd-php5.conf 7. Save and close the httpd.conf 8. Now reopen Apache's conf/ folder and create a new file called httpd-php5.conf and add the following lines to it: LoadModule php5_module "C:/php/php5apache2_2.dll" PHPIniDir "C:/php" AddType application/x-httpd-php .php 9. Apache is now configured. To test if the configuration worked or not you'll need to restart Apache. To do so find the Apache taksbar icon (bottom right hand corner of the screen) and left click it and select Apache2.2 > Restart. 10. Once Apache has restarted now open Apaches htdocs/ folder (path is something like C:/program files/Apache foundation/Apache2/htdocs) and create a folder called phpTest.php and add the following code to it: <?php phpinfo(); ?> Also whilst in the htdocs folder clear any existing files within that folder, they are not required 11. Now to test whether Apache is properly configured. Simply open your browser and go to http://localhost/phpTest.php If Apache is configure correctly you should get a page similar to this If you do Apache is successfully setup with PHP! Now just a few more needed steps. Open C:\php and rename a file called php.ini-recommended to just php.ini Add PHP to the PATH Environment Variable Have fun with PHP! -
Um, not, you are wrong. just SELECTED is necessary. http://htmlhelp.com/reference/html40/forms/option.html That is fine if you're using plain HTML4. However if you're using XHTML then you'll have to use select="select"
-
That script looks like it is for sending spam mail! What is your purpose for the use of that script? If that script uses the standard php mail function then only one line needs to be modified, you'll also be able to find the answer by reading the manual at php.net or by search google.
-
Yes that should work fine. To see if the the $title and $message arrays are populated properly place the following code after the foreach echo '$title <pre>' . print_r($title, true) . '</pre>'; echo '$message <pre>' . print_r($message , true) . '</pre>';
-
To populate an array in a single line you can do: $arr = array('item1', 'item2', 'item3', '... etc ... ' ); to display the contents of an array using print_r echo '<pre>' . print_r($arr, true) . '</pre>';
-
use nl2br Only use nl2br when you go to display the content from the database. i t is not a good idea to apply nl2br when content goes into the database, as you may find the newlines will duplicate each time you edited the text.
-
Its not a function its a core PHP setting within the php.ini
-
You cannot use variables within single quotes,: $form .= 'Username: <input type="text" name="user" value="$fetch['username']"/><br />'; $form .= 'Password: <input type="password" name="pass" value="$fetch['password']"/><br />'; $form .= 'Email: <input type="text" name="email" value="$fetch['email']"/><br />'; You should do: $form .= 'Username: <input type="text" name="user" value="'.$fetch['username'].'"/><br />'; $form .= 'Password: <input type="password" name="pass" value="'.$fetch['password'].'"/><br />'; $form .= 'Email: <input type="text" name="email" value="'.$fetch['email'].'"/><br />';
-
I have no experience of reselling. You will have to request support from your host for setting up your reseller account to control other websites PHP settings which are hosted from your reseller account
-
Can you confirm that php_mysql.dll and php_mysqli.dll are of the same build version. When you go to C:\php5\ext using Windows Explorer the files should be layout out in Tiled view, eg: file1 file2 file3 file4 etc When you look at each individual file you'll see there is three pieces of information shown to the right of the file icon. The first line is the file name (eg, php_mysql.dll) , second line is the build/version number (must be the same as your PHP Version, eg 5.2.5.5) and the third line will be the extension name. Can you verfiy that the secound line for both files (php_mysql.dll and php_mysqli.dll) are the same. All extension must be of the same build/version as the main php executable (php.exe) otherwise they will not load.
-
What? Can you explain more. If your hosting account is a reseller then the sites you host from your account will be on share hosting, which will mean you'll have full control over all the sites you setup on your reseller account.
-
Is the 20 sites on external servers (dedicated hosting) or are they on the same server but using different domains (shared hosting)? if its the latter then find your php.ini and append the full script location path) to the include_path for the script eg: include_path = ".:/path/to/script" #UNIX include_path = ".;C:/path/to/script" # WINDOWS
-
Do not get pulled into that trap, with the following line: Configuration File (php.ini) Path C:\Windows The path that PHP states for that line is the default path in which PHP checks for the php.ini. If PHP was reading a php.ini in C:\Windows it will be like so: Configuration File (php.ini) Path C:\Windows\php.ini Or Configuration File (php.ini) Path C:\Windows\System32\php.ini This where alot of people get confused with where the php.ini is/should be. The line you should concentrate on is the Loaded Configuration File line. If PHP could not find a php.ini anywhere then that line would be set to (none), eg: Loaded Configuration File (none) As that line is set to C:\php5\php.ini then that is location you should find the php.ini to edit.
-
You should start to read up on SQL Injection - parts One, Two and Three.
-
You should never trust user input, you should always validate user input and make it safe for use in a query. Because your are not escaping quotes, any double quotes in the user input will break your query. Change the following codes: $title = $_POST['title']; $infos = $_POST['infos']; $localisation = $_POST['localisation']; $date = $_POST['date']; $time = $_POST['time']; $web = $_POST['web']; to: $title = mysql_real_escape_string($_POST['title']); $infos = mysql_real_escape_string($_POST['infos']); $localisation = mysql_real_escape_string($_POST['localisation']); $date = mysql_real_escape_string($_POST['date']); $time = mysql_real_escape_string($_POST['time']); $web = mysql_real_escape_string($_POST['web']); mysql_real_escape_string will help to prevent SQL Injection attacks, as it escapes dangerous characters from user input that is not safe for use in a query.
-
Make sure you are targeting the iframe with your links, eg: <a href="products.php?catname=cat1" target="your_iframe_name">Cat One</a> <iframe name="your_iframe_name" id="your_iframe_name" ... etc ... />
-
How does that help. @carlco9020: you should be able to do what is called a database dump which will export all data in your database to a textfile, eg your_database.sql. Then on your new host you can then import the database dump file into MySQL and your database structure incuding the data help within the tbales will be restored.
-
If you dont wan to use a list then just use the HTML new line tags (<br />) or paragraph tag (<p></p>) You can always use CSS however to remove the bullet points from the list.
-
Ok I think I know what the problem is. PHP is reading the php.ini which is a good sign, but the extension php_mysqli.dll (or php_mysql.dll) both require an external library called libmysql.dll . This file should be located in the root of your php folder (C:\php5) The problem is the php executable (php.exe) never checks for files in the directory the executable is located in. This is because PHP only checks in key places which are the Registery, C:\Windows (and C:\WINDOWS\System32) and the PATH. What I'd suggest you to do instead is to add PHP to the Path Environment Variable this will be the most effective method. NOTE: If you installed PHP using the PHP Installer then I recommend you to download the zipped binaries package and extract the contents of the zip to C:\php5 overwriting existing files/folders. The Installer version comes with limited files.
-
Rewriting files using mod_rewrite (weird problem)
wildteen88 replied to mjurmann's topic in Apache HTTP Server
Have a read of the snippets of code in the thread here -
Glad I helped. The best way to be a good PHP programmer is to have a thorough understanding of the basics, such as variables, control structures, loops, operators etc. All this can be learnt by reading the easy to follow manual. Without this you'll find it hard to understand the flow/logic of the script. Everytime you come up to a part in the code that you don't understand, especially if its a functions. Just open your browser and go to http://php.net/function_name eg http://php.net/substr will take you to the page that tells you how substr() works and provides simple to follow code examples. I find myself doing this most of the time as I usually forget the parameter order for a specific function. Another thing to do is to get a script, and literally break it and then see if you can fix it on your own, or look at other (basic) scripts and seeing how they work, then go about recoding it in a different way or try to add extra features to it. When I started PHP I remember reading a tutorial at sitepoint.com which taught me how to make a simple Jokes Database, it wasn't advanced or too hard and the tutorial was explained very well throughout. After reading the tutorial I sort of understood what was happening as I had a good understanding of the basics of PHP, this then allowed me to convery it from a jokes database into a very simple forum nothing special but it was an achievement. You cant become a PHP expert in a day/week/month. PHP has a very long learning curve.
-
Can you post your database schema for the udac table Okay added in the neccessary code to insert data into a database: <?php //connect to database display error if connection fails $con = mysql_connect("localhost","root","") or die('Could not connect: ' . mysql_error()); mysql_select_db("udacupload", $con); $lines = file('welcome.txt'); foreach($lines as $line) { // check the line starts with a number 1 if(substr($line, 0, 1) == '1') { $line = substr($line, 1, strlen($line)); //replace the space(s) or tab(s) into 1 space only $line = preg_replace('/(\ +|\t+)/', ' ', trim($line)); //get the per word $words = explode(' ', $line); echo '<p><b>Heading Code:</b>' . $words[0] . '<br />'; echo '<b>Udac Code:</b>' . $words[1] . '<br />'; echo '<b>Udac Rate:</b>' . $words[2] . '<br />'; // start sql query $sql = "INSERT INTO udac SET headingcode='$words[0]', udaccode='$words[1]', udacrate='$words[2]'"; $i = 1; // sperarate each peice of data from comma delimited list foreach(explode(',', end($words)) as $data_bit) { $bit = explode('/', $data_bit); echo '<b>extraudac'.$i.':</b> ' . $bit[0] . '<br />'; echo '<b>extraudacrate'.$i.'</b>: ' . $bit[1] . '<br />'; // dynamically generate the query string $sql .= ", extraudac{$i}='$bit[0]', extraudacrate$i='$bit[1]'"; $i++; // increment counter } // display SQL query to be ran echo '<p>SQL Query: <pre>'.$sql.'</pre>'; // run query display error if query fails mysql_query($sql) or die('Error: ' . mysql_error()); // display success when query runs ok. echo 'SUCCESS!</p>'; echo '</p>'; } } ?>
-
how can i controll the position of stuff in php
wildteen88 replied to cosmoshell's topic in PHP Coding Help
Well that javascript that can't be positioned.