Everything posted by kirstys brain
-
PHP Member Activation mySQL fails!
Here's the code I ran that didn't have any error messages - does this cause errors for you? <? session_start(); include ("myown_db.php"); $code = "a constant I know exists in table"; $query = "SELECT * FROM vip WHERE state='$code'" or die ('Error: '.mysql_error ());; $result = mysql_query($query) OR die(mysql_error()); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "hi" ; } ?>
-
PHP Member Activation mySQL fails!
Hi Nick, I tried your code on my own database and got no errors ... are you sure that the contents of db.php aren't causing this problem?
-
php form to txt file
No probs Best of luck to you!
-
php form to txt file
Hi Seth, something like this should do it (if you add validation etc): <?php $string = $_POST['string']; $file = fopen("text.txt","w") or exit("Unable to open file!"); fwrite ($file, $string); fclose($file); ?> <form action="#" method='post'> <input type='text' name='string' /> <input type='submit' /> </form> I got it from here: http://www.w3schools.com/php/php_file.asp Hope that helps Kirsty
-
javascript variables and frames
Hi there, I wonder if anyone could help me out? I have a frame where some javascript variables are set but I need to access them from the parent to be displayed in a div. I've tried a lot of ways and have found a few that work in IE7 (most widely used seems to be parent.document. getElementById.. etc if I remember right, I've been trawling through obscure solutions for a couple of days now) But I can't find any method at all that will work in firefox. It's driving me bonkers Many thanks to anyone who can shed some light on this! Kirsty
-
Problem with sessions in PHP 5
Thanks Jem, I was aware of this but it's in the giant queue of many things that need to be addressed before this could be a real site. I had a look at your articles though and bookmarked them, they were really useful and explained a few things that I've not been able to find out about yet. So thankyou!
-
Problem with sessions in PHP 5
5 ... although I can't say anything about any numbers that might come after that
-
Problem with sessions in PHP 5
Thanks Snider, didn't quite fix the problem, but interesting reading. I'll consider suppressing the error message if I can't find any way of fixing it but that doesn't bode well for the future Thanks for your help
-
Problem with sessions in PHP 5
What you guys said there made a lot of sense, but when I tried it I still got the error. Maybe if I try and make the session data come straight from the table?
-
Problem with sessions in PHP 5
Cool - I'll let you know ..
-
Problem with sessions in PHP 5
Here it is, I hope it's coherent enough to understand ... <?php session_start(); if (!isset($_SESSION['username'])) {$username = $_REQUEST['username']; $_SESSION['username'] = $username;} if (!isset($_SESSION['password'])) {$password = $_REQUEST['password']; $_SESSION['password'] = $password;} ?> <html> <head> </head> <body> <?php if (isset($_REQUEST['log_out'])) {unset($_SESSION['username']); unset($_SESSION['password']);} mysql_connect("localhost", "dbname", "password") or die(mysql_error()); mysql_select_db("dbname") or die(mysql_error()); $username = $_SESSION['username']; $result = mysql_query("SELECT * FROM combined WHERE username='$username'"); $row = mysql_fetch_array($result); if ((!isset($_SESSION['password']))||($row['password']!=$_SESSION['password'])||($_SESSION['password']=="")||($row['active']=="0")) {include ("form.html"); die;} else {$result2 = mysql_query("SELECT type FROM combined WHERE username='$username'"); $row2 = mysql_fetch_array($result2); $type = $row2['type']; $_SESSION['type'] = $type;} if ((isset($_REQUEST['profile']))||(isset($_REQUEST['edit_profile']))) {include ("edit_profile.php"); die;} if ((isset($_REQUEST['delete']))||(isset($_REQUEST['submit_delete']))) {include ("delete.php"); die;} if ((isset($_REQUEST['event']))||(isset($_REQUEST['submit_event']))) {include ("add.php"); die;} if ((isset($_REQUEST['edit']))||(isset($_REQUEST['select_edit']))||(isset($_REQUEST['submit_edit']))) {include ("edit.php"); die;} ?> <form action="log_in.php" method="post"> <input class="submit" type="submit" name="event" value="Add Event" /><br /> <input class="submit" type="submit" name="edit" value="Edit Event" /><br /> <input class="submit" type="submit" name="delete" value="Delete Event" /><br /><br /> <input class="submit" type="submit" name="profile" value="Edit profile" /><br /><br /> <input class="submit" type="submit" name="log_out" value="Log Out" /> </form> </body> </html> I'm sure it's full of all kinds of other gaping holes and stuff, but like I said it's my first one so be gentle
-
Problem with sessions in PHP 5
If I understand you right (I'm not sure if I do) then I guess no, the session is first assigned the value of the (initially non-existant) request variable right at the beginning, even before the form has ever been filled in. I'm not sure how you check something locally, but if you mean on my computer then no, I don't have any server software to be able to do that. Not ideal I know ...
-
Problem with sessions in PHP 5
When someone first opens the page, if the session variables for username and password are not set it gives them a login form and ends the script. Once they've entered their details the page reloads and assigns their information, in the form of request variables, to the session variables and then goes on to check that info in a mysql database. I hope that makes sense ... I'm very new to this
-
Problem with sessions in PHP 5
Hi, I've made my first ever log in script, being a newbie to php, and although everything seems to work great every so often my webpage is throwing up this error message: Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0 I'm having trouble figuring out what this means, let alone how to fix it. As far as I can tell it's saying that the way I'm assigning values to session variables is wrong (eg: $_SESSION['username'] = $username) but it's hard to imagine another way to declare them. Also from everything I've read it seems that to enable register_globals is not an option. After much googling the only alternative I could find to using a session is to try and attach information to REQUEST variables, but this seems very messy and the only way I can think how to do it would be to have hidden inputs in every page and have the whole site rely on submit buttons for navigation. Ouch. There must be a better way! Can anyone help? Thanks in advance!
-
Removing newline characters
No joy I'm afraid - it's still coming back exactly the same. Any more ideas would be most welcome though!
-
Removing newline characters
Aye it works if you type that string into the php and run it, but if I paste the same string into an input in a form and hit submit it leaves the newline intact but puts this in front: \ How can that be?? Is there something wrong with the rest of my code? There's not much of it: <?php if (isset($_REQUEST['submit'])) {$email = ($_REQUEST['email']); echo preg_replace("/[\n|\r|\t]/","","$email");} ?> Any ideas?
-
Removing newline characters
Hi there, I'm trying to remove the some expressions from a string using regex. It's working fine except for anything like \n, \r etc. This is the code I'm using: <?php echo preg_replace("/[\n|\r|\t]/","",$email); ?> I've tried it with a million different kinds of syntax and also str_replace and it don't work, but every site I've looked at says it should. I'm very stuck Many thanks if anyone can help! Kirsty
-
padding/margin causing problems
Seems to work fine if you take position: relative out of the code for .news Try it and see
-
Is this bad SEO?
Hi Elanman, thanks a million I'll give it a try once I get back from taking the kids swimming (bleh) The reason I put this in was because I couldn't make it validate otherwise. I don't know if that'll be a problem with your method - it doesn't look like it will be - so maybe there'll be no need to worry about it anyway. Here's hoping Thanks again, you've been a great help
-
Is this bad SEO?
Hey, thanks Elanman Do you know where I could get any information on how to do that? I'm a complete newbie to javascript, I'm sure it shows
-
Is this bad SEO?
Hi there, I've just made a site for a friend where a lot of the information is only accessed through javascript by clicking (if you want to see it's here: Mabel's Website) I was wondering if this is bad for her SEO, I don't know if Google and others read the text in the script at the top of the page. I don't know if it matters with her site anyway, because there isn't much there by way of copy, but I'd like to know if this is bad practise because it's tempting to use this method on larger sites, and I can see it becoming a problem if all that text is going to be ignored by search engines. Thanks for any advice
-
How Do Big Businesses Come Straight In with a Good PR?
I disagree, I find those big commercial sites horrible to look at, too much stuff on them. I think they're pants. But then that'll be my bad taste showing I guess
-
my first css website - problem in browsing ie6
Yep, that's right. It should work as long as your 3 divs are directly on top of each other.
-
my first css website - problem in browsing ie6
Hey there Yes I know what you mean, you can easily make it vertically expandable (instead of horizontally as it is now) by replacing the images and divs that are there now with these, and stacking them on top of each other instead of floating them left: First a wide flat one holding the top border and rounded corners and putting it in a wide div at the top Then one that is 1px tall and holds the two side borders to go in the main div and have no height specified so that that div can expand downwards. The bottom of your border goes in the last image and that goes in a wide flat div at the bottom. This should achieve the desired effect, although the file sizes will be a bit bigger. Good luck!
-
my first css website - problem in browsing ie6
Hi Nana, had a look to see what I could do with your site, I've stuck together another version using only ten divs this time. It's pretty much the same as yours although you'll need to tweak the margins to your liking. It works in ie6, ie7 and ff3, and will also work in ie5 / ie5.5 if you put {text-align: center} in the body in your style sheet and adjust your margins again. It's a bit thrown together and you'll probably need to make lots of changes, but hopefully it'll give you some new ideas about what CSS can do. To make it work in ie6 I've converted your PNGs to GIFs and JPGs, but if you're really determined to inflict PNGs on yourself this site will tell you how best to do it: A List Apart - PNGs I've attached all the files including some new images. I hope it's helpful, good luck saraya.zip Kirsty