Jump to content
php.lv forumi

nosutisana


Martins Zemitis
 Share

Recommended Posts

Sveiki man ir luk gatavs scripts itkaa vis darbojas normali, bet nenosuta atiecigo informaciju uz e-pastu varbut kads zin kur ir vaina ?

 

<?php

function show_form()

{

?>

 

<form action="" method="post">

<p align="left">Dziesmas nosaukums *<br>

<input type="text" name="name" size="70" />

</p>

<p align="left">Jusu e-pasts *<br>

<input type="text" name="email" size="70"></p>

<p align="left">Club, Dance, Electro, Progressive, Trance, Hip-Hop, Cits.<br>

<input type="text" name="title" size="70"></p>

<p align="left">Link uz lejupladi *<br>

<textarea rows="10" name="mess" cols="70">http://</textarea></p>

 

<p align="left"><input type="submit" value="Nosutit" name="submit"></p>

</form>

 

<?

}

 

function complete_mail() {

$_POST['title'] = substr(htmlspecialchars(trim($_POST['title'])), 0, 1000);

$_POST['mess'] = substr(htmlspecialchars(trim($_POST['mess'])), 0, 1000000);

$_POST['name'] = substr(htmlspecialchars(trim($_POST['name'])), 0, 30);

$_POST['email'] = substr(htmlspecialchars(trim($_POST['email'])), 0, 50);

 

if (empty($_POST['name']))

output_err(0);

 

if(!preg_match("/[0-9a-z_]+@[0-9a-z_^\.]+\.[a-z]{2,3}/i", $_POST['email']))

output_err(1);

 

if(empty($_POST['mess']))

output_err(2);

 

$mess = '

Dziesmam nosaukums:'.$_POST['name'].'

Sūtītāja e-pasts:'.$_POST['email'].'

Link uz download:'.$_POST['mess'];

 

$to = 'mansepasts@inbox.lv';

 

 

 

echo '<br><strong>

<p class="box_green">Paldies! Jusu izveleta dziesma nosutita.</p></strong>';

}

 

function output_err($num)

{

$err[0] = '<p class="box_blue">Kluda! Ievadiet dziesmas nosaukumu.</p>';

$err[1] = '<p class="box_blue">Kluda! Ievadiet e-pastu.</p>';

$err[2] = '<p class="box_blue">Kluda! Nav links uz lejupladi.</p>';

 

echo '<p>'.$err[$num].'</p>';

show_form();

exit();

}

 

if (!empty($_POST['submit'])) complete_mail();

else show_form();

?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...