Squidge 101 Newbie Poster

You dont actually seem to be using any of the POST data.

Or have you not put all your code?

Squidge 101 Newbie Poster

I would suggest not using * but actually refering to the table columns. This is concidered a security risk.

Also note that mysql is not longer maintained, you woul dneed to start looking at MySQLi or PDO. If you are just starting I wuld suggest doing this sooner than later :)

// get value of id that sent from address bar
$id=$_GET['id'];
$sql="SELECT * FROM $tbl_name WHERE id='$id'";

This little bit here, leaves you wide open for attack, as you should sainitise the data to prevent attacks.

To retrive the data and sort by DESC:

ORDER BY id DESC

I hope that helps

Squidge 101 Newbie Poster

What's a portable software? and Is It even legal?

It is legal and illegal.

This one Click Here, is a collection of legal compact Apps available.

There are others, and i have in the past come across portable and cracked apps such as Dreamweaver, Flash etc. If it is under the Open Source license then yes this is all above board.

Squidge 101 Newbie Poster

please supply logout.php

this is indicating you have an undefined function, without the code it is hard to help

Squidge 101 Newbie Poster

@LastMitch

If you take the code you have so far:

    <form action="photoimage.php" method="post">
    Photo: <input type="" name"" valve=" />
    <br />
    Caption: <input type="" name"" valve="" />
    <br />
    </form>

You would name the fields, i try to keep them as obvious as possibly.

    <form action="photoimage.php" method="post">
    Photo: <input name"photo" valve=" />
    <br />
    Caption: <input name"caption" valve="" />
    <br />
    </form>

So once you get to your photoimage.php you will have a $_POST array available to you:

$_POST['photo']
$_POST['caption']

Then you can use those to add to a DB.

This is a gallery upload script which i used, and modified for my needs:
Click Here

Hope it helps

Squidge 101 Newbie Poster

Can you explain?

How is it not working?

Are you getting an error?

Is anything showing in your log files?

Squidge 101 Newbie Poster

I would suggest speaking to your web host company.

They should have a support ticket system. Sounds like a CPanel config glitch.

Squidge 101 Newbie Poster

Silly question but does the DB jqcalendar exist on your hosting site?

Did you install, or FTP and import the DB tables?

I would suggest you run it through from the begining

Squidge 101 Newbie Poster

@ vishalonne

not a problem, glad it is resolved :)

Squidge 101 Newbie Poster

Although for testing purposes, i tend use XAMPP for local dev

Squidge 101 Newbie Poster

Thatis an example from PHP.net - this is not from me.t

<?php

    $to = '' // email address where to send
    $subject = '' // Subject matter captured from form
    $message = '' // captured from form

    mail($to, $subject, $message); // Sends the message

?>
Squidge 101 Newbie Poster

Sorry i miss read. you would use the "mail" function:

http://php.net

That should help.

--

I hadnt seen the link you posted.

I have never had to do this that way.

The SMTP would be configured by your hosting, so just use the "mail" function from my link to PHP.net

--

Example:

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>
Squidge 101 Newbie Poster

This is a copy of the drop down i have used on this site: Click Here

<form id="form" method="POST" action="<?php $_SERVER['PHP_SELF']; ?>">
  <select id="sel" name="category">
        <option value="Select">Please select a gallery..</option>
            <?php
                $cxn = mysqli_connect($host,$user,$pword,$db)
                    or die ("Connection failed");
                $query = "SELECT category_id,category_name from gallery_category";
                $result = mysqli_query($cxn,$query)
                    or die ("Query Failed");
             while( $row_1 = mysqli_fetch_array( $result ) )
                {
                    @$photo_category_list .="<option value='$row_1[0]'";
                if ( $_POST["category"] == $row_1[0]) {
                   @$photo_category_list .= " selected";
                    }
                    @$photo_category_list .=">$row_1[1]</option>\n";
                }
                echo $photo_category_list
            ?>
        </select>
        <input name="Submit" type="submit" value="Change Gallery" >
    </form>
Squidge 101 Newbie Poster

is this Windows or Linux based server?

Squidge 101 Newbie Poster

You will need to create a site under SITE> New Site.

Then under this you will "Servers" set your connection to FTP, put in your login details on how you access the domain, switch over to Advanced, set the type of server (PHP/MySQL).

Once saved make sure the tick box is set to "remote"

Squidge 101 Newbie Poster

As pritaeas mentioned some packages havent been maintained for a while. But you will find side branches ofpackages which are being maintained out side of PEAR.net. This can be easily added to your repo

Squidge 101 Newbie Poster

I have used PEAR before, but i though it was being replaced by another version. I cannot remember the name of the darn thing. think it was phasr or something like that

Squidge 101 Newbie Poster

+1 for XAMPP very easy to use.

I have used EasyPHP in the past, but personal preference i choose XAMPP

Squidge 101 Newbie Poster

Does your 'ipnlistener.php' have an unclosed }?

Squidge 101 Newbie Poster

Sorry was at work :)

I would suggest you take your $_POST data and extract it:

<?php
$con = mysql_connect("localhost","root","mevooo");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
else
{
$services = $_POST['Services'];
$title = $_POST['title'];
$rootcause = $_POST['RootCause'];
$risk = $_POST['RiskRating'];
$impact = $_POST['impact'];
$efforts = $_POST['Efforts'];
$likelihood = $_POST['likelihood'];
$finding = $_POST['Finding'];
$implic = $_POST['Implication'];
$recom = $_POST['Recommendation'];
mysql_select_db("ers_1", $con);
$sql="INSERT INTO findings (Finding_ID, ServiceType_ID, Title, RootCause_ID, RiskRating_ID, Impact_ID, Efforts_ID, Likelihood_ID, Finding,Implication, Recommendation, Report_ID) VALUES ( 1, '$services','$title','$rootcause','$risk','$impact','$efforts','$likelihood','$finding','$implic','$recom', 1 )";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
else{
echo "1 record added";
}
}
mysql_close($con);
?>
<input type="button" value="HOME" onclick="location='insert_Data.php'">
Squidge 101 Newbie Poster

errrr..... 42?

Would help if you could supply the error

Squidge 101 Newbie Poster

Also i am sure if this would have the affect but your DOCTYPE is mis spelt

<DCOTYPE html>
<html>

Squidge 101 Newbie Poster

where is your SQL statement?
What uis the content of test.php?

Your form is incomplete, plus you have a FORM within a FORM. I do not beleive this is viable

Squidge 101 Newbie Poster

you could use either CSS tag: margin Click Here, or use a line break (<BR/>)

Squidge 101 Newbie Poster

how have you tried adding it in before?

do you have any examples?

Squidge 101 Newbie Poster

@pritaeas, many thanks

+1

Squidge 101 Newbie Poster

Can anyone else help out on this?

Squidge 101 Newbie Poster

:) nope didnt work

Squidge 101 Newbie Poster

@blocblue,

The idea would be to idetify the form input that contained @, which would then be indentified as an email address, which i can then validate using the FILTER_VALIDATE_EMAIL.

Hope that makes sense.

:EDIT:

So i could in theory then use just this (?):

foreach ($_POST as $formIdentifier => $userInput)
{
    // Filter
    if(!filter_var($userInput, FILTER_VALIDATE_EMAIL))
    {
        echo "email is invalid"; 
        // Add into badData[] array
        # $badData[] ="You have entered an invalid email address";
    }
}
Squidge 101 Newbie Poster

ok i have tidied a small part:

foreach ($_POST as $formIdentifier => $userInput)
{

    // Filter
    if(strtolower($formIdentifier) == "email")
    {
        if(!filter_var($userInput, FILTER_VALIDATE_EMAIL))
        {
            echo "email is invalid";
        }
    }
}

How can i change the "email" to check the variable for any @?

Squidge 101 Newbie Poster

its all very messy at the moment, so would prefer not to post as yet.

But because form fields are always different this is where i cannot get my head round how to set for this in the class

Squidge 101 Newbie Poster

Hi all,

I am working on a generic form validation class.

However I have hit a stubling block. Form fields will never be the same from user to user.

Is there a work around for this? Would it be easier to use numerical values for field names and use multiple validation functions (minimal duplication then :))?

Any assistance would be greatly appreciated

Squidge 101 Newbie Poster

I can't figure out why the contact form doesn't send me a notification email telling me someone submitted a form.

You need to call in (include/require_once) when the form is submitted, which triggers an email

I don't know how to send a user a message through their email saying that we got their form submitted.

As above

I can't figure out how to put a message in the same window saying "Thanks for Submitting Form" without putting this on another page.

You could use if(!isset()) so if the form is not submitted you display the form, else you show the "Thanks", with a timed re direct(?).

I can't figure out how to make fields required.

Basic HTML fields????

I can't figure out a solution in putting ways in checking for real emails, so I don't get spammed by users sending fake emails (the email form has to have the @ symbol in order for it to work).

Click Here

I can't figure out how to allow user's to only send form once.

Login some kind of DB table

If you need help to develop this drop me a PM with further details

Squidge 101 Newbie Poster
<?php

    if ($second == "")
    {
        if($first - $third <= 5)
        {
            echo "<img src='images/img1.png' />";
        }
        else 
        {
            echo "<img src='images/img3.png' />";
        }
    }
    else
    {
        if($first - $second <= 5)
        {
            echo "<img src='images/img1.png' />";
        }
        else
        {
            echo "<img src='images/img2.png' />";
        }
    }

?>

Img 3 will never show as they way you have your logic <=5 & >5 what else is there?

It will be greater or less than or equal to :)

Squidge 101 Newbie Poster

Thanks squidge, working fine as it should now. Thanks a lot

No problems, sorry for the previous error of mine. Been a long day :)

Squidge 101 Newbie Poster

How are you showing this?

    <?php
    $form = "<form method='post' action='signup-p.php' id='signupform'>
    <div class='form'>
    <div class='fieldset'>
    <input name='signup_form' type='hidden' />
    <div class='input'>
    <label for='username'>Username</label>
    <input type='text' name='user' id='username' value='' />
    </div>
    <div class='input'>
    <label for='email'>E-mail</label>
    <input type='text' name='email' id='email' value='' />
    </div>
    <div class='input'>
    <label for='email_confirm'>Confirm E-mail</label>
    <input type='text' name='email_confirm' id='email_confirm' value='' />
    </div>
    <div class='input'>
    <label for='password'>Password</label>
    <input type='password' name='password' id='password' />
    </div>
    <div class='input'>
    <label for='password_confirm'>Confirm password</label>
    <input type='password' name='password_confirm' id='password_confirm' />
    </div>
    </div>
    <div class='button'><strong><input type='submit' class='submit' name='registerbtn' value='Sign up' /></strong></div>
    </div>
    </form>";

    echo $form;

    ?>

Works without iss or error

Squidge 101 Newbie Poster

$form = "<form method='post' action='signup-p.php' id='signupform'>

sorry missed this one. add an echo:

`$form = echo "<form method='post' action='signup-p.php' id='signupform'>

Squidge 101 Newbie Poster

<form method="post" action="signup-p.php" id="signupform">
<div class="form">
<div class="fieldset">
<input name="signup_form" type="hidden" />
<div class="input">
<label for="username">Username</label>
<input type="text" name="user" id="username" value="" />
</div>
<div class="input">
<label for="email">E-mail</label>

I would suggest changing all the " used in this to '

<?php
$form = "<form method='post' action='signup-p.php' id='signupform'>
<div class='form'>
<div class='fieldset'>
<input name='signup_form' type='hidden' />
<div class='input'>
<label for='username'>Username</label>
<input type='text' name='user' id='username' value='' />
</div>
<div class='input'>
<label for='email'>E-mail</label>
<input type='text' name='email' id='email' value='' />
</div>
<div class='input'>
<label for='email_confirm'>Confirm E-mail</label>
<input type='text' name='email_confirm' id='email_confirm' value='' />
</div>
<div class='input'>
<label for='password'>Password</label>
<input type='password' name='password' id='password' />
</div>
<div class='input'>
<label for='password_confirm'>Confirm password</label>
<input type='password' name='password_confirm' id='password_confirm' />
</div>
</div>
<div class='button'><strong><input type='submit' class='submit' name='registerbtn' value='Sign up' /></strong></div>
</div>
</form>";
?>

You also have not terminated your php usng ;

Squidge 101 Newbie Poster

It would help to know the area you want to change to red.

As i had stated you would use an if statement nested into your existing loops. You will need to validate the data:

for example if $result4 == 'data'

Squidge 101 Newbie Poster

why is it stating not to use array_reverse()?

What is this for?

Squidge 101 Newbie Poster

This tutorial may help you Click Here

Squidge 101 Newbie Poster
<table broder="1">
          <tr>
            <td>Result 1</td>
            <td>Result 2</td>
            <td>Result 3</td>
            <td>Result 4</td>
          </tr>

Then step through your while loop.

For changing colour:

if $result4 =='fail'{
    do this
}
Squidge 101 Newbie Poster

the column "aphoto"

mine is just plain blob.

yeah my friends also suggest that holding a picture to a database is a drag..

thay say i'll just create a folder where i can store the images then save the file path into mysql but i have no idea on doing this..

thanks for your suggestion.

Have a look at this tut Click Here

Squidge 101 Newbie Poster

what is the column in your DB set to that holds the image?

I think this has to be Long BLOB or Big BLOB.

I would suggest however not hold images in the table, but holding only the file name. Loading an image out of the DB is very heavy on CPU and network

Squidge 101 Newbie Poster

you havent closed the IF statement, you are missing "}"

Is the image stored in the DB?

Is the image displayed if you put the name in directly?

Squidge 101 Newbie Poster

Is this thread now solved?

Squidge 101 Newbie Poster

what is the output of var_dump($email)?

Is this information transfering?

Squidge 101 Newbie Poster

You can apply formatting to the email also

Squidge 101 Newbie Poster

<form id="form" name="form" method="post" action="name_of_script.php">
<h1>Contact Us</h1>
<label>Name</label>
<input type="text" name="name" id="name" />
<label> Email
</label>
<input type="text" name="email" id="email" />
<label>Comments
</label>
<input type="text" textarea name="comment" id="comment"></textarea>
<button type="submit">Sign-up</button>
<div class="spacer"></div>
</form>

Very basic, but you should get the idea:

<?php

$to = '[YOUR_EMAIL_ADDRESS]';


//Clean data
$name = strip_tags(trim($_POST[name]));
$email = strip_tags(trim($_POST[email]));
$comment = strip_tags(trim($_POST[comment]));

////

$subject = "New form submitted";

$message = $name . "has submitted a form\n";
$message .= "Email address " . $email"\n";
$message .= "Comment: " . $comment;


mail($to,$subject,$message);


?>
Squidge 101 Newbie Poster

can you post your form code?