-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
[SOLVED] Why do I keep getting logged out of CMS?
MadTechie replied to goodrichdesigns's topic in PHP Coding Help
its probably here /usr/local/lib/php/php.ini i must ask, do you ONLY have this problem when you use he 'calander_admin_file.php' file ? if so, then your fix will probably not work -
[SOLVED] Why do I keep getting logged out of CMS?
MadTechie replied to goodrichdesigns's topic in PHP Coding Help
Your Sessions are being wiped please note the code below Line 10+ if(!is_writable(session_save_path()))session_save_path("/tmp"); session_start(); ob_start(); $__SESSION__=$HTTP_SESSION_VARS['__SESSION__']; foreach($HTTP_POST_VARS as $k=>$v){ if(!is_array($v))${urldecode($k)}=urldecode($v); } Line: 82+ $page or $page = 'e'; if($page =="l"){ $HTTP_SESSION_VARS = array(); //This line will cause the problem header("Location: index.php"); exit; } EDIT: maybe try setting the Session to a var then setting them back after the call ie <?php session_start(); $tmpSession = $_SESSION; include "calander_admin_file.php"; $_SESSION = $tmpSession; ?> -
normally i would suggest writing to a database but then you have to setup one (see myphpadmin (also in the contextual menu)) you could just write to a file <?php $filename = 'test.txt'; $somecontent = "Add this to the file\n"; // Let's make sure the file exists and is writable first. if (is_writable($filename)) { // In our example we're opening $filename in append mode. // The file pointer is at the bottom of the file hence // that's where $somecontent will go when we fwrite() it. if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } // Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Success, wrote ($somecontent) to file ($filename)"; fclose($handle); } else { echo "The file $filename is not writable"; } ?>
-
[SOLVED] Parse error: syntax error, unexpected T_VARIABLE
MadTechie replied to eaglelegend's topic in PHP Coding Help
change <Td valign=middle align=center><img src='/images/pets/$species.png' alt="$petName"></td> to <Td valign=middle align=center><img src='/images/pets/$species.png' alt=\"$petName\"></td> full here <? include("header.php"); ?> <h1>PLEASE NOTE</h1> <p><strong>This site is in it's development stage! Please be patient as it should be finished up shortly!</strong></p> <p>Welcome to Eagle Legend. From here you can create an account which will create your very own Virtual Pet.</p> <p>Click <a href="http://www.eaglelegend.com/register.php">here</a> to get started today!</p> <h2>Newest Adoptions</h2> <br> <table border="0" cellpadding="3" cellspacing="0" width="100%"> <tr> <? $sql = mysql_query("SELECT * FROM `pets` ORDER BY `id` DESC"); while($row = mysql_fetch_array($sql)) { extract($row); $x=$x+1; if($status <= 3) { $s = "Very Unhappy"; } if($status >= 3 && $status < 6) { $s = "Unhappy"; } if($status >= 6 && $status < 9) { $s = "Bored"; } if($status >= 9 && $status < 12) { $s = "Happy"; } if($status >= 12 && $status < 15) { $s = "Very Happy"; } if($status >= 15) { $s = "Very Happy and Playful!"; } print "<td width='33%' valign='top'> <table border=0 cellpadding=2 cellspacing=0 width=100%> <Tr> <Td valign=middle align=center><img src='/images/pets/$species.png' alt=\"$petName\"></td> <td valign=top class=other width=100%>$user adopted a $species<br> Name: $petName<br>Status: $s<br>Born: $date<br>Points: $points</td> </tr> </table> </td>"; if($x%2==0) { print "</tr><Tr>"; } } print "</table>"; ?> <? include("footer.php"); ?> EDIT:Ahh pocobueno1388 beat me -
in the systems tray (bottom right near the clock) you should see a icon (bit like a speed'o'meter ) thats WAMP it should be all white if its yellow or red theirs a problem with WAMP, (if you hover the mouse over it, it should say something like WAMP5 all services running) now left click it and a contextual menu should appear, click localhost this should start the web browser at "http://localhost/" left click it again and select "www directory" that should open a folder ie "C:\wamp\www", now in that folder create the test.php file then goto the browser "http://localhost/" and refresh you should now see the file test.php, click that and it should work (wow thats alot of "should"s )
-
how are you opening it in the browser ? it should be like this http://localhost/test.php and NOT like this file://blar/test.php
-
try this $q = 'INSERT INTO items_claimed (`master_id`, `item_name`, `item_make`, `item_details`, `item_price`) VALUES (' . $master_id .' , \'' . implode('\', \'', $qSet).'\')'; i only skimmed the question (note they are 2x single quotes,not double quotes)
-
its like a CAPTCHA, its very design is to stop automated systems
-
create a new file called test.php (for example) now paste the code above in (NO EDITS) if should give you a form click submit (get the error) fill ing the form submit (get the responce) try that and post what fails
-
Okay this is soo very untested <select name="time" id="time" disabled> <?php for ( $counter = 1; $counter <= 12; $counter += 1) { ?> <option value="<?php echo $counter; ?>"><?php echo $counter; ?></option> <?php } ?> </select> <!-- Add --> <select name="mins" id="mins" disabled> <?php for ( $counter = 0; $counter <= 45; $counter += 15) { ?> <option value="<?php echo $counter; ?>"><?php echo $counter; ?></option> <?php } ?> </select> <!-- done adding --> <select name="ampm" id="ampm" disabled> <option value="am">AM</option> <option value="pm">PM</option> </select> $order_for = $_POST['order_for']; $time = $_POST['time']; $min = $_POST['mins']; //Add $ampm = $_POST['ampm']; if ($order_for == 'now') { $forDate = date('Y-m-d H:i:s'); } else if ($order_for == 'today') { $forDate = date('Y-m-d',time() + (60+$min)*60).' '.($ampm == 'am' ? str_pad($time,2,'0',STR_PAD_LEFT) : ($time + 12)).':$min:00'; //Edit } else { $forDate = date('Y-m-d',time() + 12*(60+$min)*60).' '.($ampm == 'am' ? str_pad($time,2,'0',STR_PAD_LEFT) : ($time + 12)).':$min:00'; //Edit }
-
form needs the name set NOT just ID's since when has name been depreciated ? name has its own use and id has it own use many complex forms CSS & javascript use both! i put all the code into one files try this <!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>Welcome Form</title> </head> <body> <?php $showform = true; if(isset($_POST['Submit'])) { $errmsg = ""; if (empty($_POST['firstname'])) $errmsg .= "<p>Please enter your first name</p>"; if (empty($_POST['lastname'])) $errmsg .= "<p>Please enter your last name</p>"; if (empty($_POST['address1'])) $errmsg .= "<p>Please enter your address fully</p>"; if (empty($_POST['address2'])) $errmsg .= "<p>Please enter your address fully</p>"; if (empty($_POST['postcode'])) $errmsg .= "<p>Please enter your postcode</p>"; if (empty($_POST['phone'])) $errmsg .= "<p>Please enter your phone number</p>"; if (empty($_POST['email'])) $errmsg .= "<p>Please enter your email address </p>"; if (empty($_POST['companyname'])) $errmsg .= "<p>Please enter your company name</p>"; if(!empty($errmsg)) { echo "<p>Please fill in the required fields to continue.</p>".$errmsg; }else { $showform = false; $result = ""; $result .= "First Name: " . $_POST['firstname'] . "\r\n"; $result .= "Last Name: " . $_POST['lastname'] . "\r\n"; $result .= "address1: " . $_POST['address1'] . "\r\n"; $result .= "address2: " . $_POST['address2'] . "\r\n"; $result .= "address3: " . $_POST['address3']. "\r\n"; $result .= "city: " . $_POST['city'] . "\r\n"; $result .= "county: " . $_POST['county'] . "\r\n"; $result .= "postcode: " . $_POST['postcode'] . "\r\n"; echo "The form has been submitted. Thankyou!"; echo nl2br($result); } } if($showform){ ?> <!-- action="welcomeform.php" // removed this as i'm using single file! --> <form method="post"> Title: <label> <select name="title" id="title"> <option>Dr</option> <option>Mr</option> <option>Master</option> <option>Mrs</option> <option>Ms</option> <option>Miss</option> </select> </label> <option></option> <br /><br /> First Name: <input type="text" name="firstname" /><br /> Last Name: <input type="text" name="lastname" /><br /><br /> Address 1: <input type="text" name="address1" /><br /><br /> Address 2: <input type="text" name="address2" /><br /><br /> Address 3: <input type="text" name="address3" /><br /><br /> City: <input type="text" name="city" /><br /><br /> County: <input type="text" name="county" /><br /><br /> Postcode: <input type="text" name="postcode" /><br /><br /> Email: <input type="text" name="email" /><br /><br /> Phone: <input type="text" name="phone" /> <br /> <br /><br /> Company Information<br /><br /> Job Title: <input type="text" name="jobtitle" /><br /><br /> Company Name: <input type="text" name="companyname" /><br /><br /> Type Of Business: <label> <select name="business" id="business"> <option>Government Agency</option> <option>Local Government</option> <option>Health</option> <option>Education</option> <option>Manufacturing</option> <option>Financial Services</option> <option>Retail</option> <option>IT</option> <option>Textiles</option> <option>Professional Services</option> <option>Construction</option> </select> </label> <option></option><br /><br /> Number of Employees: <label> <select name="empoyees" id="employees"> <option>10 or fewer</option> <option>11 - 50</option> <option>51 - 10</option> <option>101 - 500</option> <option>501 - 1000</option> <option>1001 - 5000</option> <option>More than 5000</option> </select> </label> <option></option><br /><br /> Purchase Timescale: <label> <select name="empoyees" id="employees"> <option>Immediate</option> <option>3 months</option> <option>6 months</option> <option>1 year</option> <option>more than 1 year</option> </select> </label> <option></option><br /><br /> <input type="submit" name="Submit" value="Submit" > </form> </body> </html> <?php } ?> <h2>Cookies</h2> <?php echo "<pre>";print_r($_COOKIE);echo "</pre>"; ?>
-
the fact your trying to write a curl to login without their permision seam a little suspect to me!!
-
whats $id set to ? what appears in the url? need more info!!!
-
try this <?php $result .= "First Name: " . $firstname . "\r\n"; $result .= "Last Name: " . $lastname . "\r\n"; $result .= "address1: " . $address1 . "\r\n"; $result .= "address2: " . $address2 . "\r\n"; $result .= "address3: " . $address3. "\r\n"; $result .= "city: " . $city . "\r\n"; $result .= "county: " . $county . "\r\n"; $result .= "postcode: " . $postcode . "\r\n"; ?> <html> <!-- //No need for the form! <form> <form action="welcomeform.php" method="get"> --> <?php $errmsg = ""; if (empty($_POST['awelcomeform'])) $errmsg .= "<p>You cannot Submit a blank form. Please fill in the required fields to continue.</p>"; if (empty($_POST['firstname'])) $errmsg .= "<p>Please enter your first name</p>"; if (empty($_POST['lastname'])) $errmsg .= "<p>Please enter your last name</p>"; if (empty($_POST['address1'])) $errmsg .= "<p>Please enter your address fully</p>"; if (empty($_POST['address2'])) $errmsg .= "<p>Please enter your address fully</p>"; if (empty($_POST['postcode'])) $errmsg .= "<p>Please enter your postcode</p>"; if (empty($_POST['phone'])) $errmsg .= "<p>Please enter your phone number</p>"; if (empty($_POST['email'])) $errmsg .= "<p>Please enter your email address </p>"; if (empty($_POST['companyname'])) $errmsg .= "<p>Please enter your company name</p>"; if(!empty($errmsg)) { echo $errmsg; }else { echo "The form has been submitted. Thankyou!"; } ?> <h2>Cookies</h2> <?php echo "<pre>";print_r($_COOKIE);echo "</pre>"; ?> <!-- //Again why the form/. </form> </form> --> </html>
-
try 0x6E
-
<?php $sul = 'JAZZ10 01/04/2008</td> <td class="bodyText" align="center">6,70</td> <td class="bodyText" align="right">5,02</td> <td class="bodyText" align="right">2.430</td> <td class="bodyText" align="center">6,72</td> <td class="bodyText" align="center">6,48</td> <td class="bodyText" align="right">15.942,22</td> <td class="bodyText" align="right">20</td> <td class="bodyText" align="center">6,48</td>'; $i=0; do { $i++; $sul=preg_replace('#<td class=\"(?:.*?)\" align=(?:.*?)>#', "JAZZ".$i." - ",$sul, 1); }while ($i<10); echo $sul; ?> returns I guess i don't know what your asking for coz that looks correct to me!
-
try this <?php do { $i++; $sul=preg_replace('#<td class=\"(?:.*?)\" align=(?:.*?)>#', "JAZZ".$i,$sul, 1); }while ($i<10); ?>
-
ksort sorts by keys
-
but then your need to remove the class align etc .. seams longer to me!
-
rsort resets the index (basically what your seeing) change to arsort should resolve the problem
-
what about something like <?php do { $i++; $sul=preg_replace('<td class=\"(?:.*?)\" align=(?:.*?)>', "JAZZ".$i,$sul, 1); }while ($i<10); ?> EDIT: updated RegEx
-
Sorry we will help with code but not write it for you.. however this type of question has been asked a few time and i wrote some basic code to help people get started. its not perfect but help you get going see here
-
untested See the two comments (*****added and *****modified) <?php session_start(); require_once '../includes/connection.php'; // check that the user has logged in if(isset($_SESSION['is_logged_in']) && $_SESSION['is_logged_in'] !== true || !isset($_SESSION['is_logged_in'])) { die('You must <a href="../admin/..">login</a> to view this page!'); } // no need to query members table, query the contacts table as you already have the username in the 'user' session $sql = "SELECT * FROM contacts WHERE username='{$_SESSION['user']['username']}'"; // perform the query $result = mysqli_query($connection, $sql); // as you are only returning 1 row from the contact tables you don't need a while loop $row = mysqli_fetch_assoc($result); // display contact data for user $username = $row['username']; $type = $row['type']; $image = $row['image']; $title = $row['title']; $first_name = $row['first_name']; $surname = $row['surname']; $position= $row['position']; $company_name = $row['company_name']; $company_email = $row['company_email']; $company_fax = $row['company_fax']; $company_telephone_number = $row['company_telephone_number']; $company_fax = $row['company_fax']; $address = $row['address']; $address_1 = $row['address_1']; $address_2 = $row['address_2']; $address_3 = $row['address_3']; $town = $row['town']; $county = $row['county']; $post_code = $row['post_code']; ///// if(isset($_POST['submit'])) { $type=$_POST['type']; $title=$_POST['title']; $first_name=$_POST['first_name']; $surname=$_POST['surname']; $position=$_POST['position']; $company_name=$_POST['company_name']; $company_email=$_POST['company_email']; $company_fax=$_POST['company_fax']; $company_telephone_number=$_POST['company_telephone_number']; $address=$_POST['address']; $address_1=$_POST['address_1']; $address_2=$_POST['address_2']; $address_3=$_POST['address_3']; $town=$_POST['town']; $county=$_POST['county']; $post_code=$_POST['post_code']; $errors .= (empty($post_code)) ? "<span class=\"emptyFields\">We reuqire your postcode.</span>" : ""; $errors .= (empty($company_name)) ? "<span class=\"emptyFields\">We require a company name.</span>" : ""; $errors .= (empty($company_telephone_number)) ? "<span class=\"emptyFields\">We need your telepone number to contact you.</span>" : ""; $errors .= (empty($company_email)) ? "<span class=\"emptyFields\">To help you, we require your email.</span>" : ""; //need to add country, product and state if (!$errors) { if(!get_magic_quotes_gpc()) { $type = addslashes($type); $title = addslashes($title); $first_name = addslashes($first_name); $surname = addslashes($surname); $position= addslashes($position); $company_name = addslashes($company_name); $company_email = addslashes($company_email); $company_fax = addslashes($company_fax); $company_telephone_number= addslashes($company_telephone_number); $address= addslashes($address); $address_1= addslashes($address_1); $address_2= addslashes($address_2); $address_3= addslashes($address_3); $town= addslashes($town); $county= addslashes($county); $post_code= addslashes($post_code); } @ $db = new mysqli('localhost', 'root', 'DARREN', 'bulletins'); if (mysqli_connect_errno()) { echo 'error'; } $query = " INSERT INTO order_enquiries (type, title, first_name, surname, position, company_name, company_email, company_fax, company_telephone_number, address, address_1, address_2, address_3, town, county, post_code ) VALUES ('".$type."', '".$title."', '".$first_name."', '".$surname."', '".$position."','".$company_name."', '".$company_email."', '".$company_fax."','".$company_telephone_number."', '".$address."', '".$address_1."', '".$address_2."', '".$address_3."', '".$town."', '".$county."', '".$post_code."' )"; $result = $db->query($query); $success .= "Thank you for completing the form.<br /><br/>Your free sample will be dispatched as soon as possible.<br /><br />Please <a href=\"logout.php\" style=\"font-weight:bold;color:black;\">Logout</a></span>"; //need to add country, product and state if ($success); } }else{ //*****MODIFIED ?> <!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> <title>Complete the order form to recieve a free product</title> <link rel="stylesheet" type="text/css" href="../styles/style.css" /> <head> <body> <div id="container"> <div id="holder"> <div id="header"><img src="../../images/banner.png" style="border:none;" /></div> <div id="main"> <h3>Welcome <?php echo $username; ?><span style="color:red;"><?php echo ($errors) ? "<p class=\"errorSentence\">Some fields have not been completed: $errors</p>" : ""; ?></span> <span style="color:blue;"><?php echo ($success); ?></span></h3> Are we displaying the correct contact details? If not please complete the from to update. <br/><br/><br/> <div class="orderFormContainer" > <form method="post" action="<?php $_SERVER['PHP_SELF']?>"> <ul class="orderForm"> <li style="font-weight:bold;color:#666666;font-size:11pt;">ABOUT YOU</li> <li><input type="hidden" name="title" id="title" value="<?php echo $type; ?>"></li> <li>title: <input type="text" name="title" id="title" value="<?php echo $title; ?>"></li> <li>First name: <input type="text" name="first_name" id="first_name" value="<?php echo $first_name; ?>"></li> <li>Surname: <input type="text" name="surname" id="surname" value="<?php echo $surname; ?>"></li> <li>Position: <input type="text" name="position" id="position" value="<?php echo $position; ?>"></li> <li> </li> <li style="font-weight:bold;color:#666666;font-size:11pt;">ABOUT YOUR COMPANY</li> <li>Company name: <input type="text" name="company_name" id="company_name" value="<?php echo $company_name; ?>"></li> <li>Company email: <input type="text" name="company_email" id="company_email" value="<?php echo $company_email; ?>"></li> <li>Company tel: <input type="text" name="company_telephone_number" id="company_telephone_number" value="<?php echo $company_telephone_number; ?>"></li> <li>Company fax: <input type="text" name="company_fax" id="company_fax" value="<?php echo $company_fax; ?>"></li> <li>Address: <input type="text" name="address" id="address" value="<?php echo $address; ?>"></li> <li>Address 1: <input type="text" name="address_1" id="address_1" value="<?php echo $address_1; ?>"></li> <li>Address 2: <input type="text" name="address_2" id="address_2" value="<?php echo $address_2; ?>"></li> <li>Address 3: <input type="text" name="address_3" id="address_3" value="<?php echo $address_3; ?>"></li> <li>Town: <input type="text" name="town" id="town" value="<?php echo $town; ?>"></li> <li>County: <input type="text" name="county" id="county" value="<?php echo $county; ?>"></li> <li>Postcode: <input type="text" name="post_code" id="post_code" value="<?php echo $post_code; ?>" ></li> <li style="font-size:9pt;text-align:center;color:red;line-height:19px;font-weight:bold;">Now simply click submit <br/>to recieve a free sample</li> <li><input type="submit" name="submit" value="submit" title="submit" ></li> </ul> </form> <?php //*****ADDED } ?> <img src="../../images/<?php echo $image; ?>" class="image" title="Met Office Room Thermomemter"/> </div> </div> <div id="footer"></div> <div> </div> </div> </body> </html> ALSO $success .= Thank you for completing the form.<br /><br/>Your free sample will be dispatched as soon as possible.<br /><br />Please <a href="logout.php\" style=\"font-weight:bold;color:black;\">Logout</a></span>"; should be (added a quote at the start) $success .= "Thank you for completing the form.<br /><br/>Your free sample will be dispatched as soon as possible.<br /><br />Please <a href="logout.php\" style=\"font-weight:bold;color:black;\">Logout</a></span>"; EDIT: should be $success .= "Thank you for completing the form.<br /><br/>Your free sample will be dispatched as soon as possible.<br /><br />Please <a href=\"logout.php\" style=\"font-weight:bold;color:black;\">Logout</a></span>"; Also updated top top
-
Their login page is moving ?
-
You have stated what happens but not what you expect.. from looking at the code i assume you didn't expect the zeros change fwrite($fp, pack('H*', '6E')); should be fwrite($fp, pack('H*', 6E)); also $fp = fopen($path_to_file, "w+b"); should be $fp = fopen($path_to_file, "r+");