login  Naam:   Wachtwoord: 
Registreer je!
 Forum

connectie

Offline ferdithug - 17/05/2007 10:24
Avatar van ferdithugNieuw lid Hoi,

Ik heb een script geinstalleert en de install deed het goed, ook het gebruikersnaam en paswoordt voor de admin staan in de database.

Maar ik kan gewoon niet inloggen en niemand kan zich ook aanmelden.
Ik weet niet meer waar ik moet zoeken want de config gegevens zijn gewoon goed.

Dit is mijn connectie:
  1. <?
  2.  
  3.  
  4. $connection = mysql_connect($db_host, $db_username, $db_password) or die(mysql_error());
  5. $db = mysql_select_db($db_name, $connection);
  6.  
  7.  
  8. $qset = "select * from job_settings";
  9. $rset = mysql_query($qset) or die(mysql_error());
  10. $aset = mysql_fetch_array($rset);
  11.  
  12.  
  13. ?>


Iemand enig idee wat er is?
Ik denk dat het maar iets kleins is maar je moet het net maar weten.:s

10 antwoorden

Gesponsorde links
Offline W0etah - 17/05/2007 10:26
Avatar van W0etah PHP beginner tjah, je kan geen gevens uit de database halen voordat je connectie hebt.
  1. $connection = mysql_connect('localhost', 'username', 'paswoord') or die(mysql_error());
  2. $db = mysql_select_db('databasename', $connection);


alles wat tussen '' vervangen door jouw gegevens
Offline ferdithug - 17/05/2007 10:50
Avatar van ferdithug Nieuw lid Ik heb 2 bestanden 1= conn.php met het script wat hier boven staat en commen.php met de gegevens.
Offline mebus - 17/05/2007 11:28
Avatar van mebus Nieuw lid commen.php boven die connectie includen en commen.php goed invullen
Offline ferdithug - 17/05/2007 12:17
Avatar van ferdithug Nieuw lid Lukt niet.
Mijn connectie is zo:

Commen.php:
  1. <?
  2.  
  3. // Be sure when you edit this file that you DO NOT delete the quotation marks or remove any code. Also, do not use quotations in the variables or the site will not work.
  4.  
  5.  
  6. $dbhost="db.website.nl"; // probably localhost
  7. $dbname="webname"; // database name
  8. $dbuser="webuser"; // database username
  9. $dbpassword="xxxxxx"; // database password
  10. $ratiohigh=2; // link views
  11. $ratiolow=1.5; // credits given to the user for the above link views
  12. $referral_credits=1000; //link impressions given to a referral signup
  13. $baseurl="http://www.website.nl/reflinkex/"; //must include trailing slash
  14. $bannerexchangename="RefLinkEx";
  15. $namefrom="admin";
  16. $emailfrom="mail@hotmail.com";
  17. $admin_password = "pass"; //this is the password to your main banner site banners
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24. ////////////////////////////////////////
  25. // End Site Config //
  26. ////////////////////////////////////////
  27.  
  28.  
  29. $passwordretrievalsubject="$bannerexchangename - password retrieval";
  30. $passwordretrievalbody="Hi _username_,
  31.  
  32. As requested, your password for the $bannerexchangename is _password_
  33.  
  34. Thanks
  35. $bannerexchangename team.";
  36.  
  37.  
  38. $welcomeemailsubject="Welcome to $bannerexchangename!";
  39. $welcomeemailbody="Hi _username_,
  40.  
  41. Welcome to the $bannerexchangename, you can log in to your account at $baseurl"."login.php - your username is '_username_' and your password is '_password_'. Please click the following link to activate your account - you won't be able to log in until you have followed this link:
  42.  
  43. $baseurl"."authorise.php?username=_username_&rand=_rand_
  44.  
  45. You can start earning link views now by adding the following code to your web pages
  46.  
  47. <!--begin $bannerexchangename code -->
  48. <table width=140 height=80 border=1><tr><td bgcolor=ffffff>
  49. <iframe src=$baseurl"."display.php?id=_id_ frameborder=0 vspace=0 hspace=0 height=20 width=135 marginwidth=0 marginheight=0 scrolling=no></iframe>
  50. <iframe src=$baseurl"."display.php?id=_id_ frameborder=0 vspace=0 hspace=0 height=20 width=135 marginwidth=0 marginheight=0 scrolling=no></iframe>
  51. <iframe src=$baseurl"."display.php?id=_id_ frameborder=0 vspace=0 hspace=0 height=20 width=135 marginwidth=0 marginheight=0 scrolling=no></iframe>
  52. <iframe src=$baseurl"."display.php?id=_id_ frameborder=0 vspace=0 hspace=0 height=20 width=135 marginwidth=0 marginheight=0 scrolling=no></iframe></td>
  53. </td></tr></table>
  54. <!--end $bannerexchangename code -->
  55.  
  56. Please note though, until you have logged into the system via the URL above, added a url and title to your account and it has been reviewed by an admin, it won't be displayed on other member sites.
  57.  
  58. Thanks for joining!
  59. $bannerexchangename Support";
  60.  
  61.  
  62.  
  63. ////////////////////////////////////////
  64. //Don't edit anything below this point//
  65. ////////////////////////////////////////
  66. function totalviews()
  67. {
  68. global $dbhost;
  69. global $dbname;
  70. global $dbuser;
  71. global $dbpassword;
  72. $link = mysql_connect($dbhost, $dbuser, $dbpassword)
  73. or die("Could not connect: " . mysql_error());
  74. mysql_select_db($dbname);
  75. $sSQL="select n_Value from t_Stats where s_Name=\"totalviews\"";
  76. $results=mysql_query($sSQL);
  77. list($totalviews)=mysql_fetch_row($results);
  78. echo $totalviews;
  79. }
  80.  
  81. function stripjunk($sourcestring)
  82. {
  83. $sourcestring=str_replace("\"","",$sourcestring);
  84. $sourcestring=str_replace("<","",$sourcestring);
  85. $sourcestring=str_replace(">","",$sourcestring);
  86. return($sourcestring);
  87. }
  88. ?>


Deze wordt zeg maar op login.php geinclude.
En in login.php zelf wordt de connectie gemaakt.
login.php:
  1. <?
  2. include("common.php");
  3. if(!$username && !$password)
  4. {
  5. include("header.php");
  6. ?><center>
  7. <h4>Inloggen in je <?=$bannerexchangename?> account</h4>
  8. <form name=login method=post action=login.php>
  9. <table>
  10. <tr>
  11. <td align=right>
  12. Gebruikersnaam:
  13. </td>
  14. <td>
  15. <input name=username type=text size="15">
  16. </td>
  17. </tr>
  18. <tr>
  19. <td align=right>
  20. Paswoord:
  21. </td>
  22. <td>
  23. <input name=password type=password size="15">
  24. </td>
  25. </tr>
  26. <tr>
  27. <td colspan=2 align=center>
  28. <input type=submit value="Log in">
  29. </td>
  30. </table>
  31. </form>
  32.  
  33. <?
  34. include ("footer.php");
  35. }
  36. else
  37. {
  38. $link = mysql_connect($dbhost, $dbuser, $dbpassword)
  39. or die("Could not connect: " . mysql_error());
  40. mysql_select_db($dbname);
  41. $sSQL="select n_ID, s_Password, n_Rand, b_Activated from t_Users where s_Username=\"".stripjunk($username)."\"";
  42. $results=mysql_query($sSQL);
  43. if(mysql_num_rows($results)>0)
  44. {
  45. list($id, $pwd, $rand, $b_Activated)=mysql_fetch_row($results);
  46. if($b_Activated<>1)
  47. {
  48. include ("header.php");
  49. echo "Your account is not active yet, please click the link in the welcome email to activate it (you can't log in until it's active)";
  50. }
  51. elseif($pwd==$password)
  52. {
  53. setcookie("bannerexchangename", $username,0,"/");
  54. setcookie("bannerexchangerand", $rand,0,"/");
  55. setcookie("bannerexchangeid", $id,0,"/");
  56.  
  57. // Here Update the logged in IP to the user
  58.  
  59. $ip = $_SERVER['REMOTE_ADDR'];
  60. $qry = "update t_Users set logged_ip='$ip' where n_ID='$id'";
  61. mysql_query($qry);
  62.  
  63.  
  64. // Also set a cookie with the id as referral id so as to block user creating user duplicate accounts..
  65.  
  66. setcookie("user_referral",$id,0,"/");
  67.  
  68. echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=./account.php?action=account\">";
  69. }
  70. else
  71. {
  72. echo "Password incorrect, if you're sure this is your account and have forgotten your password, please click <a href=./forgotpwd.php?username=".stripjunk($username).">here</a> to have your password emailed to you.";
  73. }
  74. }
  75. else
  76. {
  77. include ("header.php");
  78. echo "The specified username does not exist";
  79.  
  80. }
  81.  
  82. }
  83.  
  84. include ("footer.php");
  85. ?>


Ik kom er niet meer uit:|
Offline Ultimatum - 17/05/2007 12:32
Avatar van Ultimatum PHP expert 1. Smijt lappen code op plaatscode.be
2. Je structuur is echt brak, want 2x mysql_connect? En waarom roep je die 2de mysql_connect midden in je code op? Ga je op elke pagina de connectie opnieuw maken oid 
Offline ferdithug - 17/05/2007 12:45
Avatar van ferdithug Nieuw lid 1. Ik heb deze script gekocht en niet zelf gemaakt.
2. Ik heb dit script geinstalleert en hij werkt niet.
dat er 2 connects zijn weet ik ook niet maar conn.php wordt niet gebruikt voor het inloggen.

Normaal als ik om hulp vraag wordt er altijd gevraagt als ik de hele code wil posten zodat mensen het script kunnen zien.

Nu wordt er gezuurt dat ik teveel post:s
Offline mebus - 17/05/2007 12:48 (laatste wijziging 17/05/2007 12:48)
Avatar van mebus Nieuw lid 1. Slecht gescript dus
2. documentatie is engels... Zeker van een website geplukt/kocht
3. Gratis krijg je het beter en netter en nederlandse documentatie
4. Weggegooid geld dus... Hoop dat je der niet veel hebt voor betaald;)
Offline ferdithug - 17/05/2007 13:00
Avatar van ferdithug Nieuw lid het koste maar €2,24.
Maar deze script heb je niet in het NL.
Het moet werken maar iets geeft geen connectie.
Of hij kan het niet uit de DB lezen.
De install ging goed en de tabellen en gebruikersnaam en pass staan in de database dus ? 
Offline bertmelis - 17/05/2007 21:31 (laatste wijziging 17/05/2007 21:34)
Avatar van bertmelis PHP interesse welke foutmeldingen krijg je bij het inloggen? Staat op uw server register_globals aan? (indien Apache...)

Zoniet, moet je in het script een aantal dingen aanpassen:
  1. if(!$_POST['username'] && !$_POST['password'])

trek je niets aan van die 2x mysql_connect. De ene staat in een functie, dus die wordt niet altijd gebruikt, en de andere is nodig. Trouwens, als er al een connectie is met de server, wordt die overgenomen...
Offline Ultimatum - 17/05/2007 22:53
Avatar van Ultimatum PHP expert
Citaat:
Normaal als ik om hulp vraag wordt er altijd gevraagt als ik de hele code wil posten zodat mensen het script kunnen zien.


We willen ook wel je code maar als je het hier op het forum gooit word het onoverzichtelijk. Wat er ook staat als je een topic aanmaakt is dat je alle groten lappen op plaatscode.be plaatst zodat het forum overzichtelijk word en niet 1 grote troep van lange codes...
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.224s