Jump to content

shortj75

Members
  • Posts

    118
  • Joined

  • Last visited

    Never

Everything posted by shortj75

  1. everything looks fine to me except you have to change the table name in your sql query [code] $sql = "select * from table_name where user = '$username' and password = '$password'";                                [/code] and you have to select a database in your mysql_connect [code] $conn=mysql_connect("host", "userid", "password"); if(!mysql_select_db("dbname",$conn))     die("No database selected."); [/code] other then that every thing looks fine
  2. can you narrow it down to the problem that you are haveing i can help you with one problem you might have with your sessions change this [code] <?php session_start; ?> [/code] to this [code] <?php session_start(); ?> [/code] or you sessions probably wont start and also in your login form page you are calling up $_SESSION['user'] without starting sessions you have [code] <?php if ($_SESSION['user']) { ?>   <?php print "<font class=\"greyfont\">"; ?>   <b><?php print $_SESSION['user']; ?></b> LOGGED [/code] change to this [code] <?php session_start();?> <?php if ($_SESSION['user']) { ?>   <?php print "<font class=\"greyfont\">"; ?>   <b><?php print $_SESSION['user']; ?></b> LOGGED [/code]
  3. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]this is all good as long as i have entered data in my database manualy or if i go into and edit one that as been read from a text file dont alter anything and save this can then be read by my script [/quote] you have to enter it manualy because it will read the text file as one file and it wouldnt how to seperate it into the appropriate columns it would insert all of it into one column and yes doing an update will probably work but it will insert you data two or more times depending on how many columns you have in your db table because a while loop keeps looping through each column so it will update every time i hits a new column until it has looped through every column once
  4. the problem could also be that you need a password to connect to mysql and you are not useing one and the defualt password for the root user is usually 3306 or 3307 so try this and see if it helps [code] $connect= mysql_connect("localhost", "root", "3306") or die("Unable to connect to mysql: " . mysql_error()); $db= mysql_select_db("myDatabase") or die("Unable to select database: " . mysql_error()); [/code] or this [code] $connect= mysql_connect("localhost", "root", "3307") or die("Unable to connect to mysql: " . mysql_error()); $db= mysql_select_db("myDatabase") or die("Unable to select database: " . mysql_error()); [/code] or you could just set up your own user name and password by doing the following [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]Note: the following instruction are for windows operating system if you are using a different system the instructions will probably be different[!--colorc--][/span][!--/colorc--] [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] 1. go to start menu then run 2.after run opens type in explorer after explorer opens type %UserProfile% in the address bar and navagate to startmenu/programs/accessories 3.then create a new folder and name it database 4.goto Command Prompt in the accessories folder highlight it and hit ctrl c 5.now goto the database folder you just creater and open it once ther hit ctrl v which will past a command prompt file there now rename it mysql prompt 6. now right click your new mysql prompt file and go to properties click on the shortcuts tab goto the start in box and type in "C:/Program Files/FoxServ/mysql/bin" 7.next go to the options tab go to edit options and make sure quick edit mode and insert mode are checked 8.next go to the layout tab go to the screen buffer size and chang the height to 2000 or higher then hit apply then ok 9.now open the new mysql prompt file if you followed everthing correctly there should be a line like this C:/Program Files/FoxServ/mysql/bin> 10. now type in net start mysql then hit enter and it should say services started 11.now type mysql -u root mysql then hit enter to start the mysql monitor now you should see a line that say mysql> 12.now to change the master user and password you type in update user set User='Newname' and Password=password('Newpass') where User='root'; then hit enter it should say rows affected 1 13.now type in flush privileges; then hit enter it should say rows affected 1 14.now type in exit; then hit enter and it should say bye 15.now your Mysql Username and password should be changed [/quote]
  5. is it displaying the number 404 on the query page or is it saying error 404 if it is saying error 404 that means the the page you are looking for is missing so check the action part of your form tag make sure the url is spell correctly and also in your form tag you need to put the method in there and it look like you need to put method="post" because with out that you variables $metode = $_POST['metode']; and $search = $_POST['search']; will not work if it is the number 404 try removeing the @ symbol at your @mysql_select_db and your @mysql_fetch_array($query) and see if that helps
  6. i will try to explain this the best i can [code] //ok here is your basic login on form i will not go into explaining this //assuming you have the basic nowledge of html //login.php <center><table border=1> <TH>Log-In <tr><td> <form method="post" action="authenticate.php"> User Id: <td> <input type="text" name="id" vspace="7"> <tr><td> Password: <td> <input type="password" name="pass" vspace="7"> <tr><td> <input type="submit" value="Log-In"><input type="reset" value="Reset"> </form></th></TR></TD></TABLE></center> [/code] ok now i am gonna setup a mysql connect page to connect to your database [code] //connect.php //ok now we are gonna log you in to your mysql database //first you have to enter your database hosts name then your userid and password mysql_connect('yourhost', 'your userid', 'yourpassword') or die('Could not connect.'); //now wehave to select a database and check to see if it exists //and it is not found we will give ourself an error if(!mysql_select_db('database name'))     die('No database selected.'); [/code] ok here is where everything gets logged in and you set your session variables [code] //authenticate.php //ok here we include the  is the mysql connect page we did earlier include 'connect.php'; //ok next we have to start sessions session_start(); //now we have to grab the variables from login.php $user = $_POST['id']; $pass = $_POST['pass']; //ok now we are gonna check to see that the user enter his/her userid and password if((!$user) || (!$pass)){ //if the user forgot to enter there userid and or password we show them an error //message and display the login.php page for them to try again     echo "Please enter ALL of the information! <br />";     include 'login.php';     exit(); } //here we are checking to see if the userid and password match a userid and password //in your batabase $sql = mysql_query("select * from your table here where youruseridcolumnname='$user' and yourpasswordcolumnname='$pass'"); //we are now call thebatabase table where all the //userids and passwords are stored $login_check = mysql_num_rows($sql);//here we are checking to see if they match //if they match we are gonna call them up and log them in if($login_check > 0){     while($row = mysql_fetch_array($sql)){     foreach( $row AS $key => $val ){         $$key = stripslashes( $val );     } //ok now we are gonna set up some session variables these are very important //with the session variables you can check to see if the user is logged on later //and they are used to log the user out          session_register('user');         $_SESSION['user'] = $user;         session_register('pass');         $_SESSION['pass'] = $pass;         session_register('email');         $_SESSION['email'] = $email; //now that the user is logged in and session variables are set we will redirect the //user to your indexpage              print "<META HTTP-EQUIV = 'Refresh' Content = '0; URL =index.php'>";     }   } // now if the user could not belogged in we display an error message and the //login.php form for them to try again else {     echo "You could not be logged in! Either the username and password do not match or you have not validated your membership!<br />     Please try again!<br />";     include 'login.php'; }   [/code] now we check to see if the user is logged in whith you index.php page [code] //first we start sessions you must do this at the top of every page in order for sessions to work session_start(); //now we check to se if the user is logged in by useing the session variables we creatwed earlier //by call for the $_SESSION['user'] variable if(isset($_SESSION['user'])){ //if the sessionvariable was created you will now display your index page welcome to my site and so forth } //and if the session variable was not created which means the user didnt log in we give them an error else{ echo "sorry you cannot view this page because you have failed to log in"; //and now we display your login.php page include 'login.php } [/code] sorry it wont lit me post the logout part for some reason but you can get all of what is here plus the logout part [a href=\"http://tfws.dynu.com/loginlogouttut.php\" target=\"_blank\"]here[/a]
  7. did you try notepad or wordpad or microsoft word
  8. here is the if statement i use and it works great [code] $filename="../pic.gif"; if(file_exists($filename)) {          echo "<img src=../$filename target=_blank>";    } else {   echo "<img src=../if no pic.gif height=100 width=100>"; } [/code]
  9. you can run your uploadfile and at the bottom of the same page have a mysql query insert just the name into you bd and just call the name up later when you want to display the pic like so [code] <? your upload code here.... $pic=$_POST['pic_name']; mysql_query("insert into your_table(pic_name)values('$pic')"); ?> [/code] that is to insert the name into db [code] <? $getpic=mysql_query("select * from your_table"); while($getpic2=mysql_fetch_array($getpic)){ echo "<img src=../your_pic_directory/$getpic2[pic_name]>"; } ?> [/code] and that is to pull the pic name up from the db and where pic_name is replace that with the colmn name where your pics names are stored
  10. try this [code] $query="INSERT INTO student4(id,name,class,mark)VALUES ('NULL', 'zubair', 'second', '500')"; $rt=mysql_query($query); [/code]
  11. the code i gave you will create a new page on you server
  12. yes you can do that here is an example form [code] createpageform.php <form name="create" method="post" action="createpage.php"> Title: <input type="text" name="title"> please do not add extentions like .html or .php or any other<br> <textarea name="body"  rows="20" cols="100"> </textarea><BR> <input type="submit" value="Save"> </form> </body> [/code] and here is the code you use to create the page [code] ceatepage.php $filename = "$_POST['title'].html"; $body = $_POST['body'];    if (!$handle = fopen($filename, 'a')) {          echo "Cannot open file ($filename)";          exit;    }    if (fwrite($handle, $body) === FALSE) {        echo "Cannot write to file ($filename)";        exit;    }             fclose($handle); [/code]
  13. your best bet would probably make a seperate css stylesheet like so [code] <style><!--            scrollbar-3d-light-color:lightblue;            scrollbar-arrow-color:lightblue;            scrollbar-base-color:lightblue;            scrollbar-dark-shadow-color:navy;            scrollbar-face-color:blue;            scrollbar-highlight-color:black;            scrollbar-shadow-color:black; } a:link {  text-decoration: none; color:blue} a:active { text-decoration: none; color:green} a:visited { text-decoration: none; color:navy} a:hover { font: italic; color:red;} --></style> [/code] and name it style.css then use the php include function to add it to your php page [code] <? include 'style.css'; the rest of your php code here ?> [/code] that is basically it to see that it works [a href=\"http://tfws.dynu.com/software/download.php\" target=\"_blank\"]T.F.W.S Scripts[/a]
  14. this forum is for help with your php codeing if you are haveing a problem with your code post it here and tell us what the problem is and what your desired outcome of the code is and we will see if we can help you
  15. instead of this header("Location: $_SERVER[PHP_SELF]"); try something like this [code]    echo "<br /><br /><div align=center><span class='style2'>Error, Pleaes Enter The Correct Current Password</span></div><br />"; echo "<input type=button value=back onclick=window.location='yourformpage.php'>"; [/code] see how that works for you
  16. try this [code] header("Location: echo($row_rsCWGetCustomerData[cst_weburl])");[/code] i see i forgot the ") at the end
  17. first go to /adm/connect_db.php change your info where it says $host,$user,$password and $database and save it second locate /sql/createdb.sql and copy and paste the code below over the code on the createdb.sql page and save it then rename the page to createdb.php if you donot do this when you open the page in your browser al you will see is text appear on the screen and nothing will install [code] <? include '../adm/connect_db.php'; $sql="create table exchange_links ( id     int(11) NOT NULL auto_increment,   code      text,   email     varchar(255),   back_link varchar(255),   website_url varchar(255),   name        varchar(255),   category        INT,   quand           BIGINT,   state           CHAR(1),   last_checked    BIGINT,   check_result    CHAR(1),   attempts        INT,   dont_check      CHAR(1),   edit_key        CHAR(10),   PRIMARY KEY (id),   INDEX(category) )"; mysql_query($sql) or die(mysql_error()); print "install complete"; ?> [/code] after that is done open you browser (example: Internet explorer or Mozilla or Opera) and run this [a href=\"http://HTTP://Yoursite.com/sql/createdb.sql\" target=\"_blank\"]HTTP://Yoursite.com/sql/createdb.php[/a] and you installation is complete or it will give you an error telling you you that it didnt install and what to fix ( I had to download the script to figure this out hopfully this helps)
  18. instead of useing $_SERVER[PHP_SELF] i just have the the form action to the pagename (example form.php) [code] <form method="post" action="yourformpage.php"> <input type="hidden" name="user_id" value="<?php echo $row['user_id'];?>"> <table id="wrapper"> <tr align="center" bgcolor="#333333"> <td colspan="4"><p><span class="style7">Henry County RC Club<br> P.O. Box 3268<br> McDonough, GA. 30253-9998<br> Membership / Renewal Application Form</span></p></td> </tr> <tr align="center" bgcolor="#333333"> <td colspan="4"><p><span class="style7">Please make the necessary changes and click UPDATE to complete the process.<br> Fields marked * are required.</span></p></td> </tr> <tr bgcolor="#333333"> <td align="center"><span class="type style8">* First Name</span><span class="type style3"></span></td> <td height="1"><input name="first_name" type="text" id="first_name" value="<?php echo $row['first_name'];?>" size="25" /> <td align="center" class="type style8">* Last Name</td> <td height="1"> <input name="last_name" type="text" id="last_name" value="<?php echo $row['last_name'];?>" size="25" /></td> </tr> <tr bgcolor="#333333"> <td align="center" span class="style8">* Address</span></td> <td colspan="3"><input name="address" type="text" id="address" value="<?php echo $row['address'];?>" size="30" /></td> </tr> <tr bgcolor="#333333"> <td align="center" span class="style8">Address 2</td> <td colspan="3"> <input name="address_2" type="text" id="address_2" value="<?php echo $row['address_2'];?>" size="30" /></td> </tr> <tr bgcolor="#333333"> <td align="center" class="type style8">* City</td> <td> <input name="city" type="text" id="city" value="<?php echo $row['city'];?>" size="25" /> <td align="center" class="type style8">* State</td> <td width="0"> <input name="state" type="text" id="state" value="<?php echo $row['state'];?>" size="15" /></td> </tr> <tr bgcolor="#333333"> <td align="center" class="type style8">* Zip</td> <td colspan="3"> <input name="zip" type="text" id="zip" value="<?php echo $row['zip'];?>" size="10" /></td> </tr> <tr bgcolor="#333333"> <td align="center" class="type style8">* Daytime Phone</td> <td> <input name="day_phone" type="text" id="day_phone" value="<?php echo $row['day_phone'];?>" size="12" /></td> <td align="center" class="type style8">Evening Phone</td> <td width="0"> <input name="night_phone" type="text" id="night_phone" value="<?php echo $row['night_phone'];?>" size="12" /></td> </tr> <tr bgcolor="#333333" > <td align="center" class="type style8">Cell Phone</td> <td colspan="3"> <input name="cell_phone" type="text" id="cell_phone" value="<?php echo $row['cell_phone'];?>" size="12" /></td> </tr> <tr bgcolor="#333333"> <td align="center" class="type style8">* Email</td> <td> <input name="email" type="text" id="email" value="<?php echo $row['email'];?>" size="30"></td> <td align="center" class="type style8">* AMA#</td> <td width="0"> <input name="ama" type="text" id="ama" value="<?php echo $row['ama'];?>" size="15" /></td> </tr> <tr bgcolor="#333333"> <td colspan="4" align="right"> <input type="submit" name="submit" value="submit" /></td> </tr> </table> </form> <?php if (isset($_POST['submit'])) { $row = $_POST['user_id']; $f_name = $_POST['first_name']; $l_name= $_POST['last_name']; $f_address= $_POST['address']; $s_address= $_POST['address_2']; $city= $_POST['city']; $state= $_POST['state']; $zip= $_POST['zip']; $day_phone= $_POST['day_phone']; $night_phone= $_POST['night_phone']; $cell_phone= $_POST['cell_phone']; $email= $_POST['email']; $ama= $_POST['ama']; $query = "UPDATE member_data SET first_name= '$f_name', last_name= '$l_name', address= '$f_address', address_2= '$s_address', city= '$city', state= '$state', zip= '$zip', day_phone= '$day_phone', night_phone= '$night_phone', cell_phone= '$cell_phone', email= '$email', ama= '$ama' WHERE user_id= '$row'"; $result = mysql_query($query); header("location: ../member_update/app_received.html");// redirect to  thank you page } ?> [/code] and if you want to redirect them to the thankyou page you instead of trying to load it in within you form page you can change include to header("location: ../member_update/app_received.html")
  19. try calling for the variable with global variable $_GET[]; [code] <? $page=$_GET['pg'];                     $ext = ".php";                     $pg = "".$page."".$ext."";                     if (file_exists($pg))                     {                     include($pg);                     } else {                     include("error.php");                     }                     ?>[/code]
  20. this is php code already you some <? ?> you dont need that may be you problem try this [code] <? if($HTTP_HOST=="www.napoleonp.org/ikaika/redirect.php" or $HTTP_HOST == "napoleonp.org/ikaika/redirect.php"){ header("Location:  echo($row_rsCWGetCustomerData[cst_weburl]); "); }?> [/code] that should work
  21. have you tried the include() function [code] <? include("blabla.vbs"); ?> [/code] or you may have to echo your script [code] <? echo "your vbscript here"; ?> [/code]
  22. its not your code it is the server when you first hit submit it says cant find server then when you refresh the page it loads but loses all the variables
  23. both apachi servers may be configured differently(example: one is on a lenux os and if the other one is on a windows os they would be configured different and may read code different) and that could be the problem plus another problem you might run into is if on server is running php4 and the other is running php5 some of the php4 code will not run on php5 because of the the changes but the problem you are haveing is the server because when you hit the submit button the browser says can not find server and when you hit the refresh button the page displays with the error
  24. every time it says cant find server that is a server error and not code error and when it says cant find server and you refresh it it is looseing all the veriables if you are usein the same server as the one that work just useing a different domain name then it is probaly the server that is hosting the domain name haveing errors
  25. does it keep saying it cant find server and wher you refresh it it says you did not enter all requested data
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.