Jump to content

munnaz

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

munnaz's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. or if i could just remove the last three digits off it? ' | ' So it would just print 'Home'?
  2. Thanks for reply. That output still just prints 'Home | ' Any other suggestions?
  3. $m is defined: preg_match("/<title>(.*)<\/title>/",$file,$m)) Description: int preg_match ( string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] ) semi colon doesn't change anything and path is correct. The title is clearly displayed at the top of the webpage brower when I visit it but it does not show up when I use the php code mentioned above. Any other suggestions?
  4. Hey guys, I have the following code: <? $url = "../index.php"; $file = file($url); $file = implode("",$file); if(preg_match("/<title>(.*)<\/title>/",$file,$m)) print "The title of $url is <b>$m[1]</b>"; else print "The page doesn't have a title tag"; ?> My page title on the index page is: <title>Home | <?php include("include/pagetitle.php") ?></title> But my problem is that i have <?php include("include/pagetitle.php") ?> in my title and it is not pulling that code from the include page. It just prints ''Home |'' Can anyone help? Thanks in advance!
  5. Thanks Do I just include it at the top of the login page's code (the code i posted)?
  6. Thanks Do I have to put the code anywhere specific or just at the top of the login page only? I want it to last for a day minimum.
  7. Hey guys, I have a website that people log into and watch documentaries. http://free-documentaries-online.com . I was wondering how to make my sessions last longer and also have an option for them to 'Keep me logged in'? I have the code : session_start(); at the top of every page and login.php is <?php //Start session session_start(); //Include database connection details require_once('configlogin.php'); //Array to store validation errors $errmsg_arr = array(); //Validation error flag $errflag = false; //Connect to mysql server $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } //Function to sanitize values received from the form. Prevents SQL injection function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } //Sanitize the POST values $login = clean($_POST['login']); $password = clean($_POST['password']); //Input Validations if($login == '') { $errmsg_arr[] = 'Login ID missing'; $errflag = true; } if($password == '') { $errmsg_arr[] = 'Password missing'; $errflag = true; } //If there are input validations, redirect back to the login form if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; session_write_close(); header("location: login-form.php"); exit(); } //Create query $qry="SELECT * FROM members WHERE login='$login' AND passwd='".md5($_POST['password'])."'"; $result=mysql_query($qry); //Check whether the query was successful or not if($result) { if(mysql_num_rows($result) == 1) { //Login Successful session_regenerate_id(); $member = mysql_fetch_assoc($result); $_SESSION['SESS_MEMBER_ID'] = $member['member_id']; $_SESSION['SESS_FIRST_NAME'] = $member['firstname']; $_SESSION['SESS_LAST_NAME'] = $member['lastname']; $_SESSION['SESS_FULL_NAME'] = $member['firstname']." ".$member['lastname']; $_SESSION['SESS_LOGIN'] = $member['login']; $_SESSION['SESS_EMAIL'] = $member['email']; $_SESSION['SESS_SUBSCRIBE'] = $member['subscribe']; $_SESSION['SESS_AUTO_ADD_RECENT'] = $member['autoaddrecent']; $_SESSION['SESS_VISITS'] = $member['visits']; session_write_close(); header("location: ../index.php"); exit(); }else { //Login failed header("location: login-failed.php"); exit(); } }else { die("Query failed"); } ?> I think it has something to do with session.gc_maxlifetime But im not too sure where to put it? I can't acess my php.ini file to change settings? Does that matter or can i use code. Thanks in advance!
  8. Hey, I just have a couple of admin pages that I wish to protect with a password. I was wondering if anyone had a simple script where you just enter a password on the first page and if the cookie is not set the other pages just redirect you back to enter the password? I used to have one but I lost it and can't seem to just find a simple one? Thanks
  9. I changed it to the following because I had them the same values and thought the num of the first query was getting mixed up with the number of the second query and then it would happen that way. I can't see anything wrong with the text you mentioned? $query2 = "SELECT * FROM table2"; $result2 = mysql_query($query2); $num2 = mysql_numrows($result2); $query1 = "SELECT * FROM table1"; $result1 = mysql_query($query1); $num1 = mysql_numrows($result1); Thanks!
  10. Hey, I was just wondering if you could help. I have a search and it only searches for exact phrases. $query="SELECT * FROM table WHERE title like '%$searchfield%' OR description like '%$searchfield%' ORDER BY title LIMIT $offset, $rowsPerPage"; $result=mysql_query($query); I was wondring if I could modify it so that if someone searches for something like 'Peeling a Banana' It seaches for the words 'peeling' and 'banana' and not the whole phrase as one? Thanks
  11. Hi, Just wondering if you can figure out why this code is sending two emails?? I can't figure it out. <?php $recent=$_GET['recent']; $sendemail=$_GET['sendemail']; mysql_close($conn); $output = 'no'; $dbhost = '*********'; $dbuser = '*********'; $dbpass = '*********'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('MYSQL N/A - Please Contact Admin'); $dbname = 'documentaries'; mysql_select_db($dbname); $query1 = "SELECT * FROM table1"; $result1 = mysql_query($query1); $num1 = mysql_numrows($result1); if(is_int($num1/10)){ $output = 'yes'; } if (($output == 'yes') && ($sendemail == 'yes')) { $query2 = "SELECT * FROM table2"; $result2 = mysql_query($query2); $num2 = mysql_numrows($result2); $i=0; while ($i < $num2) { $email=mysql_result($result2,$i,"email"); $subject = "Subject Here"; $msg = "Message Here"; // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $eLog="/tmp/mailError.log"; //Get the size of the error log //ensure it exists, create it if it doesn't $fh= fopen($eLog, "a+"); fclose($fh); $originalsize = filesize($eLog); mail($email,$subject,$msg,$headers); /* * NOTE: PHP caches file status so we need to clear * that cache so we can get the current file size */ clearstatcache(); $finalsize = filesize($eLog); //Check if the error log was just updated if ($originalsize != $finalsize) { print "<b>Problem sending mail to $email. (size was $originalsize, now $finalsize) See $eLog...<br>"; } else { print "Mail sent $email<br>"; } $i++; } // redirect } mysql_close($conn); // redirect ?> Thanks For your help!
  12. Hey guys was wondering if anyone could modify the code below to have $output = 'yes' if the number of rows equal 10, 20, 30, 40, 50, 60, 70, 80......... etc $dbhost = '******'; $dbuser = ''******';'; $dbpass = ''******';'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('MYSQL N/A - Please Contact Admin'); $dbname = ''******';'; mysql_select_db($dbname); $query="SELECT * FROM documentaryinfo"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close($conn); ?> Thanks -------------------------------------------------------------------------------------------------------- Watch Free Documentaries Online - The Documentary Database www.free-documentaries-online.com --------------------------------------------------------------------------------------------------------
  13. hey i have this site ( [a href=\"http://uw.munnaz.com\" target=\"_blank\"]http://uw.munnaz.com[/a] ) and i have on the side a news section. This is included from another page. every time i add something new i have to delete the bottom entry to fit in the top one. i was wondering if there was a way to include only a limited amount of lines or something similar. munnaz
×
×
  • 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.