Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Have a go at [a href=\"http://www.phpfreaks.com/tutorials/65/0.php\" target=\"_blank\"]this tutorial[/a] or search google for [a href=\"http://www.google.co.uk/search?hl=en&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=PHP+Membership+system&spell=1\" target=\"_blank\"]PHP Membership system[/a] and you'll get what your're looking for
  2. No problem. I prefer trhe Apache Module way myself. [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /]
  3. Yes if you use PHP5 you have to manaully enable the extension, just edit two lines in the php.ini if you're on Windows and you now have mysql support, for more details explainatio read my thread [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=87276\" target=\"_blank\"]here][/a] Also if you want to upgrade PHP just download the [b]Zipped[/b] binaries package and extract the contents of the zip file where your PHP folder is setup to and overrite [b]ALL[/b] current files in that folder. Now you need to edit your httpd.conf file and if you configured Apache to use PHP as a module you'll need to modify it slghtly, such as changing any instance of isapi/php4apache.dll or isapi/php4apache2.dll to php5apache.dll or php5apache2.dll And thats it! You have now upgraded PHP, save your httpd.conf and restart Apache. If you did it in a different way or used a different server, like IIS, then it may take bit more editing. If you're not on Windows and are using *nix based OS then you may need to recomiple PHP to the setup you want.
  4. Ok. What is you current setup. How are you getting your guestbook records out of the database? Could you post the code here.
  5. You need to make your $result variable global in your function. So chnage this:[code]function replacesmiley($msg) {[/code] to this: [code]function replacesmiley($msg) {     global $result; [/code] Variables dont have global scope when used in a function so you need to declare the variables that are defined out side of the function as global
  6. I dont think its your actuall memory on your server but the memory a single php script can consume. The defualt is only 8MB. If you want to change this value you'll want to edit the php.ini and find the following line: [code]memory_limit = 8M[/code] Change 8 to bigger value so your script may use more memory. So try doubling that to 16MB
  7. I suspect that they have used the [a href=\"http://uk.php.net/manual/en/function.session-set-save-handler.php\" target=\"_blank\"]session_set_save_handler[/a] functiion which allows you to define how you want session_destory to react when called. Such as it deletes the session file, rather than clearing contents of the file. In order to delete the session you need to make sure you have the correct permission set on both the folder that stores the session files and the session file it self you are about to delete. Thats probably they did it.
  8. You cannot delete or remove the session file generated with session_destroy. session_destory clears all the contents that is in the session file. Also when you destroy the session you can use the [a href=\"http://uk2.php.net/manual/en/function.session-regenerate-id.php\" target=\"_blank\"]session_regenerate_id[/a] function which regenerate the session id, therefore when the session is destroyed the old session_id is invalid.
  9. As mentioned above you should use should use the new superglobal arrays $_POST, $_GET, $_SESSION etc rather than using the old depriciated global variables $HTTP_*_VARS Also your new host ruinning linux might be running PHP5 with the register_long_arrays directive turned off. register_long_arrays are the old global variables $HTTP_*_VARS i mention above.
  10. If you have coded a forum then surely you have setup some form of permissions? Such as if user has a permission value of 1 they are admins, if they have permission value of 2 they are mods, if they dont have a permission value of 1 or 2 they are normal users. does your forum usessessions? If it does, do you store the users permission in the session? If you do then you can simply place the following in all your admin pages: [code]<?php session_start(); //if the uisers permission level is not equal to 1, they are not authorised, so kill the script if($_SESSION['permission'] != '1') {     die("YOU DONT HAVE ACCESS HERE! ONLY AUTHORISED USERS ALLOWED IN THIS AREA!"); } // rest of admin code[/code] Thats the most basic way of checking the user has the correct permission.
  11. Seems like you dont quite understand how to use mysql and php together. If you dont I suggest you read through tutotials numbers 1 through to 9 over at [a href=\"http://www.php-mysql-tutorial.com/\" target=\"_blank\"]php-mysql-tutorial.com[/a]. Also you can have a go at tutorial number 12 too, as that shows how to create a simple guestbook. Hope that helps.
  12. If you are validating user input it is best to trap all errors into an array, then at the end of the validaton checks you can check whether there are any errors in the array if there are use a simple foreach loop and then display the errors in an unordered list, or in what ever format you wish to show them. So heres what your code will basically look like: [code]if (isset($_POST['send'])) {     $error = ""; //setup blank error variable, this will store errors     if (empty($_POST['name'])) {         $error[] = 'The name field has been left blank';     }     if (empty($_POST['emailaddress'])) {         $error[] = 'The Email Address field was left blank';     }     elseif (empty($_POST['verifyemail'])) {         $error[] = 'The Verify Email Field was left blank';     }     elseif ($_POST['emailaddress'] != $_POST['verifyemail']) {         $error[] = 'The Email Addresses do not match, please fix this';     }     if (empty($_POST['description'])) {         $error[] = 'The Description Field was left blank';     }     //check that the error varibale is an array, if it loop through the error and displau them as an unordered list     if(is_array($error)) {         echo "Please correct the following errors before you continue:<br />\n<ul>";         foreach($error as $k => $v) {             echo '<li>' . $v . "</li>\n";         }         echo '</ul>';     }     else     {         //put email code here     } } //form code here[/code] Thats the best way of doing it rather than printing each error one at a time as that can pertential annoy the user. It is best to show all the errors all at once, therefore the user can work through each of the errors reported one by one.
  13. The key here is to use session_name before session_start within your admin area ie: [code]<?php session_name('adminArea'] // MUST BE FIRST LINE session_start(); //all session data created will now be tied to the adminArea session //create your sess vars as normal ?>[/code] Now in your frontend just start your session as normal: [code]<?php session_start(); //create session vars ?>[/code] You'll see now that your sessions wont mix, all admin session are tied to a seperate session. NOTE: you must have session_name('adminArea') before session_start in every file that uses sessions in your admin area. Also the name of the session can be anything but can only contain letters Hope that helps.
  14. or [a href=\"http://uk2.php.net/manual/en/function.number-format.php\" target=\"_blank\"]number_format[/a] [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /]
  15. [!--quoteo(post=380353:date=Jun 5 2006, 09:06 PM:name=moberemk)--][div class=\'quotetop\']QUOTE(moberemk @ Jun 5 2006, 09:06 PM) [snapback]380353[/snapback][/div][div class=\'quotemain\'][!--quotec--] Just keep in mind that that doesn't work in IE6 and below. You'd need to also include a wrapper <div> that has text-align: center;. [/quote] Actually it does as long as there is a valid doctype defined and that there is is width also defined for the element you are centering then your good to go, which michaellunsford has both of those!
  16. I see in your css that you hardly style any block elements such as your header tags (h1, h2, h3 etc). All your headers display different in each browser, ie they jump around, the reason for is IE, FF and Opera use different default margins/paddings on elements. Dont just set one side of an element a difined marging set all the sides, top, left, right and bottom a margin and use the short sytax too: [code]margin: top right bottom left;[/code] What I suggest you to do is set defined a margin that you want for all tags you are styling, so for your header tags do it like so: [code]h1, h2, h3 {     margin: 10px;     padding: 0px; }[/code] Also Opera tends to apply a defualt padding to most html elements rather than a margin so its a good practice to supply both margin and padding values when stying tags. Dont always rely in on a browsers defualt margin/padding values (for example IE's) as not all browsers will have the same. If you provide defualt values of margin/padding for all the tags you style then you page will look consitant in all browsers, so when you swap back and forth between browsers you shouldn't see much of a different in the way your page looks in a different browser. Currently yours jumps around a bit. edit: editted the bad grammer/spelling mistakes (hurrt up FF2! In-line spelling checker - lazy i know)
  17. [!--quoteo(post=380448:date=Jun 6 2006, 03:04 AM:name=skyblog)--][div class=\'quotetop\']QUOTE(skyblog @ Jun 6 2006, 03:04 AM) [snapback]380448[/snapback][/div][div class=\'quotemain\'][!--quotec--] Try for this iam also getting the same fatal error but finally i solved the problem firstly there is no php.ini file in c:\windows Go to php folder where you installed and rename php INI-DEST file to php.ini then copy and paste it to the c:/windows folder then made changes in that file as already mentioned Thank you very much to all giving me some idea ...., [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] [/quote] Yeah prehaps I should of mentioned that, also you shoud use php.ini-recommended but either file will do.
  18. How are you saving your php files? are you saving them with a .php extension? As far as I can see there is nothing wrong with how Apache and PHP are configured.
  19. yes, you can setup a cron job which will then execute your php script every 24hours.
  20. If you have the php folder in the windows path variable than move php.ini back to C:\php and add the following line of code to the httpd.conf file: [code]PHPIniDir "C:/php"[/code] Now save the httpd.conf file and restart Apache. Also I notice you added this line in the httpd.conf: [code]AddModule mod_php5.c[/code] this is not actually needed. Alsol when you added the PHP to window path variable make sure it is correct and when you created the variable that you restarted windows in order for the new path variable to become available.
  21. Or you can read my post [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=87276\" target=\"_blank\"]here[/a] which will help you to enable the mysql extension.
  22. Okay run through these points:[list][*]Check that php.ini is in either in C:\WINDOWS or C:\WINDOWS\SYSTEM32 [*]Check that php5td.dll is also either in the C:\WINDOWS or the C:\WINDOWS\SYSTEM32 folder [*][!--sizeo:3--][span style=\"font-size:12pt;line-height:100%\"][!--/sizeo--]ONLY DO THE ABOVE TWO STEPS IF YOU HAVE NOT ADDED THE LOCATION OF THE PHP FOLDER TO THE WINDOWS PATH VARIABLE[!--sizec--][/span][!--/sizec--] [*]Check that any configurations settings within the php.ini are correct [*]Change the [i]display_startup_errors[/i] (located near line 372 in the php.ini file) directive from Off to On, so it is read as the following: [code]display_startup_errors = On[/code] Now restart Apache, If there are any errors with the PHP configuration you should get an error message telling you whats wrong when Apache attempts to restart/load [*]Check Apache's error log for any startup errors. Apache's error log is located in the logs folder within the Apache installation folder. [*]Make sure that your restart Apache when you make any changes to the php.ini/httpd.conf file and when you move any files that is stored either in the PHP folder or the Apache folder.[/list]
  23. [!--quoteo(post=380041:date=Jun 4 2006, 10:47 PM:name=joecooper)--][div class=\'quotetop\']QUOTE(joecooper @ Jun 4 2006, 10:47 PM) [snapback]380041[/snapback][/div][div class=\'quotemain\'][!--quotec--] [code]<?php session_start(); //start the session include("db.php"); $username=$_POST['username']; //Get the username the user has entered $password=$_POST['password']; //Get the password the user has entered $password=md5($password); //turn the password they entered into md5 to compare with the DB $loginname=$_SESSION['username']; //set the global varible for login name to use else where with the script. //check to see if logged in allready if (isset($_SESSION['loggedin'])){   //if allready logged in, push them onto the members area!   header("Location : /members/index.php"); //if they arent logged in allready then log them in! } ?>[/code] It just loads the page and does nothing, when it should redirect the user to that page [/quote] You are checking whether the session variable, [b]loggedIn[/b] is set. But nowhere in the code you are setting the loggedIn session variable. Therefore your header redirect will not be excuted as your if statement is returning false in code below: [code]//check to see if logged in allready if (isset($_SESSION['loggedin'])){   //if allready logged in, push them onto the members area!   header("Location : /members/index.php"); //if they arent logged in allready then log them in! }[/code] In order for your if statement to return true and therefore execut the header redirect you need to create $_SESSION['loggedIn'] session variable. Like so: [code]$loginname=$_SESSION['username']; //set the global varible for login name to use else where with the script. $_SESSION['loggedIn'] = true; //create logged in session[/code]
  24. The way the button looks on a web page with no styling is down to the OS which gives the button a defualt style. If you want to change how a button looks you'll want to style it with CSS. You should atleast get the basics of CSS to style how your pages looks rather than using raw html code. YOu can learn the basics of css over at [a href=\"http://www.w3schools.com/css/css_intro.asp\" target=\"_blank\"]w3schools.com[/a]
  25. You cannot execute PHP files the way you do with HTML files, ie double click it and it'll open up in the browser. As PHP is a server-side lanaguage it requires a server that is configured to execute any .php files with the PHP intepreter. Now in order to do this you need to open up a browser and type in [a href=\"http://localhost/\" target=\"_blank\"]http://localhost/[/a] you should see list of files and folders now click the file you want to execute, or typeing the actuall name of the script like so: [a href=\"http://localhost/todaysdate.php\" target=\"_blank\"]http://localhost/todaysdate.php[/a] NOTE: the url [a href=\"http://localhost/\" target=\"_blank\"]http://localhost/[/a] will only work if you have a server setup on your computer. Now with the Dummies book you have there should be chapter or an apendix section that tells you how to setup a server on your computer.
×
×
  • 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.