Jump to content

pranshu82202

Members
  • Posts

    125
  • Joined

  • Last visited

    Never

Posts posted by pranshu82202

  1. I want to print the url of the webpage which i am accessing.

     

    Suppose i am accessing a page : "http://www.goooogle.com/view?id=5"

     

    I want this whole url to be printed or the whole url should be stored in the function.

     

    After googling all this a lot i  found a function :

     

    $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

     

    But this method is not working too...

     

    Any help will be appreciated.

     

    Pranshu Agrawal

    pranshu.a.11@gmail.com

  2. I have a php file which contains a ajax code and calls a php file to show some output.

     

    That php file copntains a button and on click event of that button i want to call another ajax code ......

     

    But its not running successfully....

     

    Actually nothing is happening....

     

    Tell me what shuld i do .......

     

    -pranshu.a.11@gmail.com

  3. Thanks for responding SergeiSS, but i didnt get you.... Even according to you when i write the log details in my_seperate_file.php i would be writing them at th bottom of that file.... But i need to write them at the top......

     

    And also i want to keep some php check on that file .... so i need to have php code even on that my_seperate_file.php...

  4. I have a code for writing a log file...

    The code is working fine but it inserts the new details at the bottom of the file but i want to insert in the top...

     

    So what function should i use... Here is the file my_log.php

     

    <?php
    
    $usname = $_SESSION['usname'];	
    date_default_timezone_set('Asia/Calcutta');						
    $date = date("l dS \of F Y h:i:s A");	
    $file = "log.php"; 
    $open = fopen($file, "a+"); 
    fseek($open,289);
    fwrite($open "<b><br/>USER NAME:</b>              ".$usname . "<br/>"); 
    fwrite($open, "<b>Date & Time:</b>            ".$date. "<br/>"); 
    fwrite($open, "<b>What have they done :</b>   ".$reason . "<br/><br/>"); 
    fclose($open); 
    
    ?>
    

     

    and here is my log.php file :

     

    <?php
    session_start();
    if($_SESSION['stage']!=1 || $_SESSION['stage2']!=2)
    {header('location:index.php');
    die(" ");
    }
    ?>
    <?php
    if($_GET['valu']=="view_log")
    {
    $reason=" ".$_SESSION['usname']." Viewed the LOG";
    include('my_log.php');
    header('location:log.php');
    die("");
    }
    // bytes till here are 289
    
    //LINE 1 : Log details have to insert here
    
    

     

     

    I want to insert every detail from the top of the page but just below the php code..

    What should i do...

     

    ANy helo would be appreciated :)

     

    Pranshu Agrawal

    pranshu.a.11@gmail.com

     

  5. <body>
    <script type="text/javascript">
    
    var a;
    function acc_den(a, str)
    {
    var xmlhttp;
    if (str.length==0)
      { 
      document.getElementById("ajax").innerHTML="";
      return;
      }
    
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById("ajax").innerHTML=xmlhttp.responseText;
        }
    else
    { document.getElementById("ajax").innerHTML="<center><img src=\"l2.gif\"/></center>";
    }
      }
      if(a==1)
      {
    xmlhttp.open("GET","allow.php?usname="+str,true);
    xmlhttp.send();}
    
    if(a==2)
    {xmlhttp.open("GET","deny.php?usname="+str,true);
    xmlhttp.send();}
    
    }
    </script>
    <button onclick="acc_den(1, "sweetarchie")" value="click me">CLICK ME</button>
    <div id="ajax">
    </div>
    </body>
    

     

     

    and code of allow.php is :

     

    <?php
    include('dbcon.php');
    $usname=$_GET['usname'];
    $sql=mysql_query("UPDATE usname SET check_status=1 where usname='$usname'");
    $reason="Allowed <b>".$usname."</b> to access the data";
    include('my_log.php');
    echo "CHANGED";
    ?>
    

     

     

    and code of Deny.php is :

     

    <?php
    include('dbcon.php');
    $usname=$_GET['usname'];
    $sql=mysql_query("UPDATE usname SET check_status=0 where usname='$usname'");
    $reason="Denied <b>".$usname."</b> to access the data";
    include('my_log.php');
    echo "CHANGED AGAIN";
    ?>
    

     

    I am not gtting wy this code is not working....

     

    ANY HELP WILL BE APPRECIATED :)

     

    - PRANSHU AGRAWAL

    pranshu.a.11@gmail.com

  6. I have a code

     

    <?php
    include('dbcon.php');
    $sql = mysql_query("select * from money ORDER BY sno DESC "); 
    $num=mysql_num_rows($sql);
    $snumb=0;
    echo '<form method="post" action="edit.php?action=trunc">';
    echo '<input type="submit" value="TRUNCATE TEABLE">';
    echo '</form>';
    
    echo '<form method="post" action="del_mul.php">';
    
    echo "<table border='1' id=hor-minimalist-a style=width:1200px>
    <tr>
    <th> S No. </th>
    <th> Act. ID </th>
    <th>Jisne Diye</th>
    <th>Kisko diye</th>
    <th>Kitne Diye </th>
    <th>Wajah </th>
    <th>Kisne bhare iss site main </th>
    <th>Kiss time pe </th>
    <th>Delete Entry</th>
    <th>Sel for Operation</th>
    
    
    </tr>";
    
    while($row = mysql_fetch_array($sql))
    {
    ++$snumb;
    echo "<tr>";
      echo "<td>" . $snumb. "</td>";
      echo "<td>" . $row['sno'] . "</td>";
      echo "<td>" . $row['name1'] . "</td>";
      echo "<td>" . $row['name2'] . "</td>";
      echo "<td>" . $row['amm'] . "</td>";
      echo "<td>" . $row['rea'] . "</td>";
      echo "<td>" . $row['usname'] . "</td>";
      echo "<td>" . $row['time'] . "</td>";
      echo "<td><a href=edit.php?id=" . $row['sno'] . "&action=del>DELETE</a></td>";
    echo '<td><input type="checkbox" name="mul_arr[]"  value='.$row[sno].'></td>';
    
      echo "</tr>";
    }	 
    
    echo '<input type="submit" value="DELETE SELECTED">';
    echo '</form>';
    ?>
    

     

    In this i thought that the "DELETE SELECTED" button should be below to the table but the button is getting printed above the Table...

     

    Why is it so.......??????????????

     

    And how to fix it ????????????

     

    - Pranshu Agrawal

    pranshu.a.11@gmail.com

  7. Suppose i have a table with around 10 entries in which one column contains the id and the second column contains a checkbox...

     

    If a checkbox a selected and the button (below the table) is pressed then i want to delete the columns corresponding the checked checkboxes....

     

    I am not getting how sgould i pass the get variable on the link of the button???

     

    -Pranshu Agrawal

    pranshu.a.11@gmail.com

  8. Yes the script id printing the table with a button have onclick event to set on alert("HELLO WORLD").......

     

    But the button is not working.......

     

     

    And if i access it directly it works fine.......:(

     

  9. view4.php contains some php code along with a js function....

     

    Even when i kept view4.php empty except a js function... It doesnt works......

     

    But when i access it directly it works fine......

     

     

  10. I have a php file which has a javascript function :

     

    <script type="text/javascript">
    var a;
    function vieww(a)
    {
    var xmlhttp;
    
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById("res").innerHTML=xmlhttp.responseText;
        }
    else
    { document.getElementById("res").innerHTML="<center><img src=\"l2.gif\"/></center>";
    }
      }
    
    xmlhttp.open("GET","view4.php",true);
    xmlhttp.send();
    }
    </script>
    

     

    This code opens a file view4.php... (AJAX)

     

    Now i have a js function in view4.php but it is not getting executed....

     

    But if i access view4.php diectly then the function executes successfully..........

     

    What should i do...

     

    - Pranshu Agrawal

    pranshu.a.11@gmail.com

  11. I have a php code... In which there is a link and i want to apply a javascript onclick event onthat link...

     

    echo "<a onclick=vieww_det(". $arr[$i].", ".$arr[$j].")>View Details </a>";
    

     

    But its not working...

     

    Any help will be appreciated :)

     

    - Pranshu Agrawal

    pranshu.a.11@gmail.com

  12. Actualy wht i want is .... the js function for check username only executes when user stops entering words in the username field....

     

    And after googling it a lot i found that i have to create a js function that checks whether user stops entering word and if it returns true i should call the ajax function ....

     

    But i m not getting how to create that kinda js function... :(

  13. I have a php script which is automatically checking whether the username is available or not...

     

    <?php
    
    session_start();
    
    ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <link rel="stylesheet" type="text/css" href="css/form.css" media="screen" title="bbxcss" />
    <script src="untitled_files/jquery-1.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" type="text/css" href="css/sexybuttons.css" media="screen" title="bbxcss" />
    
      <script src="untitled_files/jquery.js" type="text/javascript" charset="utf-8"></script>
    
      <script src="untitled_files/jquery-glowing.js" type="text/javascript" charset="utf-8"></script>
    
    <style type="text/css" media="screen">
    
        #top {
    
          font-size: 64px;
    
          font-family:"bradley Hand ITC";
    
          font-weight: bold;
      
    
         
    }
    a{
    
    	color:#000}
    label{
    
    
          font-family:"bradley Hand ITC";
    
          font-weight: bold;
      width:200px;
    
    	}
    
      </style>
    
    <script type="text/javascript" charset="utf-8">
    
        $(document).ready(function() {
    
          $('.white').addGlow({ textColor: 'white', haloColor: '#aaa', radius: 100 });
    
          $('.blue').addGlow({ textColor: '#00f', haloColor: '#00f', radius: 100 });
    
          $('.green').addGlow({ textColor: '#0f0', haloColor: '#0f0', radius: 100 });
    
          $('.red').addGlow({ textColor: '#f00', haloColor: '#f00', radius: 100 });
    
          $('*').bind('glow:started', console.info);
    
          $('*').bind('glow:canceled', console.info);
    
        });
    
        
    
      </script>
    
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>:: FH ::</title>
    </head>
    
    <body><center><p><a  id="top" style="color: rgb(255,255,255);" class="red" >
    Fire Hearts  Hisaab Portal</a></p><br /><Br />
    </center>
    <script type="text/javascript"> 
    function showHint(str)
    {
    var xmlhttp;
    if (str.length==0)
      { 
      document.getElementById("txtHint").innerHTML="";
      return;
      }
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
    
    
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
        }
      //if(xmlhttp.readyState==3 || xmlhttp.readyState==2 ||xmlhttp.readyState==0||xmlhttp.readyState==1)
    
    else
    { document.getElementById("txtHint").innerHTML="<img src=\"l.gif\"/>";
    
    }
      }
    xmlhttp.open("GET","check_usname.php?usname="+str,true);
    xmlhttp.send();
    }
    </script>
    
    <form name="form1" action="create.php" method="post">
    <div style="float:right">
    <a href="index.php"><input type="button"  class="sexybutton sexysimple sexyred" value="Home" name="registerbutt" style="width:150px;" /></a> <br />
    <br /></div>
    <font color="#FF0000" face="bradley Hand ITC">
    <?php
    if(isset($_SESSION['status']))
    {
    echo $_SESSION['status'];
    unset ($_SESSION['status']);	
    }
    ?></font><br />
    
    
    
    
    
    <!-- XML CONTENT ------------>
    
    
    
    
    
    
    
    <table>
    <tr>
    <td>
    <label>Email : </label> <input type="text" name="email" placeholder="abcd@xyz.com" /><br /><br />
    </td>
    </tr>
    <tr>
    <td>
    <label>Select your name :</label> <select name="usname2" >
      <option value="none">...</option>
    
      <option value="ankur">Ankur</option>
      <option value="archie">Archie</option>
      <option value="deepesh">Deepesh</option>
      <option value="jyoti">Jyoti</option>
      <option value="nikunj">Nikunj</option>
      <option value="pranshu">Pranshu</option>
      <option value="Vikas">Vikas</option>
    </select><br /><br />
    </td>
    </tr>
    <tr>
    <td>
    <label>Choose a Username : </label> <input type="text" name="usname" placeholder="Username" onkeyup="showHint(this.value)" />
    
    <br />
    <label id="txtHint"></label>
    <br />
    </td>
    </tr>
    <tr>
    <td>
    <label>Choose a Password : </label> <input type="password" name="password" placeholder="Password"  />
    </td>
    </tr>
    <tr>
    <td>
    <input type="submit" name="submit" value="Register" />
    </td>
    </tr>
    
    </table>
    </form>
    
    </body>
    </html>
    

     

    But there is a problem :  suppose user enters a username "abcdef123"

     

    then it will check first for "a" then for "ab" and then for "abc".... and so on.....

     

    So i wanted that it only checks for abcdef123 then what should i do....

     

    - PRANSHU AGRAWAL

    pranshu.a.11@gmail.com

  14. I want to know whether it is possible to execute a query on browser window close...

     

    Basically i m trying to make a online user script ... in which whenever a user closes the window he will be shown offline (i will just set flag to 0 again) :)

     

    Pranshu Agrawal

    pranshu.a.11@gmail.com

  15. I am printing something on my page by php but i m not getting why code doesnt print from the top of the page....

     

    It starts printing by leaving arount 300px from top........  I also applied css but it also does not solve that...... :(

     

    Here is my code :

     

    <?php
    include('dbcon.php');
    
    $arr[0]="ankur";$arr[1]="archie";$arr[2]="deepesh";$arr[3]="jyoti";$arr[4]="pranshu";$arr[5]="nikunj";
    $arr[6]="Vikas";
    $sqlq = mysql_query("select * from money ");
    while($row = mysql_fetch_array($sqlq))
    {
    if($row['name1']==$arr[0]) $no1=0;
    if($row['name1']==$arr[1]) $no1=1;
    if($row['name1']==$arr[2]) $no1=2;
    if($row['name1']==$arr[3]) $no1=3;
    if($row['name1']==$arr[4]) $no1=4;
    if($row['name1']==$arr[5]) $no1=5;
    if($row['name1']==$arr[6]) $no1=6;
    
    if($row['name2']==$arr[0]) $no2=0;
    if($row['name2']==$arr[1]) $no2=1;
    if($row['name2']==$arr[2]) $no2=2;
    if($row['name2']==$arr[3]) $no2=3;
    if($row['name2']==$arr[4]) $no2=4;
    if($row['name2']==$arr[5]) $no2=5;
    if($row['name2']==$arr[6]) $no2=6;
    
    $arrm[$no1][$no2]=$arrm[$no1][$no2]+$row['amm'];	
    }
    echo "<table border='1' id=hor-minimalist-a style=width:750px>
    <tr>
    <th>Jisne Diye</th>
    <th>Kisko diye</th>
    <th>Kitne Diye </th>
    <th>Details </th>
    
    </tr>";
    
    for($i=0; $i<7; $i++)
    {for($j=0; $j<7; $j++)
    {
    
    if($arrm[$i][$j]!=0 && $arr[$i]!=$arr[$j])
    {
    	echo "<tr>";
      echo "<td>" . $arr[$i] . "</td>";
      echo "<td>" . $arr[$j] . "</td>";
      echo "<td>" . $arrm[$i][$j] . "</td>";
      echo "<td><a href=viewdet.php?user1=" . $arr[$i]. "&user2=".$arr[$j].">View Details </a></td>";
      echo "</tr>";
      echo '<br>';
    }
    }}
    ?>

     

    Any help would be appreciated....

     

    -PRANSHU AGRAWAL

    pranshu.a.11@gmail.com

  16. :confused: Can any one tell me whats the best ( actually error free ) which i can use to count the number of rows finally resulting after select command.

     

    I use this ...

     

    $sql = mysql_query("select * from usname where name1='$name1' and name2='$name2' and amm='$amm'"); 
    $num=mysql_num_rows($sql); 
    echo $num;
    

     

    But it always gives the same error.... and the error is..........

     

    Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\money\insert.php on line 20

     

    where line 20 is...

     

    $num=mysql_num_rows($sql); 
    
    

     

    - Pranshu Agrawal

    pranshu.a.11@gmail.com

  17. Here is my CODE which is showing some error:

     

    <?php
    include('dbcon.php');
    session_start();
    $usname=$_POST['usname'];
    $password=$_POST['password'];
    $usname = stripslashes($usname);
    $password = stripslashes($password);
    $usname = mysql_real_escape_string($usname);
    $password = mysql_real_escape_string($password); 
    $check="y";
    $sql = "select * from usname where usname='$usname' and password='$password'"; 
    $result=mysql_query($sql);
    $count=mysql_num_rows($result);
    if($count==1)
    {
    $sqlq = "select * from usname where usname='$usname' and password='$password' and check='$check'"; 
    $resultq=mysql_query($sqlq);
    $countq=mysql_num_rows($resultq);
    if($countq==1)
    {$_SESSION['usname']=$usname;
    header('location:fire.php');}
    else
    {$_SESSION['status']="Admin Didnt grant you the permission to access the things";
    header('location:index.php');}
    }
    else
    {$_SESSION['status']="Wrong username and password";
    header('location:index.php');}
    
    die(" ");
    ?>
    

     

     

    And here are the ERRORS when the username and passwords are correct but the check is not equal to 'y'....

     

     

    Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\money\verify.php on line 18

     

    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\money\verify.php:18) in C:\xampp\htdocs\money\verify.php on line 24

     

    Please tell me where is the mistake........... :(

×
×
  • 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.