wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
[SOLVED] zend framework bootstrap on windows dodgy
wildteen88 replied to nadeemshafi9's topic in PHP Coding Help
Okay. Post the full path to where you have zend framework and the layout of your zend framework folder. -
[SOLVED] how do i make a function work for the whole page ?
wildteen88 replied to jamesxg1's topic in PHP Coding Help
Whats wrong with just calling the function? -
You have to define the location. window.location="http://yoursite.com/path/to/script.php";
-
Use window.location instead. window.reload will resend the POST data.
-
What are you using to refresh the page?
-
[SOLVED] zend framework bootstrap on windows dodgy
wildteen88 replied to nadeemshafi9's topic in PHP Coding Help
Change this define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application/')); set_include_path(APPLICATION_PATH . '/../library' . PATH_SEPARATOR . get_include_path());[ to define('BASE' , realpath(dirname(__FILE__).'/../')); define('APPLICATION_PATH', BASE . '/application')); set_include_path(BASE. '/library' . PATH_SEPARATOR . get_include_path()); -
[SOLVED] Errors in this file_get_contents code?
wildteen88 replied to bloodgoat's topic in PHP Coding Help
Juding by what your urls are. Your code relies on an outdatted setting called register_globals (which has been disabled since 2002 and is soon to be removed completely as of php6). You should update your code so it doesn't rely on this setting. Doing this allows your code to be more portable and improve security. To help suggest what to do you should post your code inful. -
You'll want to setup virtual hosts for this. You can add virtualhost definitions at the bottom of the httpd.conf VirtualHost documentation
-
Why are using mysqli_error here / Debugging message: echo '<p>' . mysqli_error($db_name) . '<br /><br />Querey: ' .$q. '</p>'; } //End of it ($res1) IF. when in the rest of your code you're using the standard mysql library functions? mysqli_* and mysql_* functions are not cross compatible. You should also realise session_is_registered or session_register are depreciated and should only be used if register_globals is enabled. You should change if(!session_is_registered(myusername)){ header("location:index_Staff.php"); } to if(!isset($_SESSION['myusername'])){ header("location:index_Staff.php"); }
-
[SOLVED] line break after every 4 records from mysql database
wildteen88 replied to brem13's topic in PHP Coding Help
Change while ($qry = mysql_fetch_array($result)) { $c = 1; while($c < 5) { echo '<a href="'.$qry[album].'/'.$qry[picture].'"><img src="'.$qry[album].'/thumbs/'.$qry[picture].'"></a><br >; $c++; } to $i = 1; while ($qry = mysql_fetch_array($result)) { echo '<a href="'.$qry[album].'/'.$qry[picture].'"><img src="'.$qry[album].'/thumbs/'.$qry[picture].'"></a>'; if($i == 4) { echo '<br />'; $i = 0; // reset counter } $i++; } -
have a ead up on the following functions fopen fwrite fread fclose. Try out the code examples provided and see if you can do what you're asking.
-
Woops I missed of your form. Sorry about that. <?php if(isset($_GET['fileid'], $_GET['site']) && is_numeric($_GET['fileid']) && is_numeric($_GET['site'])) { $fileid = $_GET['fileid']; $siteid = $_GET['site']; $username = $_COOKIE['username']; $user_id = "SELECT id FROM users WHERE username = '$username'"; $user_id_result = mysql_query($user_id); list($userid) = mysql_fetch_row($user_id_result); $findsite = "SELECT site FROM site WHERE site_id = '$siteid'"; $find_result = mysql_query($findsite); list($sitename) = mysql_fetch_row($find_result); $findfile = "SELECT filename FROM file WHERE fileid = '$fileid'"; $find_file_result = mysql_query($findfile); list($file) = mysql_fetch_row($find_file_result); $loadcontent = 'sites/'.$username.'/'.$sitename.'/'.$file; //Start loading file if(isset($_POST['save_file'])) { echo 'EDITING '.$loadcontent.'<br />'; echo 'READABLE: '.(is_readable($loadcontent) ? 'true' : 'false') . '<br />'; echo 'WRITABLE: '.(is_writable($loadcontent) ? 'true' : 'false') . '<br />'; $savecontent = stripslashes($_POST['savecontent']); if ($fp = fopen($loadcontent, "w")) { echo 'OPENED: '.$loadcontent.'<br />'; fwrite($fp, $savecontent); fclose($fp); echo 'CLOSED'; } else { echo 'Could not save changed to '.$loadcontent; } } $loadcontent = htmlspecialchars( file_get_contents($loadcontent) ); } ?> <div align="center"><form method=post action="<?php echo $_SERVER['PHP_SELF'] ?>"> <textarea name="savecontent" class="editor_box"><?php echo $loadcontent ?></textarea></div> <br> <div style="float: right;"><input type="submit" name="save_file" value="Save"></div> </form>
-
You already have a topic open here LOCKED
-
Cleaned your script up try <?php if(isset($_GET['fileid'], $_GET['site']) && is_numeric($_GET['fileid']) && is_numeric($_GET['site'])) { $fileid = $_GET['fileid']; $siteid = $_GET['site']; $username = $_COOKIE['username']; $user_id = "SELECT id FROM users WHERE username = '$username'"; $user_id_result = mysql_query($user_id); list($userid) = mysql_fetch_row($user_id_result); $findsite = "SELECT site FROM site WHERE site_id = '$siteid'"; $find_result = mysql_query($findsite); list($sitename) = mysql_fetch_row($find_result); $findfile = "SELECT filename FROM file WHERE fileid = '$fileid'"; $find_file_result = mysql_query($findfile); list($file) = mysql_fetch_row($find_file_result); $loadcontent = 'sites/'.$username.'/'.$sitename.'/'.$file; //Start loading file if(isset($_POST['save_file'])) { echo 'EDITING '.$loadcontent.'<br />'; echo 'READABLE: '.(is_readable($loadcontent) ? 'true' : 'false') . '<br />'; echo 'WRITABLE: '.(is_writable($loadcontent) ? 'true' : 'false') . '<br />'; $savecontent = stripslashes($_POST['savecontent']); if ($fp = fopen($loadcontent, "w")) { echo 'OPENED: '.$loadcontent.'<br />'; fwrite($fp, $savecontent); fclose($fp); echo 'CLOSED'; } else { echo 'Could not save changed to '.$loadcontent; } } $loadcontent = htmlspecialchars( file_get_contents($loadcontent) ); } ?> It should output some debug messages to see whats going on
-
[SOLVED] Echoing arrays through a for() statement
wildteen88 replied to bloodgoat's topic in PHP Coding Help
Oh! I didn't check over your code correctly here I corrected your code <?php $artist = array("Amen Ra", "Anaal Nathrakh", "Eminem", "Hellas Mounds"); $album = array("Mass I: Prayer I-VI", "The Codex Necro", "Marshall Mathers LP", "The Last Ferry to Cydonia"); $url = array("amen1", "anaal1", "eminem1", "hellas1"); $header = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"; $footer = "\n</table>"; $tables = null; for($i=0;$i<count($artist);$i++) { $tables .= "\n <tr> <td align=\"right\" width=\"20%\"> $artist[$i] </td> <td align=\"right\" width=\"30%\"> <a href=\"$url[$i]\">$album[$i]</a> </td>"; // increment $i to get the next record in the array $i++; $tables .= "\n <td align=\"right\" width=\"20%\"> $artist[$i] </td> <td align=\"right\" width=\"30%\"> <a href=\"?music=$url[$i]\">$album[$i]</a> </td> </tr>"; } echo $header; echo $tables; echo $footer; ?> -
$b->$language; Should be $b->language;
-
[SOLVED] Echoing arrays through a for() statement
wildteen88 replied to bloodgoat's topic in PHP Coding Help
What do you get when you view source code? I have tested your code and it is error free and works fine. You must be doing something wrong somewhere. Post a screenshot of how your running your script. -
[SOLVED] Echoing arrays through a for() statement
wildteen88 replied to bloodgoat's topic in PHP Coding Help
If short tags is disabled then your code wont run and thus you'd get a blank page. You can tell if short tags is disabled as your source code will be present when you view your pages source code. Also you saving your PHP code within .php files? -
Tried clearing your browsers cache or simply do Ctrl + F5? Maybe its caching an old page.
-
I see they are used on this line $loadcontent = 'sites/'.$username.'/'.$sitename.'/'.$file; But where are they defined/coming from? Variables must be defined before using them. Also you should avoid using short tags always use the full PHP syntax for tags (<?php ?>) and not <? ?>. The full syntax for <?= ?> is <?php echo ?>