Jump to content

wesleypipes

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Everything posted by wesleypipes

  1. My 'sports' page has three pictures(not loaded from a database but just created myself). U click on these links and it shows you(on a seperate page and displayed in a table) the records from a specific table from the database. Lets just say to display fields 'league', 'country'. I know ill have to start the php script with connecting to a database and a specific table, but how do i go about displaying the records from table. Also, the records must be stored in table. Please help a beginner  8)  ;D
  2. <?php echo date("d-m-y H:i:s", time()); $hours = date("G"); //24 hour time without leading zeros. eg. 0 or 23 if($hours >= 22 && $hours <= 3){ echo "My your up late arn't you!"; }elseif($hours >= 4 && $hours <= 7){ echo "My your up rather early!"; }elseif($hours >= 8 && $hours <= 12){ echo "Good morning, and how are we today?"; }elseif($hours >= 13 && $hours <= 17){ echo "<table align = center>"Good afternoon, are we having a nice day?"; }elseif($hours >= 18 && $hours <= 21){ echo "Good evening, hope you had a nice day."; } ?> Hi, i would like to know how id format the date to be displayed in the middle of page and how would i go about putting tags around say, 'echo "Good evening, hope you had a nice day.";' to edit it. Basically, i just need to know the correct use of tags in formattiing eg bold text, centered etc thanks
  3. Hi, id just like to know how id go about adding a page to my site. Basically, id like the page to display the date and time generated using php and also greet them. The greeting will change depending on time of day e.g good evening , morning thanks
  4. Call me stupid but what does the following mean: 1-    ($_SESSION['logged_in']!=1) (on my login, it means user isnt logged in) 2-    ($_SESSION['logged_in']==1) (on my login, it means i am logged in) Can u describe the above code in simple terms please?
  5. ok thanks ken - would i have to change the code alot to make it work with phpmailer
  6. Basically user enters in details through a form. Afterwards, emails are sent. The php code is below. Im using my isp for that smtp stuff which requires a pass. Anyway, once i subit the form, i get a'530 authentication required - Your email could not be sent. To fix this you must make a simple change to your email (known as SMTP authentication).' Is there a way to overcome this? <?php $to = 'wesley_pipes_@hotmail.com' ; $from = $_REQUEST['email'] ; $name = $_REQUEST['name'] ; $message = $_REQUEST['message'] ; $headers = "From: $from"; $subject = "Web Contact Data"; $fields = array(); $fields{"name"} = "Name"; $fields{"message"} = "Comments"; $fields{"email"} = "Email"; $body = "We have received the following information:\n\n"; foreach($fields as $a => $b) { $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } $headers2 = "From: noreply@YourCompany.com"; $subject2 = "Thank you for contacting us"; $autoreply = "Thank you for contacting us.Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our website at www.oursite.com"; if($from == '') {print "You have not entered an email, please go back and try again";} else { if($name == '') {print "You have not entered a name, please go back and try again";} else { $send = mail($to, $subject, $body, $headers); $send2 = mail($from, $subject2, $autoreply, $headers2); if($send) {header( "Location: http://www.YourDomain.com/thankyou.html" );} else {print "We encountered an error sending your mail, please notify webmaster@YourCompany.com"; } } } ?>
  7. Hi when trying to send mail via html forms on my localhost im getting this error: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\xampp\htdocs\contact.php on line 30 I hear this is quite a common problem. I have looked into this, but cant seem to solve thhis problem. Can someone more experienced instruct me how to overcome this error Thankyou
  8. Basically, I log in through a form, below is the code that proceeds <?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("memberdir") or die(mysql_error()); $appusername = $_POST['login_name']; $apppassword = $_POST['password']; $result = mysql_query("SELECT * FROM `user` WHERE username = '$appusername' AND password = '$apppassword'"); if (mysql_num_rows($result) > 0) {   $_SESSION['authenticatedUser'] = $appusername;   header("Location: loggedon.php"); } else {   $_SESSION['message'] = "Could not connect as $appusername";   header("Location: login.php"); } ?> ok now if i log in with a valid user, i should get notifed and the first bit of code i post should do this if you get what i mean
  9. [code] <?php session_start(); if (!isset($_SESSION["authenticatedUser"])) {   $_SESSION["message"] = "Please Login";     header("Location: login.php"); } else { ?> <body> <h2>Youre ok you are authenticated as <?php echo $_SESSION["authenticatedUser"] ?> </h2> <a href = "logout.php">logout</a> </body> </html> <?php } ?> [/code]
  10. Thankyou very much huggiebear. This has solved the my problem. Was it my php opening tags that confused the program. CHEERS. Ive only been doing this for 2 weeks and im not that good at it, but as i said THANKYOU VERY MUCH !
  11. Basically this is what i would like to do i will also post the code ive made. With a php program i would like to connect to my database, collect data from a form and save it into variables and create a query to search the user table to see if the user can basically login or not.  I have create my Form, php program and database. Below is the copy of my php code: <? mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("memberdir") or die(mysql_error()); ?> <? $appusername=$_POST['login_name']; $apppassword=$_POST['password']; $result = mysql_query(" SELECT * FROM 'user' WHERE username = $appusername AND password = $apppassword ") if (mysql_num_rows($result) > 0) { $_SESSION["authenticatedUser"] = $appusername; header("Location: loggedon.php"); } else { $_SESSION["message"] = "Could not connect as  $appusername "; header("Location: login.php"); } ?> i really wish you can help. BAsically when i submit my 'login' form i get a parse error at line 12
×
×
  • 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.