xcoderx Posted November 5, 2008 Share Posted November 5, 2008 here is the error im getting Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'www'@'localhost' (using password: NO) in /home/www/public_html/src/index.php on line 15 Warning: mysql_query() [function.mysql-query]: Access denied for user 'www'@'localhost' (using password: NO) in /home/www/public_html/src/index.php on line 82 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/www/public_html/src/index.php on line 82 Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/www/public_html/src/index.php on line 83 Warning: mysql_query() [function.mysql-query]: Access denied for user 'www'@'localhost' (using password: NO) in /home/www/public_html/src/index.php on line 153 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/www/public_html/src/index.php on line 153 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/public_html/src/index.php on line 239 Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/www/public_html/src/index.php on line 302 here is my connect db code <? $db_host = "localhost"; $db_name = "pws"; $db_user = "usr"; $db_password = "pass"; ?> and here is my script <? include("db.php"); $UserName = ""; $PassWord = ""; $isLogged = true; if(isset($HTTP_COOKIE_VARS["UserName"]) && isset($HTTP_COOKIE_VARS["PassWord"])) { $UserName = $HTTP_COOKIE_VARS["UserName"]; $PassWord = $HTTP_COOKIE_VARS["PassWord"]; } if(mysql_connect($db_host, $UserName, $PassWord) === false || ($UserName == "" || $PassWord == "")) $isLogged = false; else mysql_select_db($db_name); $item_id = $HTTP_POST_VARS["id"]; //$item_id gets used as a flag for when a new item is created. if($item_id != "" && $isLogged == true) { $name = $HTTP_POST_VARS["name"]; $price = $HTTP_POST_VARS["price"]; $summary = $HTTP_POST_VARS["summary"]; $description = $HTTP_POST_VARS["description"]; $ordre = $HTTP_POST_VARS["ordre"]; if($ordre == "") $ordre = "0"; $update = "update items set ordre = ordre + 1 where ordre >= " . $ordre; mysql_query($update); $insert = "insert into items (name, price, summary, description, ordre) values (" . "'" . $name . "', " . $price . ", " . "'" . $summary . "', " . "'" . $description . "', " . $ordre . ")"; mysql_query($insert); $item_id = mysql_insert_id(); if(isset($HTTP_POST_FILES)) { if(is_uploaded_file($HTTP_POST_FILES["thumbnail"]["tmp_name"])) { $file_handle = fopen($HTTP_POST_FILES["thumbnail"]["tmp_name"], "rb"); $thumbnail = $HTTP_POST_FILES["thumbnail"]["name"]; $file_bytes = addslashes(fread($file_handle, filesize($HTTP_POST_FILES["thumbnail"]["tmp_name"]))); $update = "update items set " . "thumbnail = '" . $file_bytes . "' " . "where id = " . $item_id; mysql_query($update); unlink($HTTP_POST_FILES["thumbnail"]["tmp_name"]); } if(is_uploaded_file($HTTP_POST_FILES["image"]["tmp_name"])) { $file_handle = fopen($HTTP_POST_FILES["image"]["tmp_name"], "rb"); $image = $HTTP_POST_FILES["image"]["name"]; $file_bytes = addslashes(fread($file_handle, filesize($HTTP_POST_FILES["image"]["tmp_name"]))); $update = "update items set " . "image = '" . $file_bytes . "' " . "where id = " . $item_id; mysql_query($update); unlink($HTTP_POST_FILES["image"]["tmp_name"]); } } } $select = "select id from items order by ordre"; $ids = mysql_query($select); while(($id = mysql_fetch_assoc($ids)) && $isLogged == true) { $item_id = $HTTP_POST_VARS["id_" . $id["id"]]; //If the item was modified, save it. if($item_id != "" && $item_id > 0) { $name = $HTTP_POST_VARS["name_" . $id["id"]]; $price = $HTTP_POST_VARS["price_" . $id["id"]]; $summary = $HTTP_POST_VARS["summary_" . $id["id"]]; $description = $HTTP_POST_VARS["description_" . $id["id"]]; $ordre = $HTTP_POST_VARS["ordre_" . $id["id"]]; $update = "update items set " . "name = '" . $name . "', " . "price = " . $price . ", " . "summary = '" . $summary . "', " . "description = '" . $description . "', " . "ordre = " . $ordre . " " . "where id = " . $item_id; mysql_query($update); //Were any files uploaded? if(isset($HTTP_POST_FILES)) { if(is_uploaded_file($HTTP_POST_FILES["thumbnail_" . $item_id]["tmp_name"])) { $file_handle = fopen($HTTP_POST_FILES["thumbnail_" . $item_id]["tmp_name"], "rb"); $thumbnail = $HTTP_POST_FILES["thumbnail_" . $item_id]["name"]; $file_bytes = addslashes(fread($file_handle, filesize($HTTP_POST_FILES["thumbnail_" . $item_id]["tmp_name"]))); $update = "update items set " . "thumbnail = '" . $file_bytes . "' " . "where id = " . $item_id; mysql_query($update); unlink($HTTP_POST_FILES["thumbnail_" . $item_id]["tmp_name"]); } if(is_uploaded_file($HTTP_POST_FILES["image_" . $item_id]["tmp_name"])) { $file_handle = fopen($HTTP_POST_FILES["image_" . $item_id]["tmp_name"], "rb"); $image = $HTTP_POST_FILES["image_" . $item_id]["name"]; $file_bytes = addslashes(fread($file_handle, filesize($HTTP_POST_FILES["image_" . $item_id]["tmp_name"]))); $update = "update items set " . "image = '" . $file_bytes . "' " . "where id = " . $item_id; mysql_query($update); unlink($HTTP_POST_FILES["image_" . $item_id]["tmp_name"]); } } } //Delete items. if($item_id != "" && $item_id < 0) { $delete = "delete from items where id = " . (-$item_id); mysql_query($delete); unlink("./images/item_" . (-$item_id) . "_thumbnail.jpg"); unlink("./images/item_" . (-$item_id) . "_image.jpg"); } } $select = "select * from items order by ordre"; $items = mysql_query($select); ?> <html> <head> <title>item shopping cart edit</title> <script> function NewImage(id) { var File; var Image; var Save; if(id != null) { eval('File = document.cart.image_' + id + ';'); eval('Image = document.images.image_file_' + id + ';'); } else { File = document.cart.image; Image = document.images.image_file; } if(File.value != '') { Image.src = File.value; save_item(id); } } function NewThumb(id) { var File; var Image; var Save; if(id != null) { eval('File = document.cart.thumbnail_' + id + ';'); eval('Image = document.images.thumbnail_file_' + id + ';'); } else { File = document.cart.thumbnail; Image = document.images.thumbnail_file; } if(File.value != '') { Image.src = File.value; save_item(id); } } function save_item(id) { if(id != null) eval('document.cart.id_' + id + '.value = ' + id + ';'); else document.cart.id.value = 0; } function delete_item(id) { eval('document.cart.id_' + id + '.value = ' + (-id) + ';'); document.cart.submit(); } function logout() { document.cookie = 'UserName='; document.cookie = 'PassWord='; document.cart.submit(); } </script> </head> <body <? if($HTTP_POST_VARS["id"] != "") { ?>onload="document.cart.ordre.value = ''; document.cart.submit();"<? } ?>> <form enctype="multipart/form-data" method="post" name="cart"> <input type="hidden" name="ordre" value="<?= $HTTP_POST_VARS["ordre"] ?>" /> <table align="center"> <? if((mysql_num_rows($items) == 0 || $HTTP_POST_VARS["ordre"] != "") && $HTTP_POST_VARS["id"] == "" && $isLogged == true) { ?> <input type="hidden" name="id" /> <tr> <td valign="top"> <table> <tr> <td>item name: </td> <td><input type="text" name="name" onchange="save_item();" /></td> </tr> <tr> <td>price: </td> <td><input type="text" name="price" onchange="save_item();" /></td> </tr> <tr> <td>summary: </td> <td><textarea name="summary" onchange="save_item();"></textarea></td> </tr> <tr> <td>description: </td> <td><textarea name="description" onchange="save_item();"></textarea></td> </td> </tr> <tr> <td> <input type="button" value="save" onclick="document.cart.submit();"/> <input type="button" value="cancel" onclick="document.cart.ordre.value = ''; document.cart.id.value = ''; document.cart.submit();"/> <input type="button" value="log out" onclick="logout();" /> <br /><br /></td> </tr> </table> </td> <td align="right" valign="top" nowrap> thumbnail: <input type="file" name="thumbnail" onchange="NewThumb();" /> <br /> <img name="thumbnail_file" /> <br /> image: <input type="file" name="image" onchange="NewImage();" /> <br /> <img name="image_file" /> </td> </tr> <? } ?> <? while(($item = mysql_fetch_assoc($items)) && ($HTTP_POST_VARS["id"] == null) && ($isLogged == true)) { $item_id = $item["id"]; $name = $item["name"]; $price = $item["price"]; $summary = $item["summary"]; $description = $item["description"]; $thumbnail = $item["thumbnail"]; $image = $item["image"]; $ordre = $item["ordre"]; if(is_dir("images/") == false) mkdir("images/", 0755); $thumbnail_file = "images/item_" . $item_id . "_thumbnail.jpg"; if($thumbnail != "") { $thumbnail_file_handle = fopen("./" . $thumbnail_file, "wb"); fwrite($thumbnail_file_handle, $thumbnail, strlen($thumbnail)); chmod("./" . $thumbnail_file, 0644); } $image_file = "images/item_" . $item_id . "_image.jpg"; if($image != "") { $image_file_handle = fopen("./" . $image_file, "wb"); fwrite($image_file_handle, $image, strlen($image)); chmod("./" . $image_file, 0644); } ?> <input type="hidden" name="id_<?= $item_id ?>" /> <tr> <td valign="top"> <table> <tr> <td>item name: </td> <td><input type="text" name="name_<?= $item_id ?>" value="<?= $name ?>" onchange="save_item(<?= $item_id ?>);" /></td> </tr> <tr> <td>price: </td> <td><input type="text" name="price_<?= $item_id ?>" value="<?= $price ?>" onchange="save_item(<?= $item_id ?>);" /></td> </tr> <tr> <td>summary: </td> <td><textarea name="summary_<?= $item_id ?>" onchange="save_item(<?= $item_id ?>);"><?= $summary ?></textarea></td> </tr> <tr> <td>description: </td> <td><textarea name="description_<?= $item_id ?>" onchange="save_item(<?= $item_id ?>);"><?= $description ?></textarea></td> </tr> <tr> <td>order: </td> <td><input type="text" name="ordre_<?= $item_id ?>" value="<?= $ordre ?>" onchange="save_item(<?= $item_id ?>);" /></td> </tr> <tr> <td> <input type="button" value="add a new item" onclick="document.cart.ordre.value = <?= $ordre + 1 ?>; document.cart.submit();"/> <input type="submit" value="save" /> <input type="button" value="delete" onclick="delete_item(<?= $item_id ?>);" /> <input type="button" value="log out" onclick="logout();" /> <br /><br /> </td> </tr> </table> </td> <td align="right" valign="top" nowrap> thumbnail: <input type="file" name="thumbnail_<?= $item_id ?>" onchange="NewThumb(<?= $item_id ?>);" /> <br /> <img name="thumbnail_file_<?= $item_id ?>" src="<?= $thumbnail_file ?>" /> <br /> image: <input type="file" name="image_<?= $item_id ?>" onchange="NewImage(<?= $item_id ?>);" /> <br /> <img name="image_file_<?= $item_id ?>" src="<?= $image_file ?>" /> <br /> </td> </tr> <? } ?> <? if($isLogged == false) { ?> <tr> <td>User Name </td> <td><input type="text" name="User" /></td> </tr> <tr> <td>Password</td> <td><input type="password" name="Pass" /></td> </tr> <tr> <td colspan="2" align="right"> <input type="button" value="log in" onclick="document.cookie = 'UserName=' + document.cart.User.value; document.cookie = 'PassWord=' + document.cart.Pass.value; document.cart.submit();"> </td> </tr> <? } ?> </table> </form> </body> </html> whats wrong with it ? Link to comment https://forums.phpfreaks.com/topic/131460-help-me-with-this-error-someone/ Share on other sites More sharing options...
Tuskony Posted November 5, 2008 Share Posted November 5, 2008 Are you sure you have permission to access the server? One problem I see is here....on line 15 where you get your 1st error. $UserName = ""; $PassWord = ""; $isLogged = true; if(isset($HTTP_COOKIE_VARS["UserName"]) && isset($HTTP_COOKIE_VARS["PassWord"])) { $UserName = $HTTP_COOKIE_VARS["UserName"]; $PassWord = $HTTP_COOKIE_VARS["PassWord"]; } if(mysql_connect($db_host, $UserName, $PassWord) == false || ($UserName == "" || $PassWord == "")) What you are basically doing is allowing mysql_connect() to call even though you may not have a valid user name and password to provide it with through your "$UserName" and "$Password" variables. Those variables could very well be NULL if the issets() aren't satisfied. You need to call mysql_connect() only if you're sure you have assigned the $UserName and $Password vars... likes this: $UserName = ""; $PassWord = ""; $isLogged = true; if(isset($HTTP_COOKIE_VARS["UserName"]) && isset($HTTP_COOKIE_VARS["PassWord"])) { $UserName = $HTTP_COOKIE_VARS["UserName"]; $PassWord = $HTTP_COOKIE_VARS["PassWord"]; } else { $UserName = "BLANK"; $PassWord = "BLANK"; } //UserName and PassWord should always have an assigned, not null, string. if(mysql_connect($db_host, $UserName, $PassWord) === false || ($UserName == "" || $PassWord == "")) Link to comment https://forums.phpfreaks.com/topic/131460-help-me-with-this-error-someone/#findComment-682737 Share on other sites More sharing options...
xcoderx Posted November 5, 2008 Author Share Posted November 5, 2008 u mean this if(mysql_connect($db_host, $UserName, $PassWord) === false || ($UserName == "" || $PassWord == "")) should be $db_host, $db_user, $db_password well i know i did fix that but its still giving error and yes ofcourse i have full access to my server help me out please brother Link to comment https://forums.phpfreaks.com/topic/131460-help-me-with-this-error-someone/#findComment-682739 Share on other sites More sharing options...
xcoderx Posted November 5, 2008 Author Share Posted November 5, 2008 oh yes u are right i have no assigned and user brother help me out with this its been eating up my haed for ages :'( Link to comment https://forums.phpfreaks.com/topic/131460-help-me-with-this-error-someone/#findComment-682740 Share on other sites More sharing options...
Tuskony Posted November 5, 2008 Share Posted November 5, 2008 Oh even when you have a properly assigned user name and password you're still getting the error? Have you tried substituting your variables in mysql_connect() with a user name and pword you know work? What exactly is this page doing and when are you getting the errors? Link to comment https://forums.phpfreaks.com/topic/131460-help-me-with-this-error-someone/#findComment-682742 Share on other sites More sharing options...
xcoderx Posted November 5, 2008 Author Share Posted November 5, 2008 im getting the error when im not logged as in the enter userid and password in if i assign a username and pws here $UserName = "my server id"; $PassWord = "my server pws"; $isLogged = true; only then i get connected but its still show that error when not logged in and i did try to substitute some but not helping out Link to comment https://forums.phpfreaks.com/topic/131460-help-me-with-this-error-someone/#findComment-682743 Share on other sites More sharing options...
Tuskony Posted November 5, 2008 Share Posted November 5, 2008 I just need to look at the code in php tags ... <? include("db.php"); $UserName = ""; $PassWord = ""; $isLogged = true; if(isset($HTTP_COOKIE_VARS["UserName"]) && isset($HTTP_COOKIE_VARS["PassWord"])) { $UserName = $HTTP_COOKIE_VARS["UserName"]; $PassWord = $HTTP_COOKIE_VARS["PassWord"]; } if(mysql_connect($db_host, $UserName, $PassWord) === false || ($UserName == "" || $PassWord == "")) $isLogged = false; else mysql_select_db($db_name); $item_id = $HTTP_POST_VARS["id"]; //$item_id gets used as a flag for when a new item is created. if($item_id != "" && $isLogged == true) { $name = $HTTP_POST_VARS["name"]; $price = $HTTP_POST_VARS["price"]; $summary = $HTTP_POST_VARS["summary"]; $description = $HTTP_POST_VARS["description"]; $ordre = $HTTP_POST_VARS["ordre"]; if($ordre == "") $ordre = "0"; $update = "update items set ordre = ordre + 1 where ordre >= " . $ordre; mysql_query($update); $insert = "insert into items (name, price, summary, description, ordre) values (" . "'" . $name . "', " . $price . ", " . "'" . $summary . "', " . "'" . $description . "', " . $ordre . ")"; mysql_query($insert); $item_id = mysql_insert_id(); if(isset($HTTP_POST_FILES)) { if(is_uploaded_file($HTTP_POST_FILES["thumbnail"]["tmp_name"])) { $file_handle = fopen($HTTP_POST_FILES["thumbnail"]["tmp_name"], "rb"); $thumbnail = $HTTP_POST_FILES["thumbnail"]["name"]; $file_bytes = addslashes(fread($file_handle, filesize($HTTP_POST_FILES["thumbnail"]["tmp_name"]))); $update = "update items set " . "thumbnail = '" . $file_bytes . "' " . "where id = " . $item_id; mysql_query($update); unlink($HTTP_POST_FILES["thumbnail"]["tmp_name"]); } if(is_uploaded_file($HTTP_POST_FILES["image"]["tmp_name"])) { $file_handle = fopen($HTTP_POST_FILES["image"]["tmp_name"], "rb"); $image = $HTTP_POST_FILES["image"]["name"]; $file_bytes = addslashes(fread($file_handle, filesize($HTTP_POST_FILES["image"]["tmp_name"]))); $update = "update items set " . "image = '" . $file_bytes . "' " . "where id = " . $item_id; mysql_query($update); unlink($HTTP_POST_FILES["image"]["tmp_name"]); } } } $select = "select id from items order by ordre"; $ids = mysql_query($select); while(($id = mysql_fetch_assoc($ids)) && $isLogged == true) { $item_id = $HTTP_POST_VARS["id_" . $id["id"]]; //If the item was modified, save it. if($item_id != "" && $item_id > 0) { $name = $HTTP_POST_VARS["name_" . $id["id"]]; $price = $HTTP_POST_VARS["price_" . $id["id"]]; $summary = $HTTP_POST_VARS["summary_" . $id["id"]]; $description = $HTTP_POST_VARS["description_" . $id["id"]]; $ordre = $HTTP_POST_VARS["ordre_" . $id["id"]]; $update = "update items set " . "name = '" . $name . "', " . "price = " . $price . ", " . "summary = '" . $summary . "', " . "description = '" . $description . "', " . "ordre = " . $ordre . " " . "where id = " . $item_id; mysql_query($update); //Were any files uploaded? if(isset($HTTP_POST_FILES)) { if(is_uploaded_file($HTTP_POST_FILES["thumbnail_" . $item_id]["tmp_name"])) { $file_handle = fopen($HTTP_POST_FILES["thumbnail_" . $item_id]["tmp_name"], "rb"); $thumbnail = $HTTP_POST_FILES["thumbnail_" . $item_id]["name"]; $file_bytes = addslashes(fread($file_handle, filesize($HTTP_POST_FILES["thumbnail_" . $item_id]["tmp_name"]))); $update = "update items set " . "thumbnail = '" . $file_bytes . "' " . "where id = " . $item_id; mysql_query($update); unlink($HTTP_POST_FILES["thumbnail_" . $item_id]["tmp_name"]); } if(is_uploaded_file($HTTP_POST_FILES["image_" . $item_id]["tmp_name"])) { $file_handle = fopen($HTTP_POST_FILES["image_" . $item_id]["tmp_name"], "rb"); $image = $HTTP_POST_FILES["image_" . $item_id]["name"]; $file_bytes = addslashes(fread($file_handle, filesize($HTTP_POST_FILES["image_" . $item_id]["tmp_name"]))); $update = "update items set " . "image = '" . $file_bytes . "' " . "where id = " . $item_id; mysql_query($update); unlink($HTTP_POST_FILES["image_" . $item_id]["tmp_name"]); } } } //Delete items. if($item_id != "" && $item_id < 0) { $delete = "delete from items where id = " . (-$item_id); mysql_query($delete); unlink("./images/item_" . (-$item_id) . "_thumbnail.jpg"); unlink("./images/item_" . (-$item_id) . "_image.jpg"); } } $select = "select * from items order by ordre"; $items = mysql_query($select); ?> <html> <head> <title>item shopping cart edit</title> <script> function NewImage(id) { var File; var Image; var Save; if(id != null) { eval('File = document.cart.image_' + id + ';'); eval('Image = document.images.image_file_' + id + ';'); } else { File = document.cart.image; Image = document.images.image_file; } if(File.value != '') { Image.src = File.value; save_item(id); } } function NewThumb(id) { var File; var Image; var Save; if(id != null) { eval('File = document.cart.thumbnail_' + id + ';'); eval('Image = document.images.thumbnail_file_' + id + ';'); } else { File = document.cart.thumbnail; Image = document.images.thumbnail_file; } if(File.value != '') { Image.src = File.value; save_item(id); } } function save_item(id) { if(id != null) eval('document.cart.id_' + id + '.value = ' + id + ';'); else document.cart.id.value = 0; } function delete_item(id) { eval('document.cart.id_' + id + '.value = ' + (-id) + ';'); document.cart.submit(); } function logout() { document.cookie = 'UserName='; document.cookie = 'PassWord='; document.cart.submit(); } </script> </head> <body <? if($HTTP_POST_VARS["id"] != "") { ?>onload="document.cart.ordre.value = ''; document.cart.submit();"<? } ?>> <form enctype="multipart/form-data" method="post" name="cart"> <input type="hidden" name="ordre" value="<?= $HTTP_POST_VARS["ordre"] ?>" /> <table align="center"> <? if((mysql_num_rows($items) == 0 || $HTTP_POST_VARS["ordre"] != "") && $HTTP_POST_VARS["id"] == "" && $isLogged == true) { ?> <input type="hidden" name="id" /> <tr> <td valign="top"> <table> <tr> <td>item name: </td> <td><input type="text" name="name" onchange="save_item();" /></td> </tr> <tr> <td>price: </td> <td><input type="text" name="price" onchange="save_item();" /></td> </tr> <tr> <td>summary: </td> <td><textarea name="summary" onchange="save_item();"></textarea></td> </tr> <tr> <td>description: </td> <td><textarea name="description" onchange="save_item();"></textarea></td> </td> </tr> <tr> <td> <input type="button" value="save" onclick="document.cart.submit();"/> <input type="button" value="cancel" onclick="document.cart.ordre.value = ''; document.cart.id.value = ''; document.cart.submit();"/> <input type="button" value="log out" onclick="logout();" /> <br /><br /></td> </tr> </table> </td> <td align="right" valign="top" nowrap> thumbnail: <input type="file" name="thumbnail" onchange="NewThumb();" /> <br /> <img name="thumbnail_file" /> <br /> image: <input type="file" name="image" onchange="NewImage();" /> <br /> <img name="image_file" /> </td> </tr> <? } ?> <? while(($item = mysql_fetch_assoc($items)) && ($HTTP_POST_VARS["id"] == null) && ($isLogged == true)) { $item_id = $item["id"]; $name = $item["name"]; $price = $item["price"]; $summary = $item["summary"]; $description = $item["description"]; $thumbnail = $item["thumbnail"]; $image = $item["image"]; $ordre = $item["ordre"]; if(is_dir("images/") == false) mkdir("images/", 0755); $thumbnail_file = "images/item_" . $item_id . "_thumbnail.jpg"; if($thumbnail != "") { $thumbnail_file_handle = fopen("./" . $thumbnail_file, "wb"); fwrite($thumbnail_file_handle, $thumbnail, strlen($thumbnail)); chmod("./" . $thumbnail_file, 0644); } $image_file = "images/item_" . $item_id . "_image.jpg"; if($image != "") { $image_file_handle = fopen("./" . $image_file, "wb"); fwrite($image_file_handle, $image, strlen($image)); chmod("./" . $image_file, 0644); } ?> <input type="hidden" name="id_<?= $item_id ?>" /> <tr> <td valign="top"> <table> <tr> <td>item name: </td> <td><input type="text" name="name_<?= $item_id ?>" value="<?= $name ?>" onchange="save_item(<?= $item_id ?>);" /></td> </tr> <tr> <td>price: </td> <td><input type="text" name="price_<?= $item_id ?>" value="<?= $price ?>" onchange="save_item(<?= $item_id ?>);" /></td> </tr> <tr> <td>summary: </td> <td><textarea name="summary_<?= $item_id ?>" onchange="save_item(<?= $item_id ?>);"><?= $summary ?></textarea></td> </tr> <tr> <td>description: </td> <td><textarea name="description_<?= $item_id ?>" onchange="save_item(<?= $item_id ?>);"><?= $description ?></textarea></td> </tr> <tr> <td>order: </td> <td><input type="text" name="ordre_<?= $item_id ?>" value="<?= $ordre ?>" onchange="save_item(<?= $item_id ?>);" /></td> </tr> <tr> <td> <input type="button" value="add a new item" onclick="document.cart.ordre.value = <?= $ordre + 1 ?>; document.cart.submit();"/> <input type="submit" value="save" /> <input type="button" value="delete" onclick="delete_item(<?= $item_id ?>);" /> <input type="button" value="log out" onclick="logout();" /> <br /><br /> </td> </tr> </table> </td> <td align="right" valign="top" nowrap> thumbnail: <input type="file" name="thumbnail_<?= $item_id ?>" onchange="NewThumb(<?= $item_id ?>);" /> <br /> <img name="thumbnail_file_<?= $item_id ?>" src="<?= $thumbnail_file ?>" /> <br /> image: <input type="file" name="image_<?= $item_id ?>" onchange="NewImage(<?= $item_id ?>);" /> <br /> <img name="image_file_<?= $item_id ?>" src="<?= $image_file ?>" /> <br /> </td> </tr> <? } ?> <? if($isLogged == false) { ?> <tr> <td>User Name </td> <td><input type="text" name="User" /></td> </tr> <tr> <td>Password</td> <td><input type="password" name="Pass" /></td> </tr> <tr> <td colspan="2" align="right"> <input type="button" value="log in" onclick="document.cookie = 'UserName=' + document.cart.User.value; document.cookie = 'PassWord=' + document.cart.Pass.value; document.cart.submit();"> </td> </tr> <? } ?> </table> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/131460-help-me-with-this-error-someone/#findComment-682747 Share on other sites More sharing options...
xcoderx Posted November 5, 2008 Author Share Posted November 5, 2008 oh ok here is where i get the error <? if($isLogged == false) { ?> <tr> <td>User Name </td> <td><input type="text" name="User" /></td> </tr> <tr> <td>Password</td> <td><input type="password" name="Pass" /></td> </tr> <tr> <td colspan="2" align="right"> <input type="button" value="log in" onclick="document.cookie = 'UserName=' + document.cart.User.value; document.cookie = 'PassWord=' + document.cart.Pass.value; document.cart.submit();"> </td> </tr> <? } ?> Link to comment https://forums.phpfreaks.com/topic/131460-help-me-with-this-error-someone/#findComment-682748 Share on other sites More sharing options...
xcoderx Posted November 5, 2008 Author Share Posted November 5, 2008 help someone Link to comment https://forums.phpfreaks.com/topic/131460-help-me-with-this-error-someone/#findComment-682761 Share on other sites More sharing options...
xcoderx Posted November 6, 2008 Author Share Posted November 6, 2008 :'( Link to comment https://forums.phpfreaks.com/topic/131460-help-me-with-this-error-someone/#findComment-683436 Share on other sites More sharing options...
xcoderx Posted November 6, 2008 Author Share Posted November 6, 2008 nobody help me Link to comment https://forums.phpfreaks.com/topic/131460-help-me-with-this-error-someone/#findComment-683441 Share on other sites More sharing options...
kenrbnsn Posted November 6, 2008 Share Posted November 6, 2008 Don't bump so often. People here don't like whiners. Ken Link to comment https://forums.phpfreaks.com/topic/131460-help-me-with-this-error-someone/#findComment-683442 Share on other sites More sharing options...
haku Posted November 6, 2008 Share Posted November 6, 2008 It looks to me like you are trying to connect to your database using form information for the username and password. But these things shouldn't change - the database username and password should be predetermined, and you should be hard coded into your script. Unless for some reason you have a number of different databases that you yourself are connecting to, and you are creating an interface page just for yourself. But if you are trying to check someone's username and password, then first you have to connect to the database using the username and password for the database, then you need to check to see if the user's username and password exist in the database. Link to comment https://forums.phpfreaks.com/topic/131460-help-me-with-this-error-someone/#findComment-683468 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.