Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. this code: [code]echo "<tr><td><a href='query_details.php?=query_number=$query_number'</td>" . $query_number;[/code] Is not valid. You have not finish creating the link. This should do: [code] echo '<tr><td><a href="query_details.php?query_number=' . $query_number . '">$query_number</a></td>"; [/code] Also please note that file/folder names should not have spaces in them. You should use either a hyphen (-) or an underscore (_) in replacement of the space.
  2. Allways use the full path to the extension dir. Also the  extension you are loading require third party libraries, which (should) are located in the root of the PHP folder. If PHP cant find these then it wont be able to load the extension. To fix this I advise you to do the following: Go to Start > Control Panel > System > Advanced Tab > click the Environment Variables button. Scroll down to the System Variables box and scroll through the list of variables until you get to the PATH variable. Select this variable and then choose the edit button. Now press the key labelled [b]End[/b] (do not press any other key) on your keyboard. Now type the following: ;C:\php; Click Ok and Ok for all the remaining Windows. Make sure you have setup the extension dir in the php.ini to C:\php\ext now save the php.ini and restart your computer. Before you restart the computer. Make sure PHP is using the correct php.ini by running the phpinfo function and looking for the [b]Configuration File (php.ini) Path[/b] and then looking at the path it states to the right of that. Is that correct path? If it is you can continue restarting your PC. If its not the correct path then add the following line to Apache config file (httpd.conf): PHPIniDir = "C:/php" save the httpd.conf and continue on with restarting your PC. Once your PC is rebooted PHP should now be able to load up the extensions.
  3. PHP4 and PHP5 are exactly the same. Except PHP5 has better OOP functionality and as you have already discovered has newer functions included. It is up to you which version however I would recommend PHP5.
  4. C:\php\ext will be fine. Add it in quotes too. Also make sure you meet the requirements set forth over at the [url=http://uk.php.net/manual/en/ref.curl.php]cURL manul[/url]. Check that your version of PHP comes with the following files: libeay32.dll and ssleay32.dll Copy those files to C:\WINDOWS restart Apache. Does the cURL library now load? I would recommend you to add your PHP folder to the Windows PATH variable. This can save a lot of trouble when getting extensions to load.
  5. just add them in the character range: [code][A-Za-z.-\s][/code]
  6. Those are the newer superglobal arrays. They replace the older (now depreciated) superglobals which are the $HTTP_*_VARS arrays $HTTP_GET_VARS is now $_GET $HTTP_POST_VARS is now $_POST etc.
  7. What do you mean depreciated tags? The only tags PHP has are the opening and closing tags (<?php ?>) Do you mean HTML?
  8. Yoo will want to store each item in an array, call this array items. this array will store the item name and price. Then you will want to use a foreach loop to display all the items. Example: [code]<?php session_start(); function getPrice($price, $dec=2) {     if(!isset($_GET["currencyID"]))     {         $_SESSION["CurrencyID"] = isset($_SESSION["CurrencyID"]) ? $_SESSION["CurrencyID"] : 1;     }     elseif(isset($_GET["currencyID"]))     {         if(is_numeric($_GET["currencyID"]))         {             $_SESSION["CurrencyID"] = $_GET["currencyID"];         }     }     $CurrencySymbols = array( 1 => "\$",                               2 => "€",                               3 => "£"                             );     //Examples Made Up     $CurrencyExchangeRate = array( 1 => 1,                                   2 => 0.759594,                                   3 => 0.510553                                   );     $price = $price * $CurrencyExchangeRate[$_SESSION["CurrencyID"]];     $price = number_format($price, $dec);     return $CurrencySymbols[$_SESSION["CurrencyID"]].$price; } // Array of items: //                  item name      , price $items= array( array('Candy Cane'    , 0.75),               array('Ginger Bread'  , 2.50),               array('Cristmas Cake' , 5.60)               ); // loop through each item and display price: foreach($items as $item) {     echo $item[0] . ' : ' . getPrice($item[1], 2);     echo '<br /><br />'; } ?> <html> <body> Show prices in: <a href="<?php echo $_SERVER['PHP_SELF']; ?>?currencyID=1"><img src="./usd.jpg" align="left" border="0" alt="USD" /></a> <a href="<?php echo $_SERVER['PHP_SELF']; ?>?currencyID=2"><img src="./euro.jpg" align="left" border="0" alt="Euro" /></a> <a href="<?php echo $_SERVER['PHP_SELF']; ?>?currencyID=3"><img src="./pound.jpg" align="left" border="0" alt="Pound"/></a> </body> </html>[/code] I created a function called getPrice to save having to write out the code in the foreach loop.
  9. When echo'ing lines with whitespace characters (\t, \n, \r etc) do not use single quotes. PHP will treat these literaly. PHP will ignore their special meaning. Instead you should use double quotes: wont work: [code=php:0]echo 'this \n string \n has \n new lines!'; // output: this \n string \n has \n new lines![/code] Will work: [code=php:0]echo "this \n string \n has \n new lines!"; /* output: this string has new lines! */[/code] NOTE: You will only see these newlines when viewing the source code in the browser. The browser ignores these characters. In order for the browser to show the new lines you will need to convert them to HTML linebreaks ([nobbc]<br />[/nobbc]
  10. When you submit data from a form or pass data over the url, the data can be a string, a number/float, a boolean etc. It will always be converted to a string. so the following wont work: $figureitout = is_int($myid); What you will want to do is use is_numeric rather than is_int. As is_numeric checks whether the string is of a numerical value. Where as is_int checks that the data is an integer. The following should work: [code=php:0]if(is_numeric($_GET['idnumber'])) {     // my id is a number!     $myid = $_GET['idnumber']; }[/code] Also the use of $HTTP_*_VARS are depreciated. You should use the newer superglobals which are $_GET, $_POST, $_SERVER etc.
  11. The only way is to recompile PHP if you want to use an extension that is not already been enabled (non windows boxes only). Ask your host and see if they can add cURL for you.
  12. what's there to critique? Asking us to critique a forum/theme that is not made by you is kinda pointless!
  13. You can use any editor. Just don't allow it to code stuff for you.
  14. Post the full error here. Also where do you call the displaylogin function from? You may need to add ob_start() and ob_end_flush() to the script that calls that function.
  15. What are downloading? Post a link to the file you are downloading. It should be MSI package. The installer should be recognised by windows if your have Windows Installer installed (comes with Windows).
  16. wildteen88

    image

    Looks like you are after a WYSIWYG editor. Search google for tinyMCE or FCKEditor Is that what you are after?
  17. Of if you don't know PHP. Then the first step is learning PHP. follow the php tutorials over at [url=http://www.w3schools.com/php/php_intro.asp]w3schools.com[/url] That will give the basics. Then you will want to learn how to do PHP and MySQL web apps. [url=http://www.php-mysql-tutorial.com/]php-mysql-tutorial.com[/url] will be able to help you there. You may also want to go out and buy some PHP books to further build your skills. Learning PHP is no easy process. You've got to learn to walk before your can run.
  18. From looks of things you are using FrontPage. Code everything by hand do not let FP code anything/everything for you otherwise you are looking for trouble.
  19. There is already multiple threads like this. Please use the forums search feature or look in the Miscellaneous and Polls forum. Thank you. Thread closed.
  20. wrap the chmod value in quotes: [code]if (!is_dir($cfg['dir_user'])) { mkdir($cfg['dir_user'], '0777'); }[/code] PHP tends to remove the leading zero from integers. Perhaps this could be causing the problem you are getting
  21. That ain't slow. Thats pretty quick. 6 thousandths of a second! The only time you should worry is when you takes seconds to load.
  22. I have modified your code a little, mainly due to repeating yourself and doing a lot of unneeded checks. Here is your new code: [code]<?php function displaylogin() {     $formaction = $_SERVER['PHP_SELF'];     $loginform = <<<HTML <form action="{$formaction}" method="pos"t name="loginform"> Username: <br /> <input type="text" name="username" size="20" class="field1"> <br /> Password: <br /> <input type="password" name="password" size="20" class="field1"> <br /><br /> <input type="submit" value="login" class="button1" name="login"> <br /><br /> <a href="register.php">Click Here To Register</a> </form> HTML;     if(!isset($_SESSION['user']) && !isset($_POST['login']))     {         // No session + No Form Login... Display the form...         echo $loginform;     }     elseif (isset($_POST['username']))     {         // if the form has been submitted... The ifs + elses between this and next comment arnt         // that important just checking if the login details are correct...         $username = mysql_real_escape_string($_POST['username']);         $password = md5($_POST['password']);         $sql = "SELECT * FROM sf_users WHERE username='$username' AND `password`='$password'";     $result = mysql_query($sql) or die(mysql_error());         if(mysql_num_rows($result) == 1)         {             $user = mysql_fetch_array($result);     $_SESSION['user'] = $user;     $member_id = $_SESSION['user']['member_id'];     $datestamp = DATESTAMP;     $newip = $_SERVER['REMOTE_ADDR'];             /* Preparing the cookie data:             ** We arew going to store it in an array             ** then when we save it to cookie             ** we will serialize it */             $cookieDATA[] = $member_id;             $cookieDATA[] = $username;             $cookieDATA[] = $password;             /* set the remeberMe cookie, it should last around 1 month.             ** This can be changed by changing 2678400 to however long             ** in secounds you want the cookie to last */             setcookie('rememberMe', serialize($cookieDATA), time()+2678400);             $sql = "UPDATE sf_users SET `last_login` = '$datestamp' WHERE `sf_users`.`member_id` =$member_id";     $result = mysql_query($sql);             echo "<br><font color=white><i>Loading... Please wait...</i></font><br>";             if ($_SESSION['user']['cus_ip'] == "0")             {                 mysql_query("UPDATE sf_users SET `ipaddress` = '$newip' WHERE `sf_users`.`member_id` =$member_id");             }     echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"0; URL=members.php\">";         }         else         {             echo "<font color=\"#FF0000\"><b>Username and/or password are incorrect. Please try again</b></font>" . $loginform;         }     }     elseif (isset($_SESSION['user']))     {         //If we have the session... echo the username has logged in         //Display member options...         $uname = $_SESSION['user']['username'];         $urank = $_SESSION['user']['rank'];         $uid = $_SESSION['user']['member_id'];         if($_SESSION['user']['active'] != "1")         {             echo <<<HTML     <font color='#FFFFFF'><i>       You have not yet activated your account! Please activate your account via the email sent to you. For security we can not       resend the email. If this is a problem, please contact an admin.</i>     </font><br />     <br /> HTML;         }         echo <<<HTML     <font color="#FFFFFF"><b>Welcome Back,<br>{$urank} {$uname}</b></font><br />     <br />     <a href="members.php">[Members Area]</a><br />     <a href="forums">[Forums]</a><br /> HTML;         if ($_SESSION['user']['CL'] >= 2)         {         echo '<a href="admin/">[Admin Panel]</a><br />';     }         echo '<a href="logout.php">[Logout]</a><br />';     } } ?>[/code] The cookie that should be setup is called [b]remeberMe[/b]. When you grab the cookie using [code=php:0]$_COOKIE['remeberMe'][/code] you will need to [url=http://php.net/unserialize]unserialize[/url] it. As the cookie holds an array of 3 items which are member id, username and password. NOTE: You may get errors. This code is untested however I checked over it for any errors. If you get any errors post theme here and I will have a look. If you get no errors then that will be a bonus. But it shouldn't. The only thing you need to do is create the bit where it fetches the cookie and signs the person in automatically which you should be able to do.
  23. error_reporting does not affect whether errors gets displayed or not. It only effects the type of errors it should log. The actual setting you will want to enable is display_errors. This is the setting that controls whether errors should be displayed during run time.
  24. You can use GET and POST at the same time yes.
  25. How do you process logins. Could you post the code for your login system.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.