Jump to content

ch4rlie

New Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by ch4rlie

  1. I have a db.php and inside it I filled out all the info needed:

    <?php
    define('DB_HOST', 'example.com');
    define('DB_NAME', 'database_name');
    define('DB_USERNAME', 'user_name');
    define('DB_PASSWORD', '*******');
    
    $odb = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USERNAME, DB_PASSWORD);
    ?>
    

    My problem is with the DB_HOST, is that my direct URL to the site? for example, google.com or is it like an IP?

     

  2. I am creating a forgotten password button, it works but it just doesn't send me an email containing the reset link.

    Here's the code for the email part:

    <?php
    
    require("../config.php");
    
    if($_GET['code'])
    {
    	$get_username = $_GET['username'];
    	$get_code = $_GET['code'];
    	
    	$query = mysql_query("SELECT * FROM users WHERE username='$get_username'");
    	
    	while($row = mysql_fetch_assoc($query))
    	{
    		$db_code = $row['passreset'];
    		$db_username = $row['username'];
    	}
    	if($get_username == $db_username && $get_code == $db_code)
    	{
    		echo "
    		
    		<form action='pass_reset_complete.php?code=$get_code' method='POST'>
    			Enter a new password<br><input type='password' name='newpass'><br>
    			Re-enter your password<br><input type='password' name='newpass1'><p>
    			<input type='hidden' name='username' value='$db_username'>
    			<input type='submit' value='Update Password!'>
    		</form>
    		
    		";
    	}
    	
    }
    
    if(!$_GET['code'])
    {
    echo "
    
    <form action='forgot_pass.php' method='POST'>
    	Enter your username<br><input type='text' name='username'><p>
    	Enter your email<br><input type='text' name='email'><p>
    	<input type='submit' value='Submit' name='submit'>
    </form>
    
    ";
    
    if(isset($_POST['submit']))
    {
    	$username = $_POST['username'];
    	$email = $_POST['email'];
    	
    	$query = mysql_query("SELECT * FROM users WHERE username='$username'");
    	$numrow = mysql_num_rows($query);
    	
    	if($numrow!=0)
    	{
    		while($row = mysql_fetch_assoc($query))
    		{
    			$db_email = $row['email'];
    		}
    		if($email == $db_email)
    		{
    			$code = rand(10000,1000000);
    			
    			$to = $db_email;
    			$subject = "Password Reset";
    			$body = "
    			
    			This is an automated email. Please DO NOT reply to this email.
    			
    			Click the link below or paste it into your browser
    			http:/www.***REMOVED***.com/second/forgot_pass.php?code=$code&username=$username
    			
    			";
    			
    			mysql_query("UPDATE users SET passreset='$code' WHERE username='$username'");
    			
    			mail($to,$subject,$body);
    			
    			echo "Check Your Email";
    		}
    		else
    		{
    			echo "Email is incorrect";	
    		}
    	}
    	else
    	{
    		echo "That username doesnt exist";	
    	}
    }
    }
    ?>
  3. So I am a complete newb at PHP coding and need help.

    Here is the form I am trying to modify...

    http://i.gyazo.com/430a43e1de5629e2ccb8a386f177c23e.png

    I am trying to make the black border fill most of the screen rather a little bit.

     

    This is the code for the whole box.

    <div id="app" class="col-md-5">
    				<div class="panel panel-default">
    					<div class="panel-heading">
    						<h1 class="panel-title">Search Box</h1>
    					</div>
    					<div class="panel-body">
    						<form id="search" data-validate="parsley" class="form-horizontal" role="form" />
    							<div class="form-group">
    								<label for="url" class="col-lg-2 control-label">URL</label>
    								
    								</div>
    							
    								</div>
    							<div class="error-container alert alert-danger">
    							</div>
    							<div class="form-group">
    								<div class="col-lg-offset-2 col-lg-10 text-right">
    									<button id="crawl" type="submit" class="btn btn-primary btn-lg">Search <span class="glyphicon glyphicon-search"></span></button>
    								</div>
    							</div>
    						</form>
    					</div>
    				</div>
    			</div>
    

    Please tell me how. 

    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.