Plz help me

Discussion in 'PHP' started by yasirzahoor, Sep 21, 2010.

  1. #1
    i have a small query please if you help me.i have hosted a website.www.wajbatee.com
    if you open this site and place cursor on anylink available on ist page..you will see the link ID in bottom task bar.but when you login to website and place cursor on any link then it does not show ID in bottom taskbar which is gng to pass to next page.website works fine in localhost but gives this issue when i host it.anyone please help me....
    Username and passowrd is test
     
    yasirzahoor, Sep 21, 2010 IP
  2. HungryMinds

    HungryMinds Active Member

    Messages:
    216
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    63
    #2
    Hi!

    Can U Just Show Your Link Area CODE?
    I Just Any Other Page And Back To Home Page.
    I've Got Same Error In This Case Too.
     
    HungryMinds, Sep 21, 2010 IP
  3. yasirzahoor

    yasirzahoor Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    $db_host = 'localhost';
    $db_user = 'root';
    $db_pwd = 'admin';
    $year1=date("y");
    $database = 'wajbatee';
    $con = mysql_connect($db_host, $db_user, $db_pwd);
    if (!$con)
    die("Can't connect to database");

    if (!mysql_select_db($database))
    die("Can't select database");
    $query="select SuppID,content,image_name, name from hotel_registration ";
    $result=mysql_query($query,$con);
    //$myrow = mysql_fetch_array($result1);

    //$num= mysql_numrows($result1);

    //mysql_close();


    //$j=100000;
    //$i=0;
    $html='';
    //while ( ($i < $num) && ( $i<$j))
    while ( $row = mysql_fetch_array($result) )
    {
    //$id=mysql_result($result1,"SuppID");
    //$m=mysql_result($result1,$i,"content");
    //print_r($row);



    $a=$row["name"];
    $id=$row["SuppID"];
    $_SESSION['id']=$_GET['id'];


    //echo("<tr><td align=center class='style10'><a href='Details.php'></a></td><td align=center class='style10'><a href='order_details.php?id= $id'>$a</a></td>");
    $html.='<tr><td><img src="images/'.$row["image_name"].'" alt="" width="130" height="40" /></td>

    <td align=center class="style10"><a href="order_details.php?id='.$id.'">'.$a.'</a></td><tr>';


    //$i++;
    }
    //echo $html;
    //mysql_free_result($result);

    // echo $html;
     
    yasirzahoor, Sep 21, 2010 IP
  4. axelay

    axelay Peon

    Messages:
    54
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    At a rough guess, I'd say that the variable $id is getting messed up by the following line.
    Try commenting out $_SESSION['id']=$_GET['id']; to see if that helps.

    I have a slight feeling your setup is serving global variables, which means that every $_GET['id'], $_POST['id'], $_SESSION['id'], will be interpreted as $id... Could be wrong though... I really cannot remember the name of this issue, anybody? (something global variables something)

    aXe
     
    axelay, Sep 22, 2010 IP
  5. yasirzahoor

    yasirzahoor Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yes Axe you are right...this was the issue i just commented the line and now its working fine :)...thankyou so much axe for your time and help...much appreciated :)
     
    yasirzahoor, Sep 22, 2010 IP
  6. axelay

    axelay Peon

    Messages:
    54
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    That's alright, however you may want to check your php.ini file and make sure register_globals is "off"
    Well it all depends how your whole site works, but it is best practice to have it turned off.

    Quick explanation:
    when you call your page like so: http://www.myserver.com/myscript.php?var1=sometext
    if you want to access the var1 when register_globals is on, you just need to reference $var1 in your code
    however if it is turned off, you have to explicitly assign it like $myvar = $_GET['var1'];

    There is a potential security issue by having it on, all I am saying ;)

    aXe
     
    axelay, Sep 22, 2010 IP