Jump to content

chandler

Members
  • Posts

    142
  • Joined

  • Last visited

Everything posted by chandler

  1. Hi, im getting alot of errors like so Deprecated: Function session_is_registered() is deprecated time to update some files, can you guys pls help im rubbish with PHP guess thats why I waited so long to update. here is the code I need to change checklogin.php // 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:index.php"); } index.php <? session_start(); /*if(!session_is_registered(myusername)){ header("location:main_login.php"); }*/ ?> index.php (display username stuff) <?php if(session_is_registered(myusername)){ ?> Welcome: <?= $_SESSION['myusername'] ?><?php } ?> index.php (edit content stuff) <?php $file = file_get_contents('content/menu_header_a.txt', 'r'); if(session_is_registered(myusername)){ ?><a href="javascript:open4()"><?php echo $file ?></a><?php } else { echo $file; }?> Many thanks for any and all your help with this one. if you could keep it simple please like ( replace this with this ) . thanks
  2. anyone got any ideas about this?
  3. great thanks for that jcbones works great. Thanks for the help everyone.
  4. <?php $file = file_get_contents('content/menu_header_a.txt', 'r'); echo $file; ?><?php if(session_is_registered(myusername)){ ?><a href="javascript:open1()"><?php echo htmlentities($file); ?></a><?php } ?> also tried this <?php $file = file_get_contents('content/menu_header_a.txt', 'r'); echo htmlentities($file); ?><?php if(session_is_registered(myusername)){ ?><a href="javascript:open1()"><?php echo $file; ?></a><?php } ?> If I dont echo it here then I don't see any content. <?php $file = file_get_contents('content/menu_header_a.txt', 'r'); echo $file; ?>
  5. Still stuck on this it seems whatever I try either removes the content or you have to be logged in to view it or it displays it twice while logged in. please post if you have any more ideas, Thanks guys
  6. any idea anyone please?
  7. maybe im doing somthing wrong but that didnt work, when I do that I am only able to see the content when logged in. Here is the whole code: header.php <?php //This condition will check either the submit button was pressed, for such test you need to check that if there is an element which has the same name as your button. if(isset($_POST['Submit'])) { //this is just the name of the file, it can be used directly but its better to use a variable its just for convinence $file = "../content.txt"; if(is_writable($file)) { //this is the open the file in write more 'w' says that it will open in writeable more $fh = fopen($file, 'w') or die("can't open file"); //I again used a variable to store the data.... which is to be written to the file //The main point is to receive the data on submit, it is when submit is done, and uppen condition for submit is fulfilled //all the elements of the form are put in the array named $_POST and you can get their values by their names //in the same way I just took the value of 'editor1' it is the name for textarea in which you displayed the text $data = stripslashes(stripslashes($_POST['header'])); ///This routine will just write the data to file given the file handle and the data. fwrite($fh, $data); //must close the file after all writing is done. fclose($fh); } else { echo "File is Not Writable<br>"; } } ?> <form method="post"> <textarea name="header"> <?php $file = file_get_contents('../content.txt'); echo $file; ?> </textarea> Then this to call the file and display it. <?php $file = file_get_contents('content.txt', 'r'); echo $file; ?> then this calls header.php that allows me to edit the content, only when logged in. <?php if(session_is_registered(myusername)){ ?><a href="javascript:open1()"><div id="edit_link">Edit</a></div><?php } ?> Im a complete noob at this a friend gave this to me and showed me how to set it up I just need to make some small modifications to it now... Remove edit link and make the content sting active so once clicked on, while logged in it will open the textarea for editing. many thanks.
  8. if i do this <?php $file = file_get_contents('contents.txt', 'r'); echo $file; ?><?php if(session_is_registered(myusername)){ ?><a href="javascript:open4()"><?php echo $file ?></a><?php } ?> then I get the content of the file printed twice on the web page Please help...thanks
  9. Hi heres what I would like to do, im sure its not the best way to do it but its the only way I have used in the past . getting content string <?php $file = file_get_contents('contents.txt', 'r'); echo $file; ?> usualy I would use a edit link with this code <?php if(session_is_registered(myusername)){ ?><a href="javascript:open1()"><div id="edit_link">Edit</a></div><?php } ?> But what I would like to do now is to skip the edit link and just make the content string a link once the user is logged in they will be able to click on the content string and it will activate the javascript:open1() Many thanks for your help
  10. I need to know How can I restrict the onclick to just the arrow? At the moment you can click anywhere in the row for it to expand. (function($){ $.fn.jExpand = function(){ var element = this; $(element).find("tr:odd").addClass("odd"); $(element).find("tr:not(.odd)").hide(); $(element).find("tr:first-child").show(); $(element).find("tr.odd").click(function() { $(this).next("tr").toggle(); }); } })(jQuery); $(document).ready(function(){ $("#report tr:odd").addClass("odd"); $("#report tr:not(.odd)").hide(); $("#report tr:first-child").show(); $("#report tr.odd").click(function(){ $(this).next("tr").toggle(); $(this).find(".arrow").toggleClass("up"); }); //$("#report").jExpand(); }); <table id="report"> <tr> <th>Header Content</th> </tr> <tr> <td>Content</td> <td></td> <td></td> <td></td> <td><div class="arrow"></div></td> </tr> <tr> <td colspan="5"> <h4>Additional information</h4> <ul> <li></li> <li></li> <li></li> </ul> </td> </tr> </table> Im a complete noob at this so much thanks for your help.
  11. great tags of gone, thank you so much Andy.
  12. no still getting the <br/> tag
  13. tried that still showing the tags though, im going to read up on those links you included. Thanks
  14. When I add some text to the front end of the textarea it displays bla <br/> bla <br/> bla <br/> How can I stop it from showing the html tags? Thanks. echo'<textarea id="info" style="width:80%; height:60px;">'; } echo $profile['info']; if($_SESSION['user_id'] == $id) { echo'</textarea><input type="submit" style="width:70%" value="send" onclick="updateInterests(document.getElementById(\'info\').value)" />';
  15. ok thanks for that
  16. wicked thanks you sooo much
  17. Hi, can any see is the are mistakes in this for me. Thanks echo'<img src="skinFiles/'.$skin['thumb_name'].'"class="skinImage" onclick="changeSkin(\'skinFiles/'.$skin["css_name"].'\')" />';
  18. I will give it a go, im a complete noob at php. thanks for all your help
  19. seems to work now after adding that, great many thanks
  20. ok thanks, like this? header('Location: main.php'); exit;
  21. Thanks, the problem is I have a domain like www.111exampleurl111.net.16.net, so I have a url redirect set up on this like www.myname.com but when this is used it is not possible to login to the site only when I use www.111exampleurl111.net.16.net, I am able to login.
  22. yes sorry, I think this is all of the login system. <?php session_start(); ob_start(); if (!isset($_SESSION["valid_user"])) { header('Location:/index.php?action=login'); } $theuser=$_SESSION["valid_user"]; ///////////////////////////////// Language Changer - start if (!$_SESSION['lang_ice']) { $_SESSION['lang_en'] = true; $_SESSION['lang_ice'] = false; } if (isset($_GET['lang'])) { if ($_GET['lang'] == "en") { $_SESSION['lang_en'] = true; $_SESSION['lang_ice'] = false; } if ($_GET['lang'] == "ice") { $_SESSION['lang_en'] = false; $_SESSION['lang_ice'] = true; } } if($_SESSION['lang_ice'] == true) { require_once '../langs/ice.php'; } if($_SESSION['lang_en'] == true) { require_once '../langs/en.php'; } /////////////////////////// Language Changer - end ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> </head> <body> <? if (!$_SESSION["valid_user"]) { echo "<li><a href=\"/main/?action=login\">$login</a></li><li><a href=\"/main/?action=register\">$register</a></li>"; } else { echo "<li><a href=\"/Users/profile.php?action=viewprofile\">$theuser</a></li><li><a href=\"/main/?logout\">$logout</a></li>"; } if ( $theuser == "admin" ) { echo "<li><a href='/admin/'>Admin Area</a>"; } ?> <?php //require("../requires/head.php"); require("../requires/config.php"); if(isset($_GET['action'])) { $action=addslashes($_GET['action']); } if(!isset($_GET['action'])) { header("Location:main.php"); } if(isset($_GET['logout'])) { session_unset(); session_destroy(); echo "Goodbye"; ?> <meta http-equiv="refresh" content="2;url=main.php" /> <?php } if(isset($_SESSION["valid_user"])) { echo "Welcome"; } if(isset($_POST['submit'])) { $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $password = md5($password); $query = mysql_query("SELECT * FROM guest_users WHERE us_nm = '$username' AND us_pw = '$password'") or die(mysql_error()); if(mysql_num_rows($query) == 0) { echo "Username and Password combination not recognised.<br>"; } else { $_SESSION["valid_user"] = $username; header("Location:main.php"); } } if ( $action == "login" ) { echo "$index2[0]"; ?> <br><br> <center> <form action="" method="post"> <table border="0" cellspacing="0" cellpadding="0" width="150"> <tr> <td width="60"><?php echo $index2[1];?>:</font></td> <td width="90"><center><input type="text" name="username"></center></td> </tr> <tr> <td colspan="2" height="6"> </td> </tr> <tr> <td width="60"><?php echo $index2[2];?>:</font></td> <td width="90"><center><input type="password" name="password"></center></td> </tr> <tr> <td colspan="2" height=\"6"><br><input type="Submit" name="submit" value="<?php echo $index2[3];?>"></td> </tr> </table> </form> </center> <?php } if ( $action == "register" ) { $username=mysql_real_escape_string($_POST['username']); $email=mysql_real_escape_string($_POST['email']); $myname=mysql_real_escape_string($_POST['myname']); $myweb=mysql_real_escape_string($_POST['myweb']); $location=mysql_real_escape_string($_POST['location']); echo " <form action='' method=\"post\" enctype=\"multipart/form-data\"> <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"570\"> <tr> <td width=\"120\">$index2[1]:</td> <td width=\"*\"><input type=\"text\" name=\"username\" value=\"$username\" class=\"itxt\"></td> </tr> <tr> <td colspan=\"2\" height=\"4\"> </td> </tr> <tr> <td width=\"120\">$index2[2]:</td> <td width=\"*\"><input type=\"password\" name=\"password\" class=\"itxt\"></td> </tr> <tr> <td colspan=\"2\" height=\"4\"> </td> </tr> <tr> <td width=\"120\">$email_ent:</td> <td width=\"*\"><input type=\"text\" name=\"email\" value=\"$email\" class=\"itxt\"></td> </tr> <tr> <td colspan=\"2\" height=\"10\"> </td> </tr> <tr> <td width=\"120\">$index2[10]:</td> <td width=\"*\"><input type=\"text\" name=\"myname\" value=\"$myname\" class=\"itxt\"></td> </tr> <tr> <td colspan=\"2\" height=\"4\"> </td> </tr> <tr> <td width=\"120\">$index2[7]:</td> <td width=\"*\"><input type=\"text\" name=\"myweb\" value=\"$myweb\" class=\"itxt\"></td> </tr> <tr> <td colspan=\"2\" height=\"4\"> </td> </tr> <tr> <td width=\"120\">$index2[8]:</td> <td width=\"*\"><input type=\"text\" name=\"location\" value=\"$location\" class=\"itxt\"></td> </tr> <tr> <td colspan=\"2\" height=\"4\"> </td> </tr> <tr> <td width=\"120\">$index2[9]:</td> <td width=\"*\" valign=\"top\"><input type=\"file\" size=\"15\" name=\"uploadfile\"></td> </tr> <tr> <td colspan=\"2\" height=\"8\"> </td> </tr> <tr> <td colspan=\"2\" height=\"4\"> <input type=\"Submit\" value=\"Submit\" name='submit_reg'> </td> </tr> </table> </form>"; } if (isset($_POST['submit_reg'])) { $upload=$_FILES['uploadfile']; $username=mysql_real_escape_string($_POST['username']); $pass_word=mysql_real_escape_string($_POST['password']); $password=mysql_real_escape_string(md5($_POST['password'])); $email=mysql_real_escape_string($_POST['email']); $myname=mysql_real_escape_string($_POST['myname']); $myweb=mysql_real_escape_string($_POST['myweb']); $location=mysql_real_escape_string($_POST['location']); $tava=basename($_FILES['uploadfile']['name']); $target_path = "../images/uploads/"; $target_path = $target_path . basename( $_FILES['uploadfile']['name']); move_uploaded_file($_FILES['uploadfile']['tmp_name'], $target_path); if(strlen($username) >= 7) { echo "Username Too long. 7 or less characters.<br>"; } else { $query=mysql_query("SELECT * FROM guest_users WHERE us_ml='$email' AND us_nm = '$username'"); $result=mysql_num_rows($query); if ($result == 0) { $one = "INSERT INTO guest_users VALUES('','$username','$password','$email','$myname','$tava','$myweb','$location')"; $two = mysql_query($one) or die("Error: Information has not been added to the users database"); $subject = "Registration"; $message = "Congratulations on registering with us. These are the details you have registered with:\n Name:".$myname."\n Username:". $username."\n Password:".$pass_word."\n Website:".$myweb."\n Location:".$location; $from = "@gmail.com"; $headers = "From: $from"; mail($email,$subject,$message,$headers); echo "<center>Now You are registered!</center>"; require_once "../requires/feet.php"; exit(); } else { echo "Username and email already in use.<br>"; } } } require("../requires/feet.php"); ?>
  23. Hi, I have a url redirect set up on my site, when I use this I am unable to login, if I use the original Domain name it works fine, thanks for your help.
  24. Thank you so much......easy when you know how:)
  25. I am patient, just wasn't 100% sure if I posted it in the right place
×
×
  • 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.