[PHP] .htaccess... why it is deleted by the server?!!!?
Hi.. I made a .htaccess file. and then uploaded it to my server.. but everytime I do it deletes it automatically.. it is hidden directly.. or sure deleted from there.. so what is the problem! My hosting account is Linux, WebServer : Apache.. so what is the problem? and how to solve it? Cheers..
[PHP] .htaccess... why it is deleted by the server?!!!?
You are right.. It is hidden only.. Okay now this problem is solved.. but the other problem is that in my .htaccess file : AuthUserFile /pass2 AuthGroupFile /pass2 AuthName AllowLocalAccess AuthType Basic order deny,allow deny from 217.164.249.134 allow from all The IP 217.164.249.134 is mine.. I want to try blocking it from transfering data from the folder /pass2 into my PC.. I mean in my website : http://www.alaedin.com/pass2/www.alaedin.com/pass2/tetetet.rm So I want to deny that RM file.. so that IP can't access it or download it to his machine.. is it possible? where must I put this file? And must I change in this script? or it is right? Please help me in this problem.. Cheers.. - Original Message - From: Richard Davey [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 04, 2004 7:44 PM Subject: Re: [PHP] .htaccess... why it is deleted by the server?!!!? Hello Radwan, Thursday, March 4, 2004, 3:38:28 PM, you wrote: RA I made a .htaccess file. and then uploaded it to my server.. RA but everytime I do it deletes it automatically.. it is hidden RA directly.. or sure deleted from there.. so what is the RA problem! Are you *sure* it is deleted? By default the fullstop (period) at the start of the filename in Unix will HIDE it from you. If you can SSH/Telnet into your account do: ls -al to show any hidden files in the directory listing. If you're viewing via an FTP client, check for Options to show hidden files. If you know this all already, sorry! :) -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] .htaccess... why it is deleted by the server?!!!?
And also must I put it without name? or can I name it for example : test.htaccess? or must I name it : .htaccess (Without name)?? Please help me.. Cheers.. - Original Message - From: Radwan Aladdin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 04, 2004 7:58 PM Subject: [PHP] .htaccess... why it is deleted by the server?!!!? You are right.. It is hidden only.. Okay now this problem is solved.. but the other problem is that in my .htaccess file : AuthUserFile /pass2 AuthGroupFile /pass2 AuthName AllowLocalAccess AuthType Basic order deny,allow deny from 217.164.249.134 allow from all The IP 217.164.249.134 is mine.. I want to try blocking it from transfering data from the folder /pass2 into my PC.. I mean in my website : http://www.alaedin.com/pass2/www.alaedin.com/pass2/tetetet.rm So I want to deny that RM file.. so that IP can't access it or download it to his machine.. is it possible? where must I put this file? And must I change in this script? or it is right? Please help me in this problem.. Cheers.. - Original Message - From: Richard Davey [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 04, 2004 7:44 PM Subject: Re: [PHP] .htaccess... why it is deleted by the server?!!!? Hello Radwan, Thursday, March 4, 2004, 3:38:28 PM, you wrote: RA I made a .htaccess file. and then uploaded it to my server.. RA but everytime I do it deletes it automatically.. it is hidden RA directly.. or sure deleted from there.. so what is the RA problem! Are you *sure* it is deleted? By default the fullstop (period) at the start of the filename in Unix will HIDE it from you. If you can SSH/Telnet into your account do: ls -al to show any hidden files in the directory listing. If you're viewing via an FTP client, check for Options to show hidden files. If you know this all already, sorry! :) -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .htaccess... why it is deleted by the server?!!!?
Okay.. and is the code right in the .htaccess file? This is the code again : AuthUserFile /pass2 AuthGroupFile /pass2 AuthName AllowLocalAccess AuthType Basic order deny,allow deny from 217.164.249.134 allow from all The directory that I want to prevent that IP from download from it is : http://www.alaedin.com/pass2 So where must I put the .htaccess file.. and does the code working well?? Cheers.. - Original Message - From: Richard Davey [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 04, 2004 8:18 PM Subject: Re: [PHP] .htaccess... why it is deleted by the server?!!!? Hello Radwan, Thursday, March 4, 2004, 4:09:07 PM, you wrote: RA And also must I put it without name? or can I name it for example : RA test.htaccess? or must I name it : .htaccess (Without name)?? Usually you must name it .htaccess There is probably a way to change what it can be called, but I'm no Apache admin so I couldn't tell you how. I dare say it might be a httpd.conf setting somewhere. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Blocking IPs from entering some files on my server??
Hello.. I put a .htaccess file on my server, and everything is fine.. But the problem is that I want to prevent all users from seeing a page.. only some IP addresses can see it.. So I tried to put my IP to be allowded.. but it said that I'm not allowded... So what to do? Did anybody tried .htaccess files to prevent IP from seeing some pages and worked? Or to give the permission for an IP address to see the page..?? This is the code : AuthUserFile /dev/null AuthGroupFile /dev/null AuthName ExampleAllowFromNCSA AuthType Basic Limit GET order deny,allow allow from 217.164.237.105 deny from all /Limit So please try it on your IP address.. Waiting your replies.. Cheers..
[PHP] Two easy questions I think..
Hi.. 1- In my mySQL DB there is a field named Whole.. there are many rows.. and every one has the value for the field Whole. What I want is to add all these values in all rows for the field Whole then show it on the screen.. I mean by add : 1 + 2 + 3 = 6... 2- I have another filed there also.. named UserNo I want every adding query to this field to include a value in the row for that field = the latest row's value + 1 For example : if there are three rows in the table.. Row1 : UserNo value = 1 Row2 : UserNo value = 2 Row3 : UserNo value = 3 I want PHP to get the last row's value for that field (In this example : 3) then add to it 1.. so it will be 4 and insert it to the new row.. Regards..
Re: [PHP] E-Commerce
Okay.. these are for the Shopping Cart.. Can anybody here tell me.. how to build a Payment Gateway? For example: like 2CheckOut did.. not only applicatios connected with 2CheckOut... I want to know how to build a company like 2CheckOut.. Of course I know it is too hard.. but I must know about that.. Hope any body here knows about that.. Regards.. - Original Message - From: John Nichel [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 13, 2004 11:24 AM Subject: Re: [PHP] E-Commerce Angelo Zanetti wrote: JOhn, do you have any other recommendations that you might have looked at after your experience with OS commerce? Not that are written in PHP. Not that I wouldn't recommend any, I just haven't looked at any other PHP carts besides OS Commerce. I'm sure there are some good ones, just like there are quite a few good ones written in Perl, C, etc. You can look here... http://php.resourceindex.com/Complete_Scripts/Shopping_Carts/ -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E-Commerce
Cool!!! Do you mean by this I can open a company like PaySystems or 2CheckOut! Must I contact banks all over the world to make the Credit Card Transaction? Or must I register in an organization? What to do now after registratin here http://www.ospayments.com/001/contact.html what must I do? Regards.. - Original Message - From: John Nichel [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 13, 2004 11:39 AM Subject: Re: [PHP] E-Commerce Radwan Aladdin wrote: Okay.. these are for the Shopping Cart.. Can anybody here tell me.. how to build a Payment Gateway? For example: like 2CheckOut did.. not only applicatios connected with 2CheckOut... I want to know how to build a company like 2CheckOut.. Of course I know it is too hard.. but I must know about that.. Hope any body here knows about that.. Regards.. *sigh* http://www.google.com/search?hl=enie=UTF-8oe=UTF-8q=php+payment+gatewayb tnG=Google+Search http://php.resourceindex.com/Complete_Scripts/Commerce_and_Finance/ -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DLL in PHP?
Hi All, Just would like to know if you can call DLL from PHP the same way you do in ASP? If so then can any one pass me some example or links. Cheers..
[PHP] Please help me with this. (Retriving info from mySQL database and then put it in combo box)
Hi all.. I have in my database the fields :CourseTitle, Language1, Language2, Language3, Language4, Language5, Language6...Etc.. Now what I want to make is : By using an ActiveX Control I want to retrive the values for these fields from the database.. so for example there are many rows there(In the database).. : MS Word XP EnglishFrench Arabic MS PowerPoint XPChinese French Arabic.Etc MS Access XPChinese JapaneseEnglish.Etc I want to retrive these rows and put them in two combo boxes (CourseTitle and CourseLanguage).. the CourseTitle combo box contains the CourseTitle values from the database. For example : MS Word XP, MS PowerPoint XP, MS Access XP...Etc and the CourseLanguage combo box contains the CourseLanguage values from the database for every CourseTitle. For example : MS Word XP has Englsih,French and Arabic languages.. so if the user chose MS Word XP then the CourseLanguage will show the languages for that Course.. I hope you got my meaning.. So what I want is to import from the database then split these info into items inside the Combo box.. Best Regards..
[PHP] Re: The final script! but still some problems..
So what is the problem? - Original Message - From: Radwan Aladdin To: [EMAIL PROTECTED] Sent: Thursday, January 29, 2004 10:40 AM Subject: The final script! but still some problems.. Hi all.. This is the final PHP code that I written.. but there i some problems.. not errors.. I said problems.. For example the Distance value is not updated correctly.. and the LessonNumber field also.. please help me fixing these problems : ?php include(Config.php); $link = mysql_connect($user_hostname, $user_username, $user_password); mysql_select_db($user_database, $link); $UserName = $_GET['UserName']; $Password = $_GET['Password']; $LogoutTime = date(U); $query1 = UPDATE accounts SET LogoutTime=$LogoutTime; $result1 = mysql_query($query1) or die(Query error: . mysql_error()); $query2 = SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE `UserName`='$UserName' AND `Password`='$Password'; $result2 = mysql_query($query2) or die(Query error: . mysql_error()); $row2 = mysql_fetch_row($result2); $query3 = UPDATE accounts SET LessonNumber=LessonNumber + 1; $RightLoginTime = $row2[LoginTime]; $Distance = $row2[Distance]; $LessonNumber = $row2[LessonNumber]; $LessonsTimeLimit = 30; ? pre ? echo $query1; echo $query2; echo $query3; ? /pre ? $query4 = UPDATE accounts SET Distance= . ($LogoutTime - $RightLoginTime) . WHERE UserName='$UserName' AND Password='$Password'; $result4 = mysql_query($query4) or die(Query error: . mysql_error());)); $query5 = SELECT Distance FROM accounts; $result5 = mysql_query($query5) or die(Query error: . mysql_error()); $row3 = mysql_fetch_row($result5); $UpdatedDistance = $row3[Distance]; ? pre ? echo $query4; ? /pre ? if($Distance == $LessonsTimeLimit){ $result3 = mysql_query($query3) or die(Query error: . mysql_error()); }else{ echo Not yet!; } ? I'm sure it is very easy for you.. I hope that.. Regards..
[PHP] Hope any body can fix this!!!
Hi.. I made the following PHP script.. And every time I try it, it shows an error message... I think there is a wrong with ($LogoutTime - $RightLoginTime'). So please try to fix the error.. What I want to do is to insert a logout time and if (LogoutTime - LoginTime = 20) for example.. then make the field LessonNumber = Its value + 1 (2 + 1 = 3 for example) This is the script :- ?php include(Config.php); $link = mysql_connect($user_hostname, $user_username, $user_password); mysql_select_db($user_database, $link); $UserName = $_GET['UserName']; $Password = $_GET['Password']; $LogoutTime = date(U); $query1 = UPDATE accounts SET LogoutTime=$LogoutTime; $query2 = SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE UserName='$UserName' AND Password='$Password'; $query3 = UPDATE accounts SET LessonNumber=LessonNumber + 1; $result = mysql_query($query1) or die(Query error: . mysql_error()); $RightLoginTime = 'LoginTime'; $Distance = 'Distance'; $LessonNumber = 'LessonNumber'; $LessonsTimeLimit = 30; $query4 = INSERT INTO accounts (Distance) ('$LogoutTime - $RightLoginTime'); $result2 = mysql_query($query4) or die(Query error: . mysql_error()); if($Distance == $LessonsTimeLimit){ $result3 = mysql_query($query3) or die(Query error: . mysql_error()); }else{ echo Not yet!; } ? Waiting your replies.. Best regards..
[PHP] Still error messages!!
Hello all.. This is the PHP code : ?php include(Config.php); $link = mysql_connect($user_hostname, $user_username, $user_password); mysql_select_db($user_database, $link); $UserName = $_GET['UserName']; $Password = $_GET['Password']; $LogoutTime = date(U); $query1 = UPDATE accounts SET LogoutTime=$LogoutTime; $query2 = SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE UserName='$UserName' AND Password='$Password'; $query3 = UPDATE accounts SET LessonNumber=LessonNumber + 1; $result = mysql_query($query1) or die(Query error: . mysql_error()); $RightLoginTime = 'LoginTime'; $Distance = 'Distance'; $LessonNumber = 'LessonNumber'; $LessonsTimeLimit = 30; $query4 = UPDATE accounts SET (Distance=' . $LogoutTime - $RightLoginTime . ') WHERE UserName= . $UserName . AND Password= . $Password . ); $result2 = mysql_query($query4) or die(Query error: . mysql_error()); if($Distance == $LessonsTimeLimit){ $result3 = mysql_query($query3) or die(Query error: . mysql_error()); }else{ echo Not yet!; } ? And this is the mySQL structure : # phpMyAdmin MySQL-Dump # version 2.2.3 # http://phpwizard.net/phpMyAdmin/ # http://phpmyadmin.sourceforge.net/ (download page) # # Host: localhost # Generation Time: Jan 28, 2004 at 08:27 PM # Server version: 3.23.47 # PHP Version: 4.1.1 # Database : `elearning` # # # Table structure for table `accounts` # CREATE TABLE accounts ( UserName varchar(50) NOT NULL default '', Password varchar(50) NOT NULL default '', SecurityQuestion varchar(50) NOT NULL default '', SecurityAnswer varchar(50) NOT NULL default '', CourseTitle varchar(50) NOT NULL default '', CourseLanguage varchar(50) NOT NULL default '', FirstName varchar(50) NOT NULL default '', LastName varchar(50) NOT NULL default '', BirthDay varchar(50) NOT NULL default '', BirthMonth varchar(50) NOT NULL default '', BirthYear varchar(50) NOT NULL default '', Gender varchar(50) NOT NULL default '', Language varchar(50) NOT NULL default '', Country varchar(50) NOT NULL default '', StateOrCity varchar(50) NOT NULL default '', ZIPPostalCode varchar(50) NOT NULL default '', Occupation varchar(50) NOT NULL default '', Email varchar(50) NOT NULL default '', Phone varchar(50) NOT NULL default '', Mobile varchar(50) NOT NULL default '', Serial varchar(50) NOT NULL default '', Activation varchar(50) NOT NULL default '', Random varchar(101) NOT NULL default '', Adjective varchar(50) NOT NULL default '', LessonNumber varchar(50) NOT NULL default '', LoginTime varchar(200) NOT NULL default '', LogoutTime varchar(200) NOT NULL default '', Distance varchar(50) NOT NULL default '', UNIQUE KEY UserName (UserName) ) TYPE=MyISAM; # # Dumping data for table `accounts` # So where are the errors? Waiting your help please.. Regards..
Re: [PHP] Still error messages!!
Hehehehehe :) sorry I forgot that :) Query error: You have an error in your SQL syntax near '0') WHERE UserName= AND Password=)' at line 1 Also when I put the right UserName and Password.. the same error!! So also there are sme other errors.. please see the whole script.. What I'm trying to do is : To UPDATE a value in the database (Login_Time and Logout_Time) and then caculate the distance between them and put it in (Distance) field.. then after that program the PHP file and put in it a LessonLimit value.. if the LessonLimit is the same of the Distance.. then make a value in that row (LessonNumber) = Its currently value + 1 (So for example : is LessonNumber = 2 then it must be 3...Etc..) Hope you got my meaning.. Waiting your help.. Regards.. - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: Radwan Aladdin [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 9:12 PM Subject: RE: [PHP] Still error messages!! [snip] So where are the errors? [/snip] Good question. You have not shown us the error message. Please show us and we can help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still error messages!!
Thank for your reply.. But I'm not trying to echo these queries.. What I'm trying to do is : To UPDATE a value in the database (Login_Time and Logout_Time) and then caculate the distance between them and put it in (Distance) field.. then after that program the PHP file and put in it a LessonLimit value.. if the LessonLimit is the same of the Distance.. then make a value in that row (LessonNumber) = Its currently value + 1 (So for example : is LessonNumber = 2 then it must be 3...Etc..) Hope you got my meaning.. The error that is displayed always is : Query error: You have an error in your SQL syntax near '0') WHERE UserName= AND Password=)' at line 1 Also when I put the right UserName and Password.. the same error!! So also there are some other errors.. please see the whole script.. Waiting your help.. Regards.. - Original Message - From: David OBrien [EMAIL PROTECTED] To: Radwan Aladdin [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 9:35 PM Subject: Re: [PHP] Still error messages!! At 12:08 PM 1/28/2004, Radwan Aladdin wrote: Hello all.. This is the PHP code : ?php include(Config.php); $link = mysql_connect($user_hostname, $user_username, $user_password); mysql_select_db($user_database, $link); $UserName = $_GET['UserName']; $Password = $_GET['Password']; $LogoutTime = date(U); $query1 = UPDATE accounts SET LogoutTime=$LogoutTime; $query2 = SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE UserName='$UserName' AND Password='$Password'; $query3 = UPDATE accounts SET LessonNumber=LessonNumber + 1; right here do a ? pre ? echo $query1; echo $query2; echo $query3; ? /pre ? and make sure the queries are what you want them to be... $result = mysql_query($query1) or die(Query error: . mysql_error()); $RightLoginTime = 'LoginTime'; $Distance = 'Distance'; $LessonNumber = 'LessonNumber'; $LessonsTimeLimit = 30; $query4 = UPDATE accounts SET (Distance=' . $LogoutTime - $RightLoginTime . ') WHERE UserName= . $UserName . AND Password= . $Password . ); Do the same here for query4 $result2 = mysql_query($query4) or die(Query error: . mysql_error()); if($Distance == $LessonsTimeLimit){ $result3 = mysql_query($query3) or die(Query error: . mysql_error()); }else{ echo Not yet!; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still error messages!!
I made that.. but there is something strange!! I SELECTED field from the database.. but it is not showing what it contains!! This is what is shown on the screen : UPDATE accounts SET LogoutTime=1075313199SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE UserName='' AND Password=''UPDATE accounts SET LessonNumber=LessonNumber + 1 Query error: You have an error in your SQL syntax near '0') WHERE UserName= AND Password=)' at line 1 So what is wrong!!!?? Everything is inserted and updated correctly in the database.. but the distance is the same.. no changes.. no updates!! Regards.. - Original Message - From: Damon Hill [EMAIL PROTECTED] To: 'Radwan Aladdin' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 9:56 PM Subject: RE: [PHP] Still error messages!! Correct Radwan, you are NOT trying to echo the queries to the screen. However, what David is trying to teach you is simply debugging techniques. By echoing the actual query that the PHP pareser is using, you can see if it is indeed what you want it to be. This way, you can debug the code yourself, instead of posting it to a list for help. That way you cut down on the number of email messages I receive and also learn something in the process. Now, echo it to the screen and see what it says :-) M Damon Hill Senior Technical Lead IFWorld, Inc. www.ifworld.com Go Hogs! People demand freedom of speech to make up for the freedom of thought which they avoid. - Soren Aabye Kierkegaard -Original Message- From: Radwan Aladdin [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 11:50 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Still error messages!! Thank for your reply.. But I'm not trying to echo these queries.. What I'm trying to do is : To UPDATE a value in the database (Login_Time and Logout_Time) and then caculate the distance between them and put it in (Distance) field.. then after that program the PHP file and put in it a LessonLimit value.. if the LessonLimit is the same of the Distance.. then make a value in that row (LessonNumber) = Its currently value + 1 (So for example : is LessonNumber = 2 then it must be 3...Etc..) Hope you got my meaning.. The error that is displayed always is : Query error: You have an error in your SQL syntax near '0') WHERE UserName= AND Password=)' at line 1 Also when I put the right UserName and Password.. the same error!! So also there are some other errors.. please see the whole script.. Waiting your help.. Regards.. - Original Message - From: David OBrien [EMAIL PROTECTED] To: Radwan Aladdin [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 9:35 PM Subject: Re: [PHP] Still error messages!! At 12:08 PM 1/28/2004, Radwan Aladdin wrote: Hello all.. This is the PHP code : ?php include(Config.php); $link = mysql_connect($user_hostname, $user_username, $user_password); mysql_select_db($user_database, $link); $UserName = $_GET['UserName']; $Password = $_GET['Password']; $LogoutTime = date(U); $query1 = UPDATE accounts SET LogoutTime=$LogoutTime; $query2 = SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE UserName='$UserName' AND Password='$Password'; $query3 = UPDATE accounts SET LessonNumber=LessonNumber + 1; right here do a ? pre ? echo $query1; echo $query2; echo $query3; ? /pre ? and make sure the queries are what you want them to be... $result = mysql_query($query1) or die(Query error: . mysql_error()); $RightLoginTime = 'LoginTime'; $Distance = 'Distance'; $LessonNumber = 'LessonNumber'; $LessonsTimeLimit = 30; $query4 = UPDATE accounts SET (Distance=' . $LogoutTime - $RightLoginTime . ') WHERE UserName= . $UserName . AND Password= . $Password . ); Do the same here for query4 $result2 = mysql_query($query4) or die(Query error: . mysql_error()); if($Distance == $LessonsTimeLimit){ $result3 = mysql_query($query3) or die(Query error: . mysql_error()); }else{ echo Not yet!; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still error messages!!
I'm using the GET method.. And it is right.. it shows the correct GET method.. the problem in is in the Destance value.. it is not updating this value to the database.. or it is wrong.. every time = 0 So what is the error? Regards.. - Original Message - From: David OBrien [EMAIL PROTECTED] To: Radwan Aladdin [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 10:34 PM Subject: Re: [PHP] Still error messages!! I assume you are using another page with a form to enter the username and password? If so: add as the first line of your script right after the ?PHP phpinfo(); Run your application, scroll to the bottom and look at the php variables and make sure that your are asking for $_GET[Username] and $_GET[Password] are what the script sees If not: You may have to run just that page with http://whatever/whatever.php?Username=whateverPassword=whatever to see if the problem is in the form or not -Dave At 01:08 PM 1/28/2004, Radwan Aladdin wrote: I made that.. but there is something strange!! I SELECTED field from the database.. but it is not showing what it contains!! This is what is shown on the screen : UPDATE accounts SET LogoutTime=1075313199SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE UserName='' AND Password=''UPDATE accounts SET LessonNumber=LessonNumber + 1 Query error: You have an error in your SQL syntax near '0') WHERE UserName= AND Password=)' at line 1 So what is wrong!!!?? Everything is inserted and updated correctly in the database.. but the distance is the same.. no changes.. no updates!! Regards.. - Original Message - From: Damon Hill [EMAIL PROTECTED] To: 'Radwan Aladdin' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 9:56 PM Subject: RE: [PHP] Still error messages!! Correct Radwan, you are NOT trying to echo the queries to the screen. However, what David is trying to teach you is simply debugging techniques. By echoing the actual query that the PHP pareser is using, you can see if it is indeed what you want it to be. This way, you can debug the code yourself, instead of posting it to a list for help. That way you cut down on the number of email messages I receive and also learn something in the process. Now, echo it to the screen and see what it says :-) M Damon Hill Senior Technical Lead IFWorld, Inc. www.ifworld.com Go Hogs! People demand freedom of speech to make up for the freedom of thought which they avoid. - Soren Aabye Kierkegaard -Original Message- From: Radwan Aladdin [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 11:50 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Still error messages!! Thank for your reply.. But I'm not trying to echo these queries.. What I'm trying to do is : To UPDATE a value in the database (Login_Time and Logout_Time) and then caculate the distance between them and put it in (Distance) field.. then after that program the PHP file and put in it a LessonLimit value.. if the LessonLimit is the same of the Distance.. then make a value in that row (LessonNumber) = Its currently value + 1 (So for example : is LessonNumber = 2 then it must be 3...Etc..) Hope you got my meaning.. The error that is displayed always is : Query error: You have an error in your SQL syntax near '0') WHERE UserName= AND Password=)' at line 1 Also when I put the right UserName and Password.. the same error!! So also there are some other errors.. please see the whole script.. Waiting your help.. Regards.. - Original Message - From: David OBrien [EMAIL PROTECTED] To: Radwan Aladdin [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 9:35 PM Subject: Re: [PHP] Still error messages!! At 12:08 PM 1/28/2004, Radwan Aladdin wrote: Hello all.. This is the PHP code : ?php include(Config.php); $link = mysql_connect($user_hostname, $user_username, $user_password); mysql_select_db($user_database, $link); $UserName = $_GET['UserName']; $Password = $_GET['Password']; $LogoutTime = date(U); $query1 = UPDATE accounts SET LogoutTime=$LogoutTime; $query2 = SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE UserName='$UserName' AND Password='$Password'; $query3 = UPDATE accounts SET LessonNumber=LessonNumber + 1; right here do a ? pre ? echo $query1; echo $query2; echo $query3; ? /pre ? and make sure the queries are what you want them to be... $result = mysql_query($query1) or die(Query error: . mysql_error()); $RightLoginTime = 'LoginTime'; $Distance = 'Distance'; $LessonNumber = 'LessonNumber'; $LessonsTimeLimit = 30; $query4 = UPDATE accounts
Re: [PHP] Still error messages!!
But I mean by $RightLoginTime = 'LoginTime'; the selected field from the database (LoginTime).. First I selected the LoginTime from the database and now I'm trying to name a variable for it to use it.. So what is the correct code? Regards.. -- SASSINC Internet Solutions - Arabic Department [EMAIL PROTECTED] http://www.SASSINC.Net - Original Message - From: John W. Holmes [EMAIL PROTECTED] To: Radwan Aladdin [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 10:46 PM Subject: Re: [PHP] Still error messages!! From: Radwan Aladdin [EMAIL PROTECTED] I made that.. but there is something strange!! It's strange you can't follow instructions... I SELECTED field from the database.. but it is not showing what it contains!! This is what is shown on the screen : UPDATE accounts SET LogoutTime=1075313199SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE UserName='' AND Password=''UPDATE accounts SET LessonNumber=LessonNumber + 1 Query error: You have an error in your SQL syntax near '0') WHERE UserName= AND Password=)' at line 1 If you had printed out all the queries, you'd realize that error is coming from $query4. $query4 = UPDATE accounts SET (Distance=' . $LogoutTime - $RightLoginTime . ') WHERE UserName= . $UserName . AND Password= . $Password . ); $UserName and $Password have no value. Your distance calculation doesn't make any sense, either, as you're subtracting a string from an integer... $LogoutTime = date(U); $RightLoginTime = 'LoginTime'; So you're setting distance equal to 1034566 - LoginTime (for example), which is just going to come out to $LogoutTime (since a string converted to an integer is zero in this case). ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still error messages!!
Now I fixed the error message.. but the problem is in Distance = 0 always.. because the LoginTime is a string.. I fetch it but the same thing!! This is the new script : ?php phpinfo(); include(Config.php); $link = mysql_connect($user_hostname, $user_username, $user_password); mysql_select_db($user_database, $link); $UserName = $_GET['UserName']; $Password = $_GET['Password']; $LogoutTime = date(U); $query1 = UPDATE accounts SET LogoutTime=$LogoutTime; $query2 = SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE UserName='$UserName' AND Password='$Password'; $result2 = mysql_query($query2) or die(Query error: . mysql_error()); $row2 = mysql_fetch_row($result2); $query3 = UPDATE accounts SET LessonNumber=LessonNumber + 1; $RightLoginTime = 'LoginTime'; $Distance = 'Distance'; $LessonNumber = 'LessonNumber'; $LessonsTimeLimit = 30; ? pre ? echo $query1; echo $query2; echo $query3; ? /pre ? $query4 = UPDATE accounts SET Distance= . $LogoutTime - $RightLoginTime . - LoginTime WHERE UserName= . $UserName . AND Password= . $Password . ); $result4 = mysql_query($query4) or die(Query error: . mysql_error()); $row4 = mysql_fetch_row($result4); ? pre ? echo $query4; ? /pre ? if($Distance == $LessonsTimeLimit){ $result3 = mysql_query($query3) or die(Query error: . mysql_error()); }else{ echo Not yet!; } ? So why it is making the Distance value = 0 and it doen't update the value in the database. (Because it must update the value in the database by it) Regards.. - Original Message - From: John Nichel [EMAIL PROTECTED] To: Radwan Aladdin [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 11:37 PM Subject: Re: [PHP] Still error messages!! Radwan Aladdin wrote: snip So where are the errors? Waiting your help please.. Regards.. What's the error message??? -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still error messages!!
Thanks alot for your reply :) I really appreciate your help.. Upto now I made this script : ?php include(Config.php); $link = mysql_connect($user_hostname, $user_username, $user_password); mysql_select_db($user_database, $link); $UserName = $_GET['UserName']; $Password = $_GET['Password']; $LogoutTime = date(U); $query1 = UPDATE accounts SET LogoutTime=$LogoutTime; $result1 = mysql_query($query1) or die(Query error: . mysql_error()); $query2 = SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE UserName='$UserName' AND Password='$Password'; $result2 = mysql_query($query2) or die(Query error: . mysql_error()); $row2 = mysql_fetch_row($result2); $query3 = UPDATE accounts SET LessonNumber=LessonNumber + 1; $RightLoginTime = $row2[LoginTime]; $Distance = $row2[Distance]; $LessonNumber = $row2[LessonNumber]; $LessonsTimeLimit = 30; ? pre ? echo $query1; echo $query2; echo $query3; ? /pre ? $query4 = UPDATE accounts SET Distance='$LogoutTime - $RightLoginTime' WHERE UserName='$UserName' AND Password='$Password'; $result4 = mysql_query($query4) or die(Query error: . mysql_error()); ? pre ? echo $query4; ? /pre ? if($Distance == $LessonsTimeLimit){ $result3 = mysql_query($query3) or die(Query error: . mysql_error()); }else{ echo Not yet!; } ? It update everyting fine.. but the problem is that the LoginTime value is not imported from the database! So what is the problem? Regards.. - Original Message - From: David OBrien [EMAIL PROTECTED] To: Radwan Aladdin [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, January 29, 2004 12:07 AM Subject: Re: [PHP] Still error messages!! At 02:45 PM 1/28/2004, Radwan Aladdin wrote: Now I fixed the error message.. but the problem is in Distance = 0 always.. because the LoginTime is a string.. I fetch it but the same thing!! This is the new script : ?php phpinfo(); include(Config.php); $link = mysql_connect($user_hostname, $user_username, $user_password); mysql_select_db($user_database, $link); $UserName = $_GET['UserName']; $Password = $_GET['Password']; $LogoutTime = date(U); $query1 = UPDATE accounts SET LogoutTime=$LogoutTime; You are not executing this query anywhere in the script $query2 = SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE UserName='$UserName' AND Password='$Password'; $result2 = mysql_query($query2) or die(Query error: . mysql_error()); $row2 = mysql_fetch_row($result2); Great that you used this to get the results in a row but you need to reference the row in your script $query3 = UPDATE accounts SET LessonNumber=LessonNumber + 1; Instead of $RightLoginTime = 'LoginTime'; use $RightLoginTime = $row2[LoginTime]; but you need to do a mysql_query for the $query1 and get that value frst Instead of $Distance = 'Distance'; use $Distance = $row2[Distance]; Instead of $LessonNumber = 'LessonNumber'; use $LessonNumber = $row2[LessonNumber]; The user comments on the online manual are a very good starting point for basic programming steps needed to accomplish a task If you would have taken the example on that page you would have seen the steps needed: set your query string execute the query get the resultset into a variable This is the norm for all mysql php programming just putting a $Distance='Distance' does not tell php that what you really want it do read the database and place the value of Distance into $Distance -Dave $LessonsTimeLimit = 30; ? pre ? echo $query1; echo $query2; echo $query3; ? /pre ? $query4 = UPDATE accounts SET Distance= . $LogoutTime - $RightLoginTime . - LoginTime WHERE UserName= . $UserName . AND Password= . $Password . ); $result4 = mysql_query($query4) or die(Query error: . mysql_error()); $row4 = mysql_fetch_row($result4); ? pre ? echo $query4; ? /pre ? if($Distance == $LessonsTimeLimit){ $result3 = mysql_query($query3) or die(Query error: . mysql_error()); }else{ echo Not yet!; } ? So why it is making the Distance value = 0 and it doen't update the value in the database. (Because it must update the value in the database by it) Regards.. - Original Message - From: John Nichel [EMAIL PROTECTED] To: Radwan Aladdin [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 11:37 PM Subject: Re: [PHP] Still error messages!! Radwan Aladdin wrote: snip So where are the errors? Waiting your help please.. Regards.. What's the error message??? -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] The final script! but still some problems..
Hi all.. This is the final PHP code that I written.. but there i some problems.. not errors.. I said problems.. For example the Distance value is not updated correctly.. and the LessonNumber field also.. please help me fixing these problems : ?php include(Config.php); $link = mysql_connect($user_hostname, $user_username, $user_password); mysql_select_db($user_database, $link); $UserName = $_GET['UserName']; $Password = $_GET['Password']; $LogoutTime = date(U); $query1 = UPDATE accounts SET LogoutTime=$LogoutTime; $result1 = mysql_query($query1) or die(Query error: . mysql_error()); $query2 = SELECT LoginTime,Distance,LessonNumber FROM accounts WHERE `UserName`='$UserName' AND `Password`='$Password'; $result2 = mysql_query($query2) or die(Query error: . mysql_error()); $row2 = mysql_fetch_row($result2); $query3 = UPDATE accounts SET LessonNumber=LessonNumber + 1; $RightLoginTime = $row2[LoginTime]; $Distance = $row2[Distance]; $LessonNumber = $row2[LessonNumber]; $LessonsTimeLimit = 30; ? pre ? echo $query1; echo $query2; echo $query3; ? /pre ? $query4 = UPDATE accounts SET Distance= . ($LogoutTime - $RightLoginTime) . WHERE UserName='$UserName' AND Password='$Password'; $result4 = mysql_query($query4) or die(Query error: . mysql_error());)); $query5 = SELECT Distance FROM accounts; $result5 = mysql_query($query5) or die(Query error: . mysql_error()); $row3 = mysql_fetch_row($result5); $UpdatedDistance = $row3[Distance]; ? pre ? echo $query4; ? /pre ? if($Distance == $LessonsTimeLimit){ $result3 = mysql_query($query3) or die(Query error: . mysql_error()); }else{ echo Not yet!; } ? I'm sure it is very easy for you.. I hope that.. Regards..
[PHP] How to echo something if not exist?
Hi all.. I want to echo something if the GET value was not exist in the database.. So for example : The user enters his email address and if this email was not found in the field of the email addresses in the table.. then echo Invalid Email Address So how to do it? Regards..
[PHP] How to make the value updated always?
Hello.. How to make the PHP file (Login page) to update a value every 5 seconds for example from the database.. So if the connection is alive it will update the value. But if the connection diconnected with the database then it will stop doing that.. then in the comming login it will do the same.. So how to do that? And also I want to know if the user didn't logout from his account.. I mean closed the APP (VB APP) without pressing the Logout button.. so will it continue updating the database? or it will automatically stop that? Regards..
[PHP] Help me with this please???
Hi.. I'm trying to make a PHP code that do the following : Inserts the server time to the database (When login). and then insert it again (When logout). Now I want to compare the two values to know the defference between them by minutes.. so for example : if the defference was 2880 minutes then update a value in the database (Value in database + 1).. and every 2880 minutes I want to add 1 to the value.. This for lessons in my project.. the lessons must be updated every 2880 minutes.. but not automatically.. I mean the user can login for 60 minutes for example and then after 10 days he can login again and see the same lesson.. so every 2880 minutes the user stay in the program.. the lesson will be updated.. I tried to make it but everytime wrong. I hope you got me well.. Waiting your help and thanks in advance.. Best regards..
[PHP] How to prevent duplicated values?
Hello.. I want to prevent mySQL from storing the same value in a specified field (Username).. so how can I do it? Regards..
[PHP] Can I run it on any OS?
Hi all.. Can I run my PHP project on any server and OS? I used the timetamp, random string, UNIQUE fields and many many other feaures for PHP.. So must I run it on Linux? or I can run it on any OS? Can you please tell me what are the OS that I can run my project on? Waiting your replies.. Thanks in advance.. Regards..
[PHP] How to make a timer inside the database?
Hi all Is it possible in mySQL to put a timer that changes a value inside a row in a table every while? For example : Add 1 to the value very 10 minutes for example.. Field number = 5 after ten minutes = 6 after another 10 minuste = 7..Etc.. Is it possible?And how? Regards..
[PHP] Please help me as fast as possible.. very important!!
Hi all Is it possible in mySQL to put a timer that changes a value inside a row in a table every while? For example : Add 1 to the value very 10 minutes for example.. Field number = 5 after ten minutes = 6 after another 10 minuste = 7..Etc.. Is it possible?And how? Regards..
Re: [PHP] Please help me as fast as possible.. very important!!
Where can I fin tutorials about it? (CRON Tab)? Regards.. - Original Message - From: Nick JORDAN [EMAIL PROTECTED] To: Radwan Aladdin raladin [EMAIL PROTECTED] Sent: Tuesday, January 20, 2004 1:56 PM Subject: Re: [PHP] Please help me as fast as possible.. very important!! Is it possible in mySQL to put a timer that changes a value inside a row in a table every while? For example : Add 1 to the value very 10 minutes for example.. Field number = 5 after ten minutes = 6 after another 10 minuste = 7..Etc.. As far as I'm aware, that's not possible in MySQL, however you could write a small script in PHP (or, indeed, some other language) which would increment the counter, and which would be run at intervals via cron (for instance). A better solution, however, would be to include a timestamp in your database, then, when data is requested, calculate how many units of ten minutes have passed and adjust your counter accordingly. Nick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What is wrong with these Codes!!!!???
Hello.. I made these three PHP files.. but I don't know where is the problem Login.php - This will grab the UserName, Password and Serial fields by GET then compare them with the one in the database (After MD5 them) Activate.php -- For the admin.. he can activate users account by entering the UserName in a filed inside "Activate.htm" and then UPDATE a value in the database to ACTIVATED Deactivate -- This will deactivate the account.. the same as the upper one.. Now.. The Login.php page is saying : Parse error: parse error in c:\apache\htdocs\user\login.php on line 20 The Activate.php page is saying : Warning: Supplied argument is not a valid MySQL-Link resource in c:\apache\htdocs\admin\activate.php on line 31 The Deactivate.php is saying the same as the Activate.php error. So I don't know where is the problem!!! everything is okay.. And there is no errors in the scripts.. so can you please take a look at them..maybe there is some falts.. I attached theTHREE PHP files with the TWO HTM files for the activation (POST the UserName for the Activation and Deactivation) Also with the .sql file of the database Waiting your help please.. Regards.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sorry the attachement was not received!! I put the codes here.
Just before a minute I sent a message with an attachement.. but the attachement was canceled by the list!! Any way.. these are the codes of the pages : Login.php : ?php $link = mysql_connect(localhost, Database username, Database password) or die(Could not connect: . mysql_error()); mysql_select_db(Database name, $link); $UserName = $_GET['UserName']; $Password = $_GET['Password']; $Serial = $_GET['Serial']; $UserName = mysql_escape_string($UserName); $Password = mysql_escape_string($Password); $Serial = mysql_escape_string($Serial); $user = escape_function($user); $query1 = select Serial from accounts where UserName='$UserName' and Password='$Password'; $query2 = SELECT Random FROM accounts; $Random = 'Random' $result = mysql_query($query1) or die(Query error: . mysql_error()); $row = mysql_fetch_row($result) or die(Incorrect credentials, Please contact the E-Learning Administraion...: . mysql_error()); $RightSerial = htmlspecialchars($row[0]); $UserSent = $Serial . $Random; $ServerReply = $RightSerial . $Random; $md5a = md5($UserSent); $md5b = md5($ServerReply); mysql_close($link); if($md5a == $md5b){ printEND HTML BODY You was accepted by the server.. /BODY/HTML END; }else{ printEND HTML BODY Sorry, you was blocked by the server for one of the following reasons : 1- You are not using the same PC that you registered from. 2- You are trying to hack the System. If you are sure that you are using the same PC.. then contact the E-Learning System Administrator. /BODY/HTML END; } Activate.php : ?php function dbConnect() { //define the database connection information $dbHost = localhost; $dbUser = Database username; $dbPass = Database password; $dbName = database name; //connect to the mysql server $link = @mysql_connect($dbHost, $dbUser, $dbPass); //return success or failure of connection if(!$link) { //report error echo Could not connect to server; exit; } //select the database if([EMAIL PROTECTED]($dbName)) { //report error echo Could not select database; exit; } } $query=mysql_query(UPDATE `accounts` SET Activation='ACTIVATED' WHERE UserName='.$_POST['UserName'].' LIMIT 1); if (mysql_affected_rows($query)==1) { echo $_POST['UserName']. has been activated; } ? Deactivate.php ?php function dbConnect() { //define the database connection information $dbHost = localhost; $dbUser = Database username; $dbPass = Database password; $dbName = Database name; //connect to the mysql server $link = @mysql_connect($dbHost, $dbUser, $dbPass); //return success or failure of connection if(!$link) { //report error echo Could not connect to server; exit; } //select the database if([EMAIL PROTECTED]($dbName)) { //report error echo Could not select database; exit; } } $query=mysql_query(UPDATE `accounts` SET Activation='DEACTIVATED' WHERE UserName='.$_POST['UserName'].' LIMIT 1); if (mysql_affected_rows($query)==1) { echo $_POST['UserName']. has been Deactivated; } ? Activate.htm HTML HEAD SCRIPT function selectit() { document.forms[Activation].elements[UserName].focus(); } /SCRIPT /HEAD BODY form NAME=Activation ACTION=Activate.php METHOD=POST BUser Name to Activate: input TYPE=TEXT SIZE=17 MAXLENGTH=16 NAME=UserNameinput TYPE=submit NAME=Activate VALUE=Activate ACTION=Activate.php METHOD=POSTbr /B /FORM /BODY/HTML Deactivate.htm HTML HEAD SCRIPT function selectit() { document.forms[Activation].elements[UserName].focus(); } /SCRIPT /HEAD BODY form NAME=Activation ACTION=Deactivate.php METHOD=POST BUser Name to Deactivate: input TYPE=TEXT SIZE=17 MAXLENGTH=16 NAME=UserNameinput TYPE=submit NAME=Deactivate VALUE=Deactivate ACTION=Deactivate.php METHOD=POSTbr /B /FORM /BODY/HTML Waiting your help.. up to now I don't know why it is error.. Regards..
Re: [PHP] Sorry the attachement was not received!! I put the codes here.
Hi dear.. thanks for your reply.. I fixed the Login.php file :) Error : 'Random' Right : 'Random'; But what must I do with this?? : $result = mysql_query($query1) or die(Query error: . mysql_error()); And I fixed the other pages.. Regards.. - Original Message - From: Toby Irmer [EMAIL PROTECTED] To: Radwan Aladdin [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, January 20, 2004 5:07 PM Subject: Re: [PHP] Sorry the attachement was not received!! I put the codes here. Go check your code for obvious errors before you post it on this list: $Random = 'Random' $result = mysql_query($query1) or die(Query error: . mysql_error()); Now spot the mistake. If you can't... tough luck. toby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to search the database?
Hello.. I made my Login and registration pages and everything is okay.. but what I want now is to know how to make this : A PHP page for the administrator.. that has a TextBox (UserName).. he will enter a user name in it.. after that he will press the button (Activate).. Now by pressing that button the PHP page will search the database (A specified table) for that username, if it is exist then search his row for a field named (Activation) and then update its value into Activated.. but if this user is not exist in that table.. a message will apear for the administrator.. Waiting your replies guys ;-) Thanks in advance... Cheers..
Re: [PHP] How to search the database?
I did a search and I found my request :) Notice : I'm sorry I didn't tell you anything about me and my brother.. So I attached with this message our CVs.. hope you will know that I'm at 9th class at school :) That why I ask very much :) Regards.. - Original Message - From: Radwan Aladdin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 19, 2004 3:08 PM Subject: Re: [PHP] How to search the database? I did a search and I found my request :) Notice : I'm sorry I didn't tell you anything about me and my brother.. So I attached with this message our CVs.. hope you will know that I'm at 9th class at school :) That why I ask very much :) Regards and thanks alot for your powerful help.. - Original Message - From: Angelo Zanetti [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] Sent: Monday, January 19, 2004 2:38 PM Subject: RE: [PHP] How to search the database? you should try to figure parts of it out before just asking. By us just giving you the answer means that you aren't going to learn anything. TRy and battle but when you get it working you will feel as if you've accomplished something rather than cut and paste someone else's code!! -Original Message- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: Monday, January 19, 2004 12:27 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] How to search the database? Hmmm, your problem sounds like a serious one but something everyone must know... I have found this site to be particularly useful http://php.net,as for some reason these guys seem to know what they are talking about. after going through the online manual (or downloading it...),...go to this site http://google.com and search for RTFM for a total solution to these kinds of problems. Cheers, -Ryan Hello.. I made my Login and registration pages and everything is okay.. but what I want now is to know how to make this : A PHP page for the administrator.. that has a TextBox (UserName).. he will enter a user name in it.. after that he will press the button (Activate).. Now by pressing that button the PHP page will search the database (A specified table) for that username, if it is exist then search his row for a field named (Activation) and then update its value into Activated.. but if this user is not exist in that table.. a message will apear for the administrator.. Waiting your replies guys ;-) Thanks in advance... Cheers.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Technikon or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is this code right?
Hi all.. I made this code for the login.php page.. it will compare A value from the users machine (Serial) and with a value inside the database (In that users' row).. so after logging it will check if also this value is the same and then echo something..is the following code is right for that? : ?php $link = mysql_connect(localhost, Database username, Database password) or die(Could not connect: . mysql_error()); mysql_select_db(Table name, $link); $UserName = $_GET['UserName']; $Password = $_GET['Password']; $Serial = $_GET['Serial']; $query = SELECT Serial, Password from accounts where UserName='$UserName'; $result = mysql_query($query) or die(Query errort: . mysql_error()); $row = mysql_fetch_row($result) or die(User Not found: . mysql_error()); $Serial = htmlspecialchars($row[0]); $UserPassword = $row[1]; $UserSerial = $row[1]; mysql_close($link); if($UserSerial == $Serial){ printEND HTML BODY Right serial! /BODY/HTML END; }else{ printEND HTML BODY Sorry, wrong serial! /BODY/HTML END; } if($UserPassword == $Password){ printEND HTML BODY Logged in successfully /BODY/HTML END; }else{ printEND HTML BODY Sorry, wrong password! /BODY/HTML END; } ? Please notice : PHP: -- $UserSerial = $row[1]; -- must I put it PHP: -- $UserSerial = $row[2]; -- or something else? Regards.. Waiting your reply..
Re: [PHP] Is this code right?
Oh sorry.. I didn't notice that.. anyway.. I want to know.. what to add to this code to make it also check the serial between the database (That users' row) and the GET variable before it echos anything.. so the UserName, Password and Serial must be the same for that user.. Waiting your reply.. regards.. - Original Message - From: Miguel J. Jiménez [EMAIL PROTECTED] To: Radwan Aladdin [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, January 19, 2004 9:29 PM Subject: Re: [PHP] Is this code right? Radwan Aladdin wrote: Hi all.. I made this code for the login.php page.. it will compare A value from the users machine (Serial) and with a value inside the database (In that users' row).. so after logging it will check if also this value is the same and then echo something..is the following code is right for that? : ?php $link = mysql_connect(localhost, Database username, Database password) or die(Could not connect: . mysql_error()); mysql_select_db(Table name, $link); $UserName = $_GET['UserName']; $Password = $_GET['Password']; $Serial = $_GET['Serial']; $query = SELECT Serial, Password from accounts where UserName='$UserName'; $result = mysql_query($query) or die(Query errort: . mysql_error()); $row = mysql_fetch_row($result) or die(User Not found: . mysql_error()); $Serial = htmlspecialchars($row[0]); mysql_select_db is for selecting the database and NOT the table, the SELECT statement must be something like this: select SOMETHING from TABLE where WHERE_CLAUSE -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is this code right?
Do you mean this is the right code : ?php $link = mysql_connect(localhost, Database username, Database password) or die(Could not connect: . mysql_error()); mysql_select_db(Database name, $link); $UserName = $_GET['UserName']; $Password = $_GET['Password']; $Serial = $_GET['Serial']; $query = SELECT Serial, Password from accounts where UserName='$UserName'; $result = mysql_query($query) or die(Query errort: . mysql_error()); $row = mysql_fetch_row($result) or die(User Not found: . mysql_error()); $Serial = htmlspecialchars($row[0]); $UserPassword = $row[1]; $UserSerial = $row[1]; mysql_close($link); if($UserSerial == $Serial){ printEND HTML BODY Right serial! /BODY/HTML END; }else{ printEND HTML BODY Sorry, wrong serial! /BODY/HTML END; } if($UserPassword == $Password){ printEND HTML BODY Logged in successfully /BODY/HTML END; }else{ printEND HTML BODY Sorry, wrong password! /BODY/HTML END; } ? - Original Message - From: Jeremy Davis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 19, 2004 9:40 PM Subject: RE: [PHP] Is this code right? snip $query = SELECT Serial, Password from accounts where UserName='$UserName'; $result = mysql_query($query) or die(Query errort: . mysql_error()); $row = mysql_fetch_row($result) or die(User Not found: . mysql_error()); mysql_fetch_row only pulls data one cell at a time so you would need to call $row[0] twice to get the two cells before calling the next row. $Serial = htmlspecialchars($row[0]); mysql_select_db is for selecting the database and NOT the table, the SELECT statement must be something like this: select SOMETHING from TABLE where WHERE_CLAUSE -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is this code right?
Just what I'm trying to do (Comparing the database with the GET) :) :) Thanks alot for your help.. Regards.. - Original Message - From: Ben Ramsey [EMAIL PROTECTED] Newsgroups: php.general To: Radwan Aladdin [EMAIL PROTECTED] Sent: Monday, January 19, 2004 10:16 PM Subject: Re: [PHP] Is this code right? Radwan Aladdin wrote: Do you mean this is the right code : The code overall looks right, but you set $Serial twice... first you do: $Serial = $_GET['Serial']; Then you do: $Serial = htmlspecialchars($row[0]); Then you set $UserSerial to $row[1] (the same as the Password column). So, when you compare $Serial to $UserSerial, you are really comparing it like this: if (htmlspecialchars($row[0]) == $row[1]) If that's what you're trying to do, then you're good. But, if you're trying to compare $UserSerial with the serial variable in $_GET, then you need to only do the following: $Serial = $_GET['Serial']; $UserSerial = $row[0]; if ($Serial == $UserSerial) Then, that should at least compare the serial field from the database with the serial variable in $_GET. -Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Hot to MD5 two values (Valu1+Valu2)
Hi all.. I want to know.. Can I use : $md5 = md5($variable1 + $variable2); Is it right to use that? Notice : I don't want I want to add the first value to the second one(1=2=3).. then make them MD5...MD5(3) (For example).. Regards..