Jump to content

wesleypipes

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Posts 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. 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"; }
    }
    }
    ?>
  4. 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
  5. 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
  6. 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.