Jump to content

InsidiousMennace

Members
  • Posts

    5
  • Joined

  • Last visited

InsidiousMennace's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi guys, Need help urgently! I have the following string: {members,"['REF_NetHosIjFlameThorn','REF_NetHosIjFuchsia','REF_NetHosIjDemo','REF_NetHosIjBluebell']","['REF_NetHosIjFlameThorn','REF_NetHosIjDemo','REF_NetHosIjBluebell']"} I need to split it up, basically it contains the following layout: {WHAT, "[NEW_VALUE]", "[OLD_VALUE]"} I need two regular expressions to parse this bastard. The first one should find the what changed, and the second one should find the changes. Thanks!
  2. Hey there guys, I think I'm just being a spastic, but I do not know what to do anymore, my javascript does not want to work, before the prepared statements are even ran, where the $_GET['action'] is checked, it already throws out my error that the action can't be run. What am I missing. <?php require_once 'config.php'; error_reporting(E_ALL); //Connection to my database $mysqli = new mysqli(DB_HOST,DB_USER,DB_PASSWORD,DB_DATABASE); if(mysqli_connect_errno()) { printf("Connection failed: %s\n", mysqli_connect_errno()); exit(); } if($_GET['action'] == 'UserLogin') { $stmt = $mysqli->stmt_init(); //prepared statement if($stmt = $mysqli->prepare("select * from login where username = ? and password = ?")) { //bind my parameters $stmt->bind_param("ss",$username,$password); $username = $_POST["username"]; $password = $_POST["password"]; //execute query $stmt->execute(); //bind the result variables $stmt->bind_result($username,$password); //Store my values $stmt->store_result(); //fetch values if($stmt->fetch()) { $_SESSION["username"] = $username; alert("Authenticated"); header("location : Main_menu.php"); exit(); } else { alert("username or password is incorrect"); } $stmt->close(); $stmt->free_result(); } else { echo "Username or password incorrect"; } } else { echo "no"; } $mysqli->close(); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title></title> </head> <script language = "javascript"> function UserLogin() { document.login.submit(); } </script> <form name="login" action="login.php?action=UserLogin" method="post"> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td colspan="3"><strong>Radius Login </strong></td> </tr> <tr> <td width="78">Username</td> <td width="6">:</td> <td width="294"><input name="username" type="text" id="username"></td> </tr> <tr> <td>Password</td> <td>:</td> <td><input name="password" type="password" id="password"></td> </tr> <tr> <td> </td> <td> </td> <td><input type="button" name="Submit" value="Login" onclick="javascript:UserLogin();"/></td> </tr> </table> </td> </tr> </table> </form> </html>
  3. Well I made som changes to my coding, seems I have a issue with my javascript function at the onclick event. Basically I am added <a href="javascript:login();">test</a></td> to test, that works as I am getting my message "submitting", and also there seems to be some issue with mysqli connection as I get my message " failed connection ". <!DOCTYPE html> <html> <script language = "javascript"> function login() { alert("submitting"); document.login.submit(); } </script> <form name="login" action="login.php?action=login" method="post"> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td colspan="3"><strong>Radius Login </strong></td> </tr> <tr> <td width="78">Username</td> <td width="6">:</td> <td width="294"><input name="username" type="text" id="username"></td> </tr> <tr> <td>Password</td> <td>:</td> <td><input name="password" type="password" id="password"></td> </tr> <tr> <td> </td> <td> </td> <td><input type="button" name="Submit" value="Login" onclick="javascript:login();"/><a href="javascript:login();">test</a></td> </tr> </table> </td> </tr> </table> </form> </html> <?php require_once 'config.php'; error_reporting(E_ALL); //Connection to my database $mysqli = new mysqli(DB_HOST,DB_USER,DB_PASSWORD); if(mysqli_connect_errno()) { printf("Connection failed: %s\n", mysqli_connect_errno()); exit(); } if($_GET['action'] == 'login') { //prepared statement if($stmt = $mysqli->prepare("select * from login where username = ? and password = ?")) { $username = $_POST["username"]; $password = $_POST["password"]; //bind my parameters $stmt->bind_param("ss",$username,$password); //execute query $stmt->execute(); //bind the result variables $stmt->bind_result($username,$password); //Store my values $stmt->store_result(); //fetch values if($stmt->fetch()) { $_SESSION["username"] = $username; header("location : index.php"); exit(); } else { echo "Username or password is incorrect"; } $stmt->close(); $stmt->free_result(); } else { echo "Failed connection"; } } else { echo("failed"); } $mysqli->close(); ?>
  4. Hi Guys, Well I started of with my login page using prepared statements, but at this point in time it does not do anything! Does not tell me weither the username and password is incorrect or right, does not move on to the next page, just nothing. Anything I am missing here? login.php
  5. Hey guys, I recently started on a mysql logger, at this point in time it's not inserting the required info into my_log table. What am I missing? Please help! php Files attached. config.php index.php
×
×
  • 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.