Jump to content

udaystrad

Members
  • Posts

    44
  • Joined

  • Last visited

Everything posted by udaystrad

  1. This should help...... background: url('bgimage.jpg') no-repeat; background-size:100%;
  2. k what i have found out is the IP which is been extracted is my Gateway IP and not client IP. Now i cant remov my gateway as i will loose my connection. i have tried sme settings but it has no effect....either nothings hapnenin or i m losing my connection. Pls if u can provide me with some solution to sort out this gateway issue or how to get the client IP if d above code doesnt work....... Thanks in advance....
  3. The server is a VPS server so cannot setup to only to LAN addresses. Will get back to you regarding the second solution.
  4. the server is at my office.... i have tried acessing from diff locations ie from my house, frnds house. But the above code is giving the location of itself as may be the code itself generates its own location. All done from a computer. If i have understood your first question this is the answer for it. There isnt any load on the server and it does not involve proxies. Its an app were the staff would login-logout for attendance. I dont want them to access from anyother loaction other than my office. So code should be as such that only accessing the pages from the office would mark them present. In order for me to do that i need to kno the location of the staff using my attendance app.
  5. Hey i have tried many codes..... this is one example of it..... The scenario is as folows... I have an IP hosted on a server... I want to kno who accesses the files of that IP... the codes that i tried yet, give out the IP of my own server or nothin at all... <?php $ip = $_SERVER['REMOTE_ADDR']; if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } Echo "Client IP is " . $ip; ?>
  6. Also wanted to kno wheter how do you guys solve these scripts ..... By actual performing it on your system creating a database??? or Or making the best out of the information given and directly giving out codes without trying it on your system???? Pls answer this. Both ways are obviously gud bt if its the second one you guys are seriously amazing.... phpfreaks rocks.....
  7. My app is complete and its running 5n. Well i m a new bee in this php world. The basic coding i had learned was from w3schools as per my boss(also many here in India advised me to w3schools) and whenever an app is to be developed i search codes in google. Is my approach ryt? or Cn you guide me good sites for learning php and sql. If you help me for Ajax also that would be great. The administrator of this group said that w3schools is the worst site to study php although whatever i learnt from it havnt found it wrong yet. May be the standard of writing the code and so i have found it myself is low you guys being expert in php. Can you guide me over it.
  8. Wel strad solutions is the company where i work and the boss of the company has allocated me this app. Like i said the style and level at which you have writen the code is a bit dificult for me at the moment being an amateur. I m continuing with the new version that you have designed and i want to update the same atendance table. You can see in the above table TIme in and time out both get inserted diferently. I want to keep time in n timeout both in the same row which can be done by updating the time in row. Bt updation depends on the last timeout value for that particular memberid. Only if the last time out value is missed that row wil be updated or else insertion wil take place as there was no time in value inserted. I hope i am able to make you understand. Time in is login. (which always is inserted and will give a value of only time in and timeout value would be missing) Time out is logout. (which will be updated if timeout mising else new row inserted) So in order to do that i now also need the id so that the system can locate the exact row. I m sorry i should have asked for the entire row or these three value(ie id, member-id and timeout). Well i do use the attendancenew table but after i extract those two values i have to del all the values in the table in order to run the fresh values when it will be inserted. I also want to tell you why i have separated Time day date and Month as when the atendance is to be checked my boss can take ny of these values separate to check particular attendance. thankful to you i have traced the last memberid and timeout but the funny part is that i dont have that id to update it back in attendance table. I wasnt aware of the id concept before. I thought the system numbers itself the entries that come in.
  9. i want you to edit query for id also..... SELECT a.MemberId, IF(a.timeout IS NULL,'Missing', a.TimeOut) as TimeOut FROM attendancenew a JOIN ( SELECT MemberId, MAX(COALESCE(TimeIn, TimeOut)) as latest FROM attendancenew GROUP BY MemberId ) as last ON a.MemberId = last.MemberId AND latest IN (a.TimeIn, a.TimeOut) This code gives a table of memberid and timeout. I also want it to include the respective id. For eg. id Memberid timeout 8 007 Missing its becoz after i get the id i can update that respective row.
  10. i tried few queries editing those lines of yours but its not workin to get id, memberid and time out all together. And also sir your level at which you have writen the codes is amazing. Could you guide me through some good sites or ebooks so that i can refer to for php and sql. I kno i m askin too many questions and too much but again i would be indeed thankful for it.
  11. hey could you also give me the query for extraxting id coresponding those values ie. along with memberid and timeout. As i want to update values in that row only.
  12. I am so thankful to you sir the way you have answered and i m sorry for my structure. To be honest i dont kno how to insert a table as u did. If u help through that i would be much more thankful. Even if you dont i would find it by myself. For sure you wont find this kind of conversation again on my side. I will run this code and give you feedback.
  13. yes.... there are number of id like 007..... there is 008 ,009.... all repeated many times..... i want to select the last values coresponding these ids..... here are the columns MemberId TimeIn TimeOut Day OutDay Month Year 007 12:32:50 Missed 16 16 November 2013 007 Missed 12:34:45 16 16 November 2013 004 11:25:12 Missed 19 19 November 2013 009 13:39:2 Missed 19 19 November 2013 006 11:1:44 Missed 20 20 November 2013 006 11:2:40 Missed 20 20 November 2013 006 Missed 11:2:57 20 20 November 2013 007 11:52:42 Missed 23 23 November 2013 008 15:7:47 Missed 20 20 November 2013 Now like this many entries will follow..... i wont to work on the last entries for a particular id....so i need to extract those values... in the above code last timeout for 007 should be 'Missed' whereas for 006 it should be 11:2:57
  14. I m finding it difficult to extract or say select last value for a particluar value(remeber this particluar value is at multiple locations in the same column). Corresponding the last particular value is a value which i want to extract. theres some mistake in my selection syntax i.e. "SELECT LAST('$timeout') FROM $attendance WHERE MemberId='$mid'" here is the complete code <?php $host="localhost"; // Host name $username="root"; // Mysql username $password="india123"; // Mysql password $db_name="test"; // Database name mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $attendance="attendance"; $timeout="TimeOut"; $mid='007'; // $takevalue = mysql_query("SELECT $timeout FROM $attendance ORDER BY $mid DESC LIMIT 1;"); $takevalue=mysql_query("SELECT LAST('$timeout') FROM $attendance WHERE MemberId='$mid'"); $array = mysql_fetch_array($takevalue); $arr=$array['TimeOut']; echo $arr; mysql_close($con); ?> If u see in the above code $mid='007'; is the particular value ie '007'. There are many number of '007' value in a column. Out of this the Time out value corresponding the last '007' value needs to be extracted. how to do it. pls give me the syntax. thnks in advance....
  15. k. i did find the mistake. i jus had to place the value in inverted comas ie $mid='009'; as the value insterd in the table was text value. Error reporting was already ON and like i said so there were no errors from the code. thank you for the help.
  16. phpMyAdmin 2.11.11.3 NO errors i think i m not able to retrieve data at selection of table.... i want it to retrieve data n display it out there has to be somethin in the array i dont kno y its not showing n giving output .... sdadsaasd even if i manage to get smethin in array... the count should cum 1.... which is 0 as it enters that loop and gives output.... no matching records both of which are wrong.... is it syntax error .... or what i m not able to trace it out....?????
  17. Got stuck with some coding.. the same sort of code is working somwhere else .....but not able to trace why this isnt workin? Here's the code... <?php $host="localhost"; // Host name $username="root"; // Mysql username $password="india123"; // Mysql password $db_name="test"; // Database name $members="members"; $mid=009; $sa="Potekar"; $sql="sdadsaasd"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $then=mysql_query("SELECT * FROM $members WHERE MID='$mid' and Surname='$sa'"); $array = mysql_fetch_array($then); $count=mysql_num_rows($array); if (!$array) { echo "$sql<br>" . mysql_error(); } else { // check if any records found if ($count==0) { echo "No matching records<br>"; } else { $ra="sid"; $sid=$array['FirstName']; echo $sid.'<br/>'; echo $ra; } } ?>
  18. k... thank you so much sir.... i did follow this method of checks for some of my codes. even the last one worked out for me. My codes are much more easy to understand.
  19. Sir pls guide me what exactly u wer tryin to say...or i have got it by myself???? n i m also stuck with one more databse problem heres the code its nt workin???? thers no output(not getin inserted in database) NO error showing. let me remind you i have tried sme other format also (which didnt work)...although dont have it .... pLs give me the line you think is right coz i have been stuck on this for a while.... mysql_query("INSERT INTO $attendance ('MemberId,TimeIn,TimeOut,Day,Month,Year') VALUES ('$mid','$timein','$timeout','$day','$month','$year') ");
  20. Hey sir but the same codes worked out for me after some changes..... or n may be i didnt understand what exactly u r tryin to say bcoz u r an expert and ur chances are more to be right....bt stil i have solved my issue... Here is the code below <?php $host="localhost"; // Host name $username="root"; // Mysql username $password="india123"; // Mysql password $db_name="test"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $myusername="maruti"; $mypassword="india123"; // If result matched $myusername and $mypassword, table row must be 1 row $dim="MID"; $attendance="attendance"; // Table name $takevalue=mysql_query("SELECT $dim FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"); $array = mysql_fetch_array($takevalue); $mid=$array['MID']; echo $mid.'<br/>'; //; ?>
  21. phpMyAdmin 2.11.11.3 NO errors out put-- SELECT MID FROM members WHERE username='maruti' and password='india123' the ouput should be -- 009 (which i m nt able to get)
  22. Heres the code dont kno wats the problem <?php $host="localhost"; // Host name $username="root"; // Mysql username $password="india123"; // Mysql password $db_name="test"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $myusername="maruti"; $mypassword="india123"; $dim="MID"; // column name $mid="SELECT $dim FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; echo $mid; ?>
  23. i m sorry for the trouble.... here's the repeat my code... <?php session_start(); if(!isset($_SESSION['uname']) || !isset($_SESSION['pwd'])){ header("Location: login.php"); } if(isset($_POST['Submit'])){ $ipno1=trim($_POST["ipno1"]); $ipno2=trim($_POST["ipno2"]); $ipno3=trim($_POST["ipno3"]); $ipno4=trim($_POST["ipno4"]); $addport=trim($_POST["addport"]); $addid=trim($_POST["addid"]); $clientname=trim($_POST["clientname"]); $plan=trim($_POST["plan"]); $validity=trim($_POST["validity"]); if($ipno1 == "" && $ipno2 == "" && $ipno3 == "" && $ipno4 == "" && $addport == "" && $addid == "" && $clientname == "" && $plan == "" && $validity == "") { $error= "All Coloumns Blank!!!"; $code= "1" ; } elseif($ipno1 == "" ) { $error= "Enter the IP First column."; $code= "1" ; } elseif(!is_numeric($ipno1)) { $error= "Entries of IP and Port should be Numeric!!!"; $code= "1" ; } elseif($ipno2 == "" ) { $error= "Enter the IP Second column."; $code= "1" ; } elseif(!is_numeric($ipno2)) { $error= "Entries of IP and Port should be Numeric!!!"; $code= "1" ; } elseif($ipno3 == "" ) { $error= "Enter the IP Third column."; $code= "1" ; } elseif(!is_numeric($ipno3)) { $error= "Entries of IP and Port should be Numeric!!!"; $code= "1" ; } elseif($ipno4 == "" ) { $error= "Enter the IP Fourth column."; $code= "1" ; } elseif(!is_numeric($ipno4)) { $error= "Entries of IP and Port should be Numeric!!!"; $code= "1" ; } elseif($addport == "" ) { $error= "Enter the Port Number."; $code= "2" ; } elseif(!is_numeric($addport)) { $error= "Port Entry should be Numeric!!!"; $code= "2" ; } elseif($addid == "" ) { $error= "Enter ID!!!"; $code= "3" ; } elseif(($clientname == "")) { $error= "Enter client name !!!"; $code= "4" ; } elseif(($plan == "")) { $error= "Enter client name!!!"; $code= "5" ; } elseif(($validity == "")) { $error= "Enter validity!!!"; $code= "6" ; } else{ $con=mysqli_connect("localhost","root","","test"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $a=$ipno1.".".$ipno2.".".$ipno3.".".$ipno4; $sql="INSERT INTO Servers (IP,Port,ID,ClientName,Plan,Validity) VALUES ('$a','$_POST[addport]','$_POST[addid]','$_POST[clientname]','$_POST[plan]','$_POST[validity]')"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "1 record added.<br/><a href='server-handling.php'>Refresh</a> "; mysqli_close($con); } } $con=mysqli_connect("localhost","root","","test"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // $values = mysqli_query($con,"SELECT IP FROM servers"); $result = mysqli_query($con,"SELECT * FROM servers"); $query = "SELECT IP FROM servers"; if ($task = mysqli_query($con, $query)) { while ($row = mysqli_fetch_assoc($task)) { //$servers = array("183.87.135.65","183.87.135.69","183.87.135.70"); if(empty($row)) { echo"<p>There's nothing in the array.....</p>"; } else { foreach($row as $server) { //print_r($server); //Array ( [IP] => 183.87.135.69 ) shazim //Notice: Use of undefined constant IP - assumed 'IP' in C:\xampp\htdocs\sapp\server-handling.php on line 152 //183.87.135.69Error: You have an error in your SQL syntax; check the manual //that corresponds to your MySQL server version for the right syntax to use near 'SET Status='ONLINE' servers WHERE IP='183.87.135.69'' at line 1 //$sql = "UPDATE testimonials SET name='$name', content='$content' WHERE id=$id"; // $result = mysql_query($sql); // if ($result === FALSE) { // die(mysql_error()); // } //} //echo "shazim"; $b=$server; echo "<br>".$b; //echo $b; $check = @fsockopen($b, 22); if ($check) { @fclose($check); $status="ONLINE"; $stat="UPDATE servers SET Status='$status' WHERE IP='$b'"; if (!mysqli_query($con,$stat)) { die('Error: ' . mysqli_error($con)); } } else { $status="OFFLINE"; $stat="UPDATE servers SET Status='$status' WHERE IP='$b'"; if (!mysqli_query($con,$stat)) { die('Error: ' . mysqli_error($con)); } } // k the manual that corresponds to your MySQL server version for the right syntax to use near '.135.69' at line 1 } } } } echo "<table border='1'> <tr> <th>IP</th> <th>Port</th> <th>ID</th> <th>Client Name</th> <th>Plan</th> <th>Validity</th> <th>Status</th> </tr>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['IP'] . "</td>"; echo "<td>" . $row['Port'] . "</td>"; echo "<td>" . $row['ID'] . "</td>"; echo "<td>" . $row['ClientName'] . "</td>"; echo "<td>" . $row['Plan'] . "</td>"; echo "<td>" . $row['Validity'] . "</td>"; echo "<td>" . $row['Status'] . "</td>"; echo "</tr>"; } echo "</table>"; mysqli_close($con); ?> <html> <body> <div class="xyz"> <div class="abc" style="float: left"> Welcome Sir You have Logged in. </div> <div class="xml" style="float:right"> <a href="logout.php">Logout</a> </div> </div> <div align="left"> <?php if (isset($error)) { echo "<p class='message'>" .$error. "</p>" ;} ?> <style type="text/css" > .error{border:1px solid red; } .message{color: red; font-weight:bold; } </style> <center> <form action="server-handling.php" method="post"> <table border="1"> <tr> <td>IP: </td> <td><INPUT type="text" size="1" name="ipno1" maxlength="3" value="<?php if(isset($ipno1)){echo $ipno1;} ?>" <?php if(isset($code) && $code == 1){echo "class=error" ;} ?> > <INPUT type="text" size="1" name="ipno2" maxlength="3" value="<?php if(isset($ipno2)){echo $ipno2;} ?>" <?php if(isset($code) && $code == 1){echo "class=error" ;} ?> > <INPUT type="text" size="1" name="ipno3" maxlength="3" value="<?php if(isset($ipno3)){echo $ipno3;} ?>" <?php if(isset($code) && $code == 1){echo "class=error" ;} ?> > <INPUT type="text" size="1"name="ipno4" maxlength="3" value="<?php if(isset($ipno4)){echo $ipno4;} ?>" <?php if(isset($code) && $code == 1){echo "class=error" ;} ?> > <br> </td> </tr> <tr> <td>Port:</td> <td><input type="text" name="addport" placeholder="Port Number" value="<?php if(isset($addport)){echo $addport;} ?>" <?php if(isset($code) && $code == 2){echo "class=error" ;} ?> ><br></td> </tr> <tr> <td>ID:</td> <td> <input type="text" name="addid" placeholder="Add id" value="<?php if(isset($addid)){echo $addid;} ?>" <?php if(isset($code) && $code == 3){echo "class=error" ;} ?>><br></td> </tr> <tr> <td>Client Name </td> <td><input type="text" name="clientname" value="<?php if(isset($clientname)){echo $clientname;} ?>" <?php if(isset($code) && $code == 4){echo "class=error" ;} ?>><br></td> </tr> <tr> <td>Plan</td> <td><input type="text" name="plan" placeholder="plan" value="<?php if(isset($plan)){echo $plan;} ?>" <?php if(isset($code) && $code == 5){echo "class=error" ;} ?>><br></td> </tr> <tr> <td>Validity </td> <td><input type="text" name="validity" placeholder="13th Nov 2011" value=" <?php if(isset($validity)){echo $validity;} ?>" <?php if(isset($code) && $code == 6){echo "class=error" ;} ?>><br> </td> </tr> <th colspan="6"> <input type="submit" value="Enter" name="Submit"> </th> </table> </form> </center> </div </body> </html>
  24. n also it smetimes gives a blank page .... for all IP port is 22....
×
×
  • 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.