Mam problem ze skryptem. probuje zalozyc konto to wyskakuje mi
Fatal error: Cannot redeclare validate() (previously declared in C:\AppServ\www\store\config.ini:48) in C:\AppServ\www\store\config.ini on line 79
<?php
// nazwa organicacji
$title = "SKLEP INTERNETOWY";
// what your selling -- appears on the left sidebar on the main page
$selling = "Soki";
// kolor tla
$bg = "#FFFFFF";
// gorne i boczne ramki
$middle = "#99CCFF";
//
$tophigh = "#6699CC";
// kolor tekstu
$textcolor = "#000000";
// nazwa hosta
$host = "localhost";
// database uzytkownik
$user = "root";
// database haslo
$pass = "";
// database nazwa
$database = "sklep";
// adres www
$website = "www.soki.pl";
// folder ze sklepem
$path = "/localhost/store";
// folder z obrazkami
$image_dir = "/store/images";
// some function definitions
/* this is the validation function needed by checkout.php3 it validates
that all the variables are filled */
function validate($lname,$fname,$address,$city,$state,$zipcode,$country,$email,$telephone)
{
echo "<font size=+1><ul>"; echo " <li><b>Wprowadz imie</li>."; } echo "<li>Wprowadz nazwisko.</li>"; $status=1;}
echo "<li>Wprowadz email.</li>"; $status=1;}
echo "<li>Wprowadz miasto.</li>"; $status=1;}
echo "<li>Wprowadz wojewodztwo.</li>"; $status=1;}
echo "<li>Wprowadz kod pocztowy</li>."; $status=1;}
echo "<li>Wprowadz kraj</li>"; $status=1;}
echo "<li>Wprowadz email.</li>"; $status=1;}
echo "<li>Wprowadz numer telefonu.</li>"; $status=1;}
if($status=="1") {die();} }
/* credit cart validation function
This was originally done by Brett@InterWebDesign.com, I modified the code to fit
my needs*/
function credit_card($cardnum, $type = 'none'){
if ($type == 'none') {
// Do nothing
}
elseif ($type == 'mastercard'){
if (strlen($cardnum) != 16
|| !ereg( '^5[1-5]', $cardnum)) { die("You have entered an invalid Mastercard number. Please re-enter your credit card information."); }
return 0;
}
elseif ($type == 'visa'){
if ((strlen($cardnum) != 13
&& strlen($cardnum) != 16
) || substr($cardnum, 0, 1) != '4') { die("You have entered an invalid Visa number. Please re-enter your credit card information."); }
return 0;
}
elseif ($type == 'amex'){
if (strlen($cardnum) != 15
|| !ereg( '^3[47]', $cardnum)) { die("You have entered an invalid American Express number. Please re-enter your credit card information.");
return 0; }
}
elseif ($type == 'discover'){
if (strlen($cardnum) != 16
|| substr($cardnum, 0, 4) != '6011') { die("You have entered an invalid Discover number. Please re-enter your credit card information.");
return 0; }
}
else {
//invalid type entered
die("Invalid type. Please select a different type."); return -1;
}
// Start MOD 10 checks
$dig = toCharArray($cardnum);
$j = 0;
for ($i=($numdig-2); $i>=0; $i-=2){
$dbl[$j] = $dig[$i] * 2;
$j++;
}
$validate =0;
for ($i=0;$i<$dblsz;$i++){
$add = toCharArray($dbl[$i]);
for ($j=0;$j<sizeof($add);$j++){
$validate += $add[$j];
}
$add = '';
}
for ($i=($numdig-1); $i>=0; $i-=2){
$validate += $dig[$i];
}
if (substr($validate, -1, 1) == '0') return 1; else return 0;
}
// takes a string and returns an array of characters
function toCharArray($input){
for ($j=0;$j<$len;$j++){
$char[$j] = substr($input, $j, 1
); }
return ($char);
}
?>
Natomias jak zaloze konto przez Mysql i probuje sie zalogowac to dostaje
Warning: include(conn.inc) [function.include]: failed to open stream: No such file or directory in C:\AppServ\www\store\login.php3 on line 60
Warning: include() [function.include]: Failed opening 'conn.inc' for inclusion (include_path='.;C:\php5\pear') in C:\AppServ\www\store\login.php3 on line 60
Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\AppServ\www\store\login.php3 on line 62
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\AppServ\www\store\login.php3 on line 62
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\store\login.php3 on line 63
<?
if(!isset($store_user_cookie) && !isset($store_user) || ($store_user_cookie == 'deleted')) { ?>
<? require("config.ini"); ?>
<body text="#000000" bgcolor="#FFFFFF">
<center>
<table border=1 width=500 cellspacing=0 cellpading=8>
<tr>
<td align=center colspan=2>
<font size=5 face="Times">
<i>
<? echo $title ?> online store</i></font>
</td>
</tr>
<tr>
<td align=center colspan=2>
Musisz sie zalogowac zanim kupisz.
</td>
</tr>
<tr>
<td align=center>
<form method=post action="
<? echo $PHP_SELF; ?>">
<table>
<tr>
<td>
<b>Uzytkownik:</b>
</td>
<td>
<input type=text size=20 name="store_user">
</td>
</tr>
<tr>
<td>
<b>Haslo:</b>
</td>
<td>
<input type=password size=20 name="store_user_pw">
</td>
</tr>
<tr>
<td colspan=2>
<input type=submit name="login" value="Login">
</td>
</tr>
<tr>
<td colspan=2>
Utworz nowe konto <a href="license.php3">click here</a>.
</td>
</tr>
</table>
</td>
</tr>
</table>
<?
}
elseif($login == "Login" && !isset($store_user_cookie)) { $password=$store_user_pw;
include("conn.inc");
$query = mysql_query("select username,password from users where username='$username' and password='$password'");
?>
<body>
<center>
<table border=1 width=500 cellspacing=0 cellpading=8>
<tr>
<td align=center><font size=5 face="Times"> <i>
<? echo $title; ?> online store
</i></font></td></tr>
<tr>
<td>
<table>
<tr><td>Niewlasciwy uzytkownik albo haslo.<br>
Musisz sie zalogowac zanim kupisz. Utworz konto(it's free)
<a href="license.php3">click here</a>.
</td></tr>
</table>
</td></tr>
</table>
<?
}
SetCookie("store_user_cookie",$username,time()+3600,"/","$SERVER_NAME");
}
elseif($action == "logoff") {
SetCookie("store_user_cookie","",time()+3600,"/","$SERVER_NAME"); Header("Location: http://$SERVER_NAME"); }
elseif(isset($store_user_cookie)) { echo "<i>$store_user_cookie</i> is logged in. <a href="login.php3?action=logoff">logoff</a>";
}
?>
pomocy (IMG:
http://forum.php.pl/style_emoticons/default/sad.gif)