Page 1 of 1

Swift Mailer Forum

Posted: Thu Oct 05, 2006 11:26 pm
by Burrito
This forum is dedicated to the Swift Mailer library. Any and all discussions about this library should be handled here. Any questions about the library should be posted in here.

See the project here

Stack It: http://www.ohloh.net/projects/3791

log

Posted: Thu Aug 26, 2010 10:48 pm
by engicos
<?php
// Connects to your Database
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("uploaddb") or die(mysql_error());
if(isset($_COOKIE['ID_my_site']))
if there is, it logs you in and directes you to the members page
{
$username = $_COOKIE['ID_my_site'];
$pass = $_COOKIE['Key_my_site'];
$check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());
while($info = mysql_fetch_array( $check ))
{
if ($pass != $info['password'])
{}
else
{header("Location: members.php");
}}
}*/

//if the login form is submitted
if (isset($_POST['submit'])) { // if form has been submitted
if(!$_POST['username'] | !$_POST['pass']) {
die('You did not fill in a required field.'); exit;
}
$check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error());
$check2 = mysql_num_rows($check);
if ($check2 == 0) {
die('That user does not exist in our database. <a href=reg.php>Click Here to Register</a>');
}
while($info = mysql_fetch_array( $check ))
{
$_POST['pass'] = stripslashes($_POST['pass']);
$info['password'] = stripslashes($info['password']);
$_POST['pass'] = md5($_POST['pass']);
if ($_POST['pass'] != $info['password']) {
die('Incorrect password, please try again.');
}
else
{
$_POST['username'] = stripslashes($_POST['username']);
$hour = time() + 3600;
setcookie(ID_my_site, $_POST['username'], $hour);
setcookie(Key_my_site, $_POST['pass'], $hour);
echo "login successful";
//then redirect them to the members area
//header("Location: members.php");
}}}
else
{
?>
</script>
</head>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<h1>Login</h1>
Username:<input type="text" name="username" onClick="alert('hi')" maxlength="40">
Password:<input type="password" name="pass" maxlength="50">
<input type="submit" name="submit" value="Login">
</form>
<?php
}
?>

reg

Posted: Thu Aug 26, 2010 10:50 pm
by engicos
<?php
// Connects to your Database
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("uploaddb") or die(mysql_error());
//This code runs if the form has been submitted
if (isset($_POST['submit'])) {
//This makes sure they did not leave any fields blank
if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) {
die('You did not complete all of the required fields');
}
// checks if the username is in use
if (!get_magic_quotes_gpc()) {
$_POST['username'] = addslashes($_POST['username']);
}
$usercheck = $_POST['username'];
$check = mysql_query("SELECT username FROM users WHERE username = '$usercheck'")
or die(mysql_error());
$check2 = mysql_num_rows($check);
//if the name exists it gives an error
if ($check2 != 0) {
die('Sorry, the username '.$_POST['username'].' is already in use.');
}
// this makes sure both passwords entered match
if ($_POST['pass'] != $_POST['pass2']) {
die('Your passwords did not match. ');
}
// here we encrypt the password and add slashes if needed
$_POST['pass'] = md5($_POST['pass']);
if (!get_magic_quotes_gpc()) {
$_POST['pass'] = addslashes($_POST['pass']);
$_POST['username'] = addslashes($_POST['username']);
}
// now we insert it into the database
$insert = "INSERT INTO users (username, password)
VALUES ('".$_POST['username']."', '".$_POST['pass']."')";
$add_member = mysql_query($insert);
?>
<h1>Registered</h1>
<p>Thank you, you have registered - <a href="login.php">you may now login</a>.</p>
<?php
}
else
{
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
Username:
<input type="text" name="username" maxlength="60">
Password:
<input type="password" name="pass" maxlength="10">
Confirm Password:
<input type="password" name="pass2" maxlength="10">
<input type="submit" name="submit" value="Register">
</form>
<?php
}
?>

img

Posted: Thu Aug 26, 2010 10:51 pm
by engicos
<?php
mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("imageupload") or die ("database not found");

$maxfilesize = 1000000;

$image_array = array("image/jpeg","image/jpg");

$filetype = $_FILES["userfile"]["type"];

if(isset($_POST['Submit'])){
if(in_array($filetype,$image_array)){
if($_FILES["userfile"]["size"] < $maxfilesize){
$image_data= addslashes(file_get_contents($_FILES["userfile"]["tmp_name"]));

$sql = "INSERT INTO images (title,imgdata) VALUES(\"".$_REQUEST[title]."\",\"".$image_data."\")";
mysql_query($sql);



$fetch = "SELECT * FROM images ORDER BY uid DESC LIMIT 1";
$result= mysql_query($fetch);


header("Content-type: image/jpeg");
$row = mysql_fetch_row($result);
echo $row[2];

}
else{
$msg = "filesize exceeded";
}
}
else{
$msg = "filetype not supported";
}
}
?>

<html>
<title>image upload</title>
<head>
<link rel="stylesheet" type="text/css" href="lipstick.css" />
<script src = "jav.js" type="text/javascript"></script>
</head>
<body >
<span class=xyz><?php echo $msg; ?></span><br />

<h3>Select File to upload</h3>

<form enctype="multipart/form-data" action="" method="post">
Please choose an image to upload:<input onclick="abhi()" name="userfile" type="file" /><br /><br />
Please enter the title of that picture:<input onblur="a()" name="title" /><br /><br />
<input type="submit" value="submit" name="Submit"/>
</form>
</body>
</html>