Jump to content

js09

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

js09's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I tried what you said earlier but then I wasn't able to log-in at all. So my checklogin.php would be: <?php ob_start(); $host="localhost"; // Host name $username="xx"; // Mysql username $password="xx"; // Mysql password $db_name="xx"; // 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"); // Define $myusername and $mypassword $_SESSION['myusername'] = $myusername; $_SESSION['mypassword'] = $mypassword; // To protect MySQL injection $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register($myusername); session_register($mypassword); header("Location: /clients/".$myusername."/"); } else { echo "Wrong Username or Password"; ob_end_flush(); ?> and in each client directory, there would be: <? $_SESSION['username'] = $myusername; //and to check of they are logged in if(isset($_SESSION['username']){ header("location:../../index.php"); } ?> With what's above this is not working.
  2. andrew, this is simply client log-in system for a photography site. i don't have too many clients so something complex isn't necessary (yet). i'm also going to be the one who defines the login/password. One issue i'm running into, is when a user logs in (for example: user123), they will get directed to the 'user123' page. based off this code: header("Location: /clients/".$myusername."/"); and in the directory 'user123' i have an index.php file with this code: <? session_start(); if(!session_is_registered(user123)){ header("location:../../index.php"); } ?> <html> <body> Login Successful <p>GALLLLERY</p> </body> </html> 'user123' does not work and the page doesn't load. it DOES work when its 'myusername' if(!session_is_registered(myusername)){ is it possible to fix this?
  3. ldb358, what line of code should i replace with $_Session['username'] = $myusername; ?? I'm a php noob. Also, i would like to automate the process as you suggested andrew, but it will leave me with a messy URL. Is it possible to direct to a specific directory, with each directory containing an 'index.php'? thanks!
  4. I've got some simple PHP code for a user log-in system. it checks to see if the username/pw is correct, if so it transfers you to universal 'gallery.php' page code below my question is, how can i specifiy which page gets loaded. if user A logs in correctly, he/she will get transferred to gallery_userA.php, and, if user B logs in correctly, he/she will get transferred to gallery_userB.php. etc. I don't need any special security features. just something basic so each user can have their own page. <?php ob_start(); $host="localhost"; // Host name $username="xxx"; // Mysql username $password="xxx"; // Mysql password $db_name="xxx"; // 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"); // Define $myusername and $mypassword $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername"); session_register("mypassword"); header("location:/gallery/"); } else { echo "Wrong Username or Password"; } ob_end_flush(); ?>
  5. My site content is called from external AJAX files and I need to be able to use jquery is some of these external files. index.php: <script type="text/javascript"> ajax_loadContent('news3','external/home.php'); </script> and in 'home.php' I have (for example) the html for a jquery script, BUT, the jquery code is still in the index.php <head> portion, so nothing gets called. such as this: <link href="css/galleria.css" rel="stylesheet" type="text/css" media="screen"> <script type="text/javascript" src="js/jquery.galleria.js"></script> <script type="text/javascript"> jQuery(function($) { $('ul.gallery').galleria(); }); </script> How can I mix these two languages?
  6. i tried this and it didn't work.. still reloaded upon clicking to another page (outside the frame) <iframe src ="audio.php" width="100%" height="200"><p>Your browser does not support iframes.</p> </iframe>
  7. anyone? i just want music to play in the background, can't be too complicated :|
  8. i've got a small flash file (.swf) that plays a few songs upon visiting a website. since i'm using php includes the file re-loads every time you click a link, even with the code in the main index template. i tried adding an iframe at the top just after the <body> tag but it still repeats. any ajax help would be appreciated! thanks
×
×
  • 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.