Jump to content

shan2batman

Members
  • Content count

    45
  • Joined

  • Last visited

Community Reputation

0 Neutral

About shan2batman

  • Rank
    Member
  1. shan2batman

    error in dns server

    i'm currently studying DNS and have run in to the following errors in my centos6 VM. this is the tut i'm following [tutorial][1] [root@server1 named]# sudo service named start Starting named: Error in named configuration: zone example.tv/IN: has no NS records zone example.tv/IN: not loaded due to errors. _default/example.tv/IN: bad zone rev.example.tv:1: unknown RR type '1.168.192.in-addr.arpa.' zone 1.168.192.in-addr.arpa/IN: loading from master file rev.example.tv failed: unknown class/type zone 1.168.192.in-addr.arpa/IN: not loaded due to errors. _default/1.168.192.in-addr.arpa/IN: unknown class/type zone localhost.localdomain/IN: loaded serial 0 zone localhost/IN: loaded serial 0 zone 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 0 zone 1.0.0.127.in-addr.arpa/IN: loaded serial 0 zone 0.in-addr.arpa/IN: loaded serial 0 [FAILED] [root@server1 named]# here is my fwd.example.tv file: $ORIGIN example.tv. $TTL 86400 @ IN SOA server1.example.tv. root.example.tv. ( 2018021011;serial 3600; refresh 1800;retry 604800; expire 86400;min TTL ) @IN NS server1.example.tv. @IN NS server2.example.tv. server1 IN A 192.168.1.17 server2 IN A 192.168.1.20 ~ ~ here is my rev.example.tv file: @ORIGIN 1.168.192.in-addr.arpa. $TTL 86400 @ IN SOA server1.example.tv. root.example.tv.( 2018021011; serial 3600; refresh 1800;retry 604800; expire 86400; minimum TTL ) @IN NS server1.example.tv. @IN NS server2.example.tv. server1 A 192.168.1.17 server2 A 192.168.1.20 17 IN PTR server1.example.tv. 20 IN PTR server2.example.tv. ~ ~ here is my /etc/named.conf file: options { listen-on port 53 { 127.0.0.1; 192.168.1.17; }; listen-on-v6 port 53 { ::1; }; directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; memstatistics-file "/var/named/data/named_mem_stats.txt"; allow-query { localhost; 192.168.1.0/24; }; allow-transfer {localhost; 192.168.1.20; }; recursion yes; dnssec-enable yes; dnssec-validation yes; dnssec-lookaside auto; /* Path to ISC DLV key */ bindkeys-file "/etc/named.iscdlv.key"; managed-keys-directory "/var/named/dynamic"; }; logging { channel default_debug { file "data/named.run"; severity dynamic; }; }; zone "." IN { type hint; file "named.ca"; }; zone "example.tv" IN{ type master; file "fwd.example.tv"; allow-update {none;}; }; zone "1.168.192.in-addr.arpa" IN{ type master; file "rev.example.tv"; allow-update{none;}; }; include "/etc/named.rfc1912.zones"; include "/etc/named.root.key";
  2. shan2batman

    need help with login script

    here is my code for login page: <?php include_once 'dbconfig.inc.php'; if (isset($_POST['submit-login'])) { $uname= htmlspecialchars($_POST['unamel']); $unamel= stripslashes($_POST['unamel']); $pass= htmlspecialchars($_POST['passl']); $pass1= stripslashes($_POST['passl']); $passl= md5($pass1); $user = $project->viewProtectedArea($unamel,$passl); var_dump($user); exit(); if ($user!="") { $_SESSION['id']=$user['user_id']; $_SESSION['fname']=$user['fname']; $_SESSION['lname']=$user['lname']; $_SESSION['uname']=$user['uname']; $_SESSION['email']=$user['email']; $_SESSION['phone']=$user['phone']; $_SESSION['avatar']=$user['avatar']; $_SESSION['app']=TRUE; $user_ok=TRUE; if (isset($_SESSION[u2])) { header("location: ../home.php?u={$_SESSION['u2']}&v={$_SESSION['uname']}"); } else { header("location: ../home.php?u={$_SESSION['uname']}"); } }} if (isset($_SESSION['app'])&&$_SESSION['uname']!="") { //echo 'your name is '.$_SESSION['fname']; header("location: ../home.php?u={$_SESSION['uname']}"); } else { header("location: ../index.php?usernotfound?id=017"); } here is the viewprotected area code from classes file: public function viewProtectedArea($unamel,$passl) { // $active=1; $stmth= $this->_db->prepare("select * from user where uname=:uname and pass=:pass and activated=1"); $stmth->bindValue(":uname",$unamel); $stmth->bindValue(":pass",$passl); $stmth->execute(); return $stmth->fetchAll(PDO::FETCH_ASSOC); }
  3. shan2batman

    need help with login script

    hi, i recently changed my host from openshift to heroku and from then on my problems started to grow. my main conn from dbconfig file is nothing but my login script is able to fetch results yet not able to login tried heroku support it didn't work. So, i decided to try my luck with you php experts to guide me create a connection and make login process easy. here is my db config file: $url=parse_url(getenv("CLEARDB_DATABASE_URL")); $server = $url["host"]; $username = $url["user"]; $password = $url["pass"]; $db = substr($url["path"],1); $host= "mysql:host=$server;dbname=$db"; try { $conn=new PDO("mysql:host=$server;dbname=$db" , $username, $password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $exc) { echo $exc->getMessage(); } //var_dump($url); var_dump($conn); echo "<br>"; var_dump($exc); include 'classes.inc.php'; //echo "<br>".$db."<br>"; $project= new projecteg($conn); var_dump($project); here is my login script: include_once 'dbconfig.inc.php'; if (isset($_POST['submit-login'])) { $uname= htmlspecialchars($_POST['unamel']); $unamel= stripslashes($_POST['unamel']); $pass= htmlspecialchars($_POST['passl']); $pass1= stripslashes($_POST['passl']); $passl= md5($pass1); $user = $project->viewProtectedArea($unamel,$passl); var_dump($user); exit(); if ($user!="") { some conditions ... } here is my output: object(PDO)#1 (0) { } NULL object(projecteg)#2 (4) { ["_db":"projecteg":private]=> object(PDO)#1 (0) { } ["query"]=> NULL ["stmth"]=> NULL ["conn"]=> NULL } array(1) { [0]=> array(21) { ["user_id"]=> string(3) "142" ["fname"]=> string(6) "gowri " ["lname"]=> string(7) "shanker" ["uname"]=> string(15) "aboutthecreator" ["pass"]=> string(32) "0c484476449dfd9a8bdf826bee31f03c" ["email"]=> string(21) "gsshanker10@gmail.com" ["phone"]=> string(1) "0" ["avatar"]=> string(25) "TueDec619064920166367.jpg" ["activated"]=> string(1) "1" ["notescheck"]=> string(19) "2017-08-14 14:51:53" ["work"]=> string(22) "inventor, entreprenuer" ["graduation"]=> string(39) "Maharaja arts and science college, cbe." ["school"]=> string(43) "Seventh day adventist, chockikulam, madurai" ["city"]=> string(14) "chennai, india" ["about_me"]=> string(123) "To tell about myself i'm a cool headed guy who loves to take risks and experiment with things if i have something in excess" ["residence"]=> string(18) "I reside in India." ["gender"]=> string(4) "male" ["interests"]=> string(116) "I love Bikes, love to chat, and spend some time on thinking on action plans about problems i face and also in women." ["quote"]=> string(79) "write something worth reading or do something worth reading- Benjamin Franklin." ["privacy"]=> string(1) "0" ["like_person_count"]=> string(1) "1" } }
  4. I have recently decided to move to heroku from openshift, now i'm having a problem of not able to connect to cleardb mysql DB from heroku. need all of your help in this. Here is my php db config file. kindly let me know where im going wrong. $url=parse_url(getenv("CLEARDB_DATABASE_URL")); $server = $url["host"]; $username = $url["user"]; $password = $url["pass"]; $db = substr($url["path"],1); $host= "mysql:host=$server;dbname=$db"; var_dump($host); try { $conn=new PDO($host , $username, $password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);} catch (PDOException $exc) { echo $exc->getMessage(); } var_dump($conn); echo "<br>"; var_dump($exc); include 'classes.inc.php'; echo "<br>".$db."<br>"; $project= new projecteg($conn); the output of $conn gives this object(PDO)#1 (0) { } NULL and i dont know how to enable the error output in heroku too.
  5. Iḿ trying to create a static ip using nmcli in centos 6.9 but couldn´t do so, as the man nmcli is not showing enough options like the online examples. To make you all to understand iĺl paste the man page here pl tell me where am i going wrong or is it the distro fault as i find many discrepancy after changing from ubuntu. NMCLI(1) NMCLI(1) NAME nmcli - command-line tool for controlling NetworkManagerSYNOPSIS nmcli [ OPTIONS ] OBJECT { COMMAND | help } OBJECT := { nm | con | dev } OPTIONS := { -t[erse] -p[retty] -m[mode] tabular | multiline -f[ields] <field1,field2,...> | all | common -e[scape] yes | no -v[ersion] -h[elp] } DESCRIPTION nmcli is a command-line tool for controlling NetworkManager and getting its status. It is not meant as a replacement of nm-applet or other similar clients. Rather it’s a complementary utility to these pro- grams. The main nmcli’s usage is on servers, headless machines or just for power users who prefer the command line. The use cases comprise: — Initscripts: ifup/ifdown can utilize NetworkManager via nmcli instead of having to manage connections itself and possible interfere with NetworkManager. — Servers, headless machines: No GUI is available; then nmcli is used to talk directly to NetworkManager and control only system-wide connections. — User sessions: For this case, nmcli can talk to nm-applet to find user connections. It can still talk directly to NetworkManager for manipulating these connections. As nmcli doesn’t have direct access to user configuration data in GConf, nm-applet handles that itself. That may, for example, cause the applet to pop up keyring dialogs when secrets are needed. OPTIONS -t, --terse Output is terse. This mode is designed and suitable for computer (script) processing. -p, --pretty Output is pretty. This causes nmcli to produce easy readable outputs for humans, i.e. values are aligned, headers are printed, etc. -m, --mode tabular | multiline Switch between tabular and multiline output. If omitted, default is tabular for most commands. For the commands producing more structured information, that cannot be displayed on a single line, default is multiline. Currenly, they are: ’nmcli con list id|uuid <name>’ ’nmcli dev list’ tabular - Output is a table where each line describes a single entry. Columns define particular properties of the entry. multiline - Each entry comprises more lines, each property on its own line. The values are prefixed with the property name. -f, --fields <field1,field2,...> | all | common This option is used to specify what fields (column names) should be printed. Valid field names differ for specific commands. List available fields by providing an invalid value to the --fields option. all is used to print all valid field values of the command. common is used to print common field values of the command. If omitted, default is common. The option is mandatory when --terse is used. In this case, generic values all and common cannot be used. (This is to maintain compatibility when new fields are added in the future). -e, --escape yes | no Whether to escape ’:’ and ’\’ characters in terse tabular mode. The escape character is ’\’. If omitted, default is yes. -v, --version Show nmcli version. -h, --help Print help information. OBJECT nm NetworkManager Use this object to inquire and change state of NetworkManager. COMMAND := { status | sleep | wakeup | wifi | wwan } status Show overall status of NetworkManager. This is the default action, when no command is provided to nm object. Reference to D-Bus: No simple reference. sleep Put NetworkManager to sleeping mode. Thus all interfaces that NetworkManager manages are deactivated. Reference to D-Bus: interface: org.freedesktop.NetworkManager method: Sleep arguments: TRUE wakeup Awake NetworkManager from sleep. When NetworkManager is awaken, devices are available to be activated. Reference to D-Bus: interface: org.freedesktop.NetworkManager method: Sleep arguments: FALSE wifi [on|off] Inquire or set status of WiFi in NetworkManager. Without any further argument, WiFi status is printed; on enables WiFi; off disables WiFi. Reference to D-Bus: No simple reference. wwan [on|off] Inquire or set status of WWAN in NetworkManager. Without any further argument, WWAN status is printed; on enables WWAN; off disables WWAN. Reference to D-Bus: No simple reference. con Connections Get information about NetworkManager’s connections. con Connections Get information about NetworkManager’s connections. COMMAND := { list | status | up | down } list [id <id> | uuid <id> | system | user] List configured connections. Without a parameter, configured connection from both system and user settings services are listed. system argument filters only system-wide connections, user prints user connections only. In order to get connection details, id with connection’s name or uuid with connection’s UUID shall be specified. When no command is given to con object, the default action is ’nmcli con list’. Reference to D-Bus: No simple reference. status Print status of active connections. Reference to D-Bus: No simple reference. up id <id> | uuid <id> [iface <iface>] [ap <hwaddr>] [--nowait] [--timeout <timeout>] Activate a connection. The connection is identified by its name using id or UUID using uuid. For requiring particular device to activate the connection on, iface option with interface name should be given. ap option can further concretize what AP should be used in case of WiFi connection. --nowait option causes nmcli to exit immediately and not to wait for command completion. --timeout option provides a means to specify how long to wait for operation completion. Reference to D-Bus: interface: org.freedesktop.NetworkManager method: ActivateConnection arguments: according to arguments down id <id> | uuid <id> Deactivate a connection. The connection is identified by its name using id or UUID using uuid. Reference to D-Bus: interface: org.freedesktop.NetworkManager method: DeactivateConnection arguments: according to arguments dev Devices Get information about devices. COMMAND := { status | list | disconnect | wifi } status Print status of devices. This is the default action, when no command is specified to dev object. Reference to D-Bus: No simple reference. list [iface <iface>] Get detailed information about devices. Without an argument, all devices are examined. To get information for a specific device, iface argument with the interface name should be provided. Reference to D-Bus: No simple reference. disconnect iface <iface> [--nowait] [--timeout <timeout>] Disconnect a device and prevent the device from automatically activating further connections without user/manual intervention. --nowait option causes nmcli to exit immediately and not to wait for command completion. --timeout option provides a means to specify how long to wait for operation completion. Reference to D-Bus: interface: org.freedesktop.NetworkManager.Device method: Disconnect arguments: none wifi [list [iface <iface>] [hwaddr <hwaddr>]] List available WiFi access points. iface and hwaddr options can be used to get just APs for particular interface or specific AP, respectively. Reference to D-Bus: No simple reference.BUGS There are probably some. If you find a bug, please report to https://bugzilla.gnome.org/ - product NetworkManager.SEE ALSO nm-tool(1), NetworkManager(. 14 April 2010 NMCLI(1) (END)
  6. plus the class is here public function viewProtectedArea($unamel,$passl) { // $active=1; $stmth= $this->_db->prepare("select * from user where uname=:uname and pass=:pass and activated=1"); $stmth->bindValue(":uname",$unamel); $stmth->bindValue(":pass",$passl); $stmth->execute(); return $stmth->fetchAll(PDO::FETCH_ASSOC); }
  7. since the script was not pulling data i finally used exit to check connection and it was giving that to pdo, normally it should atleast give the statement when we use var_dump right but it was not showing the connection credentials either here is the login script so far while troubleshooting. <?php include_once 'dbconfig.inc.php'; if (isset($_POST['submit-login'])) { $uname= htmlspecialchars($_POST['unamel']); $unamel= stripslashes($_POST['unamel']); $pass= htmlspecialchars($_POST['passl']); $pass1= stripslashes($_POST['passl']); $passl= md5($pass1); $user = $project->viewProtectedArea($unamel,$passl);var_dump($user); exit(); if ($user!="") { $_SESSION['id']=$user['user_id']; $_SESSION['fname']=$user['fname']; $_SESSION['lname']=$user['lname']; $_SESSION['uname']=$user['uname']; $_SESSION['email']=$user['email']; $_SESSION['phone']=$user['phone']; $_SESSION['avatar']=$user['avatar']; $_SESSION['app']=TRUE; $user_ok=TRUE; if (isset($_SESSION[u2])) { header("location: ../home.php?u={$_SESSION['u2']}&v={$_SESSION['uname']}"); } else { header("location: ../home.php?u={$_SESSION['uname']}"); } }} if (isset($_SESSION['app'])&&$_SESSION['uname']!="") { //echo 'your name is '.$_SESSION['fname']; header("location: ../home.php?u={$_SESSION['uname']}"); } else { header("location: ../index.php?usernotfound?id=017"); }
  8. actually requinix i'm sorry the real problem statement is that i'm not able to retrieve values from db which has values in it through a login script because of that the app is not able to log in users.
  9. hi guys i recently deployed an app in heroku through ubuntu. After troubleshooting it multiple times i finally got to install and retrieve data in clearDB mysql server in heroku with mysql workbench. But the problem is after deploying the php code, i get the following message object(PDO)#1 (0) { } when i var_dump the PDO connection, here is the code to the dbconfig file that has the connection details. $url=parse_url(getenv("CLEARDB_DATABASE_URL")); $server = $url["host"]; $username = $url["user"]; $password = $url["pass"]; $db = substr($url["path"],1); $host= "mysql:host=$server;dbname=$db"; var_dump($host); try { $conn=new PDO($host , $username, $password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $exc) { echo $exc->getMessage(); } var_dump($conn); echo "<br>"; var_dump($exc); include 'classes.inc.php'; echo "<br>".$db."<br>"; $project= new projecteg($conn); please help me with this error as i'm running like nowhere with this problem.
  10. i'm trying to make a notification tab work but do not seem to get it right. The dropdown is working fine but the ajax call to newfriends.php is not working right, when viewed with firebug there are no results to be seen in the dropdown.Quite confusing. (note the dropdown menu is located in header and can only be displayed if the session is initialised) here is the ajax used in jquery: function load_notifications(view=''){ $.ajax({ url: "notification/new_friends.php", method: "POST", data:{view:"view"}, dataType:"json", success: function(data){ $(".dropdown-menu").html(data.notification); if(data.unseen_notification>0){ $(".badge1").html(data.unseen_notification); } } }); //$(".dynamic-notification").load("notification/pm_n.php"); // $(".dynamic-notification-f").load("notification/new_friends.php"); }; load_notifications(); $(document).on("click",".count_friend", function(){ load_notifications('yes'); }); //loads every 2 seconds for chat setInterval(function(){load_notifications();},2000); here is the new_friends.php content: <?php include '../includes/dbconfig.inc.php'; if (isset($_POST['view'])) {if($_POST['view'] !=''){ $update="update friends set count='1' where friend_one=:session and count='0'"; $stmt=$conn->prepare($update); $stmt->bindValue(":session", $_SESSION['uname']); $stmt->execute(); } $sql123="select id from friends where friend_two=:sess_uname and count='0'"; $stmt123=$conn->prepare($sql123); $stmt123->bindValue(":sess_uname", $_SESSION['uname']); $stmt123->execute(); $request_count=$stmt123->fetchColumn(); //$count_friend=$stmt123->rowCount(); /*$sql_f_count="select *from user where user_id=:session_id and activated='1' limit 1"; $stmt_f_count=$conn->prepare($sql_f_count); $stmt_f_count->bindValue(":session_id", $_SESSION['id']); $stmt_f_count->execute(); $user_details=$stmt_f_count->fetchAll(); $friend_badge=$user_details[0]['friend_count_badge'];*/ require "notification/friend_request_notification.php"; // $new_friends="<span class='dropdown'><a href='#' data-placement='bottom' class='btn dropdown-toggle' data-toggle='dropdown' title='Friend Requests' data-html='true'><span class='count_friend' style=' height:33px; width:30px;'><span class='badge1 label label-pill'>".$count."</span><img src='img/logo/group-button-white.png' style='height:25px; width:27px;' alt='new_friends_alert'></span></a><ul class='dropdown-menu'></ul></span>"; //if($request_count[0]>0){ //$new_friends="<a href='#' data-placement='bottom' class='btn' data-trigger='focus' title='Friend Requests' data-toggle='popover' data-html='true' data-content='".$friend_requests."'><span class='count_friend' style=' height:33px; width:30px;'><img src='img/logo/group-button-white.png' style='height:25px; width:27px;' alt='new_friends_alert'></span><span class='badge'>".$friend_badge."</span></a>"; /*}else{ $new_friends="<a href='all_notifications.php'><img src='img/logo/group-button-black.png' style='height:25px; width:27px;' alt='new_friends_alert'></a>"; }*/ //echo $new_friends; //} $data=array( 'notification'=>$friend_requests, 'unseen_notification' =>$request_count[0][0] ); and the code for friend requests output: <?php //error_reporting(0); require_once 'includes/dbconfig.inc.php'; $sql = "select * from friends where friend_two=:session and accepted='0' order by friends_date_made asc"; $stmt = $conn->prepare($sql); $stmt->bindparam(":session", $_SESSION['uname']); $stmt->execute(); $numrows = $stmt->fetchAll(PDO::FETCH_ASSOC); $friend_requests=""; if ($numrows < 1) { $friend_requests = "You do not have any friend requests"; echo "$friend_requests"; exit(); } else { foreach ($numrows as $i=>$row1 ) { $reqid = $row1['friend_id']; $user1 = $row1['friend_one']; $datemade = $row1['friends_date_made']; $datemade1 = strftime("%B %d, %y", strtotime($datemade)); $sql = "SELECT * FROM user WHERE uname=:user1 LIMIT 1"; $stmt = $conn->prepare($sql); $stmt->bindparam(":user1", $user1); $stmt->execute(); $thumbrow = $stmt->fetchAll(PDO::FETCH_ASSOC); $user1avatar = $thumbrow[$i]['avatar']; $user1id=$thumbrow[$i]['user_id']; if ($user1avatar =="") { $user1pic = '<img src="img/avatardefault.png" height="50" style="float:left;" width="50" alt="'.$user1.'" class="user_pic">'; } else { $user1pic = '<img src="../user/user/'.$user1id.'/'.$user1avatar.'" height="50" style="float:left;" width="50" alt="'.$user1.'" class="user_pic">';} $friend_requests .= '<li><div id="'.$reqid.'" float="right" class="friendrequests"> <a href="home.php?u='.$user1.'">'. $user1pic .'</a> <div class="user_info '.$reqid.'" id="'.$reqid.'"><small>' . $datemade1 . '</small> <a href="home.php?u='.$user1.'">'.$user1.'</a> is requesting your friendship<br /><br /> <button id="'.$reqid.'" name="'.$_SESSION['uname'].'" sess="'.$_SESSION['id'].'" class="accept_btn btn btn-warning">Accept</button><span class="show-spinner"></span> or <button id="'.$reqid.'" name="'.$_SESSION['uname'].'" sess="'.$_SESSION['id'].'" class="reject_btn btn btn-warning">Reject</button> </div> </div><hr></li>'; } }
  11. shan2batman

    Help with php to display a list from a SQL Query

    ok then do this $query="select name, plan_id from table_name where condition='condition_name' order by id"; then execute the query with mysqli or pdo and create a loop and type the necessary html code like this <table> foreach($fetched_data as $content) { $result .=" <tr><td>".$content['name']."</td></tr> <tr><td>".$content['plan_id']."</td></tr> "; } echo $result; the above code will print it in table format, you can change it to any format and place it in your php page by either requiring or including the file or just run the loop in the same page. to place the $result in the desired place at any page you have to create a separate php file and loop in it and then call it in the desired place like require 'path to filename/filename.php'; or include 'path to filename/filename.php'; hope this helps forgive my english it isn't my mother tongue.
  12. shan2batman

    Help with php to display a list from a SQL Query

    sorry typed two messages by mistake
  13. shan2batman

    Help with php to display a list from a SQL Query

    no need to complicate things, use wildcard in your query like "select * from table_name where condition='codition name' order by id"
  14. shan2batman

    Help with php to display a list from a SQL Query

    no need to complicate things, use wildcard in your query like "select * from table_name where condition='codition name' order by id"
×

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.