wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
[SOLVED] HELP: PHP DIRECTORY HANDLING
wildteen88 replied to tonbernradino's topic in PHP Coding Help
did my suggestion work out? -
am i the only one who hates expert exchange?
wildteen88 replied to scarhand's topic in Miscellaneous
You dont have to actually pay to view the answers on experts exchange. Scroll to the very bottom of the page and the answers are there. -
Post your current code for your rewrites You should look into applying conditions so certain urls do not get applied to your rewrite rules. Also try to not use greedy regex terms eg: (.*) in your rules too
-
You'll want to apply some validation. There is not a built in function for this you'll have to code it yourself. To remove offensive words from user data search google for php bad word filter tutorials. Very simple script to apply.
-
[SOLVED] HELP: PHP DIRECTORY HANDLING
wildteen88 replied to tonbernradino's topic in PHP Coding Help
function getBaseDirURL() { $url = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')) ? 'https://' : 'http://'; $url .= $_SERVER['HTTP_HOST']; $uri_path = pathinfo($_SERVER['REQUEST_URI'], PATHINFO_DIRNAME); // get the base directory $pos = strpos($uri_path, '/', 1); $url .= ($pos !== false) ? substr($uri_path, 0, ($pos+1)) : $uri_path; return $url; } echo getBaseDirURL(); -
[SOLVED] Internal Site Linking... where do I start?
wildteen88 replied to Goldeneye's topic in PHP Coding Help
Id use preg_replace for this sort of thing. Example code: $str = ' Umm, int://board=4&topic=6 is intresting hello goto int://board=4 for answer! See int://article=9 too int://board=4&topic=6&message=12107320191 '; $str = preg_replace('|int://board=([\d]+)&topic=([\d]+)&message=([\d]+)|i' , '<a href="http://foo.bar/topiclist.php?board=$1&topic=$2">Message $3</a>' , $str); $str = preg_replace('|int://board=([\d]+)&topic=([\d]+)|' , '<a href="http://foo.bar/topiclist.php?board=$1&topic=$2">Topic $2</a>' , $str); $str = preg_replace('|int://board=([\d]+)|' , '<a href="http://foo.bar/topiclist.php?board=$1">Board $1</a>' , $str); $str = preg_replace('|int://article=([\d]+)|' , '<a href="http:/foo.bar/getarticle.php?article=$1">Article $1</a>' , $str); echo nl2br($str); -
[SOLVED] HELP: PHP DIRECTORY HANDLING
wildteen88 replied to tonbernradino's topic in PHP Coding Help
Use: $protocol = @$_SERVER['HTTPS'] == 'on' ? 'https' : 'http'; $URL = $protocol.'://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['REQUEST_URI']); -
ini_set('display_errors', 'E_ALL'); should be ini_set('display_errors', 'On');
-
When MySQL is installed. A default user is setup called root no password is setup for that account. A password can be set for the root account via WAMP's control panel or by using phpMyAdmin.
-
As an additional note to kens suggestion you could just use the array_values() function. $old_array = Array ( 'somename' => 'Cat', 'someothername' => 'Bird', 'anothername' => 'Horse' ); $new_array = array_values($old_array);
-
This uses javascipt to write the following html: <script language="javascript" type="text/javascript" src="http://yoursite.com:8880/javascript/newsfeeds.js.php"></script> <script language="javascript" type="text/javascript" src="http://yoursite.com:8880/javascript/promo-flags.js.php"></script> This html then includes javascript scripts it is most probably something to do with your webhost perhaps. Unless you have added that code?
-
What do you mean by Could you explain more. Installing Apache on Vista is not different to XP. However I usually install Apache using administrative privileges (right click on the installer and select Run as Administrator).
-
Make sure you have an image saved as favicon.ico in your websites root folder. The image shouldn't be larger than 16px x 16px You can also add the following line too, between the <head></head> HTML tags: <link href="http://yoursite.com/favicon.ico" rel="icon">
-
What is the purpose of this code: if (($approved!=='')&&($revise=='')){include 'approved.php';} if (($approved=='')&&($revise!=='')){include 'revise.php';} if (($approved=='')&&($revise=='')){include 'pending.php';} What are you trying to do? You'll need to explain more. Also loops do not stop if an if/else statement is present in the loop.
-
session_register is depreciated. Do not use this function. Just use $_SESSION['your_var'] = 'somevalue' to set session variables. Also I donot recommend the following: $username = $_POST['username']; $password = md5($_POST['password']); if($username && $password) { This is sloppy in my opinion. I'd do: if(isset($_POST['username']) && isset($_POST['password'])) { $username = $_POST['username']; $password = md5($_POST['password']);
-
Move whatever files you moved back to your PHP folder. PHP does not require files to moved to the Windows folder. You should add PHP to the PATH Environment Variable. By adding PHP to the PATH, PHP will look for files in the PHP installation folder.
-
[SOLVED] Extremely strange behaviour using FWRITE
wildteen88 replied to neutra's topic in PHP Coding Help
Your test function works fine for me, full test code <?php function testWrite( $fp,$data ) { echo "testWrite() [$fp] [$data]"; return( fwrite( $fp,$data ) ); } $data = 'NEW CONTENT'; $fp = fopen('file.txt', 'w'); if(testWrite($fp, $data)) { echo ' - SUCCESSS!'; } else { echo ' - FAIL!'; } fclose($fp); ?> -
Post the code for your loop. Variables can be used to reference array keys, as suggest by DarkWater's perfectly valid code. Doing $key = "test"; $_SESSION[$key] = "Lololol" is the same as $_SESSION['test'] = "Lololol"
-
Currently PHP is not reading a php.ini file after reviewing your phpinfo output you posted above. Where is your php.ini file located to? It should be in C:\Inetpub\php (I assume this is where PHP is installed). If you haven't got a php.ini then rename the file called php.ini-recommended to php.ini Restart IIS and rerun phpinfo() again. To see if PHP is reading your php.ini, the Loaded Configuration File line should be set to C:\Inetpub\php\php.ini Ignore the Configuration File (php.ini) Path line. Once you have gotten PHP to read the php.ini then read through the post PFMaBiSmAd linked to.
-
[SOLVED] how to redirect instead of denying directory listing
wildteen88 replied to prakash's topic in Apache HTTP Server
Add the following ErrorDocument 403 http://www.yoursite.com/ to your .htaccess. If a 403 error occurs then the user should be redirected back to your site. -
Done some googling and found out that WAMP has a custom phpmyadmin.conf file (located in C:/wamp/apache2/conf/alias). In this configuration file WAMP limits connections to the /phpmyadmin folder to localhost connections only. If you want to access phpmyadmin from your network then open phpmyadminc.conf for editing and find the following line: Allow from 127.0.0.1 Change that line to: Allow from 127.0.0.1 192.168.2.102 Change 192.1638.2.102 to the Ip address of your Vista laptop internal LAN address. Save phpmyadmin.conf and restart WAMP. You should now be able to access phpmadmin from your laptop.
-
Have you restarted IIS? Is PHP using the php.ini you are modifying (check this via phpinfo) I believe the php_mssql.dll extension requires the msql.dll and ntwdblib.dll libraries in order to function. These files should be in the root of your PHP installation folder. If you have added your PHP foldert to the PATH then the problem is to do with something else. Have you setup the extension_dir directive to point to your PHP extension folder. Make sure you use an absolute path (C:/path/to/php/ext) rather than a relative path (./../path/to/php/ext)
-
Just add <br /> between the empty quotes at the end of the line: if ($categorien == $query['RubriekID']) echo '<input type="checkbox" name="categorien[]" value="'.$query['RubriekID'].'">'.$query['Rubrieknaam'].'<br />'; else echo '<input type="checkbox" name="categorien[]" value="'.$query['RubriekID'].'">'.$query['Rubrieknaam'].'<br />'; Your checkboxes will now display down the page.
-
This is to do with how WAMP is configured. I believe somewhere there is configuration file (it maybe a .htaccess file in the /phpmyadmin folder) which restricts certain IP addresses from accessing that directory. This is nothing to do with phpMyAdmin. When installing the shopping cart does it ask for your website domain? Instead of entering localhost you should use your XP Computers internal LAN address (eg 192.168.2.100). If it does not ask for this then you may have to modify the script to apply this change. The stylesheet is most probably serving from http://localhost which will only work on your XP computer but not your Vista Laptop. The problem is http://localhost/ is a local loop back address for your computer only. It is not an address for accessing computers over a network. That's why on your Vista Laptop you have use your XP Computers internal LAN address in order to connect WAMP.