Jump to content

Search the Community

Showing results for tags 'mysql sql variables'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hello. I wrote based on 2 toturials and my knowledge the following code: <?php session_start(); if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="Login to Bitcoin Double Machine, cancel to sign up"'); header('HTTP/1.0 401 Unauthorized'); //echo 'You canceled the login. Click <a href="test.php">here</a> to retry.'; echo "<script type='text/javascript'> var msg = \"LOGIN CANCELLED. PLEASE REFRESH OR SIGN UP\"; msg = \" ... \" + msg;pos = 0; function scrollTitle() { document.title = msg.substring(pos, msg.length) + msg.substring(0, pos); pos++; if (pos > msg.length) pos = 0 window.setTimeout(\"scrollTitle()\",300); } scrollTitle(); </script>"; echo "<h1>To sign up, use the button below</h1>"; echo "<a href=\"signup.php\" style=\"-webkit-appearance: button;-moz-appearance: button; appearance: button; text-decoration: none; color: initial\">Sign Up</a>"; echo "<br><br>"; echo "<iframe src=\"../401.php\" seamless style=\"width:100%;height:80%\"></iframe>"; exit; } else { define('DB_HOST', 'localhost'); define('DB_NAME', 'dan cojocaru'); define('DB_USER','root'); define('DB_PASSWORD','abcd'); $con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error()); $db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL: " . mysql_error()); /* //$ID = $_SESSION['user']; //$Password = $_SESSION['pass']; */ function SignIn() { //session_start(); //starting the session for user profile page if(!empty($_SERVER['PHP_AUTH_USER'])) //checking the 'user' name which is from Sign-In.html, is it empty or have some text { $query = mysql_query("SELECT * FROM UserName where userName = " . $_SERVER['PHP_AUTH_USER'] . " AND pass = " . $_SESSION['PHP_AUTH_PW'] . "") or die(mysql_error()); //LINE 38 $row = mysql_fetch_array($query) or die(mysql_error()); if(!empty($row['userName']) AND !empty($row['pass'])) { $_SESSION['userName'] = $row['pass']; echo "SUCCESSFULLY LOGIN TO USER PROFILE PAGE..."; } else { echo "SORRY... YOU ENTERD WRONG ID AND PASSWORD... PLEASE RETRY..."; } } } //if(isset($_POST['submit'])) //{ SignIn(); //} } ?> Commented thing are not used but I never ever delete anything, just in case I might need it. So I saved this code and tested, but I got this error: Notice: Undefined index: PHP_AUTH_PW in C:\xampp\htdocs\test3.php on line 38 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Please help me to fix this code.
×
×
  • 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.