Jump to content

gk20

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

gk20's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I want to upload pictures/images to my site but I ALSO want to prevent other people from copying them?? How is this possible? That is, that people won't be able to copy any images from my site?? Any help please?
  2. I've changed the code for displaying the different categories to this: while ($row = mysql_fetch_array($cats)) { session_register('category'); $_SESSION['category'] = $category; $category = $row['category']; echo '<font color=red size="4">'; echo '&nbsp;&nbsp;'; echo '<a href="viewads.php">'; echo $row['category'] . '<br/>'; echo '</a>'; echo '</font>'; } My page for displaying the different items is called viewads.php, i dont have any files called "categortyname".php, just this viewads.php file. At the moment it displays all items in the database, but I want it so that when a user clicks on a category name on the home page it will just display the items in that particular category?? Is that possible? Heres the relevant code from my viewads.php file: session_register('cat'); $cat = $_SESSION['category']; $getcats = @mysql_query("SELECT DISTINCT category from item where category = '$cat' order by category asc"); echo '<br>'; while ($row = mysql_fetch_array($getcats)) { echo '<b><font color=red>Category: '; echo $row['category']; echo '<br><br></font></b>'; $catagain = $row['category']; $getitems = @mysql_query("SELECT itemname, cost, description, itemowner from item where category = '$catagain' order by itemname asc"); ....... ...... etc display results } But it still doesnt work!! Does anybody understand what I'm trying to say???
  3. I have a table called item with fields category and item. I can display all distinct categories but I want to display them as links on my home page, so that when u click a category it displays all items in that category on a new page? Here my code for displaying each individual category: <?php include 'db.inc.php'; $cats = @mysql_query("SELECT DISTINCT category from item ORDER BY category"); echo '<b>&nbsp Category List<br></b>'; while ($row = mysql_fetch_array($cats)) { echo '<font color=red size="4">'; echo '&nbsp;&nbsp;'; echo $row['category'] . '<br/>'; echo '</font>'; } ?> Can anyone help?
  4. I'm outputting a user's name and contact email address eg. Username: adminiistrator Email: example@domain.com Instead I would prefer to just have the user's username as a link to their email? How is this possible? Or perhaps as a link so that a popup will appear with users email and phone number?? I tried the link something like this - <a href="mailto:$email">$user</a> where $email is the result of a query - $email = $row['Email'] and $user is similar - $user = $row['username']; Ideally id like to see both options above to see which one looks best, but if i could get help with either that would be great? Thanks!!!!!
  5. Sorry, I have tried this. In my placead.php file i have this at top <?php include 'db.inc.php'; ?> <?php session_start(); session_checker(); ?> ....... ....... session_register('loginname'); $itemowner = $_SESSION['loginname']; so when I'm adding to database: insert into item set ..... itemowner = '$itemowner' but it still leaves itemowner field blank! would it have anything to do with db.inc.php file?? ...... function session_checker() { if(!session_is_registered('loginname')) { if(!session_is_registered('loginpass')) { echo "<p>You must be logged in to view this page</p>"; echo "<b><br><br/><a href=login.php?loginuser=1>Login</a></b>"; exit(); } } } Its really bugging me, it should be easier!!!
  6. I have a php file where I allow users that are logged in to add to the database.I am using session_start() and session_checker() to see of the user is logged in before allowing them access to this page. That works fine. But when I add their info to the database I also want to add their username with it, to associate this informtion with them without asking them for it again??? Is there anyway I could use their loginname from login.php in the placead.php file? Heres login.php $login = $_POST['login']; $pass = $_POST['pass']; ... ... session_register('login'); $_SESSION['loginname'] = $login; session_register('pass'); $_SESSION['password'] = $pass; heres placead.php $itemname = $_POST['itemname']; $description = $_POST['description']; $category = $_POST['category']; $cost = $_POST['cost']; $location = $_POST['location']; when I'm storing these values can I how can I store the username of that person with the information?? Please help, I've tried looking in to sessions, but I can't seem to understand it!!!
  7. Cheers for that, worked perfectly!!
  8. I'm accepting a variable from a user in a form called phonenum that is of type INT my database. I want to make it work so that if the user enters a space in between numbers e.g. between area code and number that it will work? For example if user enters 0095 123456 instead of just 0095123456? How will this work?
  9. ya it was adding it to tables alright, but just not validating the email entered by the user. I wanted restricted access to certian domains. Anyway got it going in the meantime, thanks all the same
  10. I have a form where I accept an email from the user. I enter their username and email into a table called validate, and then validate the email to see whether it ends in a certain domain. If it does then I submit all the user details into the user table. If not, then $problem=true; etc... Whether or not the email validation evaluates to true, I delete the entry i just added to the validate table Heres my code: $username = $_POST['username']; $Email = $_POST['Email']; ...... $validatename = $_POST['username']; $validateemail = $_POST['Email']; ..... $insertval = "INSERT INTO validate SET validatename = '$username', validateemail = '$Email' "; $emailval = @mysql_query("select validateemail from validate where validateemail like '%student.example.com' OR validateemail like '%EXAMPLE.IE' OR validateemail like '%STAFF.EXAMPLE.COM'"); if (mysql_num_rows($emailval) == 1) { $sql = "INSERT INTO user SET fullname='$fullname', username='$username', password='$password', Email='$Email', DOB='$DOB', phonenum='$phonenum' "; // delete from validate table here and also if $problem = true; } else { echo '<b>Invalid Email</b>'; $problem = true; } I also check whether or not the info was inserted into user table corectly etc... but I get an error saying incorect argument passed to mysql_num_rows ?????? something like that?? Can anyone help?Its wrecking my head?
  11. I have a small ads website, and upon registration users may login and place ads. But when they place their ads, I want the system to store their ad along with username without asking them to provide it again. Is there anyway that the system can store their username in a variable after successful login (from login.php) and use it later when placing an ad (in placead.php)???
  12. OK, I get that. But my links file is displayed at the top of the page, where the login is validated further down in the body of the page. I want to display the links for logged in users at the top of the page with the existing ones??? I can display the 2nd set of links but it will display them in the body?? Is there any way that I could display all links on homepage but do a check to see if a user is logged in before displaying it, that way "banning" users that arent logged in from going there?????
  13. For users that are logged in I want more links to appear, more information etc.... How do I do this? I accept from the users when logging in: login and pass and validate these. So far this works For users not logged in I only want to have links to pages like: home, register, login, about. But I want more for users who are logged in? I know I'm probably confusing, but does anybody understand what I'm trying to say? $login = $_POST['login']; $pass = $_POST['pass']; ...... ...... if (!$fail) { $chklogin = @mysql_query("SELECT loginname,loginpass FROM login WHERE loginname = '$login' AND loginpass = '$pass'"); $chkuser = @mysql_query("SELECT loginname FROM login WHERE loginname = '$login'"); if (mysql_num_rows($chkuser) == 1) { if (mysql_num_rows($chklogin) == 1) { echo '<p><b>Welcome</b></p>'; echo '<p><b>Login successful</b></p>'; echo '<input type="submit" name="<href="#"" value="HOME">'; - this is probably where the code should go etc..... - or re-direct them to a page with all links etc and output their loginname on all pages from there on Please help???
×
×
  • 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.