Warring Errors i keep getting... i was try'n to make a sight where u can send cards like Ecards but something was wrong w/ the code and this is the Error i keep getting can anyone HELP??
Warning: file(cards/cardfile.txt): failed to open stream: No such file or directory in /home/varinder/domains/varinderbola.com/public_html/cards/send.php3 on line 32
Warning: fopen(cards/cardfile.txt): failed to open stream: No such file or directory in /home/varinder/domains/varinderbola.com/public_html/cards/send.php3 on line 49
Warning: fgets(): supplied argument is not a valid stream resource in /home/varinder/domains/varinderbola.com/public_html/cards/send.php3 on line 51
Warning: fclose(): supplied argument is not a valid stream resource in /home/varinder/domains/varinderbola.com/public_html/cards/send.php3 on line 54
A preview was NOT provided because a valid email address was not provided!
i've included the code if anyone can help me???
<?php
// Variables
$cardfile="cards/cardfile.txt"; // Text file for saving cards
// Counter Script
$free=0;
$empty="empty\n";
$oldcards = file($cardfile);
$total = count($oldcards);
for($i = 0 ; $i < count($oldcards) ; $i++) {
if($array[$i] == $empty) {
$free=$i;
}
}
if($free=="0"){
if($oldcards==$empty){
$free=0;
}
else {
$free=$total;
}
}
// Place existing cards into an array.
$fd = fopen("$cardfile", "r");
$oldcards = ""; // Leave this blank
while ($buffer = fgets($fd, 4096)) {
$oldcards .= $buffer;
}
fclose($fd);
// Change Text so that it doesn't interfere with messages
$message = str_replace(":",chr(0),$message); // Colon to null character
$message = str_replace(" "," ",$message); // Double Space to HTML Space ( 
$remail = str_replace(":",chr(0),$remail);
$recipient = str_replace(":",chr(0),$recipient);
$semail = str_replace(":",chr(0),$semail);
$sender = str_replace(":",chr(0),$sender);
// Generate a Random Number - Security
srand((double)microtime()*1000000); // Random Seed
$random = rand(1000,9000); // Range (between 1000-9000)
// What is written to the Text File
$newcard = $free+1 . ":" . $picture . ":" . nl2br(htmlentities($remail)) . ":" . nl2br(htmlentities($recipient)) . ":" . nl2br(htmlentities($semail)) . ":" . nl2br(htmlentities($sender)) . ":" . eregi_replace("\n", "<br>", $message ) . ":" . $random . "\n";
$allcards = $oldcards . $newcard;
$idnumber=$free+1;
// If the recipient's email is correct
if (eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$", $remail)) {
// Preview Message
echo "<table BORDER=0 WIDTH=\"100%\">\n<tr>\n<td ALIGN=CENTER VALIGN=TOP>\n<IMG src=\"graphics/$picture\">\n</td>\n ";
echo "<td VALIGN=TOP>\n<table BORDER=0 CELLSPACING=0 CELLPADDING=0 COLS=2 WIDTH=\"100%\">\n<tr>\n<td>\n<b>To:</b>\n</td>\n<td>\n<a href=\"mailto:$remail\">";
echo stripslashes(htmlentities($recipient)) . "</a>\n</td>\n</tr>\n";
echo "<tr>\n<td>\n<b>From:</b></td>\n<td>\n<a href=\"mailto:$semail\">";
echo stripslashes(htmlentities($sender)) . "</a>\n</td>\n</tr>\n</table>\n";
echo "<B>Message:</B><BR>" . stripslashes(nl2br(htmlentities($message))) . "</td>\n</td>\n</tr>\n</table>\n";
// If the sender's email is correct
if (eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$", $semail)) {
if ($epost == "yes") { // Write to file
$cartFile = fopen("$cardfile","w");
fwrite($cartFile,$allcards);
fclose($cartFile);
// Message to be included in email
$email_message = "To pick up your card, visit
and enter Card Number $idnumber and ID number: $random
or
click on
http://www.openconcept.on.ca/cards/r...php3?viewcard=$idnumber&random=$random
The Message Text Follows:
" . eregi_replace("<br>", "\n",stripslashes($message));
// Send to recipient - Taken Out: Reply-To: $semail \r\n X-Mailer: PHP3 \r\n
mail(stripslashes($recipient) . "<$remail>", stripslashes($sender) . " has sent you a card", $email_message,"From: $semail \nReply-To:$semail\nX-Mailer: PHP3\r\n Errors-To: [email protected]");
// To send another card
echo "<P><hr width=\"50%\"><P>Your card number $idnumber has been sent to " . stripslashes($recipient);
echo "<p>\n<strong>Would you like to send another card?</strong><p>\n";
echo "<form method=\"GET\" action=\"send.phtml\">";
echo "<input type=\"radio\" value=\"yes\" NAME=\"epost\">Yes, please!";
echo "<input type=\"radio\" value=\"no\" NAME=\"epost\">No, thank you.";
echo "<input type=hidden name=\"remail\" value=\"$remail\">";
echo "<input type=hidden name=\"recipient\" value=\"" . stripslashes(htmlentities($recipient)) . "\">";
echo "<input type=hidden name=\"semail\" value=\"$semail\">";
echo "<input type=hidden name=\"sender\" value=\"" . stripslashes(htmlentities($sender)) . "\">";
echo "<input type=\"submit\" value=\"Submit\"></form><br>";
}
elseif ($epost == "no") {
echo "<P><hr width=\"50%\"><P><strong>Would you like to try again?</strong><p>\n";
echo "<form method=\"GET\" action=\"send.phtml\">";
echo "<input type=\"radio\" value=\"yes\" NAME=\"epost\">Yes, please!";
echo "<input type=\"radio\" value=\"no\" NAME=\"epost\">No, thank you.";
echo "<input type=hidden name=\"picture\" value=\"$picture\">";
echo "<input type=hidden name=\"remail\" value=\"$remail\">";
echo "<input type=hidden name=\"recipient\" value=\"" . stripslashes(htmlentities($recipient)) . "\">";
echo "<input type=hidden name=\"semail\" value=\"$semail\">";
echo "<input type=hidden name=\"sender\" value=\"" . stripslashes(htmlentities($sender)) . "\">";
echo "<input type=hidden name=\"message\" value=\"" . stripslashes(htmlentities($message)) . "\">";
echo "<input type=\"submit\" value=\"Submit\"></form><br>";
}
else {
echo "<P><hr width=\"50%\"><P><strong>You have not YET sent the card.</strong><p>\n";
echo "<form method=\"GET\" action=\"send.php3\">";
echo "<input type=\"radio\" value=\"yes\" NAME=\"epost\">Yes, please send my card!";
echo "<input type=\"radio\" value=\"no\" NAME=\"epost\">No thank you.";
echo "<input type=hidden name=\"picture\" value=\"$picture\">";
echo "<input type=hidden name=\"remail\" value=\"$remail\">";
echo "<input type=hidden name=\"recipient\" value=\"" . stripslashes(htmlentities($recipient)) . "\">";
echo "<input type=hidden name=\"semail\" value=\"$semail\">";
echo "<input type=hidden name=\"sender\" value=\"" . stripslashes(htmlentities($sender)) . "\">";
echo "<input type=hidden name=\"message\" value=\"" . stripslashes(htmlentities($message)) . "\">";
echo "<input type=hidden name=\"idnumber\" value=\"$idnumber\">";
echo "<input type=hidden name=\"\" value=\"$\">";
echo "<input type=\"submit\" value=\"Submit\"></form><br>";
}
} // End of verification for $semail
else { echo "<strong>This card was NOT sent because a valid email address was not provided!</strong><p>\n"; }
} // End of verification for $remail
else { echo "<strong>A preview was NOT provided because a valid email address was not provided!</strong><p>\n"; }
?>
Warning: file(cards/cardfile.txt): failed to open stream: No such file or directory in /home/varinder/domains/varinderbola.com/public_html/cards/send.php3 on line 32
Warning: fopen(cards/cardfile.txt): failed to open stream: No such file or directory in /home/varinder/domains/varinderbola.com/public_html/cards/send.php3 on line 49
Warning: fgets(): supplied argument is not a valid stream resource in /home/varinder/domains/varinderbola.com/public_html/cards/send.php3 on line 51
Warning: fclose(): supplied argument is not a valid stream resource in /home/varinder/domains/varinderbola.com/public_html/cards/send.php3 on line 54
A preview was NOT provided because a valid email address was not provided!
i've included the code if anyone can help me???
<?php
// Variables
$cardfile="cards/cardfile.txt"; // Text file for saving cards
// Counter Script
$free=0;
$empty="empty\n";
$oldcards = file($cardfile);
$total = count($oldcards);
for($i = 0 ; $i < count($oldcards) ; $i++) {
if($array[$i] == $empty) {
$free=$i;
}
}
if($free=="0"){
if($oldcards==$empty){
$free=0;
}
else {
$free=$total;
}
}
// Place existing cards into an array.
$fd = fopen("$cardfile", "r");
$oldcards = ""; // Leave this blank
while ($buffer = fgets($fd, 4096)) {
$oldcards .= $buffer;
}
fclose($fd);
// Change Text so that it doesn't interfere with messages
$message = str_replace(":",chr(0),$message); // Colon to null character
$message = str_replace(" "," ",$message); // Double Space to HTML Space ( 

$remail = str_replace(":",chr(0),$remail);
$recipient = str_replace(":",chr(0),$recipient);
$semail = str_replace(":",chr(0),$semail);
$sender = str_replace(":",chr(0),$sender);
// Generate a Random Number - Security
srand((double)microtime()*1000000); // Random Seed
$random = rand(1000,9000); // Range (between 1000-9000)
// What is written to the Text File
$newcard = $free+1 . ":" . $picture . ":" . nl2br(htmlentities($remail)) . ":" . nl2br(htmlentities($recipient)) . ":" . nl2br(htmlentities($semail)) . ":" . nl2br(htmlentities($sender)) . ":" . eregi_replace("\n", "<br>", $message ) . ":" . $random . "\n";
$allcards = $oldcards . $newcard;
$idnumber=$free+1;
// If the recipient's email is correct
if (eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$", $remail)) {
// Preview Message
echo "<table BORDER=0 WIDTH=\"100%\">\n<tr>\n<td ALIGN=CENTER VALIGN=TOP>\n<IMG src=\"graphics/$picture\">\n</td>\n ";
echo "<td VALIGN=TOP>\n<table BORDER=0 CELLSPACING=0 CELLPADDING=0 COLS=2 WIDTH=\"100%\">\n<tr>\n<td>\n<b>To:</b>\n</td>\n<td>\n<a href=\"mailto:$remail\">";
echo stripslashes(htmlentities($recipient)) . "</a>\n</td>\n</tr>\n";
echo "<tr>\n<td>\n<b>From:</b></td>\n<td>\n<a href=\"mailto:$semail\">";
echo stripslashes(htmlentities($sender)) . "</a>\n</td>\n</tr>\n</table>\n";
echo "<B>Message:</B><BR>" . stripslashes(nl2br(htmlentities($message))) . "</td>\n</td>\n</tr>\n</table>\n";
// If the sender's email is correct
if (eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$", $semail)) {
if ($epost == "yes") { // Write to file
$cartFile = fopen("$cardfile","w");
fwrite($cartFile,$allcards);
fclose($cartFile);
// Message to be included in email
$email_message = "To pick up your card, visit
and enter Card Number $idnumber and ID number: $random
or
click on
http://www.openconcept.on.ca/cards/r...php3?viewcard=$idnumber&random=$random
The Message Text Follows:
" . eregi_replace("<br>", "\n",stripslashes($message));
// Send to recipient - Taken Out: Reply-To: $semail \r\n X-Mailer: PHP3 \r\n
mail(stripslashes($recipient) . "<$remail>", stripslashes($sender) . " has sent you a card", $email_message,"From: $semail \nReply-To:$semail\nX-Mailer: PHP3\r\n Errors-To: [email protected]");
// To send another card
echo "<P><hr width=\"50%\"><P>Your card number $idnumber has been sent to " . stripslashes($recipient);
echo "<p>\n<strong>Would you like to send another card?</strong><p>\n";
echo "<form method=\"GET\" action=\"send.phtml\">";
echo "<input type=\"radio\" value=\"yes\" NAME=\"epost\">Yes, please!";
echo "<input type=\"radio\" value=\"no\" NAME=\"epost\">No, thank you.";
echo "<input type=hidden name=\"remail\" value=\"$remail\">";
echo "<input type=hidden name=\"recipient\" value=\"" . stripslashes(htmlentities($recipient)) . "\">";
echo "<input type=hidden name=\"semail\" value=\"$semail\">";
echo "<input type=hidden name=\"sender\" value=\"" . stripslashes(htmlentities($sender)) . "\">";
echo "<input type=\"submit\" value=\"Submit\"></form><br>";
}
elseif ($epost == "no") {
echo "<P><hr width=\"50%\"><P><strong>Would you like to try again?</strong><p>\n";
echo "<form method=\"GET\" action=\"send.phtml\">";
echo "<input type=\"radio\" value=\"yes\" NAME=\"epost\">Yes, please!";
echo "<input type=\"radio\" value=\"no\" NAME=\"epost\">No, thank you.";
echo "<input type=hidden name=\"picture\" value=\"$picture\">";
echo "<input type=hidden name=\"remail\" value=\"$remail\">";
echo "<input type=hidden name=\"recipient\" value=\"" . stripslashes(htmlentities($recipient)) . "\">";
echo "<input type=hidden name=\"semail\" value=\"$semail\">";
echo "<input type=hidden name=\"sender\" value=\"" . stripslashes(htmlentities($sender)) . "\">";
echo "<input type=hidden name=\"message\" value=\"" . stripslashes(htmlentities($message)) . "\">";
echo "<input type=\"submit\" value=\"Submit\"></form><br>";
}
else {
echo "<P><hr width=\"50%\"><P><strong>You have not YET sent the card.</strong><p>\n";
echo "<form method=\"GET\" action=\"send.php3\">";
echo "<input type=\"radio\" value=\"yes\" NAME=\"epost\">Yes, please send my card!";
echo "<input type=\"radio\" value=\"no\" NAME=\"epost\">No thank you.";
echo "<input type=hidden name=\"picture\" value=\"$picture\">";
echo "<input type=hidden name=\"remail\" value=\"$remail\">";
echo "<input type=hidden name=\"recipient\" value=\"" . stripslashes(htmlentities($recipient)) . "\">";
echo "<input type=hidden name=\"semail\" value=\"$semail\">";
echo "<input type=hidden name=\"sender\" value=\"" . stripslashes(htmlentities($sender)) . "\">";
echo "<input type=hidden name=\"message\" value=\"" . stripslashes(htmlentities($message)) . "\">";
echo "<input type=hidden name=\"idnumber\" value=\"$idnumber\">";
echo "<input type=hidden name=\"\" value=\"$\">";
echo "<input type=\"submit\" value=\"Submit\"></form><br>";
}
} // End of verification for $semail
else { echo "<strong>This card was NOT sent because a valid email address was not provided!</strong><p>\n"; }
} // End of verification for $remail
else { echo "<strong>A preview was NOT provided because a valid email address was not provided!</strong><p>\n"; }
?>
Comment