Ninjakreborn Posted July 3, 2006 Share Posted July 3, 2006 I have been waiting for allmost 2 weeks php freaks to get back up and running I couldn't get on, but now it's fixed I had a question I really needed help with.I am having a problem doing something with a pre-existing script, I fixed up a lot of the issues with it, but now I need some help with this. I was having connection issues but I got it fixed, this was not my script, I just did some major ass reconstruction to try and get it to work right, and then I encounter this, when you click on the form on this page, it doesn't do anything, even though the script is telling it to do something, on top of that, the main thing is, I register, and it makes a username and password, but nothing works when trying to log in, which is the same page the form is, that is actually the form that doesn't work for some reason.page with form[url=http://www.asicip.com/login.php]http://www.asicip.com/login.php[/url]Here is the code for that page, and for the include that does the connection, the connection seems to work, I have used it and it connected properly on the page, I had some connection issues before, but I had someone help me fix those specifically.Now what is wrong with it, any adviceLog-in page[code]<?phpsession_start();require_once("incs/conn.inc.php"); if(isset($_POST['submit'])) { $sql = "select id_administrator,superuser from administrators where username = '".$_POST['username']."' and password = '".$_POST['password']."'"; $rez = mysql_query($sql) or die (mysql_error()); if(mysql_num_rows($rez) > 0){ $row = mysql_fetch_row($rez) or die("The mysql fetch row is not working"); session_register("administrator_portal") or die("Session register issues"); $_SESSION['administrator_portal'] = $row[0]; $_SESSION['superuser'] = $row[1]; $sql="update `administrators` set `LastLoginAdmin`=Now() where id_administrator=".$_SESSION['administrator_portal']; $result=mysql_query($sql,$conn); header("Location: download2.php"); exit; }else{ $msg = "The username or password are wrong."; } } if($_GET['erroare'] == "nr"){ $msg = "Ne pare rau insa sesiunea dumneavostra a expirat.<br> You must log on."; }?><html><head><LINK href="style.css" rel=stylesheet type=text/css><title>ASIC IP</title></head><body bgcolor="#9aa8c7" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0"><script type="text/javascript">if (parseInt(navigator.appVersion.substring(0,1))>=3) { // 3.0 or greater.ch1_on = new Image(); ch1_off = new Image();ch2_on = new Image(); ch2_off = new Image();ch3_on = new Image(); ch3_off = new Image();ch4_on = new Image(); ch4_off = new Image();ch5_on = new Image(); ch5_off = new Image();ch6_on = new Image(); ch6_off = new Image();ch7_on = new Image(); ch7_off = new Image();ch8_on = new Image(); ch8_off = new Image();ch1_on.src = 'images/b_homeap.gif';ch1_off.src = 'images/b_home.gif';ch2_on.src = 'images/b_aboutap.gif';ch2_off.src = 'images/b_about.gif';ch3_on.src = 'images/b_infoap.gif';ch3_off.src = 'images/b_info.gif';ch4_on.src = 'images/b_downloadap.gif';ch4_off.src = 'images/b_download.gif';ch5_on.src = 'images/b_careerap.gif';ch5_off.src = 'images/b_career.gif';ch6_on.src = 'images/b_teamap.gif';ch6_off.src = 'images/b_team.gif';ch7_on.src = 'images/b_pressap.gif';ch7_off.src = 'images/b_press.gif';ch8_on.src = 'images/b_contactap.gif';ch8_off.src = 'images/b_contact.gif';}function activate(image) { if (parseInt(navigator.appVersion.substring(0,1))>=3) { // 3.0 or greater. imagesrc = eval(image + '_on.src'); document[image].src = imagesrc; }}function deactivate(image) { if (parseInt(navigator.appVersion.substring(0,1))>=3) { // 3.0 or greater. imagesrc = eval(image + "_off.src"); document[image].src = imagesrc; }}</script><center><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td align="right" valign="top"> </td><td align="center"><table border="0" cellpadding="0" cellspacing="0" bgcolor="#000000" width="700"><tr><td bgcolor="#9aa8c7"><? include("incs/top_menu.inc.php"); ?><table border="0" cellpadding="0" cellspacing="0" width="700" bgcolor="#FFFFFF"> <tr><td> <table border="0" cellpadding="0" cellspacing="0" width="700"> <tr> <td width="6"> </td> <td width="164" valign="top" bgcolor="#f1f1f1"> <table border="0" cellpadding="0" cellspacing="0"> <tr><td width="6"></td><td height="24"> <font class="titlu2">Downloads : :</font> </td></tr> </table> <img src="images/p.gif" width="164" height="1" border="0"><br> <table border="0" cellpadding="0" cellspacing="0"> <tr><td width="10" height="20"></td><td> <a href="download.php" class="n">Downloads</a> </td></tr> </table> <img src="images/p.gif" width="164" height="1" border="0"><br> <table border="0" cellpadding="0" cellspacing="0"> <tr><td width="10" height="20"></td><td> <a href="login.php" class="n">Login</a> </td></tr> </table> <img src="images/p.gif" width="164" height="1" border="0"><br> <table border="0" cellpadding="0" cellspacing="0"> <tr><td width="10" height="20"></td><td> <a href="register.php" class="n">Register</a> </td></tr> </table> <img src="images/p.gif" width="164" height="1" border="0"><br> <br> </td> <td width="10"> </td> <td width="510" valign="top"> <img src="images/linie.gif"><br> <br> <font class="titlu">Login</font> <br><br> <img src="images/linie.gif"><br> <br> <form name="form1" method="post" action="login.php"> <table border="0" cellspacing="0" cellpadding="0" width="200" height="96"> <tr><td> <table width="200" border="0" cellspacing="0" cellpadding="0"> <tr><td height="34" colspan="3"> </td></tr> <tr><td width="140"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="16"> </td> <td valign="top"><input type="text" name="username" style="width: 150;"></td> <td width="14"> </td> </tr> <tr> <td width="16" height="14"> </td> <td valign="top"><input type="password" name="password" style="width: 150;"></td> <td width="14"> </td> </tr> </table> </td> <td><input type="submit" name="submit" value="Login" class="button"></td></tr> </table> </td></tr> </table> </form> <br> <a href="register.php">Click here to register</a> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td valign="top"></tr></table> <br><br> <img src="images/linie.gif"><br> <table border="0" cellpadding="0" cellspacing="0"> <tr><td><img src="images/sigla_jos.gif"><br></td> <td class="stitlu"> Trademarks/Copyright ©2006 ASIC IP. All Rights Reserved.</td></tr> </table> <img src="images/linie.gif"><br> <br> </td> <td width="10"> </td> </tr> </table> </td></tr></table></td></tr></table></td><td align="left" valign="top"> </td></td></tr></table></center></body></html>[/code]The included page[code]<?php$conn = mysql_connect ("mysql", "#####", "#####");$select = mysql_select_db("ip");?>[/code]I am sure mysql is there instead of localhost, it is with yahoo, I am starting to hate yahoo more and more, they are the most retarded company I have ever seen, I am going to start converting all my yahoo clients, over to another more worthy host, yahoo is pathetic, no htaccess, or php ini access. There settings suck anus. Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/ Share on other sites More sharing options...
trq Posted July 3, 2006 Share Posted July 3, 2006 I dont see any call to session_start() in your script. Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52427 Share on other sites More sharing options...
Ninjakreborn Posted July 3, 2006 Author Share Posted July 3, 2006 [quote]session_start();[/quote]Very very top of the login.php file, it's there.Unless you mean somewhere else I should have it. Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52448 Share on other sites More sharing options...
wildteen88 Posted July 3, 2006 Share Posted July 3, 2006 Where ever you use sessions you must place session_start at the top of each page that uses sessions. Otherwise your sessions wont work. Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52482 Share on other sites More sharing options...
Ninjakreborn Posted July 3, 2006 Author Share Posted July 3, 2006 I will try this real quick and see if I can figure anything out, maybe I left a session_start out somewhere, let me try that maybe it will help. Thanks Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52524 Share on other sites More sharing options...
Ninjakreborn Posted July 3, 2006 Author Share Posted July 3, 2006 I did use sessions_start on all of them, this is what is happening and it is really confusing me, this is the related page.[url=http://www.asicip.com/download.php]http://www.asicip.com/download.php[/url]That is the page you go to, here you click on a link. It takes you to the login page here.http://www.asicip.com/login.phpTHis is where you login at, you can register, the register form is on that link if you click register, it works, adn it puts the information in the database properly I already tested it out, now when you try and click login, it doesn't do anything, it doesn't even work, it acts like it's not even working, I really really don't understand. You are suppose to be able to login, to get access to those files, I really really do not understand this, and any advice would be greatly appreciated, here is an example, here is the code for the downloads page, with all the links.Below that, is again the code for the page I am talking about, the login page, and I will also put the include page below there. You will see what I mean by it not working. I will also explains how it works, there is a page called download.php, all the links there are suppose to take you to the login.php page, it works perfectly. Then on the logins page, if you don't have a username and password you register, it works, it records your data, here is where the first issue occurs, it sends an email with just your email address, and nothing else, that is the first problem. Then when you are suppose to login, if you get the correct info it changed you over to the download2.php page there you can access all the files, because the links are changed to allow you access to the files, BUt it's not working when I click on the page login, and I try to login nothing happens.Here is all the textThe first download page, where you are denied access, it just changes you over the the login pageDownload 1Actually the code isn't even important, all it is, is a static page, with a bunch of links taking you to the login page, the login page, is herelogin page[code]<?phpsession_start();require_once("incs/conn.inc.php"); if(isset($_POST['submit'])) { $sql = "select id_administrator,superuser from administrators where username = '".$_POST['username']."' and password = '".$_POST['password']."'"; $rez = mysql_query($sql) or die (mysql_error()); if(mysql_num_rows($rez) > 0){ $row = mysql_fetch_row($rez) or die("The mysql fetch row is not working"); session_register("administrator_portal") or die("Session register issues"); $_SESSION['administrator_portal'] = $row[0]; $_SESSION['superuser'] = $row[1]; $sql="update `administrators` set `LastLoginAdmin`=Now() where id_administrator=".$_SESSION['administrator_portal']; $result=mysql_query($sql,$conn); header("Location: download2.php"); exit; }else{ $msg = "The username or password are wrong."; } } if($_GET['erroare'] == "nr"){ $msg = "Ne pare rau insa sesiunea dumneavostra a expirat.<br> You must log on."; }?><html><head><LINK href="style.css" rel=stylesheet type=text/css><title>ASIC IP</title></head><body bgcolor="#9aa8c7" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0"><script type="text/javascript">if (parseInt(navigator.appVersion.substring(0,1))>=3) { // 3.0 or greater.ch1_on = new Image(); ch1_off = new Image();ch2_on = new Image(); ch2_off = new Image();ch3_on = new Image(); ch3_off = new Image();ch4_on = new Image(); ch4_off = new Image();ch5_on = new Image(); ch5_off = new Image();ch6_on = new Image(); ch6_off = new Image();ch7_on = new Image(); ch7_off = new Image();ch8_on = new Image(); ch8_off = new Image();ch1_on.src = 'images/b_homeap.gif';ch1_off.src = 'images/b_home.gif';ch2_on.src = 'images/b_aboutap.gif';ch2_off.src = 'images/b_about.gif';ch3_on.src = 'images/b_infoap.gif';ch3_off.src = 'images/b_info.gif';ch4_on.src = 'images/b_downloadap.gif';ch4_off.src = 'images/b_download.gif';ch5_on.src = 'images/b_careerap.gif';ch5_off.src = 'images/b_career.gif';ch6_on.src = 'images/b_teamap.gif';ch6_off.src = 'images/b_team.gif';ch7_on.src = 'images/b_pressap.gif';ch7_off.src = 'images/b_press.gif';ch8_on.src = 'images/b_contactap.gif';ch8_off.src = 'images/b_contact.gif';}function activate(image) { if (parseInt(navigator.appVersion.substring(0,1))>=3) { // 3.0 or greater. imagesrc = eval(image + '_on.src'); document[image].src = imagesrc; }}function deactivate(image) { if (parseInt(navigator.appVersion.substring(0,1))>=3) { // 3.0 or greater. imagesrc = eval(image + "_off.src"); document[image].src = imagesrc; }}</script><center><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td align="right" valign="top"> </td><td align="center"><table border="0" cellpadding="0" cellspacing="0" bgcolor="#000000" width="700"><tr><td bgcolor="#9aa8c7"><? include("incs/top_menu.inc.php"); ?><table border="0" cellpadding="0" cellspacing="0" width="700" bgcolor="#FFFFFF"> <tr><td> <table border="0" cellpadding="0" cellspacing="0" width="700"> <tr> <td width="6"> </td> <td width="164" valign="top" bgcolor="#f1f1f1"> <table border="0" cellpadding="0" cellspacing="0"> <tr><td width="6"></td><td height="24"> <font class="titlu2">Downloads : :</font> </td></tr> </table> <img src="images/p.gif" width="164" height="1" border="0"><br> <table border="0" cellpadding="0" cellspacing="0"> <tr><td width="10" height="20"></td><td> <a href="download.php" class="n">Downloads</a> </td></tr> </table> <img src="images/p.gif" width="164" height="1" border="0"><br> <table border="0" cellpadding="0" cellspacing="0"> <tr><td width="10" height="20"></td><td> <a href="login.php" class="n">Login</a> </td></tr> </table> <img src="images/p.gif" width="164" height="1" border="0"><br> <table border="0" cellpadding="0" cellspacing="0"> <tr><td width="10" height="20"></td><td> <a href="register.php" class="n">Register</a> </td></tr> </table> <img src="images/p.gif" width="164" height="1" border="0"><br> <br> </td> <td width="10"> </td> <td width="510" valign="top"> <img src="images/linie.gif"><br> <br> <font class="titlu">Login</font> <br><br> <img src="images/linie.gif"><br> <br> <form name="form1" method="post" action="login.php"> <table border="0" cellspacing="0" cellpadding="0" width="200" height="96"> <tr><td> <table width="200" border="0" cellspacing="0" cellpadding="0"> <tr><td height="34" colspan="3"> </td></tr> <tr><td width="140"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="16"> </td> <td valign="top"><input type="text" name="username" style="width: 150;"></td> <td width="14"> </td> </tr> <tr> <td width="16" height="14"> </td> <td valign="top"><input type="password" name="password" style="width: 150;"></td> <td width="14"> </td> </tr> </table> </td> <td><input type="submit" name="submit" value="Login" class="button"></td></tr> </table> </td></tr> </table> </form> <br> <a href="register.php">Click here to register</a> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td valign="top"></tr></table> <br><br> <img src="images/linie.gif"><br> <table border="0" cellpadding="0" cellspacing="0"> <tr><td><img src="images/sigla_jos.gif"><br></td> <td class="stitlu"> Trademarks/Copyright ©2006 ASIC IP. All Rights Reserved.</td></tr> </table> <img src="images/linie.gif"><br> <br> </td> <td width="10"> </td> </tr> </table> </td></tr></table></td></tr></table></td><td align="left" valign="top"> </td></td></tr></table></center></body></html>[/code]Here is the included file, this only does the connection, it just connects to the database that is it.[code]<?php$conn = mysql_connect ("mysql", "####", "####");$select = mysql_select_db("ip");?>[/code]mysql is required instead of local host, it's something to do with the way yahoo sets up there stuff.Here is the new download page you should get access too.[code]<?php session_start();include("incs/auth.inc.php"); ?><html><head><LINK href="style.css" rel=stylesheet type=text/css><title>ASIC IP</title></head><body bgcolor="#9aa8c7" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0"><script type="text/javascript"><!--if (parseInt(navigator.appVersion.substring(0,1))>=3) { // 3.0 or greater.ch1_on = new Image(); ch1_off = new Image();ch2_on = new Image(); ch2_off = new Image();ch3_on = new Image(); ch3_off = new Image();ch4_on = new Image(); ch4_off = new Image();ch5_on = new Image(); ch5_off = new Image();ch6_on = new Image(); ch6_off = new Image();ch7_on = new Image(); ch7_off = new Image();ch8_on = new Image(); ch8_off = new Image();ch1_on.src = 'images/b_homeap.gif';ch1_off.src = 'images/b_home.gif';ch2_on.src = 'images/b_aboutap.gif';ch2_off.src = 'images/b_about.gif';ch3_on.src = 'images/b_infoap.gif';ch3_off.src = 'images/b_info.gif';ch4_on.src = 'images/b_downloadap.gif';ch4_off.src = 'images/b_download.gif';ch5_on.src = 'images/b_careerap.gif';ch5_off.src = 'images/b_career.gif';ch6_on.src = 'images/b_teamap.gif';ch6_off.src = 'images/b_team.gif';ch7_on.src = 'images/b_pressap.gif';ch7_off.src = 'images/b_press.gif';ch8_on.src = 'images/b_contactap.gif';ch8_off.src = 'images/b_contact.gif';}function activate(image) { if (parseInt(navigator.appVersion.substring(0,1))>=3) { // 3.0 or greater. imagesrc = eval(image + '_on.src'); document[image].src = imagesrc; }}function deactivate(image) { if (parseInt(navigator.appVersion.substring(0,1))>=3) { // 3.0 or greater. imagesrc = eval(image + "_off.src"); document[image].src = imagesrc; }}--></script><center><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td align="right" valign="top"> </td><td align="center"><table border="0" cellpadding="0" cellspacing="0" bgcolor="#000000" width="700"><tr><td bgcolor="#9aa8c7"><? include("incs/top_menu.inc.php"); ?><table border="0" cellpadding="0" cellspacing="0" width="700" bgcolor="#FFFFFF"> <tr><td> <table border="0" cellpadding="0" cellspacing="0" width="700"> <tr> <td width="6"> </td> <td width="164" valign="top" bgcolor="#f1f1f1"> <table border="0" cellpadding="0" cellspacing="0"> <tr><td width="6"></td><td height="24"> <font class="titlu2">Downloads : :</font> </td></tr> </table> <img src="images/p.gif" width="164" height="1" border="0"><br> <table border="0" cellpadding="0" cellspacing="0"> <tr><td width="10" height="20"></td><td> <a href="download2.php" class="n">Downloads</a> </td></tr> </table> <img src="images/p.gif" width="164" height="1" border="0"><br> <br> </td> <td width="10"> </td> <td width="510" valign="top"> <img src="images/linie.gif"><br> <br> <font class="titlu">Downloads</font> <br><br> <img src="images/linie.gif"><br> <br> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td valign="top"> <img src="images/rosu.gif" border="0"> <a href="dw/ASIC IP 100mA Boost.pdf" class="n" target="_blank">ASIC IP 100mA Boost</a> <br><br> <img src="images/rosu.gif" border="0"> <a href="dw/ASIC IP Adair 100b.pdf" class="n" target="_blank">ASIC IP Adair 100b</a> <br><br> <img src="images/rosu.gif" border="0"> <a href="dw/ASIC IP Adair 802.11 and network tester (UBT).pdf" class="n" target="_blank">ASIC IP Adair 802.11 and network tester (UBT)</a> <br> <img src="images/rosu.gif" border="0"> <a href="dw/ASIC IP Adair 900 and 2.4G.pdf" class="n" target="_blank">ASIC IP Adair 900 and 2.4G</a> <br><br> <img src="images/rosu.gif" border="0"> <a href="dw/ASIC IP Antenna Modules.pdf" class="n" target="_blank">ASIC IP Antenna Modules</a> <br><br> <img src="images/rosu.gif" border="0"> <a href="dw/ASIC IP Bandgap Ref.pdf" class="n" target="_blank">ASIC IP Bandgap Ref</a> <br><br> <img src="images/rosu.gif" border="0"> <a href="dw/ASIC IP Boost PS0100.pdf" class="n" target="_blank">ASIC IP Boost PS0100</a> <br><br> <img src="images/rosu.gif" border="0"> <a href="dw/ASIC IP Controller board.pdf" class="n" target="_blank">ASIC IP Controller board</a> <br><br> <img src="images/rosu.gif" border="0"> <a href="dw/ASIC IP LDO 150mA.pdf" class="n" target="_blank">ASIC IP LDO 150mA</a> <br><br> <img src="images/rosu.gif" border="0"> <a href="dw/ASIC IP LDO 300mA.pdf" class="n" target="_blank">ASIC IP LDO 300mA</a> <br><br> <img src="images/rosu.gif" border="0"> <a href="dw/ASIC IP LDO 50mA.pdf" class="n" target="_blank">ASIC IP LDO 50mA</a> <br><br> <img src="images/rosu.gif" border="0"> <a href="dw/ASIC IP R2400 Radio Module.pdf" class="n" target="_blank">ASIC IP R2400 Radio Module</a> <br><br> <img src="images/rosu.gif" border="0"> <a href="dw/ASIC IP RF Modules.pdf" class="n" target="_blank">ASIC IP RF Modules</a> <br><br> <img src="images/rosu.gif" border="0"> <a href="dw/IP Intranet Supplier Station.pdf" class="n" target="_blank">IP Intranet Supplier Station</a> <br><br> <img src="images/rosu.gif" border="0"> <a href="dw/IP Provider Station.pdf" class="n" target="_blank">IP Provider Station</a> <br><br> <img src="images/rosu.gif" border="0"> <a href="dw/IP Reuse Station.pdf" class="n" target="_blank">IP Reuse Station</a> <br><br> <img src="images/rosu.gif" border="0"> <a href="dw/IP SoC Collaborative Platform.pdf" class="n" target="_blank">IP SoC Collaborative Platform</a> <br><br></tr></table> <br><br> <img src="images/linie.gif"><br> <table border="0" cellpadding="0" cellspacing="0"> <tr><td><img src="images/sigla_jos.gif"><br></td> <td class="stitlu"> Trademarks/Copyright ©2006 ASIC IP. All Rights Reserved.</td></tr> </table> <img src="images/linie.gif"><br> <br> </td> <td width="10"> </td> </tr> </table> </td></tr></table></td></tr></table></td><td align="left" valign="top"> </td></td></tr></table></center></body></html>[/code]See I did not do this website, someone else did the whole thing, I came in and fixed some things because he didn't finish it, I think it's shit it's done in tables, the programming is sometimes pointless. I can't redo the whole site, because I am fixing a few issues for just a few hundred. I was wondering what to do about this, I have been trying, I have done everything I can think of, mysql_error calls, die, and everything else, I have been debugging for 3 days, and I feel it's probably something simple, can anyone help me out with that. Thanks Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52534 Share on other sites More sharing options...
Ninjakreborn Posted July 3, 2006 Author Share Posted July 3, 2006 I found one thing using echo statements, it is properly picking up the submit, and it is stopping at this line for some reason, but I went over it 4-5 times it all looks correct.[code] $sql = "SELECT id_administrator,superuser FROM administrators WHERE username = '".$_POST['username']."' and password = '".$_POST['password']."'"; $rez = mysql_query($sql);[/code]It is even getting the sql variable initialized, the problem is when it trys to run $rez = mysql_query($sql);That is when the script stops running any advice, there are 2 columns named that, and a table named that, and the other stuff looks right what is going on. Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52546 Share on other sites More sharing options...
redarrow Posted July 3, 2006 Share Posted July 3, 2006 Sorry to complain but the amount of images on that page is way to much.also can not see where your calling the function($name);or return();also where the connection for the last page Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52553 Share on other sites More sharing options...
kenrbnsn Posted July 3, 2006 Share Posted July 3, 2006 What is displayed when you change [code=php:0]<?php $rez = mysql_query($sql);?>[/code]to[code=php:0]<?php $rez = mysql_query($sql) or die("There was a problem with the query: $sql<br>" . mysql_error());?>[/code]Ken Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52554 Share on other sites More sharing options...
Ninjakreborn Posted July 3, 2006 Author Share Posted July 3, 2006 [quote]What is displayed when you change <?php $rez = mysql_query($sql);?>to<?php $rez = mysql_query($sql) or die("There was a problem with the query: $sql<br>" . mysql_error());?>Ken[/quote]Nothing it does absolutely nothing, I copied and pasted what you said, it still has my echo statement from earlier showing that the submit was accepted but nothing below that. Nothing changed.[quote]Sorry to complain but the amount of images on that page is way to much.also can not see where your calling the function($name);or return();also where the connection for the last page[/quote]I didn't make this website, the entire layout, design, images, content everything is someone elses, they bailed on the guy I am working for, he just needed a few more things done, so I made a few things worked, finished up the scripts for a few forms, sorted through and got register to work and ran into this, so I had no choice over images. As far as function calls to name or return, I didn't see that anywhere what do you mean.And What do you mean about connection for the last page.If anyone can help I would be greatly appreciative I am starting to get desperate on this. Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52559 Share on other sites More sharing options...
redarrow Posted July 3, 2006 Share Posted July 3, 2006 you got to correct the connection okexample $db=mysql_connect("whatever",whatever",whatever");mysql_select_db("whatever",$db); Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52563 Share on other sites More sharing options...
Ninjakreborn Posted July 3, 2006 Author Share Posted July 3, 2006 I am connected. It is in an included file, as I said up there, it is also listed out up there, the connection is good, but it's messing up the query, I will even right now attempt to move the connection information over to the other page, and see how it goes. Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52565 Share on other sites More sharing options...
Ninjakreborn Posted July 3, 2006 Author Share Posted July 3, 2006 I just checked it's not that, it is directly related to that query for some reason? Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52566 Share on other sites More sharing options...
redarrow Posted July 3, 2006 Share Posted July 3, 2006 Try without the post there and just use the '$varable_names'example only<?phpsession_start();require_once("incs/conn.inc.php"); if(isset($_POST['submit'])) { $sql = "select id_administrator,superuser from administrators where username = '$username' and password = ' $password ' "; $rez = mysql_query($sql) or die (mysql_error()); if(mysql_num_rows($rez) > 0){ $row = mysql_fetch_row($rez) or die("The mysql fetch row is not working"); session_register("administrator_portal") or die("Session register issues"); $_SESSION['administrator_portal'] = $row[0]; $_SESSION['superuser'] = $row[1]; $sql="update `administrators` set `LastLoginAdmin`=Now() where id_administrator=".$_SESSION['administrator_portal']; $result=mysql_query($sql,$conn); header("Location: download2.php"); exit; }else{ $msg = "The username or password are wrong."; } } if($_GET['erroare'] == "nr"){ $msg = "Ne pare rau insa sesiunea dumneavostra a expirat.<br> You must log on."; }?> Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52572 Share on other sites More sharing options...
Ninjakreborn Posted July 3, 2006 Author Share Posted July 3, 2006 [code] if(isset($_POST['submit'])) { echo "Right after Submit is Accepted"; $username = $_POST['username']; $password = $_POST['password']; $sql = "SELECT id_administrator,superuser FROM administrators WHERE username = {$username} and password = {$password}"; echo = "After sql is set"; $rez = mysql_query($sql); echo = "After mysql Query";[/code]I did that and now there is a problem.It doesn't do anything, the entire login page is completely white now, when I try to even get to the page? Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52576 Share on other sites More sharing options...
redarrow Posted July 3, 2006 Share Posted July 3, 2006 you plonker rodney lol joke..............YOUR USING TWO QUERYS WITH THE SAME $SQL VALABLE CHANE ONE! Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52577 Share on other sites More sharing options...
redarrow Posted July 3, 2006 Share Posted July 3, 2006 put it back then and look at your code i see your using two $sql valabers one for update and one for select change one ok Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52581 Share on other sites More sharing options...
Ninjakreborn Posted July 3, 2006 Author Share Posted July 3, 2006 Ok I didn't catch that before, Mostly because it's not my script I was just trying to fix it, I changed a few things around this is what I currently have. And unfortunately I am still getting the exact same issue.[code]<?phpsession_start();require_once("incs/conn.inc.php"); if(isset($_POST['submit'])) { echo "Right after Submit is Accepted"; $select = "SELECT id_administrator,superuser FROM administrators WHERE username = '".$_POST['username']."' and password = '".$_POST['password']."'";$rez = mysql_query($select) or die("There was a problem with the query: $sql<br>" . mysql_error()); if(mysql_num_rows($rez) > 0){ echo "Right after checking if for numrows"; $row = mysql_fetch_row($rez) or die("The mysql fetch row is not working"); session_register("administrator_portal"); $_SESSION['administrator_portal'] = $row[0]; $_SESSION['superuser'] = $row[1]; $update="update `administrators` set `LastLoginAdmin`=Now() where id_administrator=".$_SESSION['administrator_portal']; $result=mysql_query($update,$conn); header("Location: download2.php"); exit; }else{ $msg = "The username or password are wrong."; } } if($_GET['erroare'] == "nr"){ $msg = "Ne pare rau insa sesiunea dumneavostra a expirat.<br> You must log on."; }?>[/code]I changed the parts where they were like that, but the exact same thing is still happening Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52584 Share on other sites More sharing options...
redarrow Posted July 3, 2006 Share Posted July 3, 2006 trythis<?phpsession_start();require_once("incs/conn.inc.php"); if(isset($_POST['submit'])) { echo "Right after Submit is Accepted"; $sql1= "SELECT id_administrator,superuser FROM administrators WHERE username = '".$_POST['username']."' and password = '".$_POST['password']."'";$rez = mysql_query($sql1) or die("There was a problem with the query: $sql1<br>" . mysql_error()); if(mysql_num_rows($rez) > 0){ echo "Right after checking if for numrows"; $row = mysql_fetch_row($rez) or die("The mysql fetch row is not working"); session_register('administrator_portal');//used single quote $_SESSION['administrator_portal'] = $row[0]; $_SESSION['superuser'] = $row[1]; $update="update `administrators` set `LastLoginAdmin`=Now() where id_administrator=".$_SESSION['administrator_portal']; $result=mysql_query($update); //removed $conn header("Location: download2.php"); exit; }else{ $msg = "The username or password are wrong."; } } if($_GET['erroare'] == "nr"){ $msg = "Ne pare rau insa sesiunea dumneavostra a expirat.<br> You must log on."; }?> Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52587 Share on other sites More sharing options...
Ninjakreborn Posted July 3, 2006 Author Share Posted July 3, 2006 I did EXACTLY as you showed, copied and pasted what you had over the old, I don't understand, but it's still doing the same problem, here is my table information it seems to match.Db name doesn't matter I tested that connection, it's already connected to the databasedatabase name = iptable name = administratorsand here are the fields in that table[quote] Field Type Collation Attributes Null Default Extra Action id_administrator int(10) No auto_increment username varchar(50) latin1_swedish_ci Yes NULL password varchar(50) latin1_swedish_ci Yes NULL adminfirstname varchar(100) latin1_swedish_ci Yes NULL adminlastname varchar(100) latin1_swedish_ci Yes NULL email varchar(200) latin1_swedish_ci Yes NULL LastLoginAdmin date Yes NULL regdate date Yes NULL superuser tinyint(1) UNSIGNED Yes 0 Check All / Uncheck All With selected: [/quote] I REALLY don't understand why this is happening, and now the new code, I changed it exactly to how you had it, and it's still not working, any more advice, Ihave been fighting this for almost a week now, now you see where I am coming from, I am confused. Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52588 Share on other sites More sharing options...
redarrow Posted July 3, 2006 Share Posted July 3, 2006 try this ok <?phpsession_start();require_once("incs/conn.inc.php"); if(isset($_POST['submit'])) { echo "Right after Submit is Accepted"; $sql1= "SELECT administrators.id_administrator,administrators.superuser FROM administrators WHERE username = '".$_POST['username']."' and password = '".$_POST['password']."'";$rez = mysql_query($sql1) or die("There was a problem with the query: $sql1" . mysql_error()); if(mysql_num_rows($rez) > 0){ echo "Right after checking if for numrows"; $row = mysql_fetch_row($rez) or die("The mysql fetch row is not working"); session_register('administrator_portal');//used single quote $_SESSION['administrator_portal'] = $row[0]; $_SESSION['superuser'] = $row[1]; $update="update `administrators` set `LastLoginAdmin`=Now() where id_administrator=".$_SESSION['administrator_portal']; $result=mysql_query($update); //removed $conn header("Location: download2.php"); exit; }else{ $msg = "The username or password are wrong."; } } if($_GET['erroare'] == "nr"){ $msg = "Ne pare rau insa sesiunea dumneavostra a expirat.You must log on."; }?> Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52590 Share on other sites More sharing options...
Ninjakreborn Posted July 3, 2006 Author Share Posted July 3, 2006 Same issue, it's still doing the exact same thing, any more ideas, I copied and pasted that over the old, and it's doing the same thing it was before. Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52592 Share on other sites More sharing options...
litebearer Posted July 3, 2006 Share Posted July 3, 2006 Just another little 'tool' for your bag of tricks. This script will display the structure and data in a mysql database table.It is useful for checking (1) that you are using the proper values for connecting, (2) that the field names and types are what you think they are; and (3) for seeing if there is, in fact, data in the table.As an aside, it can also be used to create csv and/or excel files for downloading.The only items you need to change are in SECTIONS 1 & 2Hope this is of some help in isolating your problem.[code]<?phpsession_start();header("Cache-control: private"); // IE 6 Fix.session_unset(); ################################################################## this small script can be used to ## get and display a database table's structure (field names and field type)# get and display the field contents in an html table# get and store the field names and contents to an excel file ##################################### SECTION 1## set the database variables#$database="#####";$location = "#####"; $username = "#####"; $password = "#####"; $db_table = "#####";######################################## SECTION 2## set the function switches# 0 means use # 1 means do NOT use#$display_table_structure = 0;$display_table_contents = 0;$create_csv_file = 1; // use this to create a csv file from the data$create_excel_file = 1; // use this to create an excel file from the table // requires m_e.php$csv_name = $db_table . "_" . time(); // this gives the csv file a unique name$how_many = 10; // use this value to limit the number of records returned in the data query (0 means no limit) ########################################################################################################## DO NOT EDIT BELOW THIS POINT################################################################################################################################################ define the function(s)// This function gets the field namesfunction my_db_get_table_field_names($table) { $sql = "SHOW COLUMNS FROM `$table`"; $field_names = array(); $result2 = mysql_query($sql); for($i=0;$i<mysql_num_rows($result2);$i++){ $row = mysql_fetch_array($result2); $name = $row['Field']; array_push($field_names, $name); } return $field_names;}############################################# connect to the databasemysql_connect ($location, $username, $password); @mysql_select_db($database) or die( "Unable to select database"); $result0 = mysql_query("SHOW COLUMNS FROM $db_table");if (!$result0) { echo 'Could not run query: ' . mysql_error(); exit;}##################################################### get the field names into an array and count them$new_array = my_db_get_table_field_names($db_table);$fields = count($new_array);#################################################### get all the data and count the recordsif ($how_many == 0) { $result = mysql_query( "SELECT * FROM $db_table" ) or die("SELECT Error: ".mysql_error()); $num_rows = mysql_num_rows($result); }else{ $result = mysql_query( "SELECT * FROM $db_table LIMIT $how_many" ) or die("SELECT Error: ".mysql_error()); $num_rows = mysql_num_rows($result); }############################################################### display the general informationecho "This information is for the " . $database . " database. Table " . $db_table . "<br><br>";echo "There are " . $fields . " columns/fields and " . $num_rows . " records.<br><br>";############################################################ display the table structureif ($display_table_structure == 0) { echo "<hr>Table structure for " . $db_table . ": <br><br>"; echo "<table border=1> <tr><td>Field #</td><td>Field Name</td><td>Field Type</td></tr>"; $result9 = mysql_query("SHOW FIELDS FROM $database.$db_table"); $i = 0; while ($row = mysql_fetch_array($result9)){ echo "<tr><td>" . $i . "</td><td>" . $row['Field'] . "</td><td>" . $row['Type'] . "</td></tr>"; $i = $i +1; } echo "</table>";}############################################################### display the table contentsif ($display_table_contents == 0) { echo "<hr>Table data for " . $db_table . ": <br><br>"; print "<table width='100%' border=1>\n"; $i = 0; print "<tr>\n"; for ($i=0;$i<$fields;$i++) { print "\t<td><font face=arial size=1/>$new_array[$i]</font></td>\n"; } while ($get_info = mysql_fetch_row($result)){ print "<tr>\n"; foreach ($get_info as $field) print "\t<td><font face=arial size=1/>$field</font></td>\n"; print "</tr>\n"; } print "</table>\n"; }################################################### do the excel file creationif ($create_excel_file ==0) { ?> <meta http-equiv="refresh" content="2;url=http://nstoia.com/m_e.php"> <?PHP}?>[/code]and here is the script for the excel file[code]<?php //EDIT YOUR MySQL Connection Info: $DB_Server = "####"; //your MySQL Server $DB_Username = "####"; //your MySQL User Name $DB_Password = "####"; //your MySQL Password $DB_DBName = "####"; //your MySQL Database Name $DB_TBLName = "####"; //your MySQL Table Name //$DB_TBLName, $DB_DBName, may also be commented out & passed to the browser //as parameters in a query string, so that this code may be easily reused for //any MySQL table or any MySQL database on your server //DEFINE SQL QUERY: //you can use just about ANY kind of select statement you want - //edit this to suit your needs! $sql = "Select * from $DB_TBLName"; //Optional: print out title to top of Excel or Word file with Timestamp //for when file was generated: //set $Use_Titel = 1 to generate title, 0 not to use title $Use_Title = 1; //define date for title: EDIT this to create the time-format you need $now_date = date('m-d-Y H:i'); //define title for .doc or .xls file: EDIT this if you want $title = "Dump For Table $DB_TBLName from Database $DB_DBName on $now_date"; /* Leave the connection info below as it is: just edit the above. (Editing of code past this point recommended only for advanced users.) */ //create MySQL connection $Connect = @mysql_connect($DB_Server, $DB_Username, $DB_Password) or die("Couldn't connect to MySQL:<br>" . mysql_error() . "<br>" . mysql_errno()); //select database $Db = @mysql_select_db($DB_DBName, $Connect) or die("Couldn't select database:<br>" . mysql_error(). "<br>" . mysql_errno()); //execute query $result = @mysql_query($sql,$Connect) or die("Couldn't execute query:<br>" . mysql_error(). "<br>" . mysql_errno()); //if this parameter is included ($w=1), file returned will be in word format ('.doc') //if parameter is not included, file returned will be in excel format ('.xls') if (isset($w) && ($w==1)) { $file_type = "msword"; $file_ending = "doc"; }else { $file_type = "vnd.ms-excel"; $file_ending = "xls"; } //header info for browser: determines file type ('.doc' or '.xls') header("Content-Type: application/$file_type"); header("Content-Disposition: attachment; filename=database_dump.$file_ending"); header("Pragma: no-cache"); header("Expires: 0"); /* Start of Formatting for Word or Excel */ if (isset($w) && ($w==1)) //check for $w again { /* FORMATTING FOR WORD DOCUMENTS ('.doc') */ //create title with timestamp: if ($Use_Title == 1) { echo("$title\n\n"); } //define separator (defines columns in excel & tabs in word) $sep = "\n"; //new line character while($row = mysql_fetch_row($result)) { //set_time_limit(60); // HaRa $schema_insert = ""; for($j=0; $j<mysql_num_fields($result);$j++) { //define field names $field_name = mysql_field_name($result,$j); //will show name of fields $schema_insert .= "$field_name:\t"; if(!isset($row[$j])) { $schema_insert .= "NULL".$sep; } elseif ($row[$j] != "") { $schema_insert .= "$row[$j]".$sep; } else { $schema_insert .= "".$sep; } } $schema_insert = str_replace($sep."$", "", $schema_insert); $schema_insert .= "\t"; print(trim($schema_insert)); //end of each mysql row //creates line to separate data from each MySQL table row print "\n----------------------------------------------------\n"; } }else{ /* FORMATTING FOR EXCEL DOCUMENTS ('.xls') */ //create title with timestamp: if ($Use_Title == 1) { echo("$title\n"); } //define separator (defines columns in excel & tabs in word) $sep = "\t"; //tabbed character //start of printing column names as names of MySQL fields for ($i = 0; $i < mysql_num_fields($result); $i++) { echo mysql_field_name($result,$i) . "\t"; } print("\n"); //end of printing column names //start while loop to get data while($row = mysql_fetch_row($result)) { //set_time_limit(60); // HaRa $schema_insert = ""; for($j=0; $j<mysql_num_fields($result);$j++) { if(!isset($row[$j])) $schema_insert .= "NULL".$sep; elseif ($row[$j] != "") $schema_insert .= "$row[$j]".$sep; else $schema_insert .= "".$sep; } $schema_insert = str_replace($sep."$", "", $schema_insert); //following fix suggested by Josue (thanks, Josue!) //this corrects output in excel when table fields contain \n or \r //these two characters are now replaced with a space $schema_insert = preg_replace("/\r\n|\n\r|\n|\r/", " ", $schema_insert); $schema_insert .= "\t"; print(trim($schema_insert)); print "\n"; } } ?> [/code] Lite... Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52594 Share on other sites More sharing options...
redarrow Posted July 3, 2006 Share Posted July 3, 2006 try this and copy and past the result to us cheers.Thank you for the code member litebearer your a star cheers.<?phpsession_start();require_once("incs/conn.inc.php"); if(isset($_POST['submit'])) { echo "Right after Submit is Accepted"; $sql1= "SELECT administrators.id_administrator,administrators.superuser FROM administrators WHERE username = '".$_POST['username']."' and password = '".$_POST['password']."'";echo $sql1;//debug sql1$rez = mysql_query($sql1) or die("There was a problem with the query: $sql1" . mysql_error());echo $rez; // debug if(mysql_num_rows($rez) > 0){ echo "Right after checking if for numrows"; $row = mysql_fetch_row($rez) or die("The mysql fetch row is not working"); session_register('administrator_portal');//used single quote $_SESSION['administrator_portal'] = $row[0]; $_SESSION['superuser'] = $row[1]; $update="update `administrators` set `LastLoginAdmin`=Now() where id_administrator=".$_SESSION['administrator_portal'];echo $update;//debug $result=mysql_query($update); //removed $connecho $result;//debug header("Location: download2.php"); exit; }else{ $msg = "The username or password are wrong."; } } if($_GET['erroare'] == "nr"){ $msg = "Ne pare rau insa sesiunea dumneavostra a expirat.You must log on."; }?> Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52595 Share on other sites More sharing options...
Ninjakreborn Posted July 3, 2006 Author Share Posted July 3, 2006 [quote]Right after Submit is AcceptedSELECT administrators.id_administrator,administrators.superuser FROM administrators WHERE username = '' and password = ''Resource id #4[/quote]That is the error I ran into that time, never encountered that before, what does it mean?? Link to comment https://forums.phpfreaks.com/topic/13546-i-have-3-questions/#findComment-52596 Share on other sites More sharing options...
Recommended Posts