Jump to content

ChrisPHP

Members
  • Posts

    30
  • Joined

  • Last visited

About ChrisPHP

  • Birthday 01/25/1992

Profile Information

  • Gender
    Male
  • Location
    Lebanon

ChrisPHP's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok so I figured out a way for this code to work thanks for Psycho I used echo '<form action="content/QuickSearch.php" method="get">'; $n=$row['Nom_v']; echo '<input type="hidden" value="'.$n.'" name="n" >'; echo "<center><input type=submit value=Reserve id='".$n."' name='".$n."' /></center>"; echo '</form>'; if(isset($_GET['n'])){ $n = $_GET['n']; $sql="SELECT Reserved FROM voiture WHERE Nom_v = '$n' "; $result=mysql_query($sql); $row = mysql_fetch_array($result); $sqll="UPDATE `voiture` SET `Reserved`='1' WHERE Nom_v = '$n' "; $res=mysql_query($sqll,$dbcon); $res=mysql_query($sql,$dbcon); if(!$res) { echo "<html><font size='4' color='white'><b>Can't remove..</b></font></html>"; die(mysql_error()); } else { header('Location: ../Home.php?reserve'); } mysql_close($dbcon); } And it's now fully working Thanks a lot again and again and again all of u:)
  2. @Jessica Well the code won't go through the if(isset) loop and it won't direct to the page set nor it would change the value of the reserved to 1.. I tried debugging the code with firebug and get no errors.. @Psycho Ok I think I get what you mean i'll work on that and i'll keep u updated Thanks a million both of u
  3. I have all the code but it's actually 300 line so I wont actually display it all But I can assure you that the $n and the $row['Nom_v'] actually work and they're defined properly.. I was just wondering if there's a way to work it out because I'm frustrated by it.. If you want just drop it out don't worry I'll probably someday will figure it out lol
  4. @Jessica The $n was defined in $_SESSION['nom_v']= $row['Nom_v']; $n = $_SESSION['nom_v']; mentioned earlier in my first post @Psycho The idea was next each car there's a button... When the button is clicked it will change the row 'reserve' to 1 (to define that the car is reserved) and redirects the user to Home.php?reserved where it will display that the car is successfully reserved.. I'm using Jquery in all of the site but this idea seemed more appropriate like this... :/ Thanks again for your help all of you
  5. Yea I know this code uses a different idea or method.. The original code used to have ths instead of the function Reserve(): <?php if(isset($_POST[$n])){ $sql="SELECT Reserved FROM voiture WHERE Nom_v = '$n' "; $result=mysql_query($sql); $row = mysql_fetch_array($result); $row['Reserved'] = 1; header('Home.php?reserve'); } But it didn't work so I tried this method above
  6. Yea I did this.. but the if(isset($_POST['$n']))... wouldn't actually work when pressing the button..
  7. Oh ok thanks for your quick reply:) My idea was to display all the 'cars' available in a db with a button Reserve for every car with the id = to the name of this car.. I tried the if(isset($_POST['$n'])) and it didn't work either.. Can anyone help me out with this idea please?
  8. Hey everyone, Hope you're feeling good.. I was trying something and I can't seem to work it out.. <form action="content/QuickSearch.php" method="post"> <?php $_SESSION['nom_v']= $row['Nom_v']; $n = $_SESSION['nom_v']; echo "<center><input type=submit value=Reserve id='".$n."' name='".$n."' onmousedown='Reserve(".$n.");'/></center>"; ?> </form> <script> function Reserve(a){ <?php { $sql="SELECT Reserved FROM voiture WHERE Nom_v = '<script>a</script>' "; $row['Reserved'] = 1; header('Home.php?reserve'); } ?> } </script> The session actually works and the button is named properly.. but can I use this method? will it actually work? Because the code doesn't seem to go into the function Reserve ever... Thanks in advance anyway Regards, Chris
  9. Ok I think I know what you're talking about I'll check it out when I'll finish my finals.. I don't expect anyone will help more than that.. Thank you anyways I'll mark this as solved anw...
  10. You're asking about something very general.. I suggest you learn about authentications and redirecting, then if you have a question a little more precise I'd be happy to help you can check this link out also: http://studge.com/create-a-site-authentication-login-with-php-and-mysql/
  11. Hey everyone, I hope that you're doin all great.. So I decided to learn about sql injections more to comprehend how hackers actually think.. Let's say i know the structure of a database for a certain website, it has client as table and username as field and I want to 'hack' my way to the website; I know about ' or '1'='1 and I know how it actually functions.. My question is, can I select a certain row in a field while login in using { or 1= ( SELECT username FROM client ) -- } ? If yes, what's the proper syntax because it's giving a syntax error
  12. Well this topic is somehow old, i did solve my problem eventually.. I used jquery and a lot of debugging and managed to work out my idea Thanks anyways
  13. It did solve my problem thanks a million Just for comprehension.. what does array_shift() actually do? Thanks a lot again
  14. Hello everyone, Hope you're doing all fine I just wanted to ask about something that's happening to me recently.. Whenever I change the name of a file, it automatically adds up Array in the beginning of the name. I just wanted to know if there's a way to prevent it I'm using $target = $target . basename($_FILES['AImage']. $an .'.jpg'); where AImage is the name of the field in mysql and $an is the name that I wanted to put Thanks in advance. Best regards, Chris
×
×
  • 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.