mike12255
-
Posts
439 -
Joined
-
Last visited
-
Days Won
1
Posts posted by mike12255
-
-
any ideas on how to get this working?
-
tried your change and still not working anyone else have an idea?
-
didnt work, thanks though
-
I want this function to either log the user in or return the string $error telling the user they entered wrong info here is my code:
index.php
<?php include "universal.php"; if($_POST['submit']){ $logincheck = user_login($_POST['username'],$_POST['pwd']); } ?> <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- body { background-color: #999999; } #box{ border:2px #000000; background-color:#CCCCCC; width:400px; height:300px; } --> </style></head> <body> <div id="box"> <form method="post" action="index.php"> <p align="center"><span class="style1 style12 style20">Username: </span> <input type="text" name="username"> <br> <p align="center"><span class="style1 style12 style20">Password: </span> <input type="password" name="pwd"> <br> <input type="submit" name="login" value="Login"> </p> </form><br /> <br /> <?php if ($logincheck) { echo $logincheck; } ?> </div> </body> </html>
universal.php:
<?php //These are required on all pages so make sure they get called as soon as file is included session_start(); include ("connect.php"); function user_login ($user,$pass){ $user = mysql_real_escape_string($user); $pass = mysql_real_escape_string($pass); $sql = "SELECT * FROM tbl_users WHERE username = '".$user."'AND password = '".$pass."'"; $res = mysql_query($sql) or die (mysql_error()); if (mysql_num_rows($res) > 0){ $_SESSION['user'] = $user; header ("Location: editpages.php"); }else{ $error = "Sorry bad username/password comination"; return $error; } }// end of login function ?>
can anyone help me make the string appear on the index pagee when info is not found?
-
im not getting an error, its just not showing $error on index.php and i want it too
-
here is my index.php file
<?php include "universal.php"; if($_POST['submit']){ user_login($_POST['username'],$_POST['pwd']); } ?> <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- body { background-color: #999999; } #box{ border:2px #000000; background-color:#CCCCCC; width:400px; height:300px; } --> </style></head> <body> <div id="box"> <form method="post" action="index.php"> <p align="center"><span class="style1 style12 style20">Username: </span> <input type="text" name="username"> <br> <p align="center"><span class="style1 style12 style20">Password: </span> <input type="password" name="pwd"> <br> <input type="submit" name="login" value="Login"> </p> </form><br /> <br /> <?php if ($error){ echo $error; } ?> </div> </body> </html>
and here is my univeral.php file:
<?php /* ********************************************* ********UNIVERAL CMS FUNCTIONS*************** ********FOR STUDENT WEB PRO****************** ********DEVELOPED BY: MICHAEL H************** ******* JULY 18 2009************************ ********************************************* */ //These are required on all pages so make sure they get called as soon as file is included session_start(); include ("connect.php"); function user_login ($user,$pass,$error){ $user = mysql_real_escape_string($user); $pass = mysql_real_escape_string($pass); $sql = "SELECT * FROM tbl_users WHERE username = '".$user."'AND password = '".$pass."'"; $res = mysql_query($sql) or die (mysql_error()); if (mysql_num_rows($res) > 0){ $_SESSION['user'] = $user; header ("Location: editpages.php"); }else{ $error = "Sorry bad username/password comination"; return $error; } }// end of login function //MAKE SURE ADMIN IS LOGGED ON ON ADMIN PAGES function check_status($session){ if ($_SESSION['user']){ return true; }else{ return false; } } //CREATE THE BOX function create_box($page){ $sql = "SELECT * FROM tbl_pages WHERE page = '".$page."'"; $res = mysql_query($sql) or die (mysql_error()); while ($row = mysql_fetch_assoc($res)){ $info=$row['info']; } echo "<form method=\"post\" action=\"edit.php?page= . '$page' .\">"; echo "<div>"; echo "<p>Design exactly how you want the Wine page to look in this: click submit when finished.</p>"; echo "<div>"; echo "<textarea id=\"info\" name=\"info\" rows=\"15\" cols=\"70\" style=\"width: 80%\">"; echo $info; echo "</textarea>"; echo "</div>"; echo "<input type=\"submit\" name=\"save\" value=\"Submit\" />"; echo "</div>"; echo "</form>"; } //ENTER TEXT BOX INFO INTO DB function insert_info($info,$page){ $sql = "UPDATE tbl_pages SET info = '".$info."' WHERE page = '".$page."'"; mysql_query($sql) or die (mysql_error()); header ("Location pageedits.php"); } // LOG THE USER OUT function user_logout(){ unset($_SESSION['user']); session_destroy(); header("Location: index.php"); } ?>
for some reason when i enter nothing and click submit the error message dosnt appear, am i calling the function wrong?
-
seems to have workd, thanks
-
Im not sure whats wrong with this line, this is the same way i've done this type of things before, does anyone see the problem?
<?php echo "<form method=\"post\" action=\"edit.php?page='".$page."'\">"; ?>
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/schoolw1/public_html/test/universal.php on line 59
Parse error: syntax error, unexpected T_LNUMBER, expecting ',' or ';' in /home/schoolw1/public_html/test/universal.php on line 59
-
ok so if my code had (.*?) in it three times there would be the variables
$1 $2 and $3 if so i think i understand now and thanks for all your help!
-
so does it give (.*?) the value of $1?
im loooking off this example:
$format_search = array('#\[b\](.*?)\[/b\]#is', // Bold ([b]text[/b] '#\[i\](.*?)\[/i\]#is', // Italics ([i]text[/i] '#\[u\](.*?)\[/u\]#is', // Underline ([u]text[/u]) '#\[s\](.*?)\[/s\]#is', // Strikethrough ([s]text[/s]) '#\[quote\](.*?)\[/quote\]#is', // Quote ([quote]text[/quote]) '#\[size=([1-9]|1[0-9]|20)\](.*?)\[/size\]#is', // Font size 1-20px [size=20]text[/size]) '#\[color=\#?([A-F0-9]{3}|[A-F0-9]{6})\](.*?)\[/color\]#is', // Font color ([color=#00F]text[/color]) '#\[url=(.*?)\](.*?)\[/url\]#i', // Hyperlink with descriptive text ([url=http://url]text[/url]) '#\[url\](.*?)\[/url\]#i', // Hyperlink ([url]http://url[/url]) '#\[img\](.*?)\[/img\]#i'); // Image ([img=http://url_to_image]) // The matching array of strings to replace matches with $format_replace = array('<strong>$1</strong>', '<em>$1</em>', '<span style="text-decoration: underline;">$1</span>', '<span style="text-decoration: line-through;">$1</span>', '<blockquote>$1</blockquote>', '<pre>$1</'.'pre>', '<span style="font-size: $1px;">$2</span>', '<span style="color: #$1;">$2</span>', '<a href="$1">$2</a>', '<a href="$1">$1</a>', '<img src="$1" alt="" />');
-
So this line of code has everything in it i need to know.
#\[b\](.*?)\[/b\]#is'
First thing i don't know is why the # symbol is at the beginning what does it do?
Second thing i dont know is the (.*?) i take it it means and or something of that sorts?
and the last thing i dont understand is the #is what does that do?
Thanks for any help given
-
So im trying to place a red box (I want it to auto extend the div btw) to place content in. I wrote the words test in the div and the word test appear in the right spot but the background image is not appearing, yes it is a true path. Heres the code:
<style type="text/css"> #header { padding-left:230px; float:left; } #box{ background-image:"images/design_02.png"; float:left; position:absolute; } #buttons{ background-image:"images/design_02.png"; float:left; } body { margin:0; padding:0; background-color:#D7D0B8; } </style> <title>Untitled Document</title> </head> <div id="header"> <img src="images/design_01.png" width="239" height="213" alt=""><br /> <img src="images/design_03.png" width="8" height="388" style="float:left;" alt=""> <a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image17','','images/nrollover_04.png',1)"><img src="images/design_04.png" name="Image17" width="231" height="27" border="0"></a><br /> <img src="images/design_15.png" width="231" height="11" alt=""><br /> <a href="winecellar.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image18','','images/nrollover_06.png',1)"><img src="images/design_06.png" name="Image18" width="231" height="27" border="0"></a><br /> <img src="images/design_15.png" width="231" height="11" alt=""><br /> <a href="menu.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image19','','images/nrollover_08.png',1)"><img src="images/design_08.png" name="Image19" width="231" height="27" border="0"></a><br /> <img src="images/design_15.png" width="231" height="11" alt=""><br /> <a href="reservations.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image20','','images/nrollover_10.png',1)"><img src="images/design_10.png" name="Image20" width="231" height="27" border="0"></a><br /> <img src="images/design_15.png" width="231" height="11" alt=""><br /> <a href="giftcards.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image21','','images/nrollover_12.png',1)"><img src="images/design_12.png" name="Image21" width="231" height="27" border="0"></a> <img src="images/design_15.png" width="231" height="11" alt=""><br /> <a href="privatedining.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image22','','images/nrollover_14.png',1)"><img src="images/design_14.png" name="Image22" width="231" height="27" border="0"></a><br /> <img src="images/design_15.png" width="231" height="11" alt=""><br /> <a href="info.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image23','','images/nrollover_16.png',1)"><img src="images/design_16.png" name="Image23" width="231" height="27" border="0"></a> <img src="images/design_17.png" width="231" height="135" alt=""> </div> <div class="buttons"> test </div> <body> </body> </html>
Anyone know how to fix, demo site is at:
-
...what am i thinking, i ment update
thanks.
-
|INSERT INTO pages (info) VALUES ('
testdfasddfasdfsfadsfg
') WHERE page = '{wine}' |
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE page = '{wine}'' at line 1
I added a <br> after the last | in your code
-
nope,
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE page = '{wine}'' at line 1thanks for the effort though
-
no im talking about the query you posted
-
were is this all located? a txt file, a database? we need info
-
i've tried that query before and just again, im getting the same error
-
I can never fix these/get them right....
What is wrong with this one:
$sql = "INSERT INTO pages (info) VALUES ('$info') WHERE page = '".$page."' ";
it outputs this:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE page = 'wine'' at line 1
i though i had it so that one " didnt actually cant as apart of the query
-
I've never seen a CMS were u can login and just edit it right from there no admin panel, do you know the names of any that do this?
-
Im looking for something like this, i just saw it on youtube, anyone know were i can find it?
-
Instantly would have been nice, but regardless i got it working fine with a refresh.
-
<?php include ("connect.php"); session_start(); if (!$_SESSION['user']){ header("Location: login.php"); } if (isset($_POST['submit'])){ $target_path = 'pfd/'; $target_path = $target_path . basename( $_FILES['file']['name']); $wantedname = $_POST['name']; if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) { $sql = "INSERT INTO catagories (Name,wantedname) VALUES ('$target_path','$wantedname')"; mysql_query ($sql) or die (mysql_error());?> //Make this div appear once file has been moved <div id="loaded" style="display:none;"><img border="0" src="images/good.png">Sucsess! You May now continue</div> <?php } else{ echo "There was an error uploading the file, please try again!"; } }else{ //die($name); } ?> <html> <head> <title>Administration Center</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <style type="text/css"> <!-- body,td,th { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; color: #D7D0B8; } body { background-color: #D7D0B8; margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } #load{ z-index:1; text-align:center; font-family:"Trebuchet MS", verdana, arial,tahoma; font-size:18pt; padding-right:20px; } #loaded{ z-index:1; text-align:center; font-family:"Trebuchet MS", verdana, arial,tahoma; font-size:18pt; padding-right:20px; } #form{ position:absolute; z-index:1; margin-top:-150px; margin-left:-150px; top:50%; left:50%; text-align:center; font-family:"Trebuchet MS", verdana, arial,tahoma; font-size:18pt; } --> </style> <script type="text/javascript"> var ray={ ajax:function(st) { this.show('load'); document.getElementById("form").style.display = "none"; }, show:function(el) { this.getID(el).style.display=''; }, getID:function(el) { return document.getElementById(el); } } </script> </head> <body onLoad="MM_preloadImages('images/rollover_04.png','images/rollover_06.png','images/rollover_08.png','images/rollover_10.png','images/rollover_12.png','images/rollover_14.png','images/rollover_16.png')"> <!-- ImageReady Slices (index.psd) --> <table width="811" height="601" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01"> <tr> <td colspan="2"> <img src="images/index_01.png" width="239" height="213" alt=""></td> <td width="572" height="601" rowspan="15" valign="middle" background="images/index_02.png"><blockquote> <div id="form"> <table width="353" height="316" border="0"> <tr> <td width="347"><form name="form1" onsubmit="return ray.ajax()" method="post" action="newcatagory.php" enctype="multipart/form-data"> Fill Out The Form Below and Click Submit: <table width="341" height="156" border="0"> <tr> <td width="53">Name: </td> <td width="278"><label> <input type="text" name="name" id="name"> </label></td> </tr> <tr> <td height="36">PDF File:</td> <td><label> <input type="file" name="file" id="file"> </label></td> </tr> <tr> <td> </td> <td><label> <input type="submit" name="submit" id="submit" value="Submit"> </label></td> </tr> </table> </form> </td> </tr> </table> </div> <div id="load" style="display:none;"><img border="0" src="images/ajax-loader.gif"><br>Loading, Please wait!</div>
as can be seen after clicking submit i load some text and a gif letting them know that its loading, then after its done moving the file i want to make that disapear and show the div near the top by the php code.
-
I was wondering if there was anyway to make a picture and words (or just a div) appear after a query finishes running through.
Sorry if this is the wrong forum im not sure if this is ajax or javascript
function not doing what I want
in PHP Coding Help
Posted
bump ;P